卷积计算

今天研究了一下卷积计算。
卷积涉及到的两个输入为: 图像和filter

  • 图像: 维度为 C*H*W C是channel, 也叫做 depth, H和W就是图像的宽和高了。

  • filter, 维度为 K*K, 假设 filter的个数为 M个
    直接进行卷积的伪代码为

for w in 1..W (img_width)
  for h in 1..H (img_height)
    for x in 1..K (filter_width)
      for y in 1..K (filter_height)
        for m in 1..M (num_filters)
          for c in 1..C (img_channel)
            output(w, h, m) += input(w+x, h+y, c) * filter(m, x, y, c)
          end
        end
      end
    end
  end
end

这里写图片描述
卷积之后的输出的维度为 num_filter* out_h * out_w
注意out_h 和 out_w 是img_h, img_w经过pading 和stride之后的宽高,计算公式为:
hout=

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值