From cfb4e263c06302a7c8cd37b86f539fe1680ae532 Mon Sep 17 00:00:00 2001 From: Shiwei Song Date: Mon, 19 Oct 2020 18:22:22 +0800 Subject: [PATCH] fix padding for rectangular inference (#1165) Co-authored-by: swsong --- utils/datasets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/datasets.py b/utils/datasets.py index 9192dec4b7d9..af0f5bdc3653 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -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])