in mapillary_vistas/evaluation/confusion_matrix.py [0:0]
def add_to_confusion_matrix(prediction, ground_truth, number_labels, confusion_matrix=None):
"""
This function is a handy shortcut to update a confusion matrix with new
data. If a confusion matrix is given, the new hits are added to it.
"""
matrix_update = calculate_confusion_matrix_from_arrays(
prediction,
ground_truth,
number_labels
)
if confusion_matrix is None:
confusion_matrix = matrix_update
else:
confusion_matrix += matrix_update
return confusion_matrix