Training failed: Layer 'classoutput' input size mismatch
Show older comments
I am training my convolutional neural network by using Deep Network Designer. When I did the training part it shows me: "Training failed: Layer 'classoutput' input size mismatch. Size of input to this layer is different from the expected input size. Inputs to this layers: from layer 'softmax' (output size 32x32x2)" My input contains 100000 sets of 32x32x2 data. Could anyone give me some hint to solve this problem, thank you!
Here is my network structure:
tempLayers = [
imageInputLayer([32 32 2],"Name","imageinput")
convolution2dLayer([9 9],256,"Name","conv_1_1","Padding","same")
averagePooling2dLayer([9 9],"Name","avgpool2d_1","Padding","same")
batchNormalizationLayer("Name","batchnorm_1_1")
leakyReluLayer(0.01,"Name","leakyrelu_1_1")
convolution2dLayer([5 5],256,"Name","conv_2_1","Padding","same")
averagePooling2dLayer([5 5],"Name","avgpool2d_2","Padding","same")
batchNormalizationLayer("Name","batchnorm_2_1")
leakyReluLayer(0.01,"Name","leakyrelu_2_1")
convolution2dLayer([5 5],256,"Name","conv_3_1","Padding","same")
averagePooling2dLayer([5 5],"Name","avgpool2d_3","Padding","same")
batchNormalizationLayer("Name","batchnorm_3_1")
leakyReluLayer(0.01,"Name","leakyrelu_3_1")
transposedConv2dLayer([5 5],2,"Name","transposed-conv_1","Cropping","same")
convolution2dLayer([5 5],256,"Name","conv_1_2","Padding","same")
batchNormalizationLayer("Name","batchnorm_1_2")
leakyReluLayer(0.01,"Name","leakyrelu_1_2")];
lgraph = addLayers(lgraph,tempLayers);
tempLayers = [
convolution2dLayer([5 5],256,"Name","conv_2_2","Padding","same")
batchNormalizationLayer("Name","batchnorm_2_2")
leakyReluLayer(0.01,"Name","leakyrelu_2_2")
convolution2dLayer([5 5],256,"Name","conv_3_2","Padding","same")
batchNormalizationLayer("Name","batchnorm_3_2")
leakyReluLayer(0.01,"Name","leakyrelu_3_2")
convolution2dLayer([5 5],256,"Name","conv_6","Padding","same")
batchNormalizationLayer("Name","batchnorm_5")
leakyReluLayer(0.01,"Name","leakyrelu_5")
convolution2dLayer([5 5],256,"Name","conv_7","Padding","same")
batchNormalizationLayer("Name","batchnorm_6")
leakyReluLayer(0.01,"Name","leakyrelu_6")];
lgraph = addLayers(lgraph,tempLayers);
tempLayers = [
additionLayer(2,"Name","addition")
transposedConv2dLayer([5 5],2,"Name","transposed-conv_2","Cropping","same")
convolution2dLayer([5 5],256,"Name","conv_4","Padding","same")
batchNormalizationLayer("Name","batchnorm_4")
leakyReluLayer(0.01,"Name","leakyrelu_4")
transposedConv2dLayer([5 5],4,"Name","transposed-conv_3","Cropping","same")
convolution2dLayer([9 9],2,"Name","conv_5","Padding","same")
softmaxLayer("Name","softmax")
classificationLayer("Name","output")];
lgraph = addLayers(lgraph,tempLayers);
clear tempLayers;
lgraph = connectLayers(lgraph,"leakyrelu_1_2","conv_2_2");
lgraph = connectLayers(lgraph,"leakyrelu_1_2","addition/in1");
lgraph = connectLayers(lgraph,"leakyrelu_6","addition/in2");
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!