Skip to content

Commit c5eb1f7

Browse files
chengyangfufacebook-github-bot
authored andcommitted
Make the mask_accuracy calculation more robust in PointSup.
Summary: Make the mask_accuracy calculation more robust in PointSup. - The original version may cause weird issues in some corner cases. Reviewed By: ppwwyyxx Differential Revision: D29474348 fbshipit-source-id: 7eb7a60722b52214ccb14ac4ee2e2eeaa1d02d9b
1 parent d476937 commit c5eb1f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

projects/PointRend/point_rend/point_head.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def roi_mask_point_loss(mask_logits, instances, point_labels):
6767
# Log the training accuracy (using gt classes and 0.0 threshold for the logits)
6868
mask_accurate = (mask_logits > 0.0) == gt_mask_logits.to(dtype=torch.uint8)
6969
mask_accurate = mask_accurate[~point_ignores]
70-
mask_accuracy = mask_accurate.nonzero().size(0) / mask_accurate.numel()
70+
mask_accuracy = mask_accurate.nonzero().size(0) / max(mask_accurate.numel(), 1.0)
7171
get_event_storage().put_scalar("point/accuracy", mask_accuracy)
7272

7373
point_loss = F.binary_cross_entropy_with_logits(

0 commit comments

Comments
 (0)