Ensure consistent arrays in match_predictions

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
2019-06-03 11:43:22 +02:00
parent 1c37dc8fb1
commit 5ea412a2d0

View File

@ -142,6 +142,10 @@ def match_predictions(predictions: Sequence[Sequence[Tuple[int, float, int, int,
if len(predictions_class) == 0: if len(predictions_class) == 0:
true_positives.append(true_pos) true_positives.append(true_pos)
false_positives.append(false_pos) false_positives.append(false_pos)
cumulative_true_pos = np.cumsum(true_pos) # Cumulative sums of the true positives
cumulative_false_pos = np.cumsum(false_pos) # Cumulative sums of the false positives
cumulative_true_positives.append(cumulative_true_pos)
cumulative_false_positives.append(cumulative_false_pos)
continue continue
# Convert the predictions list for this class into a structured array so that we can sort it by confidence. # Convert the predictions list for this class into a structured array so that we can sort it by confidence.
@ -253,8 +257,6 @@ def get_precision_recall(number_gt_per_class: np.ndarray,
""" """
cumulative_precisions = [[]] cumulative_precisions = [[]]
cumulative_recalls = [[]] cumulative_recalls = [[]]
print(len(cumulative_true_positives))
print(cumulative_true_positives)
# Iterate over all classes. # Iterate over all classes.
for class_id in range(1, nr_classes + 1): for class_id in range(1, nr_classes + 1):