From 7cedc8d4743f2b2bbf835fc387c917461fa4911a Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Tue, 21 Jun 2022 14:56:53 -0700 Subject: [PATCH] Follow up to #1256, fix interpolation warning in auto_autoaugment as well --- timm/data/auto_augment.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/timm/data/auto_augment.py b/timm/data/auto_augment.py index 121a3fc6..1b51ccb4 100644 --- a/timm/data/auto_augment.py +++ b/timm/data/auto_augment.py @@ -36,11 +36,16 @@ _HPARAMS_DEFAULT = dict( img_mean=_FILL, ) -_RANDOM_INTERPOLATION = (Image.BILINEAR, Image.BICUBIC) +if hasattr(Image, "Resampling"): + _RANDOM_INTERPOLATION = (Image.Resampling.BILINEAR, Image.Resampling.BICUBIC) + _DEFAULT_INTERPOLATION = Image.Resampling.BICUBIC +else: + _RANDOM_INTERPOLATION = (Image.BILINEAR, Image.BICUBIC) + _DEFAULT_INTERPOLATION = Image.BICUBIC def _interpolation(kwargs): - interpolation = kwargs.pop('resample', Image.BILINEAR) + interpolation = kwargs.pop('resample', _DEFAULT_INTERPOLATION) if isinstance(interpolation, (list, tuple)): return random.choice(interpolation) else: