From 2f4296e3f7029139058fa08490ffa56cb5d1d4ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dao=20Zhang=20=28=E5=BC=A0=E9=81=93=29?= Date: Fri, 5 Jul 2019 16:37:33 +0800 Subject: [PATCH] Minus 1 is meaningless I don't know why we should minus 1 when resizing. Here is some examples in Python3.5: '''Python >>> (33//32)*32 32 >>> (31//32)*32 0 ''' Minus 1 will get below errors, 33 can't resize to 0 when 32 is resize to 32. --- eval.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eval.py b/eval.py index cd56e987..feb54209 100644 --- a/eval.py +++ b/eval.py @@ -56,8 +56,8 @@ def resize_image(im, max_side_len=2400): resize_h = int(resize_h * ratio) resize_w = int(resize_w * ratio) - resize_h = resize_h if resize_h % 32 == 0 else (resize_h // 32 - 1) * 32 - resize_w = resize_w if resize_w % 32 == 0 else (resize_w // 32 - 1) * 32 + resize_h = resize_h if resize_h % 32 == 0 else (resize_h // 32) * 32 + resize_w = resize_w if resize_w % 32 == 0 else (resize_w // 32) * 32 resize_h = max(32, resize_h) resize_w = max(32, resize_w) im = cv2.resize(im, (int(resize_w), int(resize_h)))