@@ -88,6 +88,9 @@ def __init__(
8888 ArgsKwargs ((32 , 29 )),
8989 ArgsKwargs ((31 , 28 ), interpolation = prototype_transforms .InterpolationMode .NEAREST ),
9090 ArgsKwargs ((33 , 26 ), interpolation = prototype_transforms .InterpolationMode .BICUBIC ),
91+ ArgsKwargs ((30 , 27 ), interpolation = PIL .Image .NEAREST ),
92+ ArgsKwargs ((35 , 29 ), interpolation = PIL .Image .BILINEAR ),
93+ ArgsKwargs ((34 , 25 ), interpolation = PIL .Image .BICUBIC ),
9194 NotScriptableArgsKwargs (31 , max_size = 32 ),
9295 ArgsKwargs ([31 ], max_size = 32 ),
9396 NotScriptableArgsKwargs (30 , max_size = 100 ),
@@ -305,6 +308,8 @@ def __init__(
305308 ArgsKwargs (25 , ratio = (0.5 , 1.5 )),
306309 ArgsKwargs ((31 , 28 ), interpolation = prototype_transforms .InterpolationMode .NEAREST ),
307310 ArgsKwargs ((33 , 26 ), interpolation = prototype_transforms .InterpolationMode .BICUBIC ),
311+ ArgsKwargs ((31 , 28 ), interpolation = PIL .Image .NEAREST ),
312+ ArgsKwargs ((33 , 26 ), interpolation = PIL .Image .BICUBIC ),
308313 ArgsKwargs ((29 , 32 ), antialias = False ),
309314 ArgsKwargs ((28 , 31 ), antialias = True ),
310315 ],
@@ -352,6 +357,8 @@ def __init__(
352357 ArgsKwargs (sigma = (2.5 , 3.9 )),
353358 ArgsKwargs (interpolation = prototype_transforms .InterpolationMode .NEAREST ),
354359 ArgsKwargs (interpolation = prototype_transforms .InterpolationMode .BICUBIC ),
360+ ArgsKwargs (interpolation = PIL .Image .NEAREST ),
361+ ArgsKwargs (interpolation = PIL .Image .BICUBIC ),
355362 ArgsKwargs (fill = 1 ),
356363 ],
357364 # ElasticTransform needs larger images to avoid the needed internal padding being larger than the actual image
@@ -386,6 +393,7 @@ def __init__(
386393 ArgsKwargs (degrees = 0.0 , shear = (4 , 5 , 4 , 13 )),
387394 ArgsKwargs (degrees = (- 20.0 , 10.0 ), translate = (0.4 , 0.6 ), scale = (0.3 , 0.8 ), shear = (4 , 5 , 4 , 13 )),
388395 ArgsKwargs (degrees = 30.0 , interpolation = prototype_transforms .InterpolationMode .NEAREST ),
396+ ArgsKwargs (degrees = 30.0 , interpolation = PIL .Image .NEAREST ),
389397 ArgsKwargs (degrees = 30.0 , fill = 1 ),
390398 ArgsKwargs (degrees = 30.0 , fill = (2 , 3 , 4 )),
391399 ArgsKwargs (degrees = 30.0 , center = (0 , 0 )),
@@ -420,6 +428,7 @@ def __init__(
420428 ArgsKwargs (p = 1 ),
421429 ArgsKwargs (p = 1 , distortion_scale = 0.3 ),
422430 ArgsKwargs (p = 1 , distortion_scale = 0.2 , interpolation = prototype_transforms .InterpolationMode .NEAREST ),
431+ ArgsKwargs (p = 1 , distortion_scale = 0.2 , interpolation = PIL .Image .NEAREST ),
423432 ArgsKwargs (p = 1 , distortion_scale = 0.1 , fill = 1 ),
424433 ArgsKwargs (p = 1 , distortion_scale = 0.4 , fill = (1 , 2 , 3 )),
425434 ],
@@ -432,6 +441,7 @@ def __init__(
432441 ArgsKwargs (degrees = 30.0 ),
433442 ArgsKwargs (degrees = (- 20.0 , 10.0 )),
434443 ArgsKwargs (degrees = 30.0 , interpolation = prototype_transforms .InterpolationMode .BILINEAR ),
444+ ArgsKwargs (degrees = 30.0 , interpolation = PIL .Image .BILINEAR ),
435445 ArgsKwargs (degrees = 30.0 , expand = True ),
436446 ArgsKwargs (degrees = 30.0 , center = (0 , 0 )),
437447 ArgsKwargs (degrees = 30.0 , fill = 1 ),
@@ -851,7 +861,11 @@ class TestAATransforms:
851861 )
852862 @pytest .mark .parametrize (
853863 "interpolation" ,
854- [prototype_transforms .InterpolationMode .NEAREST , prototype_transforms .InterpolationMode .BILINEAR ],
864+ [
865+ prototype_transforms .InterpolationMode .NEAREST ,
866+ prototype_transforms .InterpolationMode .BILINEAR ,
867+ PIL .Image .NEAREST ,
868+ ],
855869 )
856870 def test_randaug (self , inpt , interpolation , mocker ):
857871 t_ref = legacy_transforms .RandAugment (interpolation = interpolation , num_ops = 1 )
@@ -889,7 +903,11 @@ def test_randaug(self, inpt, interpolation, mocker):
889903 )
890904 @pytest .mark .parametrize (
891905 "interpolation" ,
892- [prototype_transforms .InterpolationMode .NEAREST , prototype_transforms .InterpolationMode .BILINEAR ],
906+ [
907+ prototype_transforms .InterpolationMode .NEAREST ,
908+ prototype_transforms .InterpolationMode .BILINEAR ,
909+ PIL .Image .NEAREST ,
910+ ],
893911 )
894912 def test_trivial_aug (self , inpt , interpolation , mocker ):
895913 t_ref = legacy_transforms .TrivialAugmentWide (interpolation = interpolation )
@@ -937,7 +955,11 @@ def test_trivial_aug(self, inpt, interpolation, mocker):
937955 )
938956 @pytest .mark .parametrize (
939957 "interpolation" ,
940- [prototype_transforms .InterpolationMode .NEAREST , prototype_transforms .InterpolationMode .BILINEAR ],
958+ [
959+ prototype_transforms .InterpolationMode .NEAREST ,
960+ prototype_transforms .InterpolationMode .BILINEAR ,
961+ PIL .Image .NEAREST ,
962+ ],
941963 )
942964 def test_augmix (self , inpt , interpolation , mocker ):
943965 t_ref = legacy_transforms .AugMix (interpolation = interpolation , mixture_width = 1 , chain_depth = 1 )
@@ -986,7 +1008,11 @@ def test_augmix(self, inpt, interpolation, mocker):
9861008 )
9871009 @pytest .mark .parametrize (
9881010 "interpolation" ,
989- [prototype_transforms .InterpolationMode .NEAREST , prototype_transforms .InterpolationMode .BILINEAR ],
1011+ [
1012+ prototype_transforms .InterpolationMode .NEAREST ,
1013+ prototype_transforms .InterpolationMode .BILINEAR ,
1014+ PIL .Image .NEAREST ,
1015+ ],
9901016 )
9911017 def test_aa (self , inpt , interpolation ):
9921018 aa_policy = legacy_transforms .AutoAugmentPolicy ("imagenet" )
@@ -1264,13 +1290,13 @@ def test_random_resize_eval(self, mocker):
12641290 (legacy_F .convert_image_dtype , {}),
12651291 (legacy_F .to_pil_image , {}),
12661292 (legacy_F .normalize , {}),
1267- (legacy_F .resize , {}),
1293+ (legacy_F .resize , {"interpolation" }),
12681294 (legacy_F .pad , {"padding" , "fill" }),
12691295 (legacy_F .crop , {}),
12701296 (legacy_F .center_crop , {}),
1271- (legacy_F .resized_crop , {}),
1297+ (legacy_F .resized_crop , {"interpolation" }),
12721298 (legacy_F .hflip , {}),
1273- (legacy_F .perspective , {"startpoints" , "endpoints" , "fill" }),
1299+ (legacy_F .perspective , {"startpoints" , "endpoints" , "fill" , "interpolation" }),
12741300 (legacy_F .vflip , {}),
12751301 (legacy_F .five_crop , {}),
12761302 (legacy_F .ten_crop , {}),
@@ -1279,8 +1305,8 @@ def test_random_resize_eval(self, mocker):
12791305 (legacy_F .adjust_saturation , {}),
12801306 (legacy_F .adjust_hue , {}),
12811307 (legacy_F .adjust_gamma , {}),
1282- (legacy_F .rotate , {"center" , "fill" }),
1283- (legacy_F .affine , {"angle" , "translate" , "center" , "fill" }),
1308+ (legacy_F .rotate , {"center" , "fill" , "interpolation" }),
1309+ (legacy_F .affine , {"angle" , "translate" , "center" , "fill" , "interpolation" }),
12841310 (legacy_F .to_grayscale , {}),
12851311 (legacy_F .rgb_to_grayscale , {}),
12861312 (legacy_F .to_tensor , {}),
@@ -1292,7 +1318,7 @@ def test_random_resize_eval(self, mocker):
12921318 (legacy_F .adjust_sharpness , {}),
12931319 (legacy_F .autocontrast , {}),
12941320 (legacy_F .equalize , {}),
1295- (legacy_F .elastic_transform , {"fill" }),
1321+ (legacy_F .elastic_transform , {"fill" , "interpolation" }),
12961322 ],
12971323)
12981324def test_dispatcher_signature_consistency (legacy_dispatcher , name_only_params ):
0 commit comments