【Alexnet】inputLayerに対するイメージサイズの変更について
이전 댓글 표시
MATLAB初心者の学生です。 Alexnetを用いた転移学習をしたいのですが、学習元のイメージサイズが、83×83です。 そのため、入力層を変えてみたのですが、下記のとおり、Layer'fc6 でエラーが生じました。
①Alexnetをどのように変更すればよいのでしょうか?
②また、Alexnetの変更で対応が困難な場合、学習元のイメージサイズを227×227 に変換する方法はありますでしょうか?
②の場合、大量のデータを扱っているので、簡易にできる方法があると助かります。 よろしくお願いいたします。
dsflowers=imageDatastore('C:\Flowers','IncludeSubfolders',true)
flowernames = dsflowers.Labels
dsflowers = imageDatastore('C:\Flowers','IncludeSubfolders',true,'LabelSource','foldernames')
[flwrTrain,flwrTest] = splitEachLabel(dsflowers,100)
anet=alexnet;
layers=anet.Layers
inputLayer = imageInputLayer([83 83 3]);
layers(1)=inputLayer
fc = fullyConnectedLayer(4)
layers(23) = fc
layers(end) = classificationLayer
opts = trainingOptions('sgdm','InitialLearnRate',0.001)
[flowernet,info]=trainNetwork(flwrTrain,layers,opts);
エラー:trainNetwork(line154)
無効なネットワーク
原因:Layer'fc6:Input size mismatch,Size of input to this layer is different from the expected input size.
この層の入力:from layer 'pool5'(1×1×256 出力)
채택된 답변
추가 답변 (1개)
MASAYUKI EGUCHI
2018년 4월 22일
편집: michio
2018년 4월 23일
댓글 수: 2
MASAYUKI EGUCHI
2018년 5월 26일
카테고리
도움말 센터 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!