Error using boxlabeldatastore with Image Labeler dataset

조회 수: 29(최근 30일)
Brandon McGannon
Brandon McGannon 2020년 3월 8일
답변: Rajani Mishra 2020년 3월 11일
I am having an issue with the boxlabeldatastore function when trying to train a YOLO network. I have working Arduino code that allows for bluetooth control of a Pololu Romi and the Matlab script for controlling the robot. The problem is, when trying to train the network on a dataset I created from the Image Labeler tool, I get the following errors:
Error using boxLabelDatastore (line 216)
Incorrect bounding box format. Bounding box must be an M-by-4 numeric matrix, where M specifies the number of boxes in a row. The column in the training data table that contains the
bounding boxes must be a cell array.
Error in TrainingExample_Multi_Class (line 24)
bldsTrain = boxLabelDatastore(trainingDataTbl(:,2:end));
Caused by:
Error using boxLabelDatastore
Expected input number 1, boxes in the training data table, to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64
Instead its type was struct.
I've attached both the dataset and training script, but am not sure where to go from here. Please advise.


Rajani Mishra
Rajani Mishra 2020년 3월 11일
I tried reproducing the problem using the script and mat file provided but I wasn’t able to run the script as the “data.gTruth.DataSource” in the mat file provided by you has paths pointing to locations on your system so it’s producing error while I try to run on my system.
I ran your script using the mat file present in this link’s first example :
% This data was used
data = load('vehicleTrainingData.mat');
trainingData = data.vehicleTrainingData;
No error is encountered while using boxLableDatastore() function.
After looking into your “data.gTruth”
% line number 4 in your script
data = load('HandLabelDefinitions.mat');
“data.gTruth.DataSource” is of type cell whereas for using function objectDetectorTrainingDat()
% line number 6 in your script
trainingData = objectDetectorTrainingData(data.gTruth);
the groundTruth object should have DataDource property of type groundTruthDataSource object.
You can see "data.gTruth.DataSource" having cell type for your mat file below :
Where as for "vehicleTrainingData.mat" it's of type groundTruthDataSource object :
So convert data.gTruth.DataSource from cell type to the required object type.
Refer to this link for more information :




Community Treasure Hunt

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

Start Hunting!

Translated by