Finding True Positive, True Negative, False Positive and False Negative from YOLO (v2, v3, v4) detection evaluation
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
Can anyone explain the way to get back the true Recall and Precision values from evaluateDetectionPrecision output, as this function gives out R and P only for plotting the recall-Precision curve and its average precision?
I am doing it in order to get the YOLO accuracy as well as its TP, FP, FN and TN values for result reporting.
Thank you
0 commentaires
Réponses (1)
Yash
le 15 Sep 2023
Hi,
I understand that you are interested in finding out True Positive (TP), True Negative (TN), False Positive (FP) and False Negative (FN) based on the Recall and Precision values obtained from the "evaluateDetectionPrecision" function in MATLAB's Computer Vision Toolbox.
The "evaluateDetectionPrecision" function in MATLAB's Computer Vision Toolbox primarily calculates metrics such as precision, recall, and average precision. It does not directly output TP, TN, FP, and FN values. However, you can calculate these values based on the precision and recall outputs returned by the function.
Refer to the below example to calculate the TP, FP, TN and FN:
[averagePrecision,recall,precision] = evaluateDetectionPrecision(detectionResults,groundTruthData);
% Precision is a ratio of true positive instances to all positive instances of objects in the detector
% precision = true_positives/positives
true_positives = round(precision*height(samples)) % round to avoid floating point error
% Recall is a ratio of true positive instances to the sum of true positives and false negatives
% Recall = true_positives/(true_positives+false_negatives)
false_negatives = (1-recall)*true_positives/recall
% false_positive = total_positive-true_positive
false_positives = height(boundingBoxes)-true_positive
% Since we know the total number of samples, the rest are the true negatives
true_negatives = height(samples) - (true_positives + false_negatives + false_positives)
In this code, "detectionResults" and "groundTruthData" represent the output of the object detection algorithm and the ground truth data, respectively. The height() function is used to obtain the number of samples or bounding boxes.
I hope this helps you in obtaining the TP, TN, FP, and FN values based on the Recall and Precision values.
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!