From 1b278136c3f6c5f573e8007ff0fb0caffc8fc6c3 Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Thu, 21 Jul 2022 17:36:15 -0700 Subject: [PATCH] Change models with mean 0,0,0 std 1,1,1 from int to float for consistency as mentioned in #1355 --- timm/models/mlp_mixer.py | 4 ++-- timm/models/mobilenetv3.py | 4 ++-- timm/models/mobilevit.py | 2 +- timm/models/tresnet.py | 2 +- timm/models/vision_transformer.py | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/timm/models/mlp_mixer.py b/timm/models/mlp_mixer.py index ff91def6..e07ea6e5 100644 --- a/timm/models/mlp_mixer.py +++ b/timm/models/mlp_mixer.py @@ -85,11 +85,11 @@ default_cfgs = dict( # Mixer ImageNet-21K-P pretraining mixer_b16_224_miil_in21k=_cfg( url='https://miil-public-eu.oss-eu-central-1.aliyuncs.com/model-zoo/ImageNet_21K_P/models/timm/mixer_b16_224_miil_in21k.pth', - mean=(0, 0, 0), std=(1, 1, 1), crop_pct=0.875, interpolation='bilinear', num_classes=11221, + mean=(0., 0., 0.), std=(1., 1., 1.), crop_pct=0.875, interpolation='bilinear', num_classes=11221, ), mixer_b16_224_miil=_cfg( url='https://miil-public-eu.oss-eu-central-1.aliyuncs.com/model-zoo/ImageNet_21K_P/models/timm/mixer_b16_224_miil.pth', - mean=(0, 0, 0), std=(1, 1, 1), crop_pct=0.875, interpolation='bilinear', + mean=(0., 0., 0.), std=(1., 1., 1.), crop_pct=0.875, interpolation='bilinear', ), gmixer_12_224=_cfg(mean=IMAGENET_DEFAULT_MEAN, std=IMAGENET_DEFAULT_STD), diff --git a/timm/models/mobilenetv3.py b/timm/models/mobilenetv3.py index 4a791857..62e59f9f 100644 --- a/timm/models/mobilenetv3.py +++ b/timm/models/mobilenetv3.py @@ -41,10 +41,10 @@ default_cfgs = { interpolation='bicubic', url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/mobilenetv3_large_100_ra-f55367f5.pth'), 'mobilenetv3_large_100_miil': _cfg( - interpolation='bilinear', mean=(0, 0, 0), std=(1, 1, 1), + interpolation='bilinear', mean=(0., 0., 0.), std=(1., 1., 1.), url='https://miil-public-eu.oss-eu-central-1.aliyuncs.com/model-zoo/ImageNet_21K_P/models/timm/mobilenetv3_large_100_1k_miil_78_0.pth'), 'mobilenetv3_large_100_miil_in21k': _cfg( - interpolation='bilinear', mean=(0, 0, 0), std=(1, 1, 1), + interpolation='bilinear', mean=(0., 0., 0.), std=(1., 1., 1.), url='https://miil-public-eu.oss-eu-central-1.aliyuncs.com/model-zoo/ImageNet_21K_P/models/timm/mobilenetv3_large_100_in21k_miil.pth', num_classes=11221), 'mobilenetv3_small_050': _cfg( diff --git a/timm/models/mobilevit.py b/timm/models/mobilevit.py index 2a3ab924..bd5479a7 100644 --- a/timm/models/mobilevit.py +++ b/timm/models/mobilevit.py @@ -34,7 +34,7 @@ def _cfg(url='', **kwargs): return { 'url': url, 'num_classes': 1000, 'input_size': (3, 256, 256), 'pool_size': (8, 8), 'crop_pct': 0.9, 'interpolation': 'bicubic', - 'mean': (0, 0, 0), 'std': (1, 1, 1), + 'mean': (0., 0., 0.), 'std': (1., 1., 1.), 'first_conv': 'stem.conv', 'classifier': 'head.fc', 'fixed_input_size': False, **kwargs diff --git a/timm/models/tresnet.py b/timm/models/tresnet.py index 0457acf8..068ada82 100644 --- a/timm/models/tresnet.py +++ b/timm/models/tresnet.py @@ -21,7 +21,7 @@ def _cfg(url='', **kwargs): return { 'url': url, 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': (7, 7), 'crop_pct': 0.875, 'interpolation': 'bilinear', - 'mean': (0, 0, 0), 'std': (1, 1, 1), + 'mean': (0., 0., 0.), 'std': (1., 1., 1.), 'first_conv': 'body.conv1.0', 'classifier': 'head.fc', **kwargs } diff --git a/timm/models/vision_transformer.py b/timm/models/vision_transformer.py index c92c22a3..9066a9de 100644 --- a/timm/models/vision_transformer.py +++ b/timm/models/vision_transformer.py @@ -163,12 +163,12 @@ default_cfgs = { # ViT ImageNet-21K-P pretraining by MILL 'vit_base_patch16_224_miil_in21k': _cfg( url='https://miil-public-eu.oss-eu-central-1.aliyuncs.com/model-zoo/ImageNet_21K_P/models/timm/vit_base_patch16_224_in21k_miil.pth', - mean=(0, 0, 0), std=(1, 1, 1), crop_pct=0.875, interpolation='bilinear', num_classes=11221, + mean=(0., 0., 0.), std=(1., 1., 1.), crop_pct=0.875, interpolation='bilinear', num_classes=11221, ), 'vit_base_patch16_224_miil': _cfg( url='https://miil-public-eu.oss-eu-central-1.aliyuncs.com/model-zoo/ImageNet_21K_P/models/timm' '/vit_base_patch16_224_1k_miil_84_4.pth', - mean=(0, 0, 0), std=(1, 1, 1), crop_pct=0.875, interpolation='bilinear', + mean=(0., 0., 0.), std=(1., 1., 1.), crop_pct=0.875, interpolation='bilinear', ), 'vit_base_patch16_rpn_224': _cfg(