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