Skip to content

Commit

Permalink
change erosion
Browse files Browse the repository at this point in the history
  • Loading branch information
bhack authored Jul 1, 2023
1 parent d171ffd commit 9d41c0a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions torchvision/ops/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,9 @@ def masks_to_boundaries(masks: torch.Tensor, dilation_ratio: float = 0.02) -> to

# Compute the boundaries for each mask
masks = masks.float().unsqueeze(1)
eroded_masks = F.conv2d(masks, selem, padding=dilation, groups=n)
eroded_masks = (eroded_masks == selem.view(n, -1).sum(1, keepdim=True)).byte() # Make the output binary
eroded_masks = F.conv2d(masks, selem, padding=dilation)
# Make the output binary
eroded_masks = (eroded_masks == selem.view(n, -1).sum(-1).view(n, 1, 1, 1)).byte()

contours = masks.byte() - eroded_masks

Expand Down

0 comments on commit 9d41c0a

Please sign in to comment.