Can I give multiple labels to a single file in ImageDatastore
Mostrar comentarios más antiguos
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 comentarios
KSSV
el 7 de Ag. de 2019
Try giving no source first.....then put your lables in
imds = imageDatastore(location)
imds.labels
Andy Holmes-Evans
el 7 de Ag. de 2019
Athul Prakash
el 14 de Ag. de 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
el 15 de Ag. de 2019
Abed AlRahman Al Makdah
el 21 de Feb. de 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
el 30 de Abr. de 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
el 23 de Sept. de 2022
@Abed AlRahman Al Makdah I am trying to do the exact same thing, did you manage to find a solution?
Ameetha
el 8 de En. de 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
el 8 de En. de 2023
Im using Matlab 2019 b version. pls help
Ameetha
el 25 de En. de 2023
@Yousef Omar did you find any solution?
Ameetha
el 25 de En. de 2023
@Andy Holmes-Evans can you give the solution pls
Respuestas (1)
Jayanti
el 4 de Abr. de 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!
Categorías
Más información sobre Preprocess Data for Deep Neural Networks en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!