para-lost commited on
Commit
a17efec
·
1 Parent(s): 85ee426

fix bug on device

Browse files
Files changed (1) hide show
  1. pipeline.py +12 -2
pipeline.py CHANGED
@@ -6059,8 +6059,18 @@ class MaxLongEdgeMinShortEdgeResize(torch.nn.Module):
6059
  if max(new_width, new_height) > self.max_size:
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
- return F.resize(img, (new_height, new_width), self.interpolation, antialias=self.antialias)
 
 
 
 
 
 
 
 
 
 
6064
 
6065
 
6066
  class ImageTransform:
 
6059
  if max(new_width, new_height) > self.max_size:
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_h, new_w),
6068
+ mode=interpolation, # e.g. "bilinear"
6069
+ antialias=True, # 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
 
6075
 
6076
  class ImageTransform: