When I try to modify the matlab provided cnn network, it says layer 11 is expected to have a different size.
1 回表示 (過去 30 日間)
古いコメントを表示
Here are the layer parameter.
varSize = 32;
conv1 = convolution2dLayer(5,varSize,'Padding',2,'BiasLearnRateFactor',2);
conv1.Weights = gpuArray(single(randn([5 5 3 varSize])*0.0001));
fc1 = fullyConnectedLayer(64,'BiasLearnRateFactor',2);
fc1.Weights = gpuArray(single(randn([64 576])*0.1));
fc2 = fullyConnectedLayer(4,'BiasLearnRateFactor',2);
fc2.Weights = gpuArray(single(randn([4 64])*0.1));
layers = [
imageInputLayer([varSize varSize 3]);
conv1;
maxPooling2dLayer(3,'Stride',2);
reluLayer();
convolution2dLayer(5,32,'Padding',2,'BiasLearnRateFactor',2);
reluLayer();
averagePooling2dLayer(3,'Stride',2);
convolution2dLayer(5,64,'Padding',2,'BiasLearnRateFactor',2);
reluLayer();
averagePooling2dLayer(3,'Stride',2);
fc1;
reluLayer();
fc2;
softmaxLayer()
classificationLayer()];
2 件のコメント
回答 (1 件)
Elizabeth Reese
2017 年 12 月 5 日
When you specify the weights for fc1 and fc2, the 576 and 64 respectively is taken as the expected output size from the previous layer. You can double check that this is correct using the formulas at the bottom of the layers' documentation pages to follow through what the output size is expected to be at that point. You can test this hypothesis by removing your assignments to the weights and seeing if the network will train and what the sizes are at that stage.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Image Data Workflows についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!