Re-build Resnet 50 but error
이전 댓글 표시
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);
답변 (1개)
Anshika Chaurasia
2021년 6월 16일
0 개 추천
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!
카테고리
도움말 센터 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!