フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Why do I recieve an error message "Specify all of the new elements to create an array of layers or assign to elements of layers outside of array bounds."

1 回表示 (過去 30 日間)
Satyabrata Nath
Satyabrata Nath 2017 年 3 月 2 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I am new in deep learning and trying to implement a code for transfer learning but whenever i run this code it gives an error message "Specify all of the new elements to create an array of layers or assign to elements of layers outside of array bounds." Error in line 4) , code -
  • 1)cnnMatFile = fullfile(tempdir, 'imagenet-caffe-alex.mat');
  • 2)convnet = helperImportMatConvNet(cnnMatFile);
  • 3)convnet.Layers
  • 4)layers(21) = fullyConnectedLayer(5);
  • 5)layer(23) = classificationLayer
  • 6)allimages = imageDatastore('myimages','IncludeSubfolders', true,'LabelSource', 'foldernames');
  • 7)[trainingImages, testImages]=splitEachLabel(allimages, 0.0, 'randomize');
  • 8)opts = trainingOptions('sgdm', 'InitialLearnRate', 0.001, 'MaxEpochs', 20, 'MiniBatchSize', 64);
  • 9)myNet = trainNetwork(trainingImages, layers, opts);
  • 10)predictedLabels = classify(myNet, testImages);
  • 11)accuracy = mean(predictedLabels == testImages.Labels)
Please help in solving this.

回答 (0 件)

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by