glenn-jocher
commited on
Commit
•
c12023f
1
Parent(s):
5c470d2
updates
Browse files- utils/torch_utils.py +1 -1
utils/torch_utils.py
CHANGED
@@ -141,7 +141,7 @@ def scale_img(img, ratio=1.0, same_shape=True): # img(16,3,256,416), r=ratio
|
|
141 |
s = (int(h * ratio), int(w * ratio)) # new size
|
142 |
img = F.interpolate(img, size=s, mode='bilinear', align_corners=False) # resize
|
143 |
if not same_shape: # pad/crop img
|
144 |
-
gs =
|
145 |
h, w = [math.ceil(x * ratio / gs) * gs for x in (h, w)]
|
146 |
return F.pad(img, [0, w - s[1], 0, h - s[0]], value=0.447) # value = imagenet mean
|
147 |
|
|
|
141 |
s = (int(h * ratio), int(w * ratio)) # new size
|
142 |
img = F.interpolate(img, size=s, mode='bilinear', align_corners=False) # resize
|
143 |
if not same_shape: # pad/crop img
|
144 |
+
gs = 32 # (pixels) grid size
|
145 |
h, w = [math.ceil(x * ratio / gs) * gs for x in (h, w)]
|
146 |
return F.pad(img, [0, w - s[1], 0, h - s[0]], value=0.447) # value = imagenet mean
|
147 |
|