필터 지우기
필터 지우기

What is the correct syntax for using an augmentedImageDatastore as validation data in trainingOptions for the trainNetwork() function?

조회 수: 1 (최근 30일)
I have the following image datastore:
myDataset = imageDatastore('C:\MyData',...
'IncludeSubfolders',true,...
'FileExtensions','.png',...
'LabelSource','foldernames');
[imdsTrain, imdsVal, imdsTest] = splitEachLabel(myDataset, 0.6, 0.2, 'randomized');
Which I then prepare to input into some pre-trained networks:
augimdsTrain = augmentedImageDatastore([227 227 3],imdsTrain,...
'ColorPreprocessing', 'gray2rgb',...
'DataAugmentation', augmenter);
augimdsVal = augmentedImageDatastore([227 227 3],imdsVal, ...
'ColorPreprocessing', 'gray2rgb');
augimdsTest = augmentedImageDatastore([227 227 3],imdsTest,...
'ColorPreprocessing', 'gray2rgb');
What is the correct syntax for using augimdsVal as 'ValidationData'in trainingOptions? Do I just use the augmented datastore as is (as I've seen in some of the documentation):
options = trainingOptions('sgdm','InitialLearnRate', 0.0001, 'ValidationData', augimdsVal);
Or can I add labels like so:
options = trainingOptions('sgdm','InitialLearnRate', 0.0001, 'ValidationData', {augimdsVal imdsVal.Labels});
Or is there a better way?

채택된 답변

Harsha Priya Daggubati
Harsha Priya Daggubati 2020년 5월 15일
Hi,
The name-value pair 'ValidationData' can support only the following types as a value:
  1. Image Data Store.
  2. Data Store.
  3. Table.
  4. Cell array of X and Y, where X represents data while Y represents corresponding labels.
So, I guess it is invalid to give labels again as a value.
Refer to the following link:
Hope this clarifies your concern!
  댓글 수: 3
Harsha Priya Daggubati
Harsha Priya Daggubati 2020년 5월 15일
As the imagedataStore has labels, there is no need to explicitly specify labels to augmented image datastore, when we use imds as the argument during creation.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by