Shiwei Song
swsong
commited on
Commit
•
9291daa
1
Parent(s):
3b57cb5
fix padding for rectangular inference (#1165)
Browse filesCo-authored-by: swsong <swsong@stratosphere.mobi>
- utils/datasets.py +1 -1
utils/datasets.py
CHANGED
@@ -731,7 +731,7 @@ def letterbox(img, new_shape=(640, 640), color=(114, 114, 114), auto=True, scale
|
|
731 |
new_unpad = int(round(shape[1] * r)), int(round(shape[0] * r))
|
732 |
dw, dh = new_shape[1] - new_unpad[0], new_shape[0] - new_unpad[1] # wh padding
|
733 |
if auto: # minimum rectangle
|
734 |
-
dw, dh = np.mod(dw,
|
735 |
elif scaleFill: # stretch
|
736 |
dw, dh = 0.0, 0.0
|
737 |
new_unpad = (new_shape[1], new_shape[0])
|
|
|
731 |
new_unpad = int(round(shape[1] * r)), int(round(shape[0] * r))
|
732 |
dw, dh = new_shape[1] - new_unpad[0], new_shape[0] - new_unpad[1] # wh padding
|
733 |
if auto: # minimum rectangle
|
734 |
+
dw, dh = np.mod(dw, 32), np.mod(dh, 32) # wh padding
|
735 |
elif scaleFill: # stretch
|
736 |
dw, dh = 0.0, 0.0
|
737 |
new_unpad = (new_shape[1], new_shape[0])
|