Why does "splitEachLabel" function error when using an "augmentedImageDatastore" as input?
16 次查看(过去 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!