Error using trainYOLOv​4ObjectDet​ector>iPar​seInputsYO​LOv4

4 visualizaciones (últimos 30 días)
JENHAO HSU
JENHAO HSU el 19 de Abr. de 2023
Comentada: JENHAO HSU el 20 de Jul. de 2023
When I wanted to train YOLOv4 to detect two classes instead of one, I changed
classes = 'class1';
to
classes = {'class1','class2'};
.
I got the following message.
Error using trainYOLOv4ObjectDetector>iParseInputsYOLOv4
The class names specified in the detector must match the class names in training data.
Error in trainYOLOv4ObjectDetector (line 114)
[trainingData, params] = iParseInputsYOLOv4(trainingData,detector,options,mfilename,varargin{:});
I found that there was an issue on line 469 in the trainYOLOv4ObjectDetector.m file.
if ~all(strcmp(gTruthClassNames',detectorClassNames))
I went to check these two variables (gTruthClassNames and detectorClassNames).
I found that one shape is 1*2 and the other is 2*1.
I'm not sure if this is the problem.
Is there an example of training YOLOv4 with more than two classes?
I know this webpage (yolov4objectdetector) describes how to use two classes in YOLOv4ObjectDetector, but the issue with my program is in trainYOLOv4ObjectDetector.

Respuesta aceptada

Shuba Nandini
Shuba Nandini el 28 de Abr. de 2023
Hello,
As per my understanding the error is due to mismatch between the names of the classes you have defined and the names of the classes in the trainingData being passed to the trainYolov4Detector. The issue is not with the sizes of the gTruthClassNames and detectorClassNames, as transpose has been applied, in the strcmp function.
You can also refer to this link for getting an idea on Multiobjectdetection: Multiclass Object Detection Using YOLO v2 Deep Learning - MATLAB & Simulink
I hope this helps!
  1 comentario
JENHAO HSU
JENHAO HSU el 20 de Jul. de 2023
Thank you! I have solved this problem! It is caused by the different names of the classes .

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by