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

조회 수: 2 (최근 30일)
JENHAO HSU
JENHAO HSU 2023년 4월 19일
댓글: JENHAO HSU 2023년 7월 20일
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.

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by