Why does "splitEachLabel" function error when using an "augmentedImageDatastore" as input?
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 21 Sep. 2023
Beantwortet: MathWorks Support Team
am 26 Sep. 2023
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"?
Akzeptierte Antwort
MathWorks Support Team
am 21 Sep. 2023
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Datastore finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!