From 0dccfb917d7bda3e78bcaa59dc8459eb14cba003 Mon Sep 17 00:00:00 2001 From: gaotingquan Date: Thu, 30 Sep 2021 06:49:41 +0000 Subject: [PATCH] fix: interpolation maybe be 0 --- deploy/python/preprocess.py | 2 +- ppcls/data/preprocess/ops/operators.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/python/preprocess.py b/deploy/python/preprocess.py index 5d7fc929..1da32ad6 100644 --- a/deploy/python/preprocess.py +++ b/deploy/python/preprocess.py @@ -79,7 +79,7 @@ class UnifiedResize(object): if isinstance(interpolation, str): interpolation = _cv2_interp_from_str[interpolation.lower()] # compatible with opencv < version 4.4.0 - elif not interpolation: + elif interpolation is None: interpolation = cv2.INTER_LINEAR self.resize_func = partial(cv2.resize, interpolation=interpolation) elif backend.lower() == "pil": diff --git a/ppcls/data/preprocess/ops/operators.py b/ppcls/data/preprocess/ops/operators.py index e46823d2..e551fb76 100644 --- a/ppcls/data/preprocess/ops/operators.py +++ b/ppcls/data/preprocess/ops/operators.py @@ -60,7 +60,7 @@ class UnifiedResize(object): if isinstance(interpolation, str): interpolation = _cv2_interp_from_str[interpolation.lower()] # compatible with opencv < version 4.4.0 - elif not interpolation: + elif interpolation is None: interpolation = cv2.INTER_LINEAR self.resize_func = partial(cv2.resize, interpolation=interpolation) elif backend.lower() == "pil": -- GitLab