【Alexnet】inputLayerに対するイメージサイズの変更について
Show older comments
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 出力)
Accepted Answer
More Answers (1)
MASAYUKI EGUCHI
on 22 Apr 2018
Edited: michio
on 23 Apr 2018
2 Comments
MASAYUKI EGUCHI
on 26 May 2018
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!