svpino / tf_object_detection_cm

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

Error in calculation of false positives #31

Open Chr1st1anG opened 3 years ago

Chr1st1anG commented 3 years ago

for i in range(len(detection_boxes)): if matches.shape[0] > 0 and matches[matches[:,1] == i].shape[0] == 0: confusion_matrix[confusion_matrix.shape[0] - 1][int(detection_classes[i] - 1)] += 1

If the match_array is empty, the number of the respective cell is not incremented. Although there may be detection_boxes with no match. My suggestion:

for i in range(len(detection_boxes)): if matches.shape[0] == 0 or and matches[matches[:,1] == i].shape[0] == 0: confusion_matrix[confusion_matrix.shape[0] - 1][int(detection_classes[i] - 1)] += 1