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
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