【发布时间】:2018-07-13 21:54:04
【问题描述】:
我试图了解 Matconvnet 中的 MNIST 示例是如何设计的。看起来他们使用的是 LeNet 变体,但由于我之前没有使用过 Matconvnet,所以我很难建立最后一个卷积层和第一个全连接层之间的连接:
net.layers = {} ;
net.layers{end+1} = struct('type', 'conv', ...
'weights', {{f*randn(5,5,1,20, 'single'), zeros(1, 20, 'single')}}, ...
'stride', 1, ...
'pad', 0) ;
net.layers{end+1} = struct('type', 'pool', ...
'method', 'max', ...
'pool', [2 2], ...
'stride', 2, ...
'pad', 0) ;
net.layers{end+1} = struct('type', 'conv', ...
'weights', {{f*randn(5,5,20,50, 'single'),zeros(1,50,'single')}}, ...
'stride', 1, ...
'pad', 0) ;
net.layers{end+1} = struct('type', 'pool', ...
'method', 'max', ...
'pool', [2 2], ...
'stride', 2, ...
'pad', 0) ;
net.layers{end+1} = struct('type', 'conv', ...
'weights', {{f*randn(4,4,50,500, 'single'), zeros(1,500,'single')}}, ...
'stride', 1, ...
'pad', 0) ;
net.layers{end+1} = struct('type', 'relu') ;
net.layers{end+1} = struct('type', 'conv', ...
'weights', {{f*randn(1,1,500,10, 'single'), zeros(1,10,'single')}}, ...
'stride', 1, ...
'pad', 0) ;
net.layers{end+1} = struct('type', 'softmaxloss') ;
通常,在 Tensorflow 和 MxNet 等库中,最后一个卷积层会被展平,然后连接到全连接层。在这里,据我了解,他们解释了第一个全连接层,权重{{f*randn(4,4,50,500, 'single'), zeros(1,500,'single')}} 作为全连接层,但该层仍然给出了一个三维激活图作为其结果。我看不出这里的“扁平化”是如何发生的。我需要关于如何在这里建立卷积层全连接层连接的帮助。
【问题讨论】:
标签: matlab neural-network deep-learning matconvnet