How can we use splitEachLabel for augmented image datastores?

15 ビュー (過去 30 日間)
Jasmine Ershov
Jasmine Ershov 2019 年 3 月 1 日
I am trying to use the splitEachLabel function in MATLAB on an augmented image datastore, but I get the following error:
Undefined function 'splitEachLabel' for input arguments of type 'augmentedImageDatastore'
I know that this works for normal image datastores, but what can I do to either make splitEachLabel work or get another function to have the same effect? I have looked all over the MATLAB documentation, but I cannot find a solution to this.
Here is my code:
% Create augmented image datastore auds for already existing datastore ds
auds = augmentedImageDatastore([227 227], ds);
% Get the training images and the test images
[trainImgs,testImgs] = splitEachLabel(auds, 0.6);

採用された回答

Shivam Gupta
Shivam Gupta 2019 年 3 月 7 日
splitEachLabel function splits ImageDatastore labels by proportion. As you have augumented the image data store into augmentedImageDatastore, you can try partitioning it using partitionByIndex.
Suppose there are 5 observations in auds.
To assign 3 observations in auds1 use vector [1:3]
To assign rest 2 observations in auds2 use vector [4:5]
imds=imageDatastore(pathToDirectory,'LabelSource', 'foldernames', 'FileExtensions', {'.gif'});
auds = augmentedImageDatastore([227 227], imds);
auds1 = partitionByIndex(auds,[1:3]);
auds2 = partitionByIndex(auds,[4:5]);
For more information, see:
https://in.mathworks.com/help/deeplearning/ref/augmentedimagedatastore.partitionbyindex.html#d120e63199
  2 件のコメント
Jasmine Ershov
Jasmine Ershov 2019 年 3 月 7 日
Thank you very much it worked!
Oluwatobi John Oluwafemi
Oluwatobi John Oluwafemi 2021 年 2 月 21 日
Whilst partitioning it, is there a way to randomize ?

サインインしてコメントする。

その他の回答 (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