Clear Filters
Clear Filters

Problems with the evaluateObjectDetection function

20 views (last 30 days)
Patrizia
Patrizia on 15 Jul 2024 at 11:50
Commented: Patrizia on 16 Jul 2024 at 7:47
Hello, everyone,
I would like help with the function in the title line..
thanks.
I reproduce the code and its error below.
CODE:
% Evaluate object detection results
metrics = evaluateObjectDetection(detectionResultsTbl, groundTruthDataTbl);
% Extract precision and recall for a specific class ID (e.g. classID = 1)
classID = 1;
precision = metrics.ClassMetrics.Precision{classID};
recall = metrics.ClassMetrics.Recall{classID};
% Plot the precision-recall curve
figure
plot(recall, precision);
xlabel("Recall");
ylabel("Precision");
grid on;
title(sprintf("Average Precision = %.2f", metrics.ClassMetrics.mAP(classID)));
ERROR:
Error using evaluateObjectDetection>iFindOutputIdxsFromDS
Missing data in detectionResults. Unable to find Label data in detectionResults.
Error in evaluateObjectDetection (line 27)
predOutIdxs = iFindOutputIdxsFromDS(dsResultsCopy, 3, "detectionResults");
Error in untitled2 (line 306)
metrics = evaluateObjectDetection(detectionResultsTbl, groundTruthDataTbl);
In addition, I attach tables detectionResultsTbl and groundTruthDataTbl.

Answers (1)

Muskan
Muskan on 15 Jul 2024 at 17:23
Hi, as per my understanding of the issue, it looks like the error message you are encountering is because "detectionResultsTbl" does not contain the required "Label" data. This is essential for the "evaluateObjectDetection" function to work properly.
Here are a few steps you can take to resolve this issue:
  1. Check the Structure of "detectionResultsTbl": Ensure that "detectionResultsTbl" has the necessary columns, including "Label". The table should typically include columns like "Label", "Score", "BoundingBox", etc.
  2. Verify the Contents of "detectionResultsTbl": Make sure that the "Label" column in "detectionResultsTbl" is populated with the appropriate data. If the column is missing or empty, the function will not be able to proceed.
  3. Correct the Data Preparation: If the "Label" column is missing or incorrectly populated, revisit the code where "detectionResultsTbl" is created. Ensure that you are correctly assigning labels to your detection results.
You can further refer to the documentation of "evaluateObjectDetection" for its correct usage: https://www.mathworks.com/help/vision/ref/evaluateobjectdetection.html
  1 Comment
Patrizia
Patrizia on 16 Jul 2024 at 7:47
As you can see from the attached file, the 'detectionResultTbl' appears to be correctly populated.
Thank you anyway for your reply.
Patrizia

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!