[ImageResize][Fixed] Mask processing for modes others than edge_pixel
Avoid replicating the edge for other modes.
This commit is contained in:
@@ -872,7 +872,8 @@ class ImagePad:
|
||||
out_masks = torch.nn.functional.pad(
|
||||
mask,
|
||||
(pad_left, pad_right, pad_top, pad_bottom),
|
||||
mode='replicate'
|
||||
mode='replicate' if pad_mode == "edge_pixel" else 'constant',
|
||||
value=None if pad_mode == "edge_pixel" else 1.0,
|
||||
)
|
||||
else:
|
||||
out_masks = torch.ones((B, padded_height, padded_width), dtype=image.dtype, device=image.device)
|
||||
|
||||
Reference in New Issue
Block a user