regarding label source names in data set imagedatastore

24 Ansichten (letzte 30 Tage)
navdeep sandhu
navdeep sandhu am 10 Feb. 2019
Beantwortet: Neslihan am 27 Apr. 2023
i am working on image classification problem .I am using dataset in which there are some parent folder.Each parent folder have some sub folders.And these subfolders contain the image data.when i use imagedatastore to load ,it takes subfolder as class
I want to take parent folder as class(all the folder in that parent folder sould be a class named as parent folder name).
how to do this .

Antworten (2)

Johanna Pingel
Johanna Pingel am 12 Feb. 2019
ImageDatastore works really well if you have a parent class and 1 sub folder per class.
imageDatastore('parentfolder/','IncludeSubFolders',true','LabelSource','foldernames');
If not, you may have to do a little more processing. I'm sure there's a ton of ways to accomplish this: I would suggest getting all of your images and labels for each class into a datastore
class1 = imageDatastore({'cat1/random_folder/','cat1/'});
class1.Labels = repelem("cat1",numImages);
Do this for each class, then combine them into one super datastore
imdsFinal = imageDatastore([class1.Files; class2.Files]);
imdsFinal.Labels = [class1.Labels; class2.Labels]);
This should work and be able to customize to what you're trying to do!
  9 Kommentare
AYUSH ANAND SAGAR
AYUSH ANAND SAGAR am 27 Okt. 2020
i want to display the found image's label as the output
how can i do that?
aref
aref am 23 Aug. 2022
labels= unique(trainingData.Labels);

Melden Sie sich an, um zu kommentieren.


Neslihan
Neslihan am 27 Apr. 2023
Dataset = imageDatastore('Dataset', 'IncludeSubfolders', true, 'LabelSource', 'foldernames');

Kategorien

Mehr zu Convert Image Type 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!

Translated by