Skip to content

Commit

Permalink
Merge pull request #7 from JohannesTheo/master
Browse files Browse the repository at this point in the history
FIX union calculation in hungarian_miou
  • Loading branch information
Wuziyi616 authored Sep 20, 2023
2 parents 5d97e87 + fb1c39b commit dc48212
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion slotformer/video_prediction/vp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def hungarian_miou(gt_mask, pred_mask):
N, M = true_oh.shape[-1], pred_oh.shape[-1]
# compute all pairwise IoU
intersect = (true_oh[:, :, None] * pred_oh[:, None, :]).sum(0) # [N, M]
union = true_oh.sum(0)[:, None] + pred_oh.sum(0)[None, :] # [N, M]
union = (true_oh.sum(0)[:, None] + pred_oh.sum(0)[None, :]) - intersect # [N, M]
iou = intersect / (union + 1e-8) # [N, M]
iou = iou.detach().cpu().numpy()
# find the best match for each gt
Expand Down

0 comments on commit dc48212

Please sign in to comment.