fix padding for rectangular inference (#1524)

Co-authored-by: swsong <swsong@stratosphere.mobi>
This commit is contained in:
Shiwei Song 2020-10-19 18:17:14 +08:00 committed by GitHub
parent 54722d00bb
commit cf652962fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -634,7 +634,7 @@ def letterbox(img, new_shape=(416, 416), color=(114, 114, 114), auto=True, scale
new_unpad = int(round(shape[1] * r)), int(round(shape[0] * r))
dw, dh = new_shape[1] - new_unpad[0], new_shape[0] - new_unpad[1] # wh padding
if auto: # minimum rectangle
dw, dh = np.mod(dw, 64), np.mod(dh, 64) # wh padding
dw, dh = np.mod(dw, 32), np.mod(dh, 32) # wh padding
elif scaleFill: # stretch
dw, dh = 0.0, 0.0
new_unpad = new_shape