Re-build Resnet 50 but error
Show older comments
Hello, any other guys solve this problem ? i was change the some code but tooks error . can u anyother guys solve this problem ?
original code is running 

orginal code is here :
inputSize = [256 192 3]; originalNet = resnet18;
lgraph = layerGraph(originalNet); lgraph = removeLayers(lgraph,'pool5');
lgraph = removeLayers(lgraph,'fc1000'); lgraph = removeLayers(lgraph,'prob');
lgraph = removeLayers(lgraph,'ClassificationLayer_predictions');
layers = [
transposedConv2dLayer(4,256,"Name","transposed-conv_1","Cropping","same","Stride",[2 2], "BiasLearnRateFactor", 0)
%batchNormalizationLayer("Name","batchnorm_1")
reluLayer("Name","relu_1")
transposedConv2dLayer(4,256,"Name","transposed-conv_2","Cropping","same","Stride",[2 2],"BiasLearnRateFactor",0)
%batchNormalizationLayer("Name","batchnorm_2")
reluLayer("Name","relu_2")
transposedConv2dLayer(4,256,"Name","transposed-conv_3","Cropping","same","Stride",[2 2],"BiasLearnRateFactor",0)
%batchNormalizationLayer("Name","batchnorm_3")
reluLayer("Name","relu_3")
convolution2dLayer(1,numJoints,"Name","conv2d_final")
];
lgraph = addLayers(lgraph,layers);
lgraph = connectLayers(lgraph,'res5b_relu','transposed-conv_1/in');
dlnet = dlnetwork(lgraph);
i was change the like that :
inputSize = [256 192 3]; originalNet = resnet50;
lgraph = layerGraph(originalNet);
lgraph = removeLayers(lgraph,'avg_pool');
lgraph = removeLayers(lgraph,'fc1000');
lgraph = removeLayers(lgraph,'fc1000_softmax');
lgraph = removeLayers(lgraph,'ClassificationLayer_fc1000');
layers = [
transposedConv2dLayer(4,256,"Name","transposed-conv_1","Cropping","same","Stride",[2 2], "BiasLearnRateFactor", 0)
%batchNormalizationLayer("Name","batchnorm_1")
reluLayer("Name","relu_1")
transposedConv2dLayer(4,256,"Name","transposed-conv_2","Cropping","same","Stride",[2 2],"BiasLearnRateFactor",0)
%batchNormalizationLayer("Name","batchnorm_2")
reluLayer("Name","relu_2")
transposedConv2dLayer(4,256,"Name","transposed-conv_3","Cropping","same","Stride",[2 2],"BiasLearnRateFactor",0)
%batchNormalizationLayer("Name","batchnorm_3")
reluLayer("Name","relu_3")
convolution2dLayer(1,numJoints,"Name","conv2d_final")
];
lgraph = addLayers(lgraph,layers);
lgraph = connectLayers(lgraph,'activation_49_relu','transposed-conv_1/in');
dlnet = dlnetwork(lgraph);
Answers (1)
Anshika Chaurasia
on 16 Jun 2021
0 votes
Hi,
The error is because the size of Mean array argument in imageInputLayer is not correct. Since you have changed the inputSize, the size of Mean array also needed to be changed.
The valid Mean array size are 256x192x3 array or 1x1x3 array of means per channel.
Hope it helps!
Categories
Find more on 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!