svpino / tf_object_detection_cm

Confusion Matrix in Object Detection with TensorFlow
78 stars 36 forks source link

Why removing duplicate matchings based on unique detection? #20

Closed hoangphucITJP closed 4 years ago

hoangphucITJP commented 4 years ago

Firstly, thank you for implement the project.

Applying your code in my project, I see a problem:

https://github.com/svpino/tf_object_detection_cm/blob/master/confusion_matrix.py#L78 Look at this line,

matches = matches[np.unique(matches[:,1], return_index=True)[1]]

If one detection overlapping 2 ground-truths, the lower IOU ground-truth matching will be removed by this line. So that'll be one False Negative.

Isn't that incorrect logic?

svpino commented 4 years ago

The line removes two results (detections) over the same object.

Let's say we are trying to identify cats. Sometimes, the algorithm might return 2 different detection boxes over the same cat (with each box being slightly different). The goal of this line is to make sure we only report a single detection.

Now, remember we only do that if there are more detections than ground-truth boxes. Let's say that we actually have 2 cats very close to each other. In that case, we should have 2 ground-truth boxes, so no detections will be removed.

Does that make sense?