Skip to content

Commit 7cedc8d

Browse files
committed
Follow up to #1256, fix interpolation warning in auto_autoaugment as well
1 parent 037e5e6 commit 7cedc8d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

timm/data/auto_augment.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,16 @@
3636
img_mean=_FILL,
3737
)
3838

39-
_RANDOM_INTERPOLATION = (Image.BILINEAR, Image.BICUBIC)
39+
if hasattr(Image, "Resampling"):
40+
_RANDOM_INTERPOLATION = (Image.Resampling.BILINEAR, Image.Resampling.BICUBIC)
41+
_DEFAULT_INTERPOLATION = Image.Resampling.BICUBIC
42+
else:
43+
_RANDOM_INTERPOLATION = (Image.BILINEAR, Image.BICUBIC)
44+
_DEFAULT_INTERPOLATION = Image.BICUBIC
4045

4146

4247
def _interpolation(kwargs):
43-
interpolation = kwargs.pop('resample', Image.BILINEAR)
48+
interpolation = kwargs.pop('resample', _DEFAULT_INTERPOLATION)
4449
if isinstance(interpolation, (list, tuple)):
4550
return random.choice(interpolation)
4651
else:

0 commit comments

Comments
 (0)