Invalid argument name classificationmode name must be targetcategories, mask etc.
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
While using this code from Complex yolo document in R2023a version
doTraining = true;
if doTraining
iteration = 0;
% Create subplots for the learning rate and mini-batch loss.
fig = figure;
[lossPlotter, learningRatePlotter] = configureTrainingProgressPlotter(fig);
% Custom training loop.
for epoch = 1:maxEpochs
reset(mbqTrain);
shuffle(mbqTrain);
while(hasdata(mbqTrain))
iteration = iteration + 1;
[XTrain,YTrain] = next(mbqTrain);
% Evaluate the model gradients and loss using dlfeval and the
% modelGradients function.
[gradients,state,lossInfo] = dlfeval(@modelGradients,net,XTrain,YTrain,anchorBoxes,penaltyThreshold,networkOutputs);
% Apply L2 regularization.
gradients = dlupdate(@(g,w) g + l2Regularization*w, gradients, net.Learnables);
% Determine the current learning rate value.
currentLR = piecewiseLearningRateWithWarmup(iteration,epoch,learningRate,warmupPeriod,maxEpochs);
% Update the network learnable parameters using the SGDM optimizer.
[net,velocity] = sgdmupdate(net,gradients,velocity,currentLR);
% Update the state parameters of dlnetwork.
net.State = state;
% Display progress.
if mod(iteration,10)==1
displayLossInfo(epoch,iteration,currentLR,lossInfo);
end
% Update training plot with new points.
updatePlots(lossPlotter,learningRatePlotter,iteration,currentLR,lossInfo.totalLoss);
end
end
else
net = mdl.net;
anchorBoxes = mdl.anchorBoxes;
end
% Create a table to hold the bounding boxes, scores, and labels returned by
% the detector.
results = table('Size',[0 3], ...
'VariableTypes',{'cell','cell','cell'}, ...
'VariableNames',{'Boxes','Scores','Labels'});
% Run the detector on images in the test set and collect the results.
reset(testData)
while hasdata(testData)
% Read the datastore and get the image.
data = read(testData);
image = data{1,1};
% Run the detector.
executionEnvironment = 'auto';
[bboxes,scores,labels] = detectComplexYOLOv4(net,image,anchorBoxes,classNames,executionEnvironment);
% Collect the results.
tbl = table({bboxes},{scores},{labels},'VariableNames',{'Boxes','Scores','Labels'});
results = [results; tbl];
end
% Evaluate the object detector using the average precision metric.
metrics = evaluateDetectionAOS(results, testData)
Got this error
Error using dlarray/crossentropy
Invalid argument name 'ClassificationMode'. Name must be 'TargetCategories', 'Mask', 'Reduction', 'NormalizationFactor', 'DataFormat', or 'WeightsFormat'.
Error in complexYolotrial>@(a,b,c)crossentropy(a.*c,b.*c,'ClassificationMode','multilabel') (line 400)
objLoss = sum(cellfun(@(a,b,c) crossentropy(a.*c,b.*c,'ClassificationMode','multilabel'),objectnessPredCell,objectnessDeltaTarget,boxMaskTarget(:,2)));
Error in complexYolotrial>objectnessLoss (line 400)
objLoss = sum(cellfun(@(a,b,c) crossentropy(a.*c,b.*c,'ClassificationMode','multilabel'),objectnessPredCell,objectnessDeltaTarget,boxMaskTarget(:,2)));
Error in complexYolotrial>modelGradients (line 339)
objLoss = objectnessLoss(YPredCell(:,1),objectnessTarget,objectMaskTarget);
Error in deep.internal.dlfeval (line 17)
[varargout{1:nargout}] = fun(x{:});
Error in deep.internal.dlfevalWithNestingCheck (line 15)
[varargout{1:nargout}] = deep.internal.dlfeval(fun,varargin{:});
Error in dlfeval (line 31)
[varargout{1:nargout}] = deep.internal.dlfevalWithNestingCheck(fun,varargin{:}); how to resolve it
0 comentarios
Respuestas (1)
Paras Gupta
el 1 de Mayo de 2024
Hi Gaurav,
The error provided in the question indicates that the in-built 'crossentropy' function does not support the argument 'ClassificationMode'. The 'crossentropy' function is being used inside the defined 'classConfidenceLoss' and 'objectnessLoss' functions of the example 'Lidar Object Detection Using Complex-YOLO v4 Network'.
It is to be noted that the argument 'ClassificationMode' was introduced in MATLAB R2023b. The R2023a equivalent of this argument is 'TargetCategories'. You can refer to the 'Version History' section of the following documentation for more information on the same:
Please refer to the following version-specific documentation of the example for MATLAB R2023a which uses the correct argument for 'crossentropy':
Hope this helps resolve your query.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!