updates
This commit is contained in:
1 parent
5c470d235e
commit
c12023f145
1 file changed
+1
-1
@@ -141,7 +141,7 @@ def scale_img(img, ratio=1.0, same_shape=True): # img(16,3,256,416), r=ratio
|
|||||||
s = (int(h * ratio), int(w * ratio)) # new size
|
s = (int(h * ratio), int(w * ratio)) # new size
|
||||||
img = F.interpolate(img, size=s, mode='bilinear', align_corners=False) # resize
|
img = F.interpolate(img, size=s, mode='bilinear', align_corners=False) # resize
|
||||||
if not same_shape: # pad/crop img
|
if not same_shape: # pad/crop img
|
||||||
gs = 64 # (pixels) grid size
|
gs = 32 # (pixels) grid size
|
||||||
h, w = [math.ceil(x * ratio / gs) * gs for x in (h, w)]
|
h, w = [math.ceil(x * ratio / gs) * gs for x in (h, w)]
|
||||||
return F.pad(img, [0, w - s[1], 0, h - s[0]], value=0.447) # value = imagenet mean
|
return F.pad(img, [0, w - s[1], 0, h - s[0]], value=0.447) # value = imagenet mean
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user