YOLOv4 trainingData format problem
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, I'm trying to train YOLOv4 on 5 different classes. I've created my training datastore by combining an imageDatastore from my pictures with a boxLabelDatastore from my labels. However I'm getting the error below when attempting to run training:
The class names specified in the detector must match the class names in training data.
[trainingData, detector, isRotatedBox, params] = iParseInputsYOLOv4(trainingData,detector,options,mfilename,varargin{:});
I've verified that the class names I used are exactly the same so I'm guessing it's something wrong with the way my boxLabelDatastore is formatted. I've attached a screenshot below to display the blds format.

when I stepped into iParseInputsYOLOv4 I found that the gTruthClassNames was only getting class names from the trainingData from the first entry (that 4x1 categorical). Which leaves me very confused at how the trainingData should be formatted. Right now it's 1 row for each image, each detection has a 4 length array for the bbox, each bbox has a categorical label.
Respuestas (1)
Gayathri
el 7 de Mayo de 2025
I understand that you are facing an error while training YOLOv4. The error states that the class names specified in the detector must match with the class names in the training data.
To address this error, you can try the following steps:
- Check for any leading or trailing whitespaces in the class names variable.
- Verify the case sensitivity and examine for any additional characters or invisible characters.
- Validate the variable types of class names. Ensure that "gTruth.LabelDefinitions.Name" and the class names used in the training data are of type "cell array of strings".
- Please also check that the class names are in the same order in the detector and the training data. (This could be a main reason for the error).
You can refer to the below documentation to understand more about "yolov4ObjectDetector", "trainYOLOv4ObjectDetector" and "groundTruth" object in MATLAB.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!