【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!