CNNのレイヤーの設​定で入力サイズと出力​サイズのエラーが出た​のですが解決方法がわ​かりません。

6 ビュー (過去 30 日間)
Natsuo OKADA
Natsuo OKADA 2020 年 12 月 2 日
コメント済み: Natsuo OKADA 2020 年 12 月 2 日
現在CNNで、1×5のスペクトルデータを学習させようとしています。
元々1×204のデータを学ばせていたものについて、1×5のデータを学ばせられるように入力層のサイズだけ変更しました。
以下のコードを用いて学習を行おうとしているのですが、
Input size mismatch. Size of input to this layer is different from the expected input size.
Inputs to this layer:
from layer 15 (output size 1×1×5)
とのエラーが出ました。
CNNの層構造について素人であり、こちらのエラーが層のどの部分に起因しているものなのかわからず、質問させていただきます。
素人質問で申し訳ありませんが、よろしくお願いいたします。
rockdata = imageDatastore('D:\featureselected',...
'Readfcn',@readDatastoreCSV,'IncludeSubfolders',true,'LabelSource','foldernames','FileExtensions','.csv');
% labeling the names
rocknames = rockdata.Labels;
% Dividing into Training Data and Testing Data
[imdsTrain,imdsVal, imdsTest] = splitEachLabel(rockdata,0.8, 0.1, 0.1,'randomized');
%layers
layers=[
imageInputLayer([1 5]);
convolution2dLayer([1 3],64,'Stride',1,'Padding',[0 1]);
convolution2dLayer([1 3],64,'Stride',1,'Padding',[0 1]);
batchNormalizationLayer
reluLayer();
maxPooling2dLayer([1 2],'Stride',[1 2]);
convolution2dLayer([1 3],128,'Stride',1,'Padding',[0 1]);
convolution2dLayer([1 3],128,'Stride',1,'Padding',[0 1]);
batchNormalizationLayer
reluLayer();
maxPooling2dLayer([1 2],'Stride',[1 2]);
convolution2dLayer([1 3],256,'Stride',1,'Padding',[0 1]);
convolution2dLayer([1 3],256,'Stride',1,'Padding',[0 1]);
batchNormalizationLayer
reluLayer();
maxPooling2dLayer([1 2],'Stride',[1 2]);
%fullyConnectedLayer(500);
fullyConnectedLayer(400);
fullyConnectedLayer(400);
fullyConnectedLayer(14);
softmaxLayer();
classificationLayer();
];
function data = readDatastoreCSV(filename)
data = csvread(filename);
data = reshape(data,[1 1 5 1]);
  3 件のコメント
Natsuo OKADA
Natsuo OKADA 2020 年 12 月 2 日
回答ありがとうございます。
変わらず以下のエラーが出ました。。。
Error in JWcodefor5bands (line 48)
[HSdatanet,info] = trainNetwork(imdsTrain,layers,options);
Caused by:
Layer 16: Input size mismatch. Size of input to this layer is different from the expected input size.
Inputs to this layer:
from layer 15 (output size 1×1×256)

サインインしてコメントする。

回答 (0 件)

カテゴリ

Find more on イメージを使用した深層学習 in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!