A big thank you to my GitHub Sponsors for their support!
In addition to the sponsors at the link above, I've received hardware and/or cloud resources from
I'm fortunate to be able to dedicate significant time and money of my own supporting this and other open source projects. However, as the projects increase in scope, outside support is needed to continue with the current trajectory of cloud services, hardware, and electricity costs.
timm
on his blog yesterday. Well worth a read. Getting Started with PyTorch Image Models (timm): A Practitioner’s Guidenorm_norm_norm
branch back to master (ver 0.6.x) in next week or so.
pip install git+https://github.com/rwightman/pytorch-image-models
installs!0.5.x
releases and a 0.5.x
branch will remain stable with a cherry pick or two until dust clears. Recommend sticking to pypi install for a bit if you want stable.mnasnet_small
- 65.6 top-1mobilenetv2_050
- 65.9lcnet_100/075/050
- 72.1 / 68.8 / 63.1semnasnet_075
- 73fbnetv3_b/d/g
- 79.1 / 79.7 / 82.0eca_halonext26ts
- 79.5 @ 256resnet50_gn
(new) - 80.1 @ 224, 81.3 @ 288resnet50
- 80.7 @ 224, 80.9 @ 288 (trained at 176, not replacing current a1 weights as default since these don't scale as well to higher res, weights)resnext50_32x4d
- 81.1 @ 224, 82.0 @ 288sebotnet33ts_256
(new) - 81.2 @ 224lamhalobotnet50ts_256
- 81.5 @ 256halonet50ts
- 81.7 @ 256halo2botnet50ts_256
- 82.0 @ 256resnet101
- 82.0 @ 224, 82.8 @ 288resnetv2_101
(new) - 82.1 @ 224, 83.0 @ 288resnet152
- 82.8 @ 224, 83.5 @ 288regnetz_d8
(new) - 83.5 @ 256, 84.0 @ 320regnetz_e8
(new) - 84.5 @ 256, 85.0 @ 320vit_base_patch8_224
(85.8 top-1) & in21k
variant weights added thanks Martins Bruveristimm bits
branch).data
, a bit more consistency, unit tests for all!efficientnetv2_rw_t
weights, a custom 'tiny' 13.6M param variant that is a bit better than (non NoisyStudent) B3 models. Both faster and better accuracy (at same or lower res)
vit_base_patch16_sam_224
) and B/32 (vit_base_patch32_sam_224
) models.jx_nest_base
- 83.534, jx_nest_small
- 83.120, jx_nest_tiny
- 81.426gmlp_s16_224
trained to 79.6 top-1, matching paper. Hparams for this and other recent MLP training herevit_large_patch16_384
(87.1 top-1), vit_large_r50_s32_384
(86.2 top-1), vit_base_patch16_384
(86.0 top-1)vit_deit_*
renamed to just deit_*
gmixer_24_224
MLP /w GLU, 78.1 top-1 w/ 25M params.eca_nfnet_l2
weights from my 'lightweight' series. 84.7 top-1 at 384x384.efficientnetv2_rw_m
model and weights (started training before official code). 84.8 top-1, 53M params.tf_efficientnetv2_s/m/l
tf_efficientnetv2_s/m/l_in21k
tf_efficientnetv2_s/m/l_in21ft1k
tf_efficientnetv2_b0
through b3
efficientnet_v2s
-> efficientnetv2_rw_s
efficientnetv2_*
models in-place for future native PyTorch trainingswinnet
benchmark.py
script for bulk timm
model benchmarking of train and/or inferencetimm
cleanup/style tweaks and weights have hub download supportnfnet_l0b
->nfnet_l0
) weights 82.75 top-1 @ 288x288nfnet_l0c
->eca_nfnet_l0
) weights trained by myself.
dm_nfnet_f0
and 50% faster than nfnet_f0s
w/ 1/3 param countdm_
. They require SAME padding conv, skipinit enabled, and activation gains applied in act fn.s
variants.dm_nfnet_f6
- 86.352dm_nfnet_f5
- 86.100dm_nfnet_f4
- 85.834dm_nfnet_f3
- 85.676dm_nfnet_f2
- 85.178dm_nfnet_f1
- 84.696dm_nfnet_f0
- 83.464--clip-grad .01 --clip-mode agc
--clip-grad 1.0
--clip-grad 10. --clip-mode value
byobnet.py
byobnet.py
vgg.py
)--channels-last
and --torchscript
model training, APEX does not.ecaresnet26t
- 79.88 top-1 @ 320x320, 79.08 @ 256x256ecaresnet50t
- 82.35 top-1 @ 320x320, 81.52 @ 256x256ecaresnet269d
- 84.93 top-1 @ 352x352, 84.87 @ 320x320t
) vs tiered_narrow (tn
) ResNet model defs, all tn
changed to t
and t
models removed (seresnext26t_32x4d
only model w/ weights that was removed).test_input_size
and remove extra _320
suffix ResNet model defs that were just for test.train.py /data/tfds --dataset tfds/oxford_iiit_pet --val-split test --model resnet50 -b 256 --amp --num-classes 37 --opt adamw --lr 3e-4 --weight-decay .001 --pretrained -j 2
validate.py /data/fall11_whole.tar --model resnetv2_50x1_bitm_in21k --amp
PyTorch Image Models (timm
) is a collection of image models, layers, utilities, optimizers, schedulers, data-loaders / augmentations, and reference training / validation scripts that aim to pull together a wide variety of SOTA models with ability to reproduce ImageNet training results.
The work of many others is present here. I've tried to make sure all source material is acknowledged via links to github, arxiv papers, etc in the README, documentation, and code docstrings. Please let me know if I missed anything.
All model architecture families include variants with pretrained weights. There are specific model variants without any weights, it is NOT a bug. Help training new or better weights is always appreciated. Here are some example training hparams to get you started.
A full version of the list below with source links can be found in the documentation.
Several (less common) features that I often utilize in my projects are included. Many of their additions are the reason why I maintain my own set of models, instead of using others' via PIP:
get_classifier
and reset_classifier
forward_features
(see documentation)create_model(name, features_only=True, out_indices=..., output_stride=...)
out_indices
creation arg specifies which feature maps to return, these indices are 0 based and generally correspond to the C(i + 1)
feature level.output_stride
creation arg controls output stride of the network by using dilated convolutions. Most networks are stride 32 by default. Not all networks support this..feature_info
memberstep
, cosine
w/ restarts, tanh
w/ restarts, plateau
rmsprop_tf
adapted from PyTorch RMSProp by myself. Reproduces much improved Tensorflow RMSProp behaviour.radam
by Liyuan Liu (https://arxiv.org/abs/1908.03265)novograd
by Masashi Kimura (https://arxiv.org/abs/1905.11286)lookahead
adapted from impl by Liam (https://arxiv.org/abs/1907.08610)fused<name>
optimizers by name with NVIDIA Apex installedadamp
and sgdp
by Naver ClovAI (https://arxiv.org/abs/2006.08217)adafactor
adapted from FAIRSeq impl (https://arxiv.org/abs/1804.04235)adahessian
by David Samuel (https://arxiv.org/abs/2006.00719)Model validation results can be found in the documentation and in the results tables
My current documentation for timm
covers the basics.
Getting Started with PyTorch Image Models (timm): A Practitioner’s Guide by Chris Hughes is an extensive blog post covering many aspects of timm
in detail.
timmdocs is quickly becoming a much more comprehensive set of documentation for timm
. A big thanks to Aman Arora for his efforts creating timmdocs.
paperswithcode is a good resource for browsing the models within timm
.
The root folder of the repository contains reference train, validation, and inference scripts that work with the included models and other features of this repository. They are adaptable for other datasets and use cases with a little hacking. See documentation for some basics and training hparams for some train examples that produce SOTA ImageNet results.
One of the greatest assets of PyTorch is the community and their contributions. A few of my favourite resources that pair well with the models and components here are listed below.
The code here is licensed Apache 2.0. I've taken care to make sure any third party code included or adapted has compatible (permissive) licenses such as MIT, BSD, etc. I've made an effort to avoid any GPL / LGPL conflicts. That said, it is your responsibility to ensure you comply with licenses here and conditions of any dependent licenses. Where applicable, I've linked the sources/references for various components in docstrings. If you think I've missed anything please create an issue.
So far all of the pretrained weights available here are pretrained on ImageNet with a select few that have some additional pretraining (see extra note below). ImageNet was released for non-commercial research purposes only (https://image-net.org/download). It's not clear what the implications of that are for the use of pretrained weights from that dataset. Any models I have trained with ImageNet are done for research purposes and one should assume that the original dataset license applies to the weights. It's best to seek legal advice if you intend to use the pretrained weights in a commercial product.
Several weights included or references here were pretrained with proprietary datasets that I do not have access to. These include the Facebook WSL, SSL, SWSL ResNe(Xt) and the Google Noisy Student EfficientNet models. The Facebook models have an explicit non-commercial license (CC-BY-NC 4.0, https://github.com/facebookresearch/semi-supervised-ImageNet1K-models, https://github.com/facebookresearch/WSL-Images). The Google models do not appear to have any restriction beyond the Apache 2.0 license (and ImageNet concerns). In either case, you should contact Facebook or Google with any questions.
@misc{rw2019timm,
author = {Ross Wightman},
title = {PyTorch Image Models},
year = {2019},
publisher = {GitHub},
journal = {GitHub repository},
doi = {10.5281/zenodo.4414861},
howpublished = {\url{https://github.com/rwightman/pytorch-image-models}}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。