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

2 Ansichten (letzte 30 Tage)
JENHAO HSU
JENHAO HSU am 19 Apr. 2023
Kommentiert: JENHAO HSU am 20 Jul. 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.

Akzeptierte Antwort

Shuba Nandini
Shuba Nandini am 28 Apr. 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 Kommentar
JENHAO HSU
JENHAO HSU am 20 Jul. 2023
Thank you! I have solved this problem! It is caused by the different names of the classes .

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by