Can I give multiple labels to a single file in ImageDatastore
Mostra commenti meno recenti
Can I give multiple categorical labels to a single file in ImageDatastore. For example I have an outdoor photograph which contains a Dog, Tree and Sky. I have Inceptionv3 running in Python with all files in one directory, and the muliple labels held in txt files of same names and want to rebuild this in MATLAB. The only option I can find is ('LabelSouce','foldernames'). Is it possible to add multiple labels to a single file in the Datastore, or do I need to add the file 3 times, once for each label, or use a different method?
11 Commenti
KSSV
il 7 Ago 2019
Try giving no source first.....then put your lables in
imds = imageDatastore(location)
imds.labels
Andy Holmes-Evans
il 7 Ago 2019
Athul Prakash
il 14 Ago 2019
It's not very clear how you're planning to generate target outputs for the network using these labels. Do you want independent 1/0 values to predict the presense of each class?
Also..
What's the activation function you are using for the output layer? Is it designed for multi label classification?
Andy Holmes-Evans
il 15 Ago 2019
Abed AlRahman Al Makdah
il 21 Feb 2020
I am also trying to use a two dimensional array for my labels. My network output's dimension is 2, it is for regression, not classification. The function imageDatastore takes only 1 dimensional array for labels. If you find a way how to use a 2 dimensional array, let me know.
Thank you
Nidhi Sawant
il 30 Apr 2021
@Athul Prakash Matlab 2020b has released multi label classification example without creating datastores. The problem discussed here yet persisits to create a imagedatastore with multi-label classification. Could you please enlighten on this? Thanks.
Yousef Omar
il 23 Set 2022
@Abed AlRahman Al Makdah I am trying to do the exact same thing, did you manage to find a solution?
Ameetha
il 8 Gen 2023
@Abed AlRahman Al Makdah I am trying to label an Image with two of its another features in Matlab using imageDataStore. ie 2D arrays as label. Did you find a solution?
Ameetha
il 8 Gen 2023
Im using Matlab 2019 b version. pls help
Ameetha
il 25 Gen 2023
@Yousef Omar did you find any solution?
Ameetha
il 25 Gen 2023
@Andy Holmes-Evans can you give the solution pls
Risposte (1)
Jayanti
il 4 Apr 2025
Hi,
To assign multiple labels to a single image in MATLAB, you can use a combination of “imageDatastore” and “arrayDatastore”.
Start by preparing a cell array where each cell contains a categorical array of labels corresponding to each image. Create an “arrayDatastore” with this cell array. Use the “combine” function to merge the image and label datastores.
For example, if you have two images, you can set up the combined datastore as shown below:
labelCellArray = cell(2, 1);
labelCellArray{1} = categorical(["ball" "dog" "cat"]);
labelCellArray{2} = categorical(["tree" "sky"]);
labelDs = arrayDatastore(labelCellArray);
dsTrain = combine(imds, labelDs);
Hope this will be helpful!
Categorie
Scopri di più su Preprocess Data for Deep Neural Networks in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!