-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Hi,
I think there is an issue in greedy_many_to_many_matching.py and the way we decide on our max score elements.
We have a Priority-Queue that is based on a heap. Now, during the for-loop, we handle the heap as a simple list and directly remove elements from it. Python handles queue removals by simply compressing it, shifting every element right to the removed element, by one to the left.
However, this is not a safe operation on a heap, and will break the ordering of the heap/priority-queue
This can cause wrong elements to be at the top of the heap/priority queue.
greedy_many_to_many_matching.py 108-L142
for o_clr, o_gt_id, o_pred_id in q.queue:
denominator_gt = float(np.sum(gt_skel[o_gt_id]))
if o_gt_id == gt_id:
# remove old clRecall entry
q.queue.remove((o_clr, o_gt_id, o_pred_id))
if not only_one_gt:
# add updated clRecall entry
o_clr_new = np.sum(np.logical_and(gt_avail[o_gt_id], instance_mask(pred_labels, o_pred_id))) / denominator_gt
q.put(((-1) * o_clr_new, o_gt_id, o_pred_id))
if o_pred_id == pred_id:
# remove old clRecall entry
q.queue.remove((o_clr, o_gt_id, o_pred_id))
if not only_one_pred:
# add updated clRecall entry
o_clr_new = np.sum(np.logical_and(gt_skel[o_gt_id], pred_avail[o_pred_id])) / denominator_gt
q.put(((-1) * o_clr_new, o_gt_id, o_pred_id))Metadata
Metadata
Assignees
Labels
No labels