From 9d41c0aaae48ef3dcebf5201b8abad652f63fed6 Mon Sep 17 00:00:00 2001 From: bhack Date: Sat, 1 Jul 2023 14:33:48 +0200 Subject: [PATCH] change erosion --- torchvision/ops/boxes.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/torchvision/ops/boxes.py b/torchvision/ops/boxes.py index faaefd460a1..5842ff01519 100644 --- a/torchvision/ops/boxes.py +++ b/torchvision/ops/boxes.py @@ -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