ファイルパスの仕様が分からないです
MATLAB Drive/研究/画像認識/DLdata/training
の位置にある画像フォルダの中の画像を使用してCNNで処理したいのですが、おそらくファイルパスの設定がうまくいっておらずエラーが起きます。
実行しているスクリプトは、
MATLAB Drive/研究/画像認識/DLcode
の位置にあります。
以下に実行したスクリプトを載せます。
MATLAB
1clear, close all 2 3% 学習用カラム画像データ用パスの設定 4trainingDatasetPath = fullfile('MATLAB Drive','研究','画像認識', 'DLdata', 'training'); 5% 学習用カラム画像データのデータストアの作成 6TrainingData = imageDatastore(trainingDatasetPath,'IncludeSubfolders', true, 'LabelSource', 'foldernames','FileExtensions','.tif'); 7 8% 評価用カラム画像データ用パスの設定 9testDatasetPath = fullfile('MATLAB Drive','研究','画像認識', 'DLdata', 'test'); 10% 評価用カラム画像データのデータストアの作成 11TestData = imageDatastore(testDatasetPath,'IncludeSubfolders', true, 'LabelSource', 'foldernames','FileExtensions','.tif'); 12 13layers = [ 14 imageInputLayer([32 32 1]) 15 16 convolution2dLayer(5,20,'Padding',0) 17 batchNormalizationLayer 18 reluLayer 19 maxPooling2dLayer(2,'Stride',2) 20 21 convolution2dLayer(5,20,'Padding',0) 22 batchNormalizationLayer 23 reluLayer 24 maxPooling2dLayer(2,'Stride',2) 25 26 convolution2dLayer(3,20,'Padding',0) 27 batchNormalizationLayer 28 reluLayer 29 30 fullyConnectedLayer(4) 31 softmaxLayer 32 classificationLayer]; 33 34% 学習パラメータの設定(最適化手法:SGDM, 最大エポック数:15,初期学習率:0.0001) 35options = trainingOptions('sgdm','MaxEpochs',3,'ValidationData',TestData,'ValidationFrequency',17,'Verbose',false,'Plots','training-progress'); 36%options = trainingOptions('sgdm','MaxEpochs',3,'Verbose',false,'Plots','training-progress'); 37 38% ニューラルネットワークの学習 39tic; 40net = trainNetwork(TrainingData, layers, options); 41toc; 42 43% 学習したニューラルネットワークで評価画像を分類 44YTest = classify(net, TestData); 45% 評価画像の正解ラベルを設定 46TTest = TestData.Labels; 47 48% 正解率の算出 49accuracy = sum(YTest == TTest)/numel(TTest) 50
コマンドウィンドウのエラーについての表示
Error using imageDatastore (line 125)
Cannot find files or folders matching: 'MATLAB Drive/研究/画像認識/DLdata/training'.
Error in trainPCP1 (line 6)
TrainingData = imageDatastore(trainingDatasetPath,'IncludeSubfolders', true, 'LabelSource', 'foldernames','FileExtensions','.tif');
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。