Why does "splitEachLabel" function error when using an "augmentedImageDatastore" as input?
조회 수: 15 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2023년 9월 21일
답변: MathWorks Support Team
2023년 9월 26일
I am using the "splitEachlabel" function to split my image data using the following code:
% create imageDatastore
imds = imageDatastore(fullfile(matlabroot, 'toolbox', 'matlab', {'demos','imagesci'}),...
'LabelSource', 'foldernames', 'FileExtensions', {'.jpg', '.png', '.tif'});
% create augmentedImageDatastore
auimds = augmentedImageDatastore([256 256 3],imds,'ColorPreprocessing','rgb2gray');
% splitEach label for imageDatastore
[imds60,imds40] = splitEachLabel(imds ,0.6);
% splitEach label for augmentedImageDatastore
[auimds60,auimds40] = splitEachLabel(auimds ,0.6);
This works for "imageDatastore" objects but when using "augmentedImageDatastore" objects, I receive the following error:
Incorrect number or types of inputs or outputs for function splitEachLabel.
How can I use "splitEachLabel" function for "augmentedImageDatastore"?
채택된 답변
MathWorks Support Team
2023년 9월 21일
This is expected behaviour, the "augmentedImageDatastore" object does not have a object function named "splitEachLabel".
Please ensure that you split the data first, and then create the "augmentedImageDatastore" object. For example:
% create imageDatastoreimds = imageDatastore(fullfile(matlabroot, 'toolbox', 'matlab', {'demos','imagesci'}),...
'LabelSource', 'foldernames', 'FileExtensions', {'.jpg', '.png', '.tif'});
% splitEach label for imageDatastore
[imds60,imds40] = splitEachLabel(imds ,0.6);
% create augmentedImageDatastores
auimds60 = augmentedImageDatastore([256 256 3],imds60,'ColorPreprocessing','rgb2gray');
auimds40 = augmentedImageDatastore([256 256 3],imds40,'ColorPreprocessing','rgb2gray');
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Datastore에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!