how i can fix internal change in number of elements in yolo v4 network while training

36 次查看(过去 30 天)
Error using reshape
Number of elements must not change. Use [] as one of the size inputs to automatically calculate the appropriate size for that dimension.
Error in trainYOLOv4ObjectDetector>iGetMaxIOUPredictedWithGroundTruth (line 565)
iou(:,:,:,batchSize) = reshape(maxOverlap,h,w,c);
Error in trainYOLOv4ObjectDetector>iGenerateTargets (line 418)
iou = iGetMaxIOUPredictedWithGroundTruth(bx,by,bw,bh,groundTruth,isRotatedBox);
Error in trainYOLOv4ObjectDetector>calculateLoss (line 302)
[boxTarget, objectnessTarget, classTarget, objectMaskTarget, boxErrorScale] = iGenerateTargets(gatheredPredictions, YTrain, params.InputSize, params.AnchorBoxes, penaltyThreshold, isRotatedBox);
Error in trainYOLOv4ObjectDetector>@(varargin)calculateLoss(lossParams,isRotatedBox,varargin) (line 226)
lossFcn = @(varargin) calculateLoss(lossParams,isRotatedBox,varargin);
Error in images.dltrain.internal.SerialTrainer>modelGradients (line 140)
loss = lossFcn(networkOutputs{:},targets{:});
Error in deep.internal.dlfeval (line 17)
[varargout{1:nargout}] = fun(x{:});
Error in deep.internal.dlfevalWithNestingCheck (line 19)
[varargout{1:nargout}] = deep.internal.dlfeval(fun,varargin{:});
Error in dlfeval (line 31)
[varargout{1:nargout}] = deep.internal.dlfevalWithNestingCheck(fun,varargin{:});
Error in images.dltrain.internal.SerialTrainer/fit (line 76)
[loss,grad,state,networkOutputs,lossData] = dlfeval(@modelGradients,self.Network,self.LossFcn,...
Error in images.dltrain.internal.dltrain (line 114)
net = fit(networkTrainer);
Error in trainYOLOv4ObjectDetector (line 245)
[trainedDetector,infoTrain] = images.dltrain.internal.dltrain(mbq,detector,options,lossFcn,metrics,validationPatienceMetric,'ExperimentMonitor',params.ExperimentMonitor);
I have single class dataset withy class name person and this is error i am facing a time of training, i have gpu compute capacity 5.2 with gpu Nvidia M400
WHAT CAN BE ISSUE HERE I AM CUNFUSED THAT IS IT WITH PREPROCESSING OF COMPUTE CAPACITY

采纳的回答

Prasanna
Prasanna 2024-8-19,9:41
Hi Maaz,
It sounds like you’re encountering an issue with the reshape function in your YOLOv4 object detector training script. The error message being encountered during the training of a YOLOv4 object detector in MATLAB suggests an issue with the reshaping of arrays within the function iGetMaxIOUPredictedWithGroundTruth. This error often arises due to a mismatch in expected dimensions during operations like reshaping or concatenation. Here are some steps to troubleshoot and solve the issue:
  • Ensure that the dataset is correctly pre-processed. This includes the dimensions of the input images, annotations, and any transformations applied to the data.
  • Verify that the annotations for the single class ("person") are correctly formatted and match the expected input size for the network.
  • The error may be related to a mismatch in batch size, or the dimensions of the tensors being processed. Ensure that the batch size used during training is consistent with the dimensions expected by the network.
  • Check the configuration of your YOLOv4 network. Ensure that the input size, anchor boxes, and other hyperparameters are correctly set for the dataset. Confirm that the number of classes in the network configuration matches the dataset (in this case, it should be set to 1 for the "person" class).
You can refer the following answers for more ways to solve the error:
Hope this helps!

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by