From 4fe2da558cc3bc46d8f3abfe3ff1d0b9f191c7cd Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Fri, 2 Aug 2019 23:16:07 -0700 Subject: [PATCH] Add MixNet Small and Large PyTorch native weights (no same padding) --- README.md | 51 ++++++++++++++------------------- timm/models/gen_efficientnet.py | 12 ++++---- 2 files changed, 29 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 4067ebc3..1a9e9a5e 100644 --- a/README.md +++ b/README.md @@ -69,35 +69,28 @@ A CSV file containing an ImageNet-1K validation results summary for all included ### Self-trained Weights I've leveraged the training scripts in this repository to train a few of the models with missing weights to good levels of performance. These numbers are all for 224x224 training and validation image sizing with the usual 87.5% validation crop. -#### @ 224x224 -|Model | Prec@1 (Err) | Prec@5 (Err) | Param # | Image Scaling | -|---|---|---|---|---| -| resnext50d_32x4d | 79.674 (20.326) | 94.868 (5.132) | 25.1M | bicubic | -| resnext50_32x4d | 78.512 (21.488) | 94.042 (5.958) | 25M | bicubic | -| resnet50 | 78.470 (21.530) | 94.266 (5.734) | 25.6M | bicubic | -| mixnet_m | 77.256 (22.744) | 93.418 (6.582) | 5.01M | bicubic | -| seresnext26_32x4d | 77.104 (22.896) | 93.316 (6.684) | 16.8M | bicubic | -| efficientnet_b0 | 76.912 (23.088) | 93.210 (6.790) | 5.29M | bicubic | -| resnet26d | 76.68 (23.32) | 93.166 (6.834) | 16M | bicubic | -| mobilenetv3_100 | 75.634 (24.366) | 92.708 (7.292) | 5.5M | bicubic | -| mnasnet_a1 | 75.448 (24.552) | 92.604 (7.396) | 3.89M | bicubic | -| resnet26 | 75.292 (24.708) | 92.57 (7.43) | 16M | bicubic | -| fbnetc_100 | 75.124 (24.876) | 92.386 (7.614) | 5.6M | bilinear | -| resnet34 | 75.110 (24.890) | 92.284 (7.716) | 22M | bilinear | -| seresnet34 | 74.808 (25.192) | 92.124 (7.876) | 22M | bilinear | -| mnasnet_b1 | 74.658 (25.342) | 92.114 (7.886) | 4.38M | bicubic | -| spnasnet_100 | 74.084 (25.916) | 91.818 (8.182) | 4.42M | bilinear | -| seresnet18 | 71.742 (28.258) | 90.334 (9.666) | 11.8M | bicubic | - -#### @ 240x240 -|Model | Prec@1 (Err) | Prec@5 (Err) | Param # | Image Scaling | -|---|---|---|---|---| -| efficientnet_b1 | 78.692 (21.308) | 94.086 (5.914) | 7.79M | bicubic | - -#### @ 260x260 -|Model | Prec@1 (Err) | Prec@5 (Err) | Param # | Image Scaling | -|---|---|---|---|---| -| efficientnet_b2 | 79.760 (20.240) | 94.714 (5.286) | 9.11M | bicubic | +|Model | Prec@1 (Err) | Prec@5 (Err) | Param # | Image Scaling | Image Size | +|---|---|---|---|---|---| +| efficientnet_b2 | 79.760 (20.240) | 94.714 (5.286) | 9.11M | bicubic | 260 | +| resnext50d_32x4d | 79.674 (20.326) | 94.868 (5.132) | 25.1M | bicubic | 224 | +| mixnet_l | 78.976 (21.024 | 94.184 (5.816) | 7.33M | bicubic | 224 | +| efficientnet_b1 | 78.692 (21.308) | 94.086 (5.914) | 7.79M | bicubic | 240 | +| resnext50_32x4d | 78.512 (21.488) | 94.042 (5.958) | 25M | bicubic | 224 | +| resnet50 | 78.470 (21.530) | 94.266 (5.734) | 25.6M | bicubic | 224 | +| mixnet_m | 77.256 (22.744) | 93.418 (6.582) | 5.01M | bicubic | 224 | +| seresnext26_32x4d | 77.104 (22.896) | 93.316 (6.684) | 16.8M | bicubic | 224 | +| efficientnet_b0 | 76.912 (23.088) | 93.210 (6.790) | 5.29M | bicubic | 224 | +| resnet26d | 76.68 (23.32) | 93.166 (6.834) | 16M | bicubic | 224 | +| mixnet_s | 75.988 (24.012) | 92.794 (7.206) | 4.13M | bicubic | 224 | +| mobilenetv3_100 | 75.634 (24.366) | 92.708 (7.292) | 5.5M | bicubic | 224 | +| mnasnet_a1 | 75.448 (24.552) | 92.604 (7.396) | 3.89M | bicubic | 224 | +| resnet26 | 75.292 (24.708) | 92.57 (7.43) | 16M | bicubic | 224 | +| fbnetc_100 | 75.124 (24.876) | 92.386 (7.614) | 5.6M | bilinear 224 | +| resnet34 | 75.110 (24.890) | 92.284 (7.716) | 22M | bilinear | 224 | +| seresnet34 | 74.808 (25.192) | 92.124 (7.876) | 22M | bilinear | 224 | +| mnasnet_b1 | 74.658 (25.342) | 92.114 (7.886) | 4.38M | bicubic | 224 | +| spnasnet_100 | 74.084 (25.916) | 91.818 (8.182) | 4.42M | bilinear | 224 | +| seresnet18 | 71.742 (28.258) | 90.334 (9.666) | 11.8M | bicubic | 224 | ### Ported Weights diff --git a/timm/models/gen_efficientnet.py b/timm/models/gen_efficientnet.py index 20b551c1..9a8c347f 100644 --- a/timm/models/gen_efficientnet.py +++ b/timm/models/gen_efficientnet.py @@ -112,10 +112,12 @@ default_cfgs = { 'tf_efficientnet_b7': _cfg( url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_efficientnet_b7_aa-076e3472.pth', input_size=(3, 600, 600), pool_size=(19, 19), crop_pct=0.949), - 'mixnet_s': _cfg(url=''), + 'mixnet_s': _cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/mixnet_s-a907afbc.pth'), 'mixnet_m': _cfg( url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/mixnet_m-4647fc68.pth'), - 'mixnet_l': _cfg(url=''), + 'mixnet_l': _cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/mixnet_l-5a9a2ed8.pth'), 'tf_mixnet_s': _cfg( url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_mixnet_s-89d3354b.pth'), 'tf_mixnet_m': _cfg( @@ -1636,12 +1638,12 @@ def tf_efficientnet_b7(pretrained=False, num_classes=1000, in_chans=3, **kwargs) def mixnet_s(pretrained=False, num_classes=1000, in_chans=3, **kwargs): """Creates a MixNet Small model. """ - default_cfg = default_cfgs['mixnet_m'] + default_cfg = default_cfgs['mixnet_s'] model = _gen_mixnet_s( channel_multiplier=1.0, num_classes=num_classes, in_chans=in_chans, **kwargs) model.default_cfg = default_cfg - #if pretrained: - # load_pretrained(model, default_cfg, num_classes, in_chans) + if pretrained: + load_pretrained(model, default_cfg, num_classes, in_chans) return model