We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
老师你好,我在阅读你们代码的时候遇到了一些问题不太理解。 1.在ch17-CNNBasic MinFramework jit_utility.py 中 ` def img2col(input_data, filter_h, filter_w, stride=1, pad=0):
N, C, H, W = input_data.shape out_h = (H + 2*pad - filter_h)//stride + 1 out_w = (W + 2*pad - filter_w)//stride + 1 img = input_data if pad > 0: img = np.pad(input_data, [(0,0), (0,0), (pad, pad), (pad, pad)], 'constant') col = np.zeros((N, C, filter_h, filter_w, out_h, out_w)) for i in range(filter_h): i_max = i + stride*out_h for j in range(filter_w): j_max = j + stride*out_w col[:, :, i, j, :, :] = img[:, :, i:i_max:stride, j:j_max:stride] col = np.transpose(col, axes=(0, 4, 5, 1, 2, 3)).reshape(N*out_h*out_w, -1) return col`
为什么col要变成这个形状(Nout_hout_w, -1)??????
`def col2img(col, input_shape, filter_h, filter_w, stride, pad, out_h, out_w):
N, C, H, W = input_shape tmp1 = col.reshape(N, out_h, out_w, C, filter_h, filter_w) tmp2 = np.transpose(tmp1, axes=(0, 3, 4, 5, 1, 2)) img = np.zeros((N, C, H + 2*pad + stride - 1, W + 2*pad + stride - 1)) for i in range(filter_h): i_max = i + stride*out_h for j in range(filter_w): j_max = j + stride*out_w img[:, :, i:i_max:stride, j:j_max:stride] += tmp2[:, :, i, j, :, :] return img[:, :, pad:H + pad, pad:W + pad]`
为什么初始化img的形状是(N, C, H + 2pad + stride - 1, W + 2pad + stride - 1)
The text was updated successfully, but these errors were encountered:
虽然不知道为什么但是这样矩阵变来变去,居然又变回去了 好神奇啊
Sorry, something went wrong.
这个在17.2中有详细解释
No branches or pull requests
老师你好,我在阅读你们代码的时候遇到了一些问题不太理解。
1.在ch17-CNNBasic MinFramework jit_utility.py 中
`
def img2col(input_data, filter_h, filter_w, stride=1, pad=0):
为什么col要变成这个形状(Nout_hout_w, -1)??????
`def col2img(col, input_shape, filter_h, filter_w, stride, pad, out_h, out_w):
为什么初始化img的形状是(N, C, H + 2pad + stride - 1, W + 2pad + stride - 1)
The text was updated successfully, but these errors were encountered: