Getting both Bounding Boxes and Labels with boxLabelDatastore

Hello! I want to train a YOLOv4 NN and and for that I have a trainingData table with three columns, the first with the image name, the second with the bounding boxes and the tird with the labels. The problem is that I'm unable to process both the bounding boxes and the labels into the boxLabelDatastore funtion.
How can I do it? I attach an example of my trainingData table and a bit of my code. Thanks for help in advance!
imdsTrain = imageDatastore(trainingDataTbl{:,"imageFilename"});
bldsTrain = boxLabelDatastore(trainingDataTbl(:,2));

Réponses (1)

Hi Gonzalo,
To get both the bounding boxes and their corresponding labels into the datastore for training YOLOv4, you can follow these steps:
  • Include all the label-related columns from your table when creating the boxLabelDatastore, instead of passing only the bounding box column. For example:
imdsTrain = imageDatastore(trainingDataTbl.imageFilename);
bldsTrain = boxLabelDatastore(trainingDataTbl(:,2:end));
trainingData = combine(imdsTrain,bldsTrain);
I hope it resolves your query.

Catégories

En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange

Question posée :

le 27 Fév 2026

Réponse apportée :

le 11 Mar 2026

Community Treasure Hunt

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

Start Hunting!

Translated by