Error training Yolox object detector

조회 수: 2 (최근 30일)
吉村
吉村 2024년 7월 29일
답변: Himanshu 2024년 8월 7일
[imds,blds] = objectDetectorTrainingData(gTruth);
ds = combine(imds,blds);
inputSize = [128 228 3];
numImages = numpartitions(ds);
numTrain = floor(16/25*numImages);
numVal = floor(4/25*numImages);
shuffledIndices = randperm(numImages);
dsTrain = subset(ds,shuffledIndices(1:numTrain));
dsVal = subset(ds,shuffledIndices(numTrain+1:numTrain+numVal));
dsTest = subset(ds,shuffledIndices(numTrain+numVal+1:end));
classes = {'pistol'};
detector = yoloxObjectDetector("tiny-coco",classes,InputSize=inputSize);
options = trainingOptions("sgdm", ...
InitialLearnRate=0.0001, ...
MiniBatchSize=4,...
MaxEpochs=4, ...
ResetInputNormalization=false, ...
Metrics=mAPObjectDetectionMetric(Name="mAP50"), ...
ObjectiveMetricName="mAP50", ...
ValidationData=dsVal, ...
ValidationFrequency=20, ...
VerboseFrequency=2);
trainedDetector = trainYOLOXObjectDetector(dsTrain,detector,options);
Epoch Iteration TimeElapsed LearnRate TrainingYoloXLoss ValidationYoloXLoss ValidationmAP50
_____ _________ ___________ _________ _________________ ___________________ _______________
1 1 00:00:00 0.001 8.7567 8.3197 0.040369
1 2 00:00:03 0.001 6.1269
1 4 00:00:04 0.001 4.7617
次を使用中のエラー: minibatchqueue/next (行 226)
'MiniBatchFcn' の値で指定された関数を適用できません。
エラー: images.dltrain.internal.SerialTrainer/fit (行 73)
[batch{:}] = next(self.DataQueue);
エラー: images.dltrain.internal.dltrain (行 114)
net = fit(networkTrainer);
エラー: trainYOLOXObjectDetector (行 232)
[netOut,info] = images.dltrain.internal.dltrain(queue,net,options,lossFcn,metrics,lossMetric,ExperimentMonitor=NameVal.ExperimentMonitor);
エラー: yolox_det (行 45)
trainedDetector = trainYOLOXObjectDetector(dsTrain,detector,options);
原因:
次を使用中のエラー: cat
連結する配列の次元が一致しません。
このようなエラーになる原因は何でしょうか.inputSize = [128 228 3];はサンプルを参考にしています.この一行で全てサイズ変換されているのでしょうか.
What could be the cause of this error? I used inputSize = [128 228 3]; as a reference from a sample. Does this single line automatically convert all sizes?

답변 (1개)

Himanshu
Himanshu 2024년 8월 7일
Hi,
I see that you are facing an error related to the dimensions of arrays being concatenated during the training process of the YOLOX object detector. This error is typically caused by inconsistencies in the dimensions of the images or labels in the dataset.
To solve this error, you need to ensure that all images in your dataset are resized to the specified input size and that the aspect ratio is maintained. Additionally, verify that the bounding box labels are correctly formatted and match the dimensions of the resized images.
I faced a similar issue and by following the below steps I was able to resolve the issue:
  1. Ensure that all images are resized to the specified input size [128 228 3].
  2. Check that the aspect ratio of the input size is consistent with the aspect ratio of the images in your dataset. If not, pad or crop the images accordingly.
  3. Ensure that the bounding box labels correspond correctly to the resized images.
Please refer to the below documentations for more information.
  1. Preprocess Images for Deep Learning: https://www.mathworks.com/help/deeplearning/ug/preprocess-images-for-deep-learning.html
  2. Object Detection Using YOLO v3 Deep Learning: https://www.mathworks.com/help/vision/ug/object-detection-using-yolo-v3-deep-learning.html
I hope this helps.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by