".github/git@developer.sourcefind.cn:OpenDAS/bitsandbytes.git" did not exist on "318a86e345840388b50fa466b34d5726123d0ff6"
Unverified Commit f007a5e1 authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

fix resize for segmentation masks without channel dimension (#6576)

* fix resize for segmentation masks without batch dim

* micro improvement of stable crop

* Revert "micro improvement of stable crop"

This reverts commit e981e36f92dabc8f2ee05bec53a628a476a2b236.
parent ebb68f33
...@@ -135,7 +135,20 @@ def resize_image_pil( ...@@ -135,7 +135,20 @@ def resize_image_pil(
def resize_segmentation_mask( def resize_segmentation_mask(
segmentation_mask: torch.Tensor, size: List[int], max_size: Optional[int] = None segmentation_mask: torch.Tensor, size: List[int], max_size: Optional[int] = None
) -> torch.Tensor: ) -> torch.Tensor:
return resize_image_tensor(segmentation_mask, size=size, interpolation=InterpolationMode.NEAREST, max_size=max_size) if segmentation_mask.ndim < 3:
segmentation_mask = segmentation_mask.unsqueeze(0)
needs_squeeze = True
else:
needs_squeeze = False
output = resize_image_tensor(
segmentation_mask, size=size, interpolation=InterpolationMode.NEAREST, max_size=max_size
)
if needs_squeeze:
output = output.squeeze(0)
return output
def resize_bounding_box( def resize_bounding_box(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment