Convert [XTrain YTrain] to imageDatastore

3 ビュー (過去 30 日間)
Juan Vasconez
Juan Vasconez 2022 年 10 月 20 日
回答済み: Sanjana 2023 年 6 月 8 日
%I want to convert an image dataset [XTrain YTrain] to a imageDatastore format.
%XTrain size = 128 128 3 25 (4-D double since there are 25 RGB imagens of 128x128 pixels)
%YTrain size = 25x1 (25 labels, one labe for each image)
% DataSetStore = imageDatastore(source_file, ...
IncludeSubfolders=true, ....
LabelSource="foldernames");
Is it possible??? Or it is necessary to have the images in the respective folders and subfolders with the LabelSource="foldernames"

回答 (1 件)

Sanjana
Sanjana 2023 年 6 月 8 日
Hi,
I understand that you want to create “image Datastore”, for the image dataset with images and their corresponding labels.
And as per the “image Datastore” documentation, it is required for the images to be present in the respective folders named with the corresponding label Name, for the “Labels” attribute to have the corresponding labels for all the images in the dataset.
But you can still set “Labels” attribute of “image Datastore” to YTrain, in case if YTrain is a cell Array.
Imds.Labels = YTrain
Hope this helps!

カテゴリ

Help Center および File ExchangeImage Processing and Computer Vision についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by