def sort_findings(model, image_tuples, test_images, labels, false_positives, false_negatives, fp_images, fn_images, index): """False positive if model says road doesn't exist, but OpenStreetMap says it does. False negative if model says road exists, but OpenStreetMap doesn't list it. """ pred_index = 0 for p in model.predict(test_images): label = labels[index][0] if has_ways_in_center(label, 1) and p[0] > .5: false_positives.append(p) fp_images.append(image_tuples[pred_index]) elif not has_ways_in_center(label, 16) and p[0] <= .5: false_negatives.append(p) fn_images.append(image_tuples[pred_index]) pred_index += 1 index += 1 return index, false_positives, false_negatives, fp_images, fn_images