From e91c2181b3265cc06477391ee8e0765ab3881348 Mon Sep 17 00:00:00 2001 From: alih Date: Fri, 29 Jul 2022 11:09:13 -0700 Subject: [PATCH] Fixes 1.0 crop reproducibility issue. transforms.CenterCrop automatically converts image size into a tuple, but transforms.Resize does not. When running models on ImageNet at 384x384 with 1.0 crop_pct, this will result in transforms.Resize(384). Some methods (i.e. ConvNeXt, Swin) implement this with transforms.Resize((384, 384)). As a result their reported scores on ImageNet at 384 are not reproducible with timm's validation script. --- timm/data/transforms_factory.py | 1 + 1 file changed, 1 insertion(+) diff --git a/timm/data/transforms_factory.py b/timm/data/transforms_factory.py index a5facbf5..3fb73272 100644 --- a/timm/data/transforms_factory.py +++ b/timm/data/transforms_factory.py @@ -145,6 +145,7 @@ def transforms_imagenet_eval( scale_size = tuple([int(x / crop_pct) for x in img_size]) else: scale_size = int(math.floor(img_size / crop_pct)) + scale_size = (scale_size, scale_size) tfl = [ transforms.Resize(scale_size, interpolation=str_to_interp_mode(interpolation)),