Why does "splitEachLabel" function error when using an "augmented​ImageDatas​tore" as input?

15 ビュー (過去 30 日間)
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
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 件)

カテゴリ

Help Center および File ExchangeDatastore についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by