我尝试为卷积网络实现反褶积层。我所说的反褶积是指,假设我有3x227x227
输入图像到一个带有大小为3x11x11
和步长为4的过滤器的层。因此,生成的特征映射的大小为55x55
。我尝试做的是应用反向操作,我将55x55
特征映射投影到3x227x227
图像。基本上,55x55
特征图上的每个值都由3x11x11
过滤器加权并投影到图像空间,并对由于步长而产生的重叠区域进行平均。在
我试图用numpy实现它,但没有成功。我找到了一个用强力嵌套for循环的解决方案,但速度太慢了。如何在numpy中有效地实现它?欢迎任何帮助。在
Tags:
正如在this question中所讨论的,反褶积只是一个卷积层,但是有特定的填充、步长和滤波器大小的选择。在
例如,如果您当前的图像大小是}的卷积来获得
55x55
,那么您可以应用padding=20
、stride=1
和{75x75
图像,然后95x95
依此类推。(我不是说这个数字的选择给出了输出图像的期望质量,只是大小。实际上,我认为从227x227
向下采样到55x55
然后再向上采样到227x227
太激进了,但您可以自由尝试任何架构)。在以下是任何步幅和填充的向前传球的实现。它使用im2col transformation,但是使用numpy中的
stride_tricks
。它不像现代GPU实现那样优化,但绝对比4 inner loops更快:相关问题 更多 >
编程相关推荐