我正在尝试重现https://arxiv.org/abs/1610.01683中描述的卷积网络。
他们的设置概述:
但是,在尝试组合不同过滤器的结果时,我似乎遇到了障碍。 在论文中,作者有一个"堆叠"层,其中堆叠20个不同的滤波的1D信号,以产生一种频谱图,然后将其馈送到另一个卷积层。如何在matlab中做类似的事情?以下是我尝试过的,以及我得到的错误消息:
输入:
inputLayer=imageInputLayer([1 6000]);
c1=convolution2dLayer([1 200],20,'stride',1);
p1=maxPooling2dLayer([1 20],'stride',10);
c2=convolution2dLayer([20 30],400,'numChannels',20);
p2=maxPooling2dLayer([1 10],'stride',[1 2]);
f1=fullyConnectedLayer(500);
f2=fullyConnectedLayer(500);
s1=softmaxLayer;
outputLayer=classificationLayer;
convnet=[inputLayer; c1; p1; c2; p2; f1; f2; s1;outputLayer]
opts = trainingOptions('sgdm');
convnet = trainNetwork(allData',labels,convnet,opts);
输出:
convnet =
9x1 Layer array with layers:
1 '' Image Input 1x6000x1 images with 'zerocenter' normalization
2 '' Convolution 20 1x200 convolutions with stride [1 1] and padding [0 0]
3 '' Max Pooling 1x20 max pooling with stride [10 10] and padding [0 0]
4 '' Convolution 400 20x30 convolutions with stride [1 1] and padding [0 0]
5 '' Max Pooling 1x10 max pooling with stride [1 2] and padding [0 0]
6 '' Fully Connected 500 fully connected layer
7 '' Fully Connected 500 fully connected layer
8 '' Softmax softmax
9 '' Classification Output cross-entropy
Error using nnet.cnn.layer.Layer>iInferSize (line 261)
Layer 5 is expected to have a different size.
Error in nnet.cnn.layer.Layer.inferParameters (line 53)
layers = iInferSize(layers, i, inputSize);
Error in trainNetwork (line 61)
layers = nnet.cnn.layer.Layer.inferParameters(layers);
错误消息是针对第5层的,但我怀疑它与第4层有关,其中"堆叠"发生了。 想法?
答案 0 :(得分:0)
这里的根本问题是convolution2dLayer不理解1D输入。通过深入细节,结果表明输入很快变得毫无意义(例如,负行数)。