Afficher commentaires plus anciens
エラーの意味が分からなくまたなぜエラーが出ているのかわかりりません
クラス 'augmentedImageDatastore' のメソッド、プロパティまたはフィール
ド 'Labels' が認識されません。
このようなエラーがでました。
%% 画像読み込み
imds = imageDatastore('catdog','IncludeSubfolders',true,'LabelSource','foldernames');
labelCount = countEachLabel(imds)
%% データで振り分ける
rateTrainFiles = 0.6;
[imdsTrain,imdsValidation] = splitEachLabel(imds,rateTrainFiles,'randomize');
s_image = [256,256,3];
imdsTrain = augmentedImageDatastore(s_image,imdsTrain);
imdsValidation = augmentedImageDatastore(s_image,imdsValidation);
%%DNN
layers = [
imageInputLayer(s_image)
%% 特徴抽出
convolution2dLayer(3,8,'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,16,'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,32,'Padding','same')
batchNormalizationLayer
reluLayer
fullyConnectedLayer(2)%クラスの数
softmaxLayer
classificationLayer];
options = trainingOptions('sgdm', ...
'InitialLearnRate',0.01,...
'MaxEpochs',4,...
'Shuffle','every-epoch',...
'ValidationData',imdsValidation,...
'VerboseFrequency',30,...
'Verbose',false, ...
'Plots','training-progress');
net = trainNetwork(imdsTrain,layers,options);
YPred = classify(net,imdsValidation);
クラス 'augmentedImageDatastore' のメソッド、プロパティまたはフィール
ド 'Labels' が認識されません。
YValidation = imdsValidation.Labels;
accuracy = sum(YPred == YValidation)/numel(YValidation)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!