change resize
Browse files- pipeline.py +6 -6
pipeline.py
CHANGED
@@ -6060,15 +6060,15 @@ class MaxLongEdgeMinShortEdgeResize(torch.nn.Module):
|
|
6060 |
scale = self.max_size / max(new_width, new_height)
|
6061 |
new_width, new_height = self._apply_scale(new_width, new_height, scale)
|
6062 |
|
6063 |
-
if img.dim() == 3:
|
6064 |
-
|
6065 |
resized = F.interpolate(
|
6066 |
img,
|
6067 |
-
size=(
|
6068 |
-
mode=interpolation, # e.g. "bilinear"
|
6069 |
-
antialias=
|
6070 |
)
|
6071 |
-
resized = resized.squeeze(0) # → [C,H,W]
|
6072 |
return resized
|
6073 |
# return F.resize(img, (new_height, new_width), self.interpolation, antialias=self.antialias)
|
6074 |
|
|
|
6060 |
scale = self.max_size / max(new_width, new_height)
|
6061 |
new_width, new_height = self._apply_scale(new_width, new_height, scale)
|
6062 |
|
6063 |
+
# if img.dim() == 3:
|
6064 |
+
# img = img.unsqueeze(0) # → [1,C,H,W]
|
6065 |
resized = F.interpolate(
|
6066 |
img,
|
6067 |
+
size=(new_height, new_width),
|
6068 |
+
mode=self.interpolation, # e.g. "bilinear"
|
6069 |
+
antialias=self.antialias, # if you need anti‑aliasing
|
6070 |
)
|
6071 |
+
# resized = resized.squeeze(0) # → [C,H,W]
|
6072 |
return resized
|
6073 |
# return F.resize(img, (new_height, new_width), self.interpolation, antialias=self.antialias)
|
6074 |
|