From 3b8b39644fb84935b03a6c6203465862a230c1ba Mon Sep 17 00:00:00 2001 From: Yang Nie Date: Mon, 8 Aug 2022 17:57:45 +0800 Subject: [PATCH] change the default interpolation of pil from `NEAREST` to `BILINEAR` (same to cv2 backend) --- deploy/python/preprocess.py | 2 ++ ppcls/data/preprocess/ops/operators.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/deploy/python/preprocess.py b/deploy/python/preprocess.py index 5e42851f..c5b5e7cd 100644 --- a/deploy/python/preprocess.py +++ b/deploy/python/preprocess.py @@ -100,6 +100,8 @@ class UnifiedResize(object): elif backend.lower() == "pil": if isinstance(interpolation, str): interpolation = _pil_interp_from_str[interpolation.lower()] + elif interpolation is None: + interpolation = Image.BILINEAR self.resize_func = partial( _pil_resize, resample=interpolation, return_numpy=return_numpy) else: diff --git a/ppcls/data/preprocess/ops/operators.py b/ppcls/data/preprocess/ops/operators.py index e290223c..0d6653a8 100644 --- a/ppcls/data/preprocess/ops/operators.py +++ b/ppcls/data/preprocess/ops/operators.py @@ -99,6 +99,8 @@ class UnifiedResize(object): elif backend.lower() == "pil": if isinstance(interpolation, str): interpolation = _pil_interp_from_str[interpolation.lower()] + elif interpolation is None: + interpolation = Image.BILINEAR self.resize_func = partial( _pil_resize, resample=interpolation, return_numpy=return_numpy) else: -- GitLab