error "Error using nnet.inter​nal.cnn.la​yer.util.i​nferParame​ters>iInfe​rSize (line 86) The output of layer 13 is incompatible with the input expected by layer 14."

33 ビュー (過去 30 日間)
where is the error in this code ..i only use googlenet as deep tuning without change any thing in it's Layers except the last 3 layers . i changed the size of my images to be similar of googlenet (224 224) so what wrong
net=googlenet;
TransfereLayers= net.Layers(2:end-3);
%% my layers Layers =[...
imageInputLayer([224 224 3],'Name','input')
TransfereLayers
fullyConnectedLayer(2,'Name',fc)
softmaxLayer
classificationLayer('Name','coutput')];
%% define the weights and biase
Layers(142).Weights = randn([2 1024]) * 0.001;
Layers(142).Bias = randn([2 1])*0.001 + 1;
%% options opts=trainingOptions('sgdm','Initiallearnrate',0.0001,'maxEpoch',maxEpochs ,..... 'Minibatchsize',miniBatchSize ,... 'Plots','training-progress',.... 'LearnRateSchedule', 'piecewise', ... 'LearnRateDropFactor', 0.1, ... 'LearnRateDropPeriod', 1, ... 'ValidationData',valDigitData,'ValidationFrequency',50 );
[mynet, traininfo] = trainNetwork(trainingimages,Layers,opts);
  3 件のコメント
Salma Hassan
Salma Hassan 2018 年 1 月 19 日
i didn't find what is wrong ? if you know please post the answer...thanks
conngame
conngame 2018 年 4 月 3 日
You guys ever figure this problem out?

サインインしてコメントする。

回答 (1 件)

Joakim Lindblad
Joakim Lindblad 2018 年 3 月 9 日
It's because GoogLeNet is a DAG which matlab handles differently than a layered network.
You can try with
trainNetwork(trainingimages,layerGraph(Layers),opts);
but I'm not sure that will be enough in this case.
  1 件のコメント
Johannes Bergstrom
Johannes Bergstrom 2018 年 5 月 31 日
編集済み: Johannes Bergstrom 2018 年 5 月 31 日
For an example showing how to do transfer learning with DAG networks, see Transfer Learning Using GoogLeNet.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by