kaanakan / object_detection_confusion_matrix

Python class for calculating confusion matrix for object detection task
MIT License
85 stars 18 forks source link

Empty predictions scenario #5

Closed evansavage closed 2 years ago

evansavage commented 4 years ago

Hi, thanks for making this code available! It has come to great use for me.

One suggestion: I ran into an issue for a scenario where there is ground truth available, but no predictions. In that case, all bounding boxes in the ground truth are registered as FNs in the confusion matrix. This was an easy fix outside the code:

if preds.size == 0: # FN across the board!
    for truth in gt: # update corresponding final row  
        conf_mat.matrix[truth[0], -1] += 1

Just a suggestion for an initial check in your code!

kaanakan commented 4 years ago

Hi,

Thank you for raising this. I think the code does this if I understand you correctly.

In the case where there is no predictions but there are ground truths, the code will jump to the part: https://github.com/kaanakan/object_detection_confusion_matrix/blob/8e47b398c959f54e8f017f1fc36624b71f170d82/confusion_matrix.py#L78-L80

in that part, the code does exactly what you suggested.

If you think I did not understand the situation, please explain. Thank you.

I will leave it open until we agree on the same solution.

ghost commented 4 years ago

Hi @kaanakan @evansavage can you guys please tell me how to make setting after having both ground truth and prediction values??

kaanakan commented 4 years ago

Dear @lrscse,

As I stated before in #4, you first create the ConfusionMatrix class with appropriate parameters.

Then, you need give the parameters, ground truths and predictions, to process_batch method of the ConfusionMatrix class.

After feeding all the values, you can retrieve the matrix by return_matrix method.

VesninEN commented 3 years ago

I think there will be error in line 51 for empty detections detections = detections[detections[:, 4] > self.CONF_THRESHOLD]