[bug fix] potential problem if img fed to model is in rectangular shape

This commit is contained in:
wanghaoyang0106 committed 2020-07-03 13:09:21 +08:00
1 parent 6ca3f35cd4
commit b57f83d005
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -679,8 +679,8 @@ def letterbox(img, new_shape=(640, 640), color=(114, 114, 114), auto=True, scale
dw, dh = np.mod(dw, 64), np.mod(dh, 64) # wh padding
elif scaleFill: # stretch
dw, dh = 0.0, 0.0
new_unpad = new_shape
ratio = new_shape[0] / shape[1], new_shape[1] / shape[0] # width, height ratios
new_unpad = (new_shape[1], new_shape[0])
ratio = new_shape[1] / shape[1], new_shape[0] / shape[0] # width, height ratios
dw /= 2 # divide padding into 2 sides
dh /= 2