CNN-Numpy
CNN-Numpy copied to clipboard
Inplement an CNN frame with Numpy, easy to learn, hard to use hhhh
首先,感谢作者的项目,学到了很多。 关于layers/fc.py的第42行self.bias -= alpha * self.bias,是否应该是self.bias -= alpha * self.b_gradient呢?
想问一下输入20*20的,输出26的字母识别,为什么改了输入输出的size之后正确率这么低啊 
楼主你好,因为conv的反向传播时计算梯度,就是用x的转置去乘上一层传递下来的梯度,为啥在fc里面变成了用上一层梯度乘x的转置呀。 就是如下代码,在fc的27行左右,为啥楼主你写的源代码如下: col_x = self.x[i][:, np.newaxis] eta_i = eta[i][:, np.newaxis].T self.w_gradient += np.dot(col_x, eta_i) 而不是这样呀: col_x = self.x[i][np.newaxis,:].T eta_i = eta[i][np.newaxis,:] self.w_gradient += np.dot(col_x, eta_i) 我刚试了一下下面这种方式也是可以正常训练的。所以我不知道是我矩阵梯度算错了,还是楼主不小心写错了,或者是两种方式都是可以的呢,希望楼主能解答一下疑惑,谢谢
谢谢。发现一些错误跑步起来,就是python版本的问题引起的。
Questions
Hi, 请问可以解释一下为什么Conv2D中: weights_scale = math.sqrt(reduce(lambda x, y: x * y, shape) / self.output_channels), 这个weights_scale的作用和它为什么这么计算吗?
我还是认为, pooling.py的79行,应该对self.index有一个清零的步骤,self.index = np.zeros(self.input_shape) 即: forward(self, x): out = np.zeros([x.shape[0], x.shape[1] / self.stride, x.shape[2] / self.stride, self.output_channels]) self.index = np.zeros(self.input_shape) for b in range(x.shape[0]): ............................ 供讨论
Hi,麻烦您解释一下在base_conv.py里面卷积的反向传播代码:flip_weights = np.flipud(np.fliplr(self.weights)) 这里为什么需要左右上下翻转完了再进行reshape,谢谢啦