Skip to content

Commit

Permalink
Merge pull request #8 from funkelab/bugfix_iou
Browse files Browse the repository at this point in the history
Fix key error bug in iou
  • Loading branch information
cmalinmayor authored Apr 4, 2024
2 parents 7820cca + 2aecf79 commit c72b59b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/motile_toolbox/candidate_graph/iou.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ def add_iou(
frames = sorted(node_frame_dict.keys())
ious = _get_iou_dict(segmentation, multihypo=multihypo)
for frame in tqdm(frames):
if frame + 1 not in node_frame_dict:
if frame + 1 not in node_frame_dict.keys():
continue
next_nodes = node_frame_dict[frame + 1]
for node_id in node_frame_dict[frame]:
for next_id in next_nodes:
iou = ious.get(node_id, {}).get(next_id, 0)
cand_graph.edges[(node_id, next_id)][EdgeAttr.IOU.value] = iou
if (node_id, next_id) in cand_graph.edges:
cand_graph.edges[(node_id, next_id)][EdgeAttr.IOU.value] = iou

0 comments on commit c72b59b

Please sign in to comment.