Clear Filters
Clear Filters

Training Datastore Error when Training Yolov4 for Object Detection

2 views (last 30 days)
I have a labeled image dataset created with MATLAB image labeler containing two label classes. I'm trying to train a yolov4 on this dataset for object detection.
My data preprocessing consists of resizing and augmentation of the images and labeling boxes using code from several examples posted on the MATLAB website.
When I run the code I get the following error:
Error using vision.internal.inputValidation.checkGroundTruthDatastore
The read method of the training input datastore must return an M-by-3 cell or table
I find this confusing because my training datastore has one subdatastore containing mx1 images and a second subdatastore containing mx2 boxes and their corresponding labels which means that the training data should be in the proper M-by-3 input.

Answers (1)

Udit06
Udit06 on 11 Dec 2023
Hi Raymond,
I understand that you are facing an issue in training YOLO v4 object detector using the labeled data generated using the Image Labeler app. You can follow the following steps to resolve the issue.
1) On exporting the labeled images using Image Labeler app into a MAT file, the labeled data gets stored in the "gTruth" variable. which contains three properties as shown below.
2) To generate the training data from the groundTruth data for object detection purpose, you can use the "objectDetectorTrainingData" function which will creates an image datastore and a box label datastore training data from the specified ground truth. You can refer to the following MathWorks documentation to understand more about the "objectDetectorTrainingData" function.
3) You can then combine the image and box label datastores using "combine" function to create a datastore needed for training. You can refer to the following MathWorks documentation to understand more about the "combine" function.
4) The combined datastore obtained in the above step can then be used for training YOLO v4 object detector.
I hope this helps.

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!