When I try to modify the matlab provided cnn network, it says layer 11 is expected to have a different size.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Elizabeth Reese
el 5 de Dic. de 2017
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 comentarios
Ver también
Categorías
Más información sobre Image Data Workflows en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!