Skip to content

Commit

Permalink
fix padding for rectangular inference (ultralytics#1165)
Browse files Browse the repository at this point in the history
Co-authored-by: swsong <swsong@stratosphere.mobi>
  • Loading branch information
menggui1993 and swsong committed Oct 19, 2020
1 parent 6d11f13 commit cfb4e26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ def letterbox(img, new_shape=(640, 640), 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[1], new_shape[0])
Expand Down

0 comments on commit cfb4e26

Please sign in to comment.