From e4c99d2bd64fcfb2146666f1bdfc627bf60e258d Mon Sep 17 00:00:00 2001 From: nateraw Date: Fri, 23 Sep 2022 17:51:45 -0700 Subject: [PATCH 01/26] :memo: add hfdocs documentation --- .github/workflows/build_pr_documentation.yml | 16 + .github/workflows/delete_doc_comment.yml | 13 + hfdocs/source/_conf.yml | 1 + hfdocs/source/_toctree.yml | 149 ++++ hfdocs/source/archived_changes.mdx | 418 +++++++++++ hfdocs/source/changes.mdx | 187 +++++ hfdocs/source/feature_extraction.mdx | 196 +++++ hfdocs/source/index.mdx | 89 +++ hfdocs/source/model_pages.mdx | 5 + hfdocs/source/models.mdx | 230 ++++++ .../models/adversarial-inception-v3.mdx | 165 +++++ hfdocs/source/models/advprop.mdx | 524 ++++++++++++++ hfdocs/source/models/big-transfer.mdx | 362 ++++++++++ hfdocs/source/models/csp-darknet.mdx | 148 ++++ hfdocs/source/models/csp-resnet.mdx | 143 ++++ hfdocs/source/models/csp-resnext.mdx | 144 ++++ hfdocs/source/models/densenet.mdx | 372 ++++++++++ hfdocs/source/models/dla.mdx | 612 ++++++++++++++++ hfdocs/source/models/dpn.mdx | 323 +++++++++ hfdocs/source/models/ecaresnet.mdx | 303 ++++++++ hfdocs/source/models/efficientnet-pruned.mdx | 212 ++++++ hfdocs/source/models/efficientnet.mdx | 392 ++++++++++ hfdocs/source/models/ensemble-adversarial.mdx | 165 +++++ hfdocs/source/models/ese-vovnet.mdx | 159 +++++ hfdocs/source/models/fbnet.mdx | 143 ++++ hfdocs/source/models/gloun-inception-v3.mdx | 145 ++++ hfdocs/source/models/gloun-resnet.mdx | 571 +++++++++++++++ hfdocs/source/models/gloun-resnext.mdx | 209 ++++++ hfdocs/source/models/gloun-senet.mdx | 130 ++++ hfdocs/source/models/gloun-seresnext.mdx | 203 ++++++ hfdocs/source/models/gloun-xception.mdx | 133 ++++ hfdocs/source/models/hrnet.mdx | 425 +++++++++++ hfdocs/source/models/ig-resnext.mdx | 276 ++++++++ hfdocs/source/models/inception-resnet-v2.mdx | 139 ++++ hfdocs/source/models/inception-v3.mdx | 152 ++++ hfdocs/source/models/inception-v4.mdx | 138 ++++ hfdocs/source/models/legacy-se-resnet.mdx | 324 +++++++++ hfdocs/source/models/legacy-se-resnext.mdx | 234 ++++++ hfdocs/source/models/legacy-senet.mdx | 141 ++++ hfdocs/source/models/mixnet.mdx | 231 ++++++ hfdocs/source/models/mnasnet.mdx | 176 +++++ hfdocs/source/models/mobilenet-v2.mdx | 277 ++++++++ hfdocs/source/models/mobilenet-v3.mdx | 205 ++++++ hfdocs/source/models/nasnet.mdx | 137 ++++ hfdocs/source/models/noisy-student.mdx | 577 +++++++++++++++ hfdocs/source/models/pnasnet.mdx | 138 ++++ hfdocs/source/models/regnetx.mdx | 559 +++++++++++++++ hfdocs/source/models/regnety.mdx | 573 +++++++++++++++ hfdocs/source/models/res2net.mdx | 327 +++++++++ hfdocs/source/models/res2next.mdx | 142 ++++ hfdocs/source/models/resnest.mdx | 475 +++++++++++++ hfdocs/source/models/resnet-d.mdx | 330 +++++++++ hfdocs/source/models/resnet.mdx | 445 ++++++++++++ hfdocs/source/models/resnext.mdx | 250 +++++++ hfdocs/source/models/rexnet.mdx | 264 +++++++ hfdocs/source/models/se-resnet.mdx | 189 +++++ hfdocs/source/models/selecsls.mdx | 203 ++++++ hfdocs/source/models/seresnext.mdx | 234 ++++++ hfdocs/source/models/skresnet.mdx | 179 +++++ hfdocs/source/models/skresnext.mdx | 137 ++++ hfdocs/source/models/spnasnet.mdx | 129 ++++ hfdocs/source/models/ssl-resnet.mdx | 198 ++++++ hfdocs/source/models/swsl-resnet.mdx | 198 ++++++ hfdocs/source/models/swsl-resnext.mdx | 284 ++++++++ .../models/tf-efficientnet-condconv.mdx | 256 +++++++ hfdocs/source/models/tf-efficientnet-lite.mdx | 262 +++++++ hfdocs/source/models/tf-efficientnet.mdx | 669 ++++++++++++++++++ hfdocs/source/models/tf-inception-v3.mdx | 154 ++++ hfdocs/source/models/tf-mixnet.mdx | 200 ++++++ hfdocs/source/models/tf-mobilenet-v3.mdx | 387 ++++++++++ hfdocs/source/models/tresnet.mdx | 358 ++++++++++ hfdocs/source/models/wide-resnet.mdx | 169 +++++ hfdocs/source/models/xception.mdx | 230 ++++++ hfdocs/source/results.mdx | 67 ++ hfdocs/source/scripts.mdx | 35 + hfdocs/source/training_hparam_examples.mdx | 63 ++ 76 files changed, 18398 insertions(+) create mode 100644 .github/workflows/build_pr_documentation.yml create mode 100644 .github/workflows/delete_doc_comment.yml create mode 100644 hfdocs/source/_conf.yml create mode 100644 hfdocs/source/_toctree.yml create mode 100644 hfdocs/source/archived_changes.mdx create mode 100644 hfdocs/source/changes.mdx create mode 100644 hfdocs/source/feature_extraction.mdx create mode 100644 hfdocs/source/index.mdx create mode 100644 hfdocs/source/model_pages.mdx create mode 100644 hfdocs/source/models.mdx create mode 100644 hfdocs/source/models/adversarial-inception-v3.mdx create mode 100644 hfdocs/source/models/advprop.mdx create mode 100644 hfdocs/source/models/big-transfer.mdx create mode 100644 hfdocs/source/models/csp-darknet.mdx create mode 100644 hfdocs/source/models/csp-resnet.mdx create mode 100644 hfdocs/source/models/csp-resnext.mdx create mode 100644 hfdocs/source/models/densenet.mdx create mode 100644 hfdocs/source/models/dla.mdx create mode 100644 hfdocs/source/models/dpn.mdx create mode 100644 hfdocs/source/models/ecaresnet.mdx create mode 100644 hfdocs/source/models/efficientnet-pruned.mdx create mode 100644 hfdocs/source/models/efficientnet.mdx create mode 100644 hfdocs/source/models/ensemble-adversarial.mdx create mode 100644 hfdocs/source/models/ese-vovnet.mdx create mode 100644 hfdocs/source/models/fbnet.mdx create mode 100644 hfdocs/source/models/gloun-inception-v3.mdx create mode 100644 hfdocs/source/models/gloun-resnet.mdx create mode 100644 hfdocs/source/models/gloun-resnext.mdx create mode 100644 hfdocs/source/models/gloun-senet.mdx create mode 100644 hfdocs/source/models/gloun-seresnext.mdx create mode 100644 hfdocs/source/models/gloun-xception.mdx create mode 100644 hfdocs/source/models/hrnet.mdx create mode 100644 hfdocs/source/models/ig-resnext.mdx create mode 100644 hfdocs/source/models/inception-resnet-v2.mdx create mode 100644 hfdocs/source/models/inception-v3.mdx create mode 100644 hfdocs/source/models/inception-v4.mdx create mode 100644 hfdocs/source/models/legacy-se-resnet.mdx create mode 100644 hfdocs/source/models/legacy-se-resnext.mdx create mode 100644 hfdocs/source/models/legacy-senet.mdx create mode 100644 hfdocs/source/models/mixnet.mdx create mode 100644 hfdocs/source/models/mnasnet.mdx create mode 100644 hfdocs/source/models/mobilenet-v2.mdx create mode 100644 hfdocs/source/models/mobilenet-v3.mdx create mode 100644 hfdocs/source/models/nasnet.mdx create mode 100644 hfdocs/source/models/noisy-student.mdx create mode 100644 hfdocs/source/models/pnasnet.mdx create mode 100644 hfdocs/source/models/regnetx.mdx create mode 100644 hfdocs/source/models/regnety.mdx create mode 100644 hfdocs/source/models/res2net.mdx create mode 100644 hfdocs/source/models/res2next.mdx create mode 100644 hfdocs/source/models/resnest.mdx create mode 100644 hfdocs/source/models/resnet-d.mdx create mode 100644 hfdocs/source/models/resnet.mdx create mode 100644 hfdocs/source/models/resnext.mdx create mode 100644 hfdocs/source/models/rexnet.mdx create mode 100644 hfdocs/source/models/se-resnet.mdx create mode 100644 hfdocs/source/models/selecsls.mdx create mode 100644 hfdocs/source/models/seresnext.mdx create mode 100644 hfdocs/source/models/skresnet.mdx create mode 100644 hfdocs/source/models/skresnext.mdx create mode 100644 hfdocs/source/models/spnasnet.mdx create mode 100644 hfdocs/source/models/ssl-resnet.mdx create mode 100644 hfdocs/source/models/swsl-resnet.mdx create mode 100644 hfdocs/source/models/swsl-resnext.mdx create mode 100644 hfdocs/source/models/tf-efficientnet-condconv.mdx create mode 100644 hfdocs/source/models/tf-efficientnet-lite.mdx create mode 100644 hfdocs/source/models/tf-efficientnet.mdx create mode 100644 hfdocs/source/models/tf-inception-v3.mdx create mode 100644 hfdocs/source/models/tf-mixnet.mdx create mode 100644 hfdocs/source/models/tf-mobilenet-v3.mdx create mode 100644 hfdocs/source/models/tresnet.mdx create mode 100644 hfdocs/source/models/wide-resnet.mdx create mode 100644 hfdocs/source/models/xception.mdx create mode 100644 hfdocs/source/results.mdx create mode 100644 hfdocs/source/scripts.mdx create mode 100644 hfdocs/source/training_hparam_examples.mdx diff --git a/.github/workflows/build_pr_documentation.yml b/.github/workflows/build_pr_documentation.yml new file mode 100644 index 00000000..19c62cff --- /dev/null +++ b/.github/workflows/build_pr_documentation.yml @@ -0,0 +1,16 @@ +name: Build PR Documentation + +on: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main + with: + commit_sha: ${{ github.event.pull_request.head.sha }} + pr_number: ${{ github.event.number }} + package: timm \ No newline at end of file diff --git a/.github/workflows/delete_doc_comment.yml b/.github/workflows/delete_doc_comment.yml new file mode 100644 index 00000000..c05e94c5 --- /dev/null +++ b/.github/workflows/delete_doc_comment.yml @@ -0,0 +1,13 @@ +name: Delete dev documentation + +on: + pull_request: + types: [ closed ] + + +jobs: + delete: + uses: huggingface/doc-builder/.github/workflows/delete_doc_comment.yml@main + with: + pr_number: ${{ github.event.number }} + package: timm \ No newline at end of file diff --git a/hfdocs/source/_conf.yml b/hfdocs/source/_conf.yml new file mode 100644 index 00000000..ed950717 --- /dev/null +++ b/hfdocs/source/_conf.yml @@ -0,0 +1 @@ +default_branch_name = "master" \ No newline at end of file diff --git a/hfdocs/source/_toctree.yml b/hfdocs/source/_toctree.yml new file mode 100644 index 00000000..3fa994b6 --- /dev/null +++ b/hfdocs/source/_toctree.yml @@ -0,0 +1,149 @@ +- sections: + - local: index + title: Pytorch Image Models (timm) + - local: models + title: Model Summaries + - local: results + title: Results + - local: scripts + title: Scripts + - local: training_hparam_examples + title: Training Examples + - local: feature_extraction + title: Feature Extraction + - local: changes + title: Recent Changes + - local: archived_changes + title: Archived Changes + - local: model_pages + title: Model Pages + isExpanded: false + sections: + - local: models/adversarial-inception-v3 + title: Adversarial Inception v3 + - local: models/advprop + title: AdvProp (EfficientNet) + - local: models/big-transfer + title: Big Transfer (BiT) + - local: models/csp-darknet + title: CSP-DarkNet + - local: models/csp-resnet + title: CSP-ResNet + - local: models/csp-resnext + title: CSP-ResNeXt + - local: models/densenet + title: DenseNet + - local: models/dla + title: Deep Layer Aggregation + - local: models/dpn + title: Dual Path Network (DPN) + - local: models/ecaresnet + title: ECA-ResNet + - local: models/efficientnet + title: EfficientNet + - local: models/efficientnet-pruned + title: EfficientNet (Knapsack Pruned) + - local: models/ensemble-adversarial + title: Ensemble Adversarial Inception ResNet v2 + - local: models/ese-vovnet + title: ESE-VoVNet + - local: models/fbnet + title: FBNet + - local: models/gloun-inception-v3 + title: (Gluon) Inception v3 + - local: models/gloun-resnet + title: (Gluon) ResNet + - local: models/gloun-resnext + title: (Gluon) ResNeXt + - local: models/gloun-senet + title: (Gluon) SENet + - local: models/gloun-seresnext + title: (Gluon) SE-ResNeXt + - local: models/gloun-xception + title: (Gluon) Xception + - local: models/hrnet + title: HRNet + - local: models/ig-resnext + title: Instagram ResNeXt WSL + - local: models/inception-resnet-v2 + title: Inception ResNet v2 + - local: models/inception-v3 + title: Inception v3 + - local: models/inception-v4 + title: Inception v4 + - local: models/legacy-se-resnet + title: (Legacy) SE-ResNet + - local: models/legacy-se-resnext + title: (Legacy) SE-ResNeXt + - local: models/legacy-senet + title: (Legacy) SENet + - local: models/mixnet + title: MixNet + - local: models/mnasnet + title: MnasNet + - local: models/mobilenet-v2 + title: MobileNet v2 + - local: models/mobilenet-v3 + title: MobileNet v3 + - local: models/nasnet + title: NASNet + - local: models/noisy-student + title: Noisy Student (EfficientNet) + - local: models/pnasnet + title: PNASNet + - local: models/regnetx + title: RegNetX + - local: models/regnety + title: RegNetY + - local: models/res2net + title: Res2Net + - local: models/res2next + title: Res2NeXt + - local: models/resnest + title: ResNeSt + - local: models/resnet + title: ResNet + - local: models/resnet-d + title: ResNet-D + - local: models/resnext + title: ResNeXt + - local: models/rexnet + title: RexNet + - local: models/se-resnet + title: SE-ResNet + - local: models/selecsls + title: SelecSLS + - local: models/seresnext + title: SE-ResNeXt + - local: models/skresnet + title: SK-ResNet + - local: models/skresnext + title: SK-ResNeXt + - local: models/spnasnet + title: SPNASNet + - local: models/ssl-resnet + title: SSL ResNet + - local: models/swsl-resnet + title: SWSL ResNet + - local: models/swsl-resnext + title: SWSL ResNeXt + - local: models/tf-efficientnet + title: (Tensorflow) EfficientNet + - local: models/tf-efficientnet-condconv + title: (Tensorflow) EfficientNet CondConv + - local: models/tf-efficientnet-lite + title: (Tensorflow) EfficientNet Lite + - local: models/tf-inception-v3 + title: (Tensorflow) Inception v3 + - local: models/tf-mixnet + title: (Tensorflow) MixNet + - local: models/tf-mobilenet-v3 + title: (Tensorflow) MobileNet v3 + - local: models/tresnet + title: TResNet + - local: models/wide-resnet + title: Wide ResNet + - local: models/xception + title: Xception + title: Get started + diff --git a/hfdocs/source/archived_changes.mdx b/hfdocs/source/archived_changes.mdx new file mode 100644 index 00000000..25778562 --- /dev/null +++ b/hfdocs/source/archived_changes.mdx @@ -0,0 +1,418 @@ +# Archived Changes + +### July 12, 2021 + +* Add XCiT models from [official facebook impl](https://github.com/facebookresearch/xcit). Contributed by [Alexander Soare](https://github.com/alexander-soare) + +### July 5-9, 2021 + +* Add `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) + * top-1 82.34 @ 288x288 and 82.54 @ 320x320 +* Add [SAM pretrained](https://arxiv.org/abs/2106.01548) in1k weight for ViT B/16 (`vit_base_patch16_sam_224`) and B/32 (`vit_base_patch32_sam_224`) models. +* Add 'Aggregating Nested Transformer' (NesT) w/ weights converted from official [Flax impl](https://github.com/google-research/nested-transformer). Contributed by [Alexander Soare](https://github.com/alexander-soare). + * `jx_nest_base` - 83.534, `jx_nest_small` - 83.120, `jx_nest_tiny` - 81.426 + +### June 23, 2021 + +* Reproduce gMLP model training, `gmlp_s16_224` trained to 79.6 top-1, matching [paper](https://arxiv.org/abs/2105.08050). Hparams for this and other recent MLP training [here](https://gist.github.com/rwightman/d6c264a9001f9167e06c209f630b2cc6) + +### June 20, 2021 + +* Release Vision Transformer 'AugReg' weights from [How to train your ViT? Data, Augmentation, and Regularization in Vision Transformers](https://arxiv.org/abs/2106.10270) + * .npz weight loading support added, can load any of the 50K+ weights from the [AugReg series](https://console.cloud.google.com/storage/browser/vit_models/augreg) + * See [example notebook](https://colab.research.google.com/github/google-research/vision_transformer/blob/master/vit_jax_augreg.ipynb) from [official impl](https://github.com/google-research/vision_transformer/) for navigating the augreg weights + * Replaced all default weights w/ best AugReg variant (if possible). All AugReg 21k classifiers work. + * Highlights: `vit_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_*` + * Remove my old small model, replace with DeiT compatible small w/ AugReg weights +* Add 1st training of my `gmixer_24_224` MLP /w GLU, 78.1 top-1 w/ 25M params. +* Add weights from official ResMLP release (https://github.com/facebookresearch/deit) +* Add `eca_nfnet_l2` weights from my 'lightweight' series. 84.7 top-1 at 384x384. +* Add distilled BiT 50x1 student and 152x2 Teacher weights from [Knowledge distillation: A good teacher is patient and consistent](https://arxiv.org/abs/2106.05237) +* NFNets and ResNetV2-BiT models work w/ Pytorch XLA now + * weight standardization uses F.batch_norm instead of std_mean (std_mean wasn't lowered) + * eps values adjusted, will be slight differences but should be quite close +* Improve test coverage and classifier interface of non-conv (vision transformer and mlp) models +* Cleanup a few classifier / flatten details for models w/ conv classifiers or early global pool +* Please report any regressions, this PR touched quite a few models. + +### June 8, 2021 + +* Add first ResMLP weights, trained in PyTorch XLA on TPU-VM w/ my XLA branch. 24 block variant, 79.2 top-1. +* Add ResNet51-Q model w/ pretrained weights at 82.36 top-1. + * NFNet inspired block layout with quad layer stem and no maxpool + * Same param count (35.7M) and throughput as ResNetRS-50 but +1.5 top-1 @ 224x224 and +2.5 top-1 at 288x288 + +### May 25, 2021 + +* Add LeViT, Visformer, Convit (PR by Aman Arora), Twins (PR by paper authors) transformer models +* Cleanup input_size/img_size override handling and testing for all vision transformer models +* Add `efficientnetv2_rw_m` model and weights (started training before official code). 84.8 top-1, 53M params. + +### May 14, 2021 + +* Add EfficientNet-V2 official model defs w/ ported weights from official [Tensorflow/Keras](https://github.com/google/automl/tree/master/efficientnetv2) impl. + * 1k trained variants: `tf_efficientnetv2_s/m/l` + * 21k trained variants: `tf_efficientnetv2_s/m/l_in21k` + * 21k pretrained -> 1k fine-tuned: `tf_efficientnetv2_s/m/l_in21ft1k` + * v2 models w/ v1 scaling: `tf_efficientnetv2_b0` through `b3` + * Rename my prev V2 guess `efficientnet_v2s` -> `efficientnetv2_rw_s` + * Some blank `efficientnetv2_*` models in-place for future native PyTorch training + +### May 5, 2021 + +* Add MLP-Mixer models and port pretrained weights from [Google JAX impl](https://github.com/google-research/vision_transformer/tree/linen) +* Add CaiT models and pretrained weights from [FB](https://github.com/facebookresearch/deit) +* Add ResNet-RS models and weights from [TF](https://github.com/tensorflow/tpu/tree/master/models/official/resnet/resnet_rs). Thanks [Aman Arora](https://github.com/amaarora) +* Add CoaT models and weights. Thanks [Mohammed Rizin](https://github.com/morizin) +* Add new ImageNet-21k weights & finetuned weights for TResNet, MobileNet-V3, ViT models. Thanks [mrT](https://github.com/mrT23) +* Add GhostNet models and weights. Thanks [Kai Han](https://github.com/iamhankai) +* Update ByoaNet attention modles + * Improve SA module inits + * Hack together experimental stand-alone Swin based attn module and `swinnet` + * Consistent '26t' model defs for experiments. +* Add improved Efficientnet-V2S (prelim model def) weights. 83.8 top-1. +* WandB logging support + +### April 13, 2021 + +* Add Swin Transformer models and weights from https://github.com/microsoft/Swin-Transformer + +### April 12, 2021 + +* Add ECA-NFNet-L1 (slimmed down F1 w/ SiLU, 41M params) trained with this code. 84% top-1 @ 320x320. Trained at 256x256. +* Add EfficientNet-V2S model (unverified model definition) weights. 83.3 top-1 @ 288x288. Only trained single res 224. Working on progressive training. +* Add ByoaNet model definition (Bring-your-own-attention) w/ SelfAttention block and corresponding SA/SA-like modules and model defs + * Lambda Networks - https://arxiv.org/abs/2102.08602 + * Bottleneck Transformers - https://arxiv.org/abs/2101.11605 + * Halo Nets - https://arxiv.org/abs/2103.12731 +* Adabelief optimizer contributed by Juntang Zhuang + +### April 1, 2021 + +* Add snazzy `benchmark.py` script for bulk `timm` model benchmarking of train and/or inference +* Add Pooling-based Vision Transformer (PiT) models (from https://github.com/naver-ai/pit) + * Merged distilled variant into main for torchscript compatibility + * Some `timm` cleanup/style tweaks and weights have hub download support +* Cleanup Vision Transformer (ViT) models + * Merge distilled (DeiT) model into main so that torchscript can work + * Support updated weight init (defaults to old still) that closer matches original JAX impl (possibly better training from scratch) + * Separate hybrid model defs into different file and add several new model defs to fiddle with, support patch_size != 1 for hybrids + * Fix fine-tuning num_class changes (PiT and ViT) and pos_embed resizing (Vit) with distilled variants + * nn.Sequential for block stack (does not break downstream compat) +* TnT (Transformer-in-Transformer) models contributed by author (from https://gitee.com/mindspore/mindspore/tree/master/model_zoo/research/cv/TNT) +* Add RegNetY-160 weights from DeiT teacher model +* Add new NFNet-L0 w/ SE attn (rename `nfnet_l0b`->`nfnet_l0`) weights 82.75 top-1 @ 288x288 +* Some fixes/improvements for TFDS dataset wrapper + +### March 7, 2021 + +* First 0.4.x PyPi release w/ NFNets (& related), ByoB (GPU-Efficient, RepVGG, etc). +* Change feature extraction for pre-activation nets (NFNets, ResNetV2) to return features before activation. + +### Feb 18, 2021 + +* Add pretrained weights and model variants for NFNet-F* models from [DeepMind Haiku impl](https://github.com/deepmind/deepmind-research/tree/master/nfnets). + * Models are prefixed with `dm_`. They require SAME padding conv, skipinit enabled, and activation gains applied in act fn. + * These models are big, expect to run out of GPU memory. With the GELU activiation + other options, they are roughly 1/2 the inference speed of my SiLU PyTorch optimized `s` variants. + * Original model results are based on pre-processing that is not the same as all other models so you'll see different results in the results csv (once updated). + * Matching the original pre-processing as closely as possible I get these results: + * `dm_nfnet_f6` - 86.352 + * `dm_nfnet_f5` - 86.100 + * `dm_nfnet_f4` - 85.834 + * `dm_nfnet_f3` - 85.676 + * `dm_nfnet_f2` - 85.178 + * `dm_nfnet_f1` - 84.696 + * `dm_nfnet_f0` - 83.464 + +### Feb 16, 2021 + +* Add Adaptive Gradient Clipping (AGC) as per https://arxiv.org/abs/2102.06171. Integrated w/ PyTorch gradient clipping via mode arg that defaults to prev 'norm' mode. For backward arg compat, clip-grad arg must be specified to enable when using train.py. + * AGC w/ default clipping factor `--clip-grad .01 --clip-mode agc` + * PyTorch global norm of 1.0 (old behaviour, always norm), `--clip-grad 1.0` + * PyTorch value clipping of 10, `--clip-grad 10. --clip-mode value` + * AGC performance is definitely sensitive to the clipping factor. More experimentation needed to determine good values for smaller batch sizes and optimizers besides those in paper. So far I've found .001-.005 is necessary for stable RMSProp training w/ NFNet/NF-ResNet. + +### Feb 12, 2021 + +* Update Normalization-Free nets to include new NFNet-F (https://arxiv.org/abs/2102.06171) model defs + +### Feb 10, 2021 + +* More model archs, incl a flexible ByobNet backbone ('Bring-your-own-blocks') + * GPU-Efficient-Networks (https://github.com/idstcv/GPU-Efficient-Networks), impl in `byobnet.py` + * RepVGG (https://github.com/DingXiaoH/RepVGG), impl in `byobnet.py` + * classic VGG (from torchvision, impl in `vgg`) +* Refinements to normalizer layer arg handling and normalizer+act layer handling in some models +* Default AMP mode changed to native PyTorch AMP instead of APEX. Issues not being fixed with APEX. Native works with `--channels-last` and `--torchscript` model training, APEX does not. +* Fix a few bugs introduced since last pypi release + +### Feb 8, 2021 + +* Add several ResNet weights with ECA attention. 26t & 50t trained @ 256, test @ 320. 269d train @ 256, fine-tune @320, test @ 352. + * `ecaresnet26t` - 79.88 top-1 @ 320x320, 79.08 @ 256x256 + * `ecaresnet50t` - 82.35 top-1 @ 320x320, 81.52 @ 256x256 + * `ecaresnet269d` - 84.93 top-1 @ 352x352, 84.87 @ 320x320 +* Remove separate tiered (`t`) 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). +* Support model default_cfgs with separate train vs test resolution `test_input_size` and remove extra `_320` suffix ResNet model defs that were just for test. + +### Jan 30, 2021 + +* Add initial "Normalization Free" NF-RegNet-B* and NF-ResNet model definitions based on [paper](https://arxiv.org/abs/2101.08692) + +### Jan 25, 2021 + +* Add ResNetV2 Big Transfer (BiT) models w/ ImageNet-1k and 21k weights from https://github.com/google-research/big_transfer +* Add official R50+ViT-B/16 hybrid models + weights from https://github.com/google-research/vision_transformer +* ImageNet-21k ViT weights are added w/ model defs and representation layer (pre logits) support + * NOTE: ImageNet-21k classifier heads were zero'd in original weights, they are only useful for transfer learning +* Add model defs and weights for DeiT Vision Transformer models from https://github.com/facebookresearch/deit +* Refactor dataset classes into ImageDataset/IterableImageDataset + dataset specific parser classes +* Add Tensorflow-Datasets (TFDS) wrapper to allow use of TFDS image classification sets with train script + * Ex: `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` +* Add improved .tar dataset parser that reads images from .tar, folder of .tar files, or .tar within .tar + * Run validation on full ImageNet-21k directly from tar w/ BiT model: `validate.py /data/fall11_whole.tar --model resnetv2_50x1_bitm_in21k --amp` +* Models in this update should be stable w/ possible exception of ViT/BiT, possibility of some regressions with train/val scripts and dataset handling + +### Jan 3, 2021 + +* Add SE-ResNet-152D weights + * 256x256 val, 0.94 crop top-1 - 83.75 + * 320x320 val, 1.0 crop - 84.36 +* Update results files + +### Dec 18, 2020 + +* Add ResNet-101D, ResNet-152D, and ResNet-200D weights trained @ 256x256 + * 256x256 val, 0.94 crop (top-1) - 101D (82.33), 152D (83.08), 200D (83.25) + * 288x288 val, 1.0 crop - 101D (82.64), 152D (83.48), 200D (83.76) + * 320x320 val, 1.0 crop - 101D (83.00), 152D (83.66), 200D (84.01) + +### Dec 7, 2020 + +* Simplify EMA module (ModelEmaV2), compatible with fully torchscripted models +* Misc fixes for SiLU ONNX export, default_cfg missing from Feature extraction models, Linear layer w/ AMP + torchscript +* PyPi release @ 0.3.2 (needed by EfficientDet) + + +### Oct 30, 2020 + +* Test with PyTorch 1.7 and fix a small top-n metric view vs reshape issue. +* Convert newly added 224x224 Vision Transformer weights from official JAX repo. 81.8 top-1 for B/16, 83.1 L/16. +* Support PyTorch 1.7 optimized, native SiLU (aka Swish) activation. Add mapping to 'silu' name, custom swish will eventually be deprecated. +* Fix regression for loading pretrained classifier via direct model entrypoint functions. Didn't impact create_model() factory usage. +* PyPi release @ 0.3.0 version! + +### Oct 26, 2020 + +* Update Vision Transformer models to be compatible with official code release at https://github.com/google-research/vision_transformer +* Add Vision Transformer weights (ImageNet-21k pretrain) for 384x384 base and large models converted from official jax impl + * ViT-B/16 - 84.2 + * ViT-B/32 - 81.7 + * ViT-L/16 - 85.2 + * ViT-L/32 - 81.5 + +### Oct 21, 2020 + +* Weights added for Vision Transformer (ViT) models. 77.86 top-1 for 'small' and 79.35 for 'base'. Thanks to [Christof](https://www.kaggle.com/christofhenkel) for training the base model w/ lots of GPUs. + +### Oct 13, 2020 + +* Initial impl of Vision Transformer models. Both patch and hybrid (CNN backbone) variants. Currently trying to train... +* Adafactor and AdaHessian (FP32 only, no AMP) optimizers +* EdgeTPU-M (`efficientnet_em`) model trained in PyTorch, 79.3 top-1 +* Pip release, doc updates pending a few more changes... + +### Sept 18, 2020 + +* New ResNet 'D' weights. 72.7 (top-1) ResNet-18-D, 77.1 ResNet-34-D, 80.5 ResNet-50-D +* Added a few untrained defs for other ResNet models (66D, 101D, 152D, 200/200D) + +### Sept 3, 2020 + +* New weights + * Wide-ResNet50 - 81.5 top-1 (vs 78.5 torchvision) + * SEResNeXt50-32x4d - 81.3 top-1 (vs 79.1 cadene) +* Support for native Torch AMP and channels_last memory format added to train/validate scripts (`--channels-last`, `--native-amp` vs `--apex-amp`) +* Models tested with channels_last on latest NGC 20.08 container. AdaptiveAvgPool in attn layers changed to mean((2,3)) to work around bug with NHWC kernel. + +### Aug 12, 2020 + +* New/updated weights from training experiments + * EfficientNet-B3 - 82.1 top-1 (vs 81.6 for official with AA and 81.9 for AdvProp) + * RegNetY-3.2GF - 82.0 top-1 (78.9 from official ver) + * CSPResNet50 - 79.6 top-1 (76.6 from official ver) +* Add CutMix integrated w/ Mixup. See [pull request](https://github.com/rwightman/pytorch-image-models/pull/218) for some usage examples +* Some fixes for using pretrained weights with `in_chans` != 3 on several models. + +### Aug 5, 2020 + +Universal feature extraction, new models, new weights, new test sets. +* All models support the `features_only=True` argument for `create_model` call to return a network that extracts feature maps from the deepest layer at each stride. +* New models + * CSPResNet, CSPResNeXt, CSPDarkNet, DarkNet + * ReXNet + * (Modified Aligned) Xception41/65/71 (a proper port of TF models) +* New trained weights + * SEResNet50 - 80.3 top-1 + * CSPDarkNet53 - 80.1 top-1 + * CSPResNeXt50 - 80.0 top-1 + * DPN68b - 79.2 top-1 + * EfficientNet-Lite0 (non-TF ver) - 75.5 (submitted by [@hal-314](https://github.com/hal-314)) +* Add 'real' labels for ImageNet and ImageNet-Renditions test set, see [`results/README.md`](results/README.md) +* Test set ranking/top-n diff script by [@KushajveerSingh](https://github.com/KushajveerSingh) +* Train script and loader/transform tweaks to punch through more aug arguments +* README and documentation overhaul. See initial (WIP) documentation at https://rwightman.github.io/pytorch-image-models/ +* adamp and sgdp optimizers added by [@hellbell](https://github.com/hellbell) + +### June 11, 2020 + +Bunch of changes: +* DenseNet models updated with memory efficient addition from torchvision (fixed a bug), blur pooling and deep stem additions +* VoVNet V1 and V2 models added, 39 V2 variant (ese_vovnet_39b) trained to 79.3 top-1 +* Activation factory added along with new activations: + * select act at model creation time for more flexibility in using activations compatible with scripting or tracing (ONNX export) + * hard_mish (experimental) added with memory-efficient grad, along with ME hard_swish + * context mgr for setting exportable/scriptable/no_jit states +* Norm + Activation combo layers added with initial trial support in DenseNet and VoVNet along with impl of EvoNorm and InplaceAbn wrapper that fit the interface +* Torchscript works for all but two of the model types as long as using Pytorch 1.5+, tests added for this +* Some import cleanup and classifier reset changes, all models will have classifier reset to nn.Identity on reset_classifer(0) call +* Prep for 0.1.28 pip release + +### May 12, 2020 + +* Add ResNeSt models (code adapted from https://github.com/zhanghang1989/ResNeSt, paper https://arxiv.org/abs/2004.08955)) + +### May 3, 2020 + +* Pruned EfficientNet B1, B2, and B3 (https://arxiv.org/abs/2002.08258) contributed by [Yonathan Aflalo](https://github.com/yoniaflalo) + +### May 1, 2020 + +* Merged a number of execellent contributions in the ResNet model family over the past month + * BlurPool2D and resnetblur models initiated by [Chris Ha](https://github.com/VRandme), I trained resnetblur50 to 79.3. + * TResNet models and SpaceToDepth, AntiAliasDownsampleLayer layers by [mrT23](https://github.com/mrT23) + * ecaresnet (50d, 101d, light) models and two pruned variants using pruning as per (https://arxiv.org/abs/2002.08258) by [Yonathan Aflalo](https://github.com/yoniaflalo) +* 200 pretrained models in total now with updated results csv in results folder + +### April 5, 2020 + +* Add some newly trained MobileNet-V2 models trained with latest h-params, rand augment. They compare quite favourably to EfficientNet-Lite + * 3.5M param MobileNet-V2 100 @ 73% + * 4.5M param MobileNet-V2 110d @ 75% + * 6.1M param MobileNet-V2 140 @ 76.5% + * 5.8M param MobileNet-V2 120d @ 77.3% + +### March 18, 2020 + +* Add EfficientNet-Lite models w/ weights ported from [Tensorflow TPU](https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet/lite) +* Add RandAugment trained ResNeXt-50 32x4d weights with 79.8 top-1. Trained by [Andrew Lavin](https://github.com/andravin) (see Training section for hparams) + +### April 5, 2020 + +* Add some newly trained MobileNet-V2 models trained with latest h-params, rand augment. They compare quite favourably to EfficientNet-Lite + * 3.5M param MobileNet-V2 100 @ 73% + * 4.5M param MobileNet-V2 110d @ 75% + * 6.1M param MobileNet-V2 140 @ 76.5% + * 5.8M param MobileNet-V2 120d @ 77.3% + +### March 18, 2020 + +* Add EfficientNet-Lite models w/ weights ported from [Tensorflow TPU](https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet/lite) +* Add RandAugment trained ResNeXt-50 32x4d weights with 79.8 top-1. Trained by [Andrew Lavin](https://github.com/andravin) (see Training section for hparams) + +### Feb 29, 2020 + +* New MobileNet-V3 Large weights trained from stratch with this code to 75.77% top-1 +* IMPORTANT CHANGE - default weight init changed for all MobilenetV3 / EfficientNet / related models + * overall results similar to a bit better training from scratch on a few smaller models tried + * performance early in training seems consistently improved but less difference by end + * set `fix_group_fanout=False` in `_init_weight_goog` fn if you need to reproducte past behaviour +* Experimental LR noise feature added applies a random perturbation to LR each epoch in specified range of training + +### Feb 18, 2020 + +* Big refactor of model layers and addition of several attention mechanisms. Several additions motivated by 'Compounding the Performance Improvements...' (https://arxiv.org/abs/2001.06268): + * Move layer/module impl into `layers` subfolder/module of `models` and organize in a more granular fashion + * ResNet downsample paths now properly support dilation (output stride != 32) for avg_pool ('D' variant) and 3x3 (SENets) networks + * Add Selective Kernel Nets on top of ResNet base, pretrained weights + * skresnet18 - 73% top-1 + * skresnet34 - 76.9% top-1 + * skresnext50_32x4d (equiv to SKNet50) - 80.2% top-1 + * ECA and CECA (circular padding) attention layer contributed by [Chris Ha](https://github.com/VRandme) + * CBAM attention experiment (not the best results so far, may remove) + * Attention factory to allow dynamically selecting one of SE, ECA, CBAM in the `.se` position for all ResNets + * Add DropBlock and DropPath (formerly DropConnect for EfficientNet/MobileNetv3) support to all ResNet variants +* Full dataset results updated that incl NoisyStudent weights and 2 of the 3 SK weights + +### Feb 12, 2020 + +* Add EfficientNet-L2 and B0-B7 NoisyStudent weights ported from [Tensorflow TPU](https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet) + +### Feb 6, 2020 + +* Add RandAugment trained EfficientNet-ES (EdgeTPU-Small) weights with 78.1 top-1. Trained by [Andrew Lavin](https://github.com/andravin) (see Training section for hparams) + +### Feb 1/2, 2020 + +* Port new EfficientNet-B8 (RandAugment) weights, these are different than the B8 AdvProp, different input normalization. +* Update results csv files on all models for ImageNet validation and three other test sets +* Push PyPi package update + +### Jan 31, 2020 + +* Update ResNet50 weights with a new 79.038 result from further JSD / AugMix experiments. Full command line for reproduction in training section below. + +### Jan 11/12, 2020 + +* Master may be a bit unstable wrt to training, these changes have been tested but not all combos +* Implementations of AugMix added to existing RA and AA. Including numerous supporting pieces like JSD loss (Jensen-Shannon divergence + CE), and AugMixDataset +* SplitBatchNorm adaptation layer added for implementing Auxiliary BN as per AdvProp paper +* ResNet-50 AugMix trained model w/ 79% top-1 added +* `seresnext26tn_32x4d` - 77.99 top-1, 93.75 top-5 added to tiered experiment, higher img/s than 't' and 'd' + +### Jan 3, 2020 + +* Add RandAugment trained EfficientNet-B0 weight with 77.7 top-1. Trained by [Michael Klachko](https://github.com/michaelklachko) with this code and recent hparams (see Training section) +* Add `avg_checkpoints.py` script for post training weight averaging and update all scripts with header docstrings and shebangs. + +### Dec 30, 2019 + +* Merge [Dushyant Mehta's](https://github.com/mehtadushy) PR for SelecSLS (Selective Short and Long Range Skip Connections) networks. Good GPU memory consumption and throughput. Original: https://github.com/mehtadushy/SelecSLS-Pytorch + +### Dec 28, 2019 + +* Add new model weights and training hparams (see Training Hparams section) + * `efficientnet_b3` - 81.5 top-1, 95.7 top-5 at default res/crop, 81.9, 95.8 at 320x320 1.0 crop-pct + * trained with RandAugment, ended up with an interesting but less than perfect result (see training section) + * `seresnext26d_32x4d`- 77.6 top-1, 93.6 top-5 + * deep stem (32, 32, 64), avgpool downsample + * stem/dowsample from bag-of-tricks paper + * `seresnext26t_32x4d`- 78.0 top-1, 93.7 top-5 + * deep tiered stem (24, 48, 64), avgpool downsample (a modified 'D' variant) + * stem sizing mods from Jeremy Howard and fastai devs discussing ResNet architecture experiments + +### Dec 23, 2019 + +* Add RandAugment trained MixNet-XL weights with 80.48 top-1. +* `--dist-bn` argument added to train.py, will distribute BN stats between nodes after each train epoch, before eval + +### Dec 4, 2019 + +* Added weights from the first training from scratch of an EfficientNet (B2) with my new RandAugment implementation. Much better than my previous B2 and very close to the official AdvProp ones (80.4 top-1, 95.08 top-5). + +### Nov 29, 2019 + +* Brought EfficientNet and MobileNetV3 up to date with my https://github.com/rwightman/gen-efficientnet-pytorch code. Torchscript and ONNX export compat excluded. + * AdvProp weights added + * Official TF MobileNetv3 weights added +* EfficientNet and MobileNetV3 hook based 'feature extraction' classes added. Will serve as basis for using models as backbones in obj detection/segmentation tasks. Lots more to be done here... +* HRNet classification models and weights added from https://github.com/HRNet/HRNet-Image-Classification +* Consistency in global pooling, `reset_classifer`, and `forward_features` across models + * `forward_features` always returns unpooled feature maps now +* Reasonable chance I broke something... let me know + +### Nov 22, 2019 + +* Add ImageNet training RandAugment implementation alongside AutoAugment. PyTorch Transform compatible format, using PIL. Currently training two EfficientNet models from scratch with promising results... will update. +* `drop-connect` cmd line arg finally added to `train.py`, no need to hack model fns. Works for efficientnet/mobilenetv3 based models, ignored otherwise. \ No newline at end of file diff --git a/hfdocs/source/changes.mdx b/hfdocs/source/changes.mdx new file mode 100644 index 00000000..93dc9fac --- /dev/null +++ b/hfdocs/source/changes.mdx @@ -0,0 +1,187 @@ +# Recent Changes + +### July 27, 2022 + +* All runtime benchmark and validation result csv files are up-to-date! +* A few more weights & model defs added: + * `darknetaa53` - 79.8 @ 256, 80.5 @ 288 + * `convnext_nano` - 80.8 @ 224, 81.5 @ 288 + * `cs3sedarknet_l` - 81.2 @ 256, 81.8 @ 288 + * `cs3darknet_x` - 81.8 @ 256, 82.2 @ 288 + * `cs3sedarknet_x` - 82.2 @ 256, 82.7 @ 288 + * `cs3edgenet_x` - 82.2 @ 256, 82.7 @ 288 + * `cs3se_edgenet_x` - 82.8 @ 256, 83.5 @ 320 +* `cs3*` weights above all trained on TPU w/ `bits_and_tpu` branch. Thanks to TRC program! +* Add output_stride=8 and 16 support to ConvNeXt (dilation) +* deit3 models not being able to resize pos_emb fixed +* Version 0.6.7 PyPi release (/w above bug fixes and new weighs since 0.6.5) + +### July 8, 2022 + +More models, more fixes + +* Official research models (w/ weights) added: + * EdgeNeXt from (https://github.com/mmaaz60/EdgeNeXt) + * MobileViT-V2 from (https://github.com/apple/ml-cvnets) + * DeiT III (Revenge of the ViT) from (https://github.com/facebookresearch/deit) +* My own models: + * Small `ResNet` defs added by request with 1 block repeats for both basic and bottleneck (resnet10 and resnet14) + * `CspNet` refactored with dataclass config, simplified CrossStage3 (`cs3`) option. These are closer to YOLO-v5+ backbone defs. + * More relative position vit fiddling. Two `srelpos` (shared relative position) models trained, and a medium w/ class token. + * Add an alternate downsample mode to EdgeNeXt and train a `small` model. Better than original small, but not their new USI trained weights. +* My own model weight results (all ImageNet-1k training) + * `resnet10t` - 66.5 @ 176, 68.3 @ 224 + * `resnet14t` - 71.3 @ 176, 72.3 @ 224 + * `resnetaa50` - 80.6 @ 224 , 81.6 @ 288 + * `darknet53` - 80.0 @ 256, 80.5 @ 288 + * `cs3darknet_m` - 77.0 @ 256, 77.6 @ 288 + * `cs3darknet_focus_m` - 76.7 @ 256, 77.3 @ 288 + * `cs3darknet_l` - 80.4 @ 256, 80.9 @ 288 + * `cs3darknet_focus_l` - 80.3 @ 256, 80.9 @ 288 + * `vit_srelpos_small_patch16_224` - 81.1 @ 224, 82.1 @ 320 + * `vit_srelpos_medium_patch16_224` - 82.3 @ 224, 83.1 @ 320 + * `vit_relpos_small_patch16_cls_224` - 82.6 @ 224, 83.6 @ 320 + * `edgnext_small_rw` - 79.6 @ 224, 80.4 @ 320 +* `cs3`, `darknet`, and `vit_*relpos` weights above all trained on TPU thanks to TRC program! Rest trained on overheating GPUs. +* Hugging Face Hub support fixes verified, demo notebook TBA +* Pretrained weights / configs can be loaded externally (ie from local disk) w/ support for head adaptation. +* Add support to change image extensions scanned by `timm` datasets/parsers. See (https://github.com/rwightman/pytorch-image-models/pull/1274#issuecomment-1178303103) +* Default ConvNeXt LayerNorm impl to use `F.layer_norm(x.permute(0, 2, 3, 1), ...).permute(0, 3, 1, 2)` via `LayerNorm2d` in all cases. + * a bit slower than previous custom impl on some hardware (ie Ampere w/ CL), but overall fewer regressions across wider HW / PyTorch version ranges. + * previous impl exists as `LayerNormExp2d` in `models/layers/norm.py` +* Numerous bug fixes +* Currently testing for imminent PyPi 0.6.x release +* LeViT pretraining of larger models still a WIP, they don't train well / easily without distillation. Time to add distill support (finally)? +* ImageNet-22k weight training + finetune ongoing, work on multi-weight support (slowly) chugging along (there are a LOT of weights, sigh) ... + +### May 13, 2022 + +* Official Swin-V2 models and weights added from (https://github.com/microsoft/Swin-Transformer). Cleaned up to support torchscript. +* Some refactoring for existing `timm` Swin-V2-CR impl, will likely do a bit more to bring parts closer to official and decide whether to merge some aspects. +* More Vision Transformer relative position / residual post-norm experiments (all trained on TPU thanks to TRC program) + * `vit_relpos_small_patch16_224` - 81.5 @ 224, 82.5 @ 320 -- rel pos, layer scale, no class token, avg pool + * `vit_relpos_medium_patch16_rpn_224` - 82.3 @ 224, 83.1 @ 320 -- rel pos + res-post-norm, no class token, avg pool + * `vit_relpos_medium_patch16_224` - 82.5 @ 224, 83.3 @ 320 -- rel pos, layer scale, no class token, avg pool + * `vit_relpos_base_patch16_gapcls_224` - 82.8 @ 224, 83.9 @ 320 -- rel pos, layer scale, class token, avg pool (by mistake) +* Bring 512 dim, 8-head 'medium' ViT model variant back to life (after using in a pre DeiT 'small' model for first ViT impl back in 2020) +* Add ViT relative position support for switching btw existing impl and some additions in official Swin-V2 impl for future trials +* Sequencer2D impl (https://arxiv.org/abs/2205.01972), added via PR from author (https://github.com/okojoalg) + +### May 2, 2022 + +* Vision Transformer experiments adding Relative Position (Swin-V2 log-coord) (`vision_transformer_relpos.py`) and Residual Post-Norm branches (from Swin-V2) (`vision_transformer*.py`) + * `vit_relpos_base_patch32_plus_rpn_256` - 79.5 @ 256, 80.6 @ 320 -- rel pos + extended width + res-post-norm, no class token, avg pool + * `vit_relpos_base_patch16_224` - 82.5 @ 224, 83.6 @ 320 -- rel pos, layer scale, no class token, avg pool + * `vit_base_patch16_rpn_224` - 82.3 @ 224 -- rel pos + res-post-norm, no class token, avg pool +* Vision Transformer refactor to remove representation layer that was only used in initial vit and rarely used since with newer pretrain (ie `How to Train Your ViT`) +* `vit_*` models support removal of class token, use of global average pool, use of fc_norm (ala beit, mae). + +### April 22, 2022 + +* `timm` models are now officially supported in [fast.ai](https://www.fast.ai/)! Just in time for the new Practical Deep Learning course. `timmdocs` documentation link updated to [timm.fast.ai](http://timm.fast.ai/). +* Two more model weights added in the TPU trained [series](https://github.com/rwightman/pytorch-image-models/releases/tag/v0.1-tpu-weights). Some In22k pretrain still in progress. + * `seresnext101d_32x8d` - 83.69 @ 224, 84.35 @ 288 + * `seresnextaa101d_32x8d` (anti-aliased w/ AvgPool2d) - 83.85 @ 224, 84.57 @ 288 + +### March 23, 2022 + +* Add `ParallelBlock` and `LayerScale` option to base vit models to support model configs in [Three things everyone should know about ViT](https://arxiv.org/abs/2203.09795) +* `convnext_tiny_hnf` (head norm first) weights trained with (close to) A2 recipe, 82.2% top-1, could do better with more epochs. + +### March 21, 2022 + +* Merge `norm_norm_norm`. **IMPORTANT** this update for a coming 0.6.x release will likely de-stabilize the master branch for a while. Branch [`0.5.x`](https://github.com/rwightman/pytorch-image-models/tree/0.5.x) or a previous 0.5.x release can be used if stability is required. +* Significant weights update (all TPU trained) as described in this [release](https://github.com/rwightman/pytorch-image-models/releases/tag/v0.1-tpu-weights) + * `regnety_040` - 82.3 @ 224, 82.96 @ 288 + * `regnety_064` - 83.0 @ 224, 83.65 @ 288 + * `regnety_080` - 83.17 @ 224, 83.86 @ 288 + * `regnetv_040` - 82.44 @ 224, 83.18 @ 288 (timm pre-act) + * `regnetv_064` - 83.1 @ 224, 83.71 @ 288 (timm pre-act) + * `regnetz_040` - 83.67 @ 256, 84.25 @ 320 + * `regnetz_040h` - 83.77 @ 256, 84.5 @ 320 (w/ extra fc in head) + * `resnetv2_50d_gn` - 80.8 @ 224, 81.96 @ 288 (pre-act GroupNorm) + * `resnetv2_50d_evos` 80.77 @ 224, 82.04 @ 288 (pre-act EvoNormS) + * `regnetz_c16_evos` - 81.9 @ 256, 82.64 @ 320 (EvoNormS) + * `regnetz_d8_evos` - 83.42 @ 256, 84.04 @ 320 (EvoNormS) + * `xception41p` - 82 @ 299 (timm pre-act) + * `xception65` - 83.17 @ 299 + * `xception65p` - 83.14 @ 299 (timm pre-act) + * `resnext101_64x4d` - 82.46 @ 224, 83.16 @ 288 + * `seresnext101_32x8d` - 83.57 @ 224, 84.270 @ 288 + * `resnetrs200` - 83.85 @ 256, 84.44 @ 320 +* HuggingFace hub support fixed w/ initial groundwork for allowing alternative 'config sources' for pretrained model definitions and weights (generic local file / remote url support soon) +* SwinTransformer-V2 implementation added. Submitted by [Christoph Reich](https://github.com/ChristophReich1996). Training experiments and model changes by myself are ongoing so expect compat breaks. +* Swin-S3 (AutoFormerV2) models / weights added from https://github.com/microsoft/Cream/tree/main/AutoFormerV2 +* MobileViT models w/ weights adapted from https://github.com/apple/ml-cvnets +* PoolFormer models w/ weights adapted from https://github.com/sail-sg/poolformer +* VOLO models w/ weights adapted from https://github.com/sail-sg/volo +* Significant work experimenting with non-BatchNorm norm layers such as EvoNorm, FilterResponseNorm, GroupNorm, etc +* Enhance support for alternate norm + act ('NormAct') layers added to a number of models, esp EfficientNet/MobileNetV3, RegNet, and aligned Xception +* Grouped conv support added to EfficientNet family +* Add 'group matching' API to all models to allow grouping model parameters for application of 'layer-wise' LR decay, lr scale added to LR scheduler +* Gradient checkpointing support added to many models +* `forward_head(x, pre_logits=False)` fn added to all models to allow separate calls of `forward_features` + `forward_head` +* All vision transformer and vision MLP models update to return non-pooled / non-token selected features from `foward_features`, for consistency with CNN models, token selection or pooling now applied in `forward_head` + +### Feb 2, 2022 + +* [Chris Hughes](https://github.com/Chris-hughes10) posted an exhaustive run through of `timm` on his blog yesterday. Well worth a read. [Getting Started with PyTorch Image Models (timm): A Practitioner’s Guide](https://towardsdatascience.com/getting-started-with-pytorch-image-models-timm-a-practitioners-guide-4e77b4bf9055) +* I'm currently prepping to merge the `norm_norm_norm` branch back to master (ver 0.6.x) in next week or so. + * The changes are more extensive than usual and may destabilize and break some model API use (aiming for full backwards compat). So, beware `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. + +### Jan 14, 2022 + +* Version 0.5.4 w/ release to be pushed to pypi. It's been a while since last pypi update and riskier changes will be merged to main branch soon.... +* Add ConvNeXT models /w weights from official impl (https://github.com/facebookresearch/ConvNeXt), a few perf tweaks, compatible with timm features +* Tried training a few small (~1.8-3M param) / mobile optimized models, a few are good so far, more on the way... + * `mnasnet_small` - 65.6 top-1 + * `mobilenetv2_050` - 65.9 + * `lcnet_100/075/050` - 72.1 / 68.8 / 63.1 + * `semnasnet_075` - 73 + * `fbnetv3_b/d/g` - 79.1 / 79.7 / 82.0 +* TinyNet models added by [rsomani95](https://github.com/rsomani95) +* LCNet added via MobileNetV3 architecture + +### Nov 22, 2021 + +* A number of updated weights anew new model defs + * `eca_halonext26ts` - 79.5 @ 256 + * `resnet50_gn` (new) - 80.1 @ 224, 81.3 @ 288 + * `resnet50` - 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](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-rsb-weights/resnet50_a1h2_176-001a1197.pth)) + * `resnext50_32x4d` - 81.1 @ 224, 82.0 @ 288 + * `sebotnet33ts_256` (new) - 81.2 @ 224 + * `lamhalobotnet50ts_256` - 81.5 @ 256 + * `halonet50ts` - 81.7 @ 256 + * `halo2botnet50ts_256` - 82.0 @ 256 + * `resnet101` - 82.0 @ 224, 82.8 @ 288 + * `resnetv2_101` (new) - 82.1 @ 224, 83.0 @ 288 + * `resnet152` - 82.8 @ 224, 83.5 @ 288 + * `regnetz_d8` (new) - 83.5 @ 256, 84.0 @ 320 + * `regnetz_e8` (new) - 84.5 @ 256, 85.0 @ 320 +* `vit_base_patch8_224` (85.8 top-1) & `in21k` variant weights added thanks [Martins Bruveris](https://github.com/martinsbruveris) +* Groundwork in for FX feature extraction thanks to [Alexander Soare](https://github.com/alexander-soare) + * models updated for tracing compatibility (almost full support with some distlled transformer exceptions) + +### Oct 19, 2021 + +* ResNet strikes back (https://arxiv.org/abs/2110.00476) weights added, plus any extra training components used. Model weights and some more details here (https://github.com/rwightman/pytorch-image-models/releases/tag/v0.1-rsb-weights) +* BCE loss and Repeated Augmentation support for RSB paper +* 4 series of ResNet based attention model experiments being added (implemented across byobnet.py/byoanet.py). These include all sorts of attention, from channel attn like SE, ECA to 2D QKV self-attention layers such as Halo, Bottlneck, Lambda. Details here (https://github.com/rwightman/pytorch-image-models/releases/tag/v0.1-attn-weights) +* Working implementations of the following 2D self-attention modules (likely to be differences from paper or eventual official impl): + * Halo (https://arxiv.org/abs/2103.12731) + * Bottleneck Transformer (https://arxiv.org/abs/2101.11605) + * LambdaNetworks (https://arxiv.org/abs/2102.08602) +* A RegNetZ series of models with some attention experiments (being added to). These do not follow the paper (https://arxiv.org/abs/2103.06877) in any way other than block architecture, details of official models are not available. See more here (https://github.com/rwightman/pytorch-image-models/releases/tag/v0.1-attn-weights) +* ConvMixer (https://openreview.net/forum?id=TVHS5Y4dNvM), CrossVit (https://arxiv.org/abs/2103.14899), and BeiT (https://arxiv.org/abs/2106.08254) architectures + weights added +* freeze/unfreeze helpers by [Alexander Soare](https://github.com/alexander-soare) + +### Aug 18, 2021 + +* Optimizer bonanza! + * Add LAMB and LARS optimizers, incl trust ratio clipping options. Tweaked to work properly in PyTorch XLA (tested on TPUs w/ `timm bits` [branch](https://github.com/rwightman/pytorch-image-models/tree/bits_and_tpu/timm/bits)) + * Add MADGRAD from FB research w/ a few tweaks (decoupled decay option, step handling that works with PyTorch XLA) + * Some cleanup on all optimizers and factory. No more `.data`, a bit more consistency, unit tests for all! + * SGDP and AdamP still won't work with PyTorch XLA but others should (have yet to test Adabelief, Adafactor, Adahessian myself). +* EfficientNet-V2 XL TF ported weights added, but they don't validate well in PyTorch (L is better). The pre-processing for the V2 TF training is a bit diff and the fine-tuned 21k -> 1k weights are very sensitive and less robust than the 1k weights. +* Added PyTorch trained EfficientNet-V2 'Tiny' w/ GlobalContext attn weights. Only .1-.2 top-1 better than the SE so more of a curiosity for those interested. diff --git a/hfdocs/source/feature_extraction.mdx b/hfdocs/source/feature_extraction.mdx new file mode 100644 index 00000000..f625d191 --- /dev/null +++ b/hfdocs/source/feature_extraction.mdx @@ -0,0 +1,196 @@ +# Feature Extraction + +All of the models in `timm` have consistent mechanisms for obtaining various types of features from the model for tasks besides classification. + +## Penultimate Layer Features (Pre-Classifier Features) + +The features from the penultimate model layer can be obtained in several ways without requiring model surgery (although feel free to do surgery). One must first decide if they want pooled or un-pooled features. + +### Unpooled + +There are three ways to obtain unpooled features. + +Without modifying the network, one can call `model.forward_features(input)` on any model instead of the usual `model(input)`. This will bypass the head classifier and global pooling for networks. + +If one wants to explicitly modify the network to return unpooled features, they can either create the model without a classifier and pooling, or remove it later. Both paths remove the parameters associated with the classifier from the network. + +#### forward_features() + +```py +>>> import torch +>>> import timm +>>> m = timm.create_model('xception41', pretrained=True) +>>> o = m(torch.randn(2, 3, 299, 299)) +>>> print(f'Original shape: {o.shape}') +>>> o = m.forward_features(torch.randn(2, 3, 299, 299)) +>>> print(f'Unpooled shape: {o.shape}') +``` + +Output: + +```text +Original shape: torch.Size([2, 1000]) +Unpooled shape: torch.Size([2, 2048, 10, 10]) +``` + +#### Create with no classifier and pooling + +```py +>>> import torch +>>> import timm +>>> m = timm.create_model('resnet50', pretrained=True, num_classes=0, global_pool='') +>>> o = m(torch.randn(2, 3, 224, 224)) +>>> print(f'Unpooled shape: {o.shape}') +``` + +Output: + +```text +Unpooled shape: torch.Size([2, 2048, 7, 7]) +``` + +#### Remove it later + +```py +>>> import torch +>>> import timm +>>> m = timm.create_model('densenet121', pretrained=True) +>>> o = m(torch.randn(2, 3, 224, 224)) +>>> print(f'Original shape: {o.shape}') +>>> m.reset_classifier(0, '') +>>> o = m(torch.randn(2, 3, 224, 224)) +>>> print(f'Unpooled shape: {o.shape}') +``` + +Output: + +```text +Original shape: torch.Size([2, 1000]) +Unpooled shape: torch.Size([2, 1024, 7, 7]) +``` + +### Pooled + +To modify the network to return pooled features, one can use `forward_features()` and pool/flatten the result themselves, or modify the network like above but keep pooling intact. + +#### Create with no classifier + +```py +>>> import torch +>>> import timm +>>> m = timm.create_model('resnet50', pretrained=True, num_classes=0) +>>> o = m(torch.randn(2, 3, 224, 224)) +>>> print(f'Pooled shape: {o.shape}') +``` + +Output: + +```text +Pooled shape: torch.Size([2, 2048]) +``` + +#### Remove it later + +```py +>>> import torch +>>> import timm +>>> m = timm.create_model('ese_vovnet19b_dw', pretrained=True) +>>> o = m(torch.randn(2, 3, 224, 224)) +>>> print(f'Original shape: {o.shape}') +>>> m.reset_classifier(0) +>>> o = m(torch.randn(2, 3, 224, 224)) +>>> print(f'Pooled shape: {o.shape}') +``` + +Output: + +```text +Original shape: torch.Size([2, 1000]) +Pooled shape: torch.Size([2, 1024]) +``` + + +## Multi-scale Feature Maps (Feature Pyramid) + +Object detection, segmentation, keypoint, and a variety of dense pixel tasks require access to feature maps from the backbone network at multiple scales. This is often done by modifying the original classification network. Since each network varies quite a bit in structure, it's not uncommon to see only a few backbones supported in any given obj detection or segmentation library. + +`timm` allows a consistent interface for creating any of the included models as feature backbones that output feature maps for selected levels. + +A feature backbone can be created by adding the argument `features_only=True` to any `create_model` call. By default 5 strides will be output from most models (not all have that many), with the first starting at 2 (some start at 1 or 4). + +### Create a feature map extraction model + +```py +>>> import torch +>>> import timm +>>> m = timm.create_model('resnest26d', features_only=True, pretrained=True) +>>> o = m(torch.randn(2, 3, 224, 224)) +>>> for x in o: +... print(x.shape) +``` + +Output: + +```text +torch.Size([2, 64, 112, 112]) +torch.Size([2, 256, 56, 56]) +torch.Size([2, 512, 28, 28]) +torch.Size([2, 1024, 14, 14]) +torch.Size([2, 2048, 7, 7]) +``` + +### Query the feature information + +After a feature backbone has been created, it can be queried to provide channel or resolution reduction information to the downstream heads without requiring static config or hardcoded constants. The `.feature_info` attribute is a class encapsulating the information about the feature extraction points. + +```py +>>> import torch +>>> import timm +>>> m = timm.create_model('regnety_032', features_only=True, pretrained=True) +>>> print(f'Feature channels: {m.feature_info.channels()}') +>>> o = m(torch.randn(2, 3, 224, 224)) +>>> for x in o: +... print(x.shape) +``` + +Output: + +```text +Feature channels: [32, 72, 216, 576, 1512] +torch.Size([2, 32, 112, 112]) +torch.Size([2, 72, 56, 56]) +torch.Size([2, 216, 28, 28]) +torch.Size([2, 576, 14, 14]) +torch.Size([2, 1512, 7, 7]) +``` + +### Select specific feature levels or limit the stride + +There are two additional creation arguments impacting the output features. + +* `out_indices` selects which indices to output +* `output_stride` limits the feature output stride of the network (also works in classification mode BTW) + +`out_indices` is supported by all models, but not all models have the same index to feature stride mapping. Look at the code or check feature_info to compare. The out indices generally correspond to the `C(i+1)th` feature level (a `2^(i+1)` reduction). For most models, index 0 is the stride 2 features, and index 4 is stride 32. + +`output_stride` is achieved by converting layers to use dilated convolutions. Doing so is not always straightforward, some networks only support `output_stride=32`. + +```py +>>> import torch +>>> import timm +>>> m = timm.create_model('ecaresnet101d', features_only=True, output_stride=8, out_indices=(2, 4), pretrained=True) +>>> print(f'Feature channels: {m.feature_info.channels()}') +>>> print(f'Feature reduction: {m.feature_info.reduction()}') +>>> o = m(torch.randn(2, 3, 320, 320)) +>>> for x in o: +... print(x.shape) +``` + +Output: + +```text +Feature channels: [512, 2048] +Feature reduction: [8, 8] +torch.Size([2, 512, 40, 40]) +torch.Size([2, 2048, 40, 40]) +``` diff --git a/hfdocs/source/index.mdx b/hfdocs/source/index.mdx new file mode 100644 index 00000000..3733ae1e --- /dev/null +++ b/hfdocs/source/index.mdx @@ -0,0 +1,89 @@ +# Getting Started + +## Welcome + +Welcome to the `timm` documentation, a lean set of docs that covers the basics of `timm`. + +For a more comprehensive set of docs (currently under development), please visit [timmdocs](http://timm.fast.ai) by [Aman Arora](https://github.com/amaarora). + +## Install + +The library can be installed with pip: + +``` +pip install timm +``` + +I update the PyPi (pip) packages when I'm confident there are no significant model regressions from previous releases. If you want to pip install the bleeding edge from GitHub, use: +``` +pip install git+https://github.com/rwightman/pytorch-image-models.git +``` + +### Conda Environment + + + +- All development and testing has been done in Conda Python 3 environments on Linux x86-64 systems, specifically 3.7, 3.8, 3.9, 3.10 + +- Little to no care has been taken to be Python 2.x friendly and will not support it. If you run into any challenges running on Windows, or other OS, I'm definitely open to looking into those issues so long as it's in a reproducible (read Conda) environment. + +- PyTorch versions 1.9, 1.10, 1.11 have been tested with the latest versions of this code. + + + +I've tried to keep the dependencies minimal, the setup is as per the PyTorch default install instructions for Conda: + +```bash +conda create -n torch-env +conda activate torch-env +conda install pytorch torchvision cudatoolkit=11.3 -c pytorch +conda install pyyaml +``` + +## Load a Pretrained Model + +Pretrained models can be loaded using `timm.create_model` + +```py +>>> import timm + +>>> m = timm.create_model('mobilenetv3_large_100', pretrained=True) +>>> m.eval() +``` + +## List Models with Pretrained Weights + +```py +>>> import timm +>>> from pprint import pprint +>>> model_names = timm.list_models(pretrained=True) +>>> pprint(model_names) +[ + 'adv_inception_v3', + 'cspdarknet53', + 'cspresnext50', + 'densenet121', + 'densenet161', + 'densenet169', + 'densenet201', + 'densenetblur121d', + 'dla34', + 'dla46_c', +] +``` + +## List Model Architectures by Wildcard + +```py +>>> import timm +>>> from pprint import pprint +>>> model_names = timm.list_models('*resne*t*') +>>> pprint(model_names) +[ + 'cspresnet50', + 'cspresnet50d', + 'cspresnet50w', + 'cspresnext50', + ... +] +``` diff --git a/hfdocs/source/model_pages.mdx b/hfdocs/source/model_pages.mdx new file mode 100644 index 00000000..a78663f1 --- /dev/null +++ b/hfdocs/source/model_pages.mdx @@ -0,0 +1,5 @@ +# Available Models + +`timm` comes bundled with a number of model architectures and corresponding pretrained models. + +In these pages, you will find the models available in the `timm` library, as well as information on how to use them. \ No newline at end of file diff --git a/hfdocs/source/models.mdx b/hfdocs/source/models.mdx new file mode 100644 index 00000000..c993f887 --- /dev/null +++ b/hfdocs/source/models.mdx @@ -0,0 +1,230 @@ +# Model Summaries + +The model architectures included come from a wide variety of sources. Sources, including papers, original impl ("reference code") that I rewrote / adapted, and PyTorch impl that I leveraged directly ("code") are listed below. + +Most included models have pretrained weights. The weights are either: + +1. from their original sources +2. ported by myself from their original impl in a different framework (e.g. Tensorflow models) +3. trained from scratch using the included training script + +The validation results for the pretrained weights are [here](results) + +A more exciting view (with pretty pictures) of the models within `timm` can be found at [paperswithcode](https://paperswithcode.com/lib/timm). + +## Big Transfer ResNetV2 (BiT) + +* Implementation: [resnetv2.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/resnetv2.py) +* Paper: `Big Transfer (BiT): General Visual Representation Learning` - https://arxiv.org/abs/1912.11370 +* Reference code: https://github.com/google-research/big_transfer + +## Cross-Stage Partial Networks + +* Implementation: [cspnet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/cspnet.py) +* Paper: `CSPNet: A New Backbone that can Enhance Learning Capability of CNN` - https://arxiv.org/abs/1911.11929 +* Reference impl: https://github.com/WongKinYiu/CrossStagePartialNetworks + +## DenseNet + +* Implementation: [densenet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/densenet.py) +* Paper: `Densely Connected Convolutional Networks` - https://arxiv.org/abs/1608.06993 +* Code: https://github.com/pytorch/vision/tree/master/torchvision/models + +## DLA + +* Implementation: [dla.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/dla.py) +* Paper: https://arxiv.org/abs/1707.06484 +* Code: https://github.com/ucbdrive/dla + +## Dual-Path Networks + +* Implementation: [dpn.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/dpn.py) +* Paper: `Dual Path Networks` - https://arxiv.org/abs/1707.01629 +* My PyTorch code: https://github.com/rwightman/pytorch-dpn-pretrained +* Reference code: https://github.com/cypw/DPNs + +## GPU-Efficient Networks + +* Implementation: [byobnet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/byobnet.py) +* Paper: `Neural Architecture Design for GPU-Efficient Networks` - https://arxiv.org/abs/2006.14090 +* Reference code: https://github.com/idstcv/GPU-Efficient-Networks + +## HRNet + +* Implementation: [hrnet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/hrnet.py) +* Paper: `Deep High-Resolution Representation Learning for Visual Recognition` - https://arxiv.org/abs/1908.07919 +* Code: https://github.com/HRNet/HRNet-Image-Classification + +## Inception-V3 + +* Implementation: [inception_v3.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/inception_v3.py) +* Paper: `Rethinking the Inception Architecture for Computer Vision` - https://arxiv.org/abs/1512.00567 +* Code: https://github.com/pytorch/vision/tree/master/torchvision/models + +## Inception-V4 + +* Implementation: [inception_v4.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/inception_v4.py) +* Paper: `Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning` - https://arxiv.org/abs/1602.07261 +* Code: https://github.com/Cadene/pretrained-models.pytorch +* Reference code: https://github.com/tensorflow/models/tree/master/research/slim/nets + +## Inception-ResNet-V2 + +* Implementation: [inception_resnet_v2.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/inception_resnet_v2.py) +* Paper: `Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning` - https://arxiv.org/abs/1602.07261 +* Code: https://github.com/Cadene/pretrained-models.pytorch +* Reference code: https://github.com/tensorflow/models/tree/master/research/slim/nets + +## NASNet-A + +* Implementation: [nasnet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/nasnet.py) +* Papers: `Learning Transferable Architectures for Scalable Image Recognition` - https://arxiv.org/abs/1707.07012 +* Code: https://github.com/Cadene/pretrained-models.pytorch +* Reference code: https://github.com/tensorflow/models/tree/master/research/slim/nets/nasnet + +## PNasNet-5 + +* Implementation: [pnasnet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/pnasnet.py) +* Papers: `Progressive Neural Architecture Search` - https://arxiv.org/abs/1712.00559 +* Code: https://github.com/Cadene/pretrained-models.pytorch +* Reference code: https://github.com/tensorflow/models/tree/master/research/slim/nets/nasnet + +## EfficientNet + +* Implementation: [efficientnet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/efficientnet.py) +* Papers: + * EfficientNet NoisyStudent (B0-B7, L2) - https://arxiv.org/abs/1911.04252 + * EfficientNet AdvProp (B0-B8) - https://arxiv.org/abs/1911.09665 + * EfficientNet (B0-B7) - https://arxiv.org/abs/1905.11946 + * EfficientNet-EdgeTPU (S, M, L) - https://ai.googleblog.com/2019/08/efficientnet-edgetpu-creating.html + * MixNet - https://arxiv.org/abs/1907.09595 + * MNASNet B1, A1 (Squeeze-Excite), and Small - https://arxiv.org/abs/1807.11626 + * MobileNet-V2 - https://arxiv.org/abs/1801.04381 + * FBNet-C - https://arxiv.org/abs/1812.03443 + * Single-Path NAS - https://arxiv.org/abs/1904.02877 +* My PyTorch code: https://github.com/rwightman/gen-efficientnet-pytorch +* Reference code: https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet + +## MobileNet-V3 + +* Implementation: [mobilenetv3.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/mobilenetv3.py) +* Paper: `Searching for MobileNetV3` - https://arxiv.org/abs/1905.02244 +* Reference code: https://github.com/tensorflow/models/tree/master/research/slim/nets/mobilenet + +## RegNet + +* Implementation: [regnet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/regnet.py) +* Paper: `Designing Network Design Spaces` - https://arxiv.org/abs/2003.13678 +* Reference code: https://github.com/facebookresearch/pycls/blob/master/pycls/models/regnet.py + +## RepVGG + +* Implementation: [byobnet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/byobnet.py) +* Paper: `Making VGG-style ConvNets Great Again` - https://arxiv.org/abs/2101.03697 +* Reference code: https://github.com/DingXiaoH/RepVGG + +## ResNet, ResNeXt + +* Implementation: [resnet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/resnet.py) + +* ResNet (V1B) + * Paper: `Deep Residual Learning for Image Recognition` - https://arxiv.org/abs/1512.03385 + * Code: https://github.com/pytorch/vision/tree/master/torchvision/models +* ResNeXt + * Paper: `Aggregated Residual Transformations for Deep Neural Networks` - https://arxiv.org/abs/1611.05431 + * Code: https://github.com/pytorch/vision/tree/master/torchvision/models +* 'Bag of Tricks' / Gluon C, D, E, S ResNet variants + * Paper: `Bag of Tricks for Image Classification with CNNs` - https://arxiv.org/abs/1812.01187 + * Code: https://github.com/dmlc/gluon-cv/blob/master/gluoncv/model_zoo/resnetv1b.py +* Instagram pretrained / ImageNet tuned ResNeXt101 + * Paper: `Exploring the Limits of Weakly Supervised Pretraining` - https://arxiv.org/abs/1805.00932 + * Weights: https://pytorch.org/hub/facebookresearch_WSL-Images_resnext (NOTE: CC BY-NC 4.0 License, NOT commercial friendly) +* Semi-supervised (SSL) / Semi-weakly Supervised (SWSL) ResNet and ResNeXts + * Paper: `Billion-scale semi-supervised learning for image classification` - https://arxiv.org/abs/1905.00546 + * Weights: https://github.com/facebookresearch/semi-supervised-ImageNet1K-models (NOTE: CC BY-NC 4.0 License, NOT commercial friendly) +* Squeeze-and-Excitation Networks + * Paper: `Squeeze-and-Excitation Networks` - https://arxiv.org/abs/1709.01507 + * Code: Added to ResNet base, this is current version going forward, old `senet.py` is being deprecated +* ECAResNet (ECA-Net) + * Paper: `ECA-Net: Efficient Channel Attention for Deep CNN` - https://arxiv.org/abs/1910.03151v4 + * Code: Added to ResNet base, ECA module contributed by @VRandme, reference https://github.com/BangguWu/ECANet + +## Res2Net + +* Implementation: [res2net.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/res2net.py) +* Paper: `Res2Net: A New Multi-scale Backbone Architecture` - https://arxiv.org/abs/1904.01169 +* Code: https://github.com/gasvn/Res2Net + +## ResNeSt + +* Implementation: [resnest.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/resnest.py) +* Paper: `ResNeSt: Split-Attention Networks` - https://arxiv.org/abs/2004.08955 +* Code: https://github.com/zhanghang1989/ResNeSt + +## ReXNet + +* Implementation: [rexnet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/rexnet.py) +* Paper: `ReXNet: Diminishing Representational Bottleneck on CNN` - https://arxiv.org/abs/2007.00992 +* Code: https://github.com/clovaai/rexnet + +## Selective-Kernel Networks + +* Implementation: [sknet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/sknet.py) +* Paper: `Selective-Kernel Networks` - https://arxiv.org/abs/1903.06586 +* Code: https://github.com/implus/SKNet, https://github.com/clovaai/assembled-cnn + +## SelecSLS + +* Implementation: [selecsls.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/selecsls.py) +* Paper: `XNect: Real-time Multi-Person 3D Motion Capture with a Single RGB Camera` - https://arxiv.org/abs/1907.00837 +* Code: https://github.com/mehtadushy/SelecSLS-Pytorch + +## Squeeze-and-Excitation Networks + +* Implementation: [senet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/senet.py) +NOTE: I am deprecating this version of the networks, the new ones are part of `resnet.py` + +* Paper: `Squeeze-and-Excitation Networks` - https://arxiv.org/abs/1709.01507 +* Code: https://github.com/Cadene/pretrained-models.pytorch + +## TResNet + +* Implementation: [tresnet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/tresnet.py) +* Paper: `TResNet: High Performance GPU-Dedicated Architecture` - https://arxiv.org/abs/2003.13630 +* Code: https://github.com/mrT23/TResNet + +## VGG + +* Implementation: [vgg.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/vgg.py) +* Paper: `Very Deep Convolutional Networks For Large-Scale Image Recognition` - https://arxiv.org/pdf/1409.1556.pdf +* Reference code: https://github.com/pytorch/vision/blob/master/torchvision/models/vgg.py + +## Vision Transformer + +* Implementation: [vision_transformer.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/vision_transformer.py) +* Paper: `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` - https://arxiv.org/abs/2010.11929 +* Reference code and pretrained weights: https://github.com/google-research/vision_transformer + +## VovNet V2 and V1 + +* Implementation: [vovnet.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/vovnet.py) +* Paper: `CenterMask : Real-Time Anchor-Free Instance Segmentation` - https://arxiv.org/abs/1911.06667 +* Reference code: https://github.com/youngwanLEE/vovnet-detectron2 + +## Xception + +* Implementation: [xception.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/xception.py) +* Paper: `Xception: Deep Learning with Depthwise Separable Convolutions` - https://arxiv.org/abs/1610.02357 +* Code: https://github.com/Cadene/pretrained-models.pytorch + +## Xception (Modified Aligned, Gluon) + +* Implementation: [gluon_xception.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/gluon_xception.py) +* Paper: `Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation` - https://arxiv.org/abs/1802.02611 +* Reference code: https://github.com/dmlc/gluon-cv/tree/master/gluoncv/model_zoo, https://github.com/jfzhang95/pytorch-deeplab-xception/ + +## Xception (Modified Aligned, TF) + +* Implementation: [aligned_xception.py](https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/aligned_xception.py) +* Paper: `Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation` - https://arxiv.org/abs/1802.02611 +* Reference code: https://github.com/tensorflow/models/tree/master/research/deeplab diff --git a/hfdocs/source/models/adversarial-inception-v3.mdx b/hfdocs/source/models/adversarial-inception-v3.mdx new file mode 100644 index 00000000..eb17342c --- /dev/null +++ b/hfdocs/source/models/adversarial-inception-v3.mdx @@ -0,0 +1,165 @@ +# Adversarial Inception v3 + +**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifer](https://paperswithcode.com/method/auxiliary-classifier) to propagate label information lower down the network (along with the use of batch normalization for layers in the sidehead). The key building block is an [Inception Module](https://paperswithcode.com/method/inception-v3-module). + +This particular model was trained for study of adversarial examples (adversarial training). + +The weights from this model were ported from [Tensorflow/Models](https://github.com/tensorflow/models). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('adv_inception_v3', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `adv_inception_v3`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('adv_inception_v3', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/abs-1804-00097, + author = {Alexey Kurakin and + Ian J. Goodfellow and + Samy Bengio and + Yinpeng Dong and + Fangzhou Liao and + Ming Liang and + Tianyu Pang and + Jun Zhu and + Xiaolin Hu and + Cihang Xie and + Jianyu Wang and + Zhishuai Zhang and + Zhou Ren and + Alan L. Yuille and + Sangxia Huang and + Yao Zhao and + Yuzhe Zhao and + Zhonglin Han and + Junjiajia Long and + Yerkebulan Berdibekov and + Takuya Akiba and + Seiya Tokui and + Motoki Abe}, + title = {Adversarial Attacks and Defences Competition}, + journal = {CoRR}, + volume = {abs/1804.00097}, + year = {2018}, + url = {http://arxiv.org/abs/1804.00097}, + archivePrefix = {arXiv}, + eprint = {1804.00097}, + timestamp = {Thu, 31 Oct 2019 16:31:22 +0100}, + biburl = {https://dblp.org/rec/journals/corr/abs-1804-00097.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/advprop.mdx b/hfdocs/source/models/advprop.mdx new file mode 100644 index 00000000..9a0ecfd7 --- /dev/null +++ b/hfdocs/source/models/advprop.mdx @@ -0,0 +1,524 @@ +# AdvProp (EfficientNet) + +**AdvProp** is an adversarial training scheme which treats adversarial examples as additional examples, to prevent overfitting. Key to the method is the usage of a separate auxiliary batch norm for adversarial examples, as they have different underlying distributions to normal examples. + +The weights from this model were ported from [Tensorflow/TPU](https://github.com/tensorflow/tpu). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('tf_efficientnet_b0_ap', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `tf_efficientnet_b0_ap`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('tf_efficientnet_b0_ap', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{xie2020adversarial, + title={Adversarial Examples Improve Image Recognition}, + author={Cihang Xie and Mingxing Tan and Boqing Gong and Jiang Wang and Alan Yuille and Quoc V. Le}, + year={2020}, + eprint={1911.09665}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/big-transfer.mdx b/hfdocs/source/models/big-transfer.mdx new file mode 100644 index 00000000..25f557d7 --- /dev/null +++ b/hfdocs/source/models/big-transfer.mdx @@ -0,0 +1,362 @@ +# Big Transfer (BiT) + +**Big Transfer (BiT)** is a type of pretraining recipe that pre-trains on a large supervised source dataset, and fine-tunes the weights on the target task. Models are trained on the JFT-300M dataset. The finetuned models contained in this collection are finetuned on ImageNet. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('resnetv2_101x1_bitm', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `resnetv2_101x1_bitm`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('resnetv2_101x1_bitm', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{kolesnikov2020big, + title={Big Transfer (BiT): General Visual Representation Learning}, + author={Alexander Kolesnikov and Lucas Beyer and Xiaohua Zhai and Joan Puigcerver and Jessica Yung and Sylvain Gelly and Neil Houlsby}, + year={2020}, + eprint={1912.11370}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/csp-darknet.mdx b/hfdocs/source/models/csp-darknet.mdx new file mode 100644 index 00000000..f6a0d38c --- /dev/null +++ b/hfdocs/source/models/csp-darknet.mdx @@ -0,0 +1,148 @@ +# CSP-DarkNet + +**CSPDarknet53** is a convolutional neural network and backbone for object detection that uses [DarkNet-53](https://paperswithcode.com/method/darknet-53). It employs a CSPNet strategy to partition the feature map of the base layer into two parts and then merges them through a cross-stage hierarchy. The use of a split and merge strategy allows for more gradient flow through the network. + +This CNN is used as the backbone for [YOLOv4](https://paperswithcode.com/method/yolov4). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('cspdarknet53', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `cspdarknet53`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('cspdarknet53', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{bochkovskiy2020yolov4, + title={YOLOv4: Optimal Speed and Accuracy of Object Detection}, + author={Alexey Bochkovskiy and Chien-Yao Wang and Hong-Yuan Mark Liao}, + year={2020}, + eprint={2004.10934}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/csp-resnet.mdx b/hfdocs/source/models/csp-resnet.mdx new file mode 100644 index 00000000..ae8f0ea3 --- /dev/null +++ b/hfdocs/source/models/csp-resnet.mdx @@ -0,0 +1,143 @@ +# CSP-ResNet + +**CSPResNet** is a convolutional neural network where we apply the Cross Stage Partial Network (CSPNet) approach to [ResNet](https://paperswithcode.com/method/resnet). The CSPNet partitions the feature map of the base layer into two parts and then merges them through a cross-stage hierarchy. The use of a split and merge strategy allows for more gradient flow through the network. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('cspresnet50', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `cspresnet50`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('cspresnet50', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{wang2019cspnet, + title={CSPNet: A New Backbone that can Enhance Learning Capability of CNN}, + author={Chien-Yao Wang and Hong-Yuan Mark Liao and I-Hau Yeh and Yueh-Hua Wu and Ping-Yang Chen and Jun-Wei Hsieh}, + year={2019}, + eprint={1911.11929}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/csp-resnext.mdx b/hfdocs/source/models/csp-resnext.mdx new file mode 100644 index 00000000..54f07d91 --- /dev/null +++ b/hfdocs/source/models/csp-resnext.mdx @@ -0,0 +1,144 @@ +# CSP-ResNeXt + +**CSPResNeXt** is a convolutional neural network where we apply the Cross Stage Partial Network (CSPNet) approach to [ResNeXt](https://paperswithcode.com/method/resnext). The CSPNet partitions the feature map of the base layer into two parts and then merges them through a cross-stage hierarchy. The use of a split and merge strategy allows for more gradient flow through the network. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('cspresnext50', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `cspresnext50`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('cspresnext50', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{wang2019cspnet, + title={CSPNet: A New Backbone that can Enhance Learning Capability of CNN}, + author={Chien-Yao Wang and Hong-Yuan Mark Liao and I-Hau Yeh and Yueh-Hua Wu and Ping-Yang Chen and Jun-Wei Hsieh}, + year={2019}, + eprint={1911.11929}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/densenet.mdx b/hfdocs/source/models/densenet.mdx new file mode 100644 index 00000000..ee6e5d1a --- /dev/null +++ b/hfdocs/source/models/densenet.mdx @@ -0,0 +1,372 @@ +# DenseNet + +**DenseNet** is a type of convolutional neural network that utilises dense connections between layers, through [Dense Blocks](http://www.paperswithcode.com/method/dense-block), where we connect *all layers* (with matching feature-map sizes) directly with each other. To preserve the feed-forward nature, each layer obtains additional inputs from all preceding layers and passes on its own feature-maps to all subsequent layers. + +The **DenseNet Blur** variant in this collection by Ross Wightman employs [Blur Pooling](http://www.paperswithcode.com/method/blur-pooling) + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('densenet121', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `densenet121`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('densenet121', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/HuangLW16a, + author = {Gao Huang and + Zhuang Liu and + Kilian Q. Weinberger}, + title = {Densely Connected Convolutional Networks}, + journal = {CoRR}, + volume = {abs/1608.06993}, + year = {2016}, + url = {http://arxiv.org/abs/1608.06993}, + archivePrefix = {arXiv}, + eprint = {1608.06993}, + timestamp = {Mon, 10 Sep 2018 15:49:32 +0200}, + biburl = {https://dblp.org/rec/journals/corr/HuangLW16a.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + +``` +@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}} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/dla.mdx b/hfdocs/source/models/dla.mdx new file mode 100644 index 00000000..e7e4673d --- /dev/null +++ b/hfdocs/source/models/dla.mdx @@ -0,0 +1,612 @@ +# Deep Layer Aggregation + +Extending “shallow” skip connections, **Dense Layer Aggregation (DLA)** incorporates more depth and sharing. The authors introduce two structures for deep layer aggregation (DLA): iterative deep aggregation (IDA) and hierarchical deep aggregation (HDA). These structures are expressed through an architectural framework, independent of the choice of backbone, for compatibility with current and future networks. + +IDA focuses on fusing resolutions and scales while HDA focuses on merging features from all modules and channels. IDA follows the base hierarchy to refine resolution and aggregate scale stage-bystage. HDA assembles its own hierarchy of tree-structured connections that cross and merge stages to aggregate different levels of representation. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('dla102', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `dla102`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('dla102', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{yu2019deep, + title={Deep Layer Aggregation}, + author={Fisher Yu and Dequan Wang and Evan Shelhamer and Trevor Darrell}, + year={2019}, + eprint={1707.06484}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/dpn.mdx b/hfdocs/source/models/dpn.mdx new file mode 100644 index 00000000..b7c9dbbb --- /dev/null +++ b/hfdocs/source/models/dpn.mdx @@ -0,0 +1,323 @@ +# Dual Path Network (DPN) + +A **Dual Path Network (DPN)** is a convolutional neural network which presents a new topology of connection paths internally. The intuition is that [ResNets](https://paperswithcode.com/method/resnet) enables feature re-usage while DenseNet enables new feature exploration, and both are important for learning good representations. To enjoy the benefits from both path topologies, Dual Path Networks share common features while maintaining the flexibility to explore new features through dual path architectures. + +The principal building block is an [DPN Block](https://paperswithcode.com/method/dpn-block). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('dpn107', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `dpn107`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('dpn107', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{chen2017dual, + title={Dual Path Networks}, + author={Yunpeng Chen and Jianan Li and Huaxin Xiao and Xiaojie Jin and Shuicheng Yan and Jiashi Feng}, + year={2017}, + eprint={1707.01629}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/ecaresnet.mdx b/hfdocs/source/models/ecaresnet.mdx new file mode 100644 index 00000000..3dd25371 --- /dev/null +++ b/hfdocs/source/models/ecaresnet.mdx @@ -0,0 +1,303 @@ +# ECA-ResNet + +An **ECA ResNet** is a variant on a [ResNet](https://paperswithcode.com/method/resnet) that utilises an [Efficient Channel Attention module](https://paperswithcode.com/method/efficient-channel-attention). Efficient Channel Attention is an architectural unit based on [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block) that reduces model complexity without dimensionality reduction. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('ecaresnet101d', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `ecaresnet101d`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('ecaresnet101d', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{wang2020ecanet, + title={ECA-Net: Efficient Channel Attention for Deep Convolutional Neural Networks}, + author={Qilong Wang and Banggu Wu and Pengfei Zhu and Peihua Li and Wangmeng Zuo and Qinghua Hu}, + year={2020}, + eprint={1910.03151}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/efficientnet-pruned.mdx b/hfdocs/source/models/efficientnet-pruned.mdx new file mode 100644 index 00000000..90f7f1aa --- /dev/null +++ b/hfdocs/source/models/efficientnet-pruned.mdx @@ -0,0 +1,212 @@ +# EfficientNet (Knapsack Pruned) + +**EfficientNet** is a convolutional neural network architecture and scaling method that uniformly scales all dimensions of depth/width/resolution using a *compound coefficient*. Unlike conventional practice that arbitrary scales these factors, the EfficientNet scaling method uniformly scales network width, depth, and resolution with a set of fixed scaling coefficients. For example, if we want to use $2^N$ times more computational resources, then we can simply increase the network depth by $\alpha ^ N$, width by $\beta ^ N$, and image size by $\gamma ^ N$, where $\alpha, \beta, \gamma$ are constant coefficients determined by a small grid search on the original small model. EfficientNet uses a compound coefficient $\phi$ to uniformly scales network width, depth, and resolution in a principled way. + +The compound scaling method is justified by the intuition that if the input image is bigger, then the network needs more layers to increase the receptive field and more channels to capture more fine-grained patterns on the bigger image. + +The base EfficientNet-B0 network is based on the inverted bottleneck residual blocks of [MobileNetV2](https://paperswithcode.com/method/mobilenetv2), in addition to [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block). + +This collection consists of pruned EfficientNet models. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('efficientnet_b1_pruned', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `efficientnet_b1_pruned`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('efficientnet_b1_pruned', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{tan2020efficientnet, + title={EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks}, + author={Mingxing Tan and Quoc V. Le}, + year={2020}, + eprint={1905.11946}, + archivePrefix={arXiv}, + primaryClass={cs.LG} +} +``` + +``` +@misc{aflalo2020knapsack, + title={Knapsack Pruning with Inner Distillation}, + author={Yonathan Aflalo and Asaf Noy and Ming Lin and Itamar Friedman and Lihi Zelnik}, + year={2020}, + eprint={2002.08258}, + archivePrefix={arXiv}, + primaryClass={cs.LG} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/efficientnet.mdx b/hfdocs/source/models/efficientnet.mdx new file mode 100644 index 00000000..21e6baaf --- /dev/null +++ b/hfdocs/source/models/efficientnet.mdx @@ -0,0 +1,392 @@ +# EfficientNet + +**EfficientNet** is a convolutional neural network architecture and scaling method that uniformly scales all dimensions of depth/width/resolution using a *compound coefficient*. Unlike conventional practice that arbitrary scales these factors, the EfficientNet scaling method uniformly scales network width, depth, and resolution with a set of fixed scaling coefficients. For example, if we want to use $2^N$ times more computational resources, then we can simply increase the network depth by $\alpha ^ N$, width by $\beta ^ N$, and image size by $\gamma ^ N$, where $\alpha, \beta, \gamma$ are constant coefficients determined by a small grid search on the original small model. EfficientNet uses a compound coefficient $\phi$ to uniformly scales network width, depth, and resolution in a principled way. + +The compound scaling method is justified by the intuition that if the input image is bigger, then the network needs more layers to increase the receptive field and more channels to capture more fine-grained patterns on the bigger image. + +The base EfficientNet-B0 network is based on the inverted bottleneck residual blocks of [MobileNetV2](https://paperswithcode.com/method/mobilenetv2), in addition to [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('efficientnet_b0', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `efficientnet_b0`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('efficientnet_b0', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{tan2020efficientnet, + title={EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks}, + author={Mingxing Tan and Quoc V. Le}, + year={2020}, + eprint={1905.11946}, + archivePrefix={arXiv}, + primaryClass={cs.LG} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/ensemble-adversarial.mdx b/hfdocs/source/models/ensemble-adversarial.mdx new file mode 100644 index 00000000..a20f43d9 --- /dev/null +++ b/hfdocs/source/models/ensemble-adversarial.mdx @@ -0,0 +1,165 @@ +# # Ensemble Adversarial Inception ResNet v2 + +**Inception-ResNet-v2** is a convolutional neural architecture that builds on the Inception family of architectures but incorporates [residual connections](https://paperswithcode.com/method/residual-connection) (replacing the filter concatenation stage of the Inception architecture). + +This particular model was trained for study of adversarial examples (adversarial training). + +The weights from this model were ported from [Tensorflow/Models](https://github.com/tensorflow/models). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('ens_adv_inception_resnet_v2', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `ens_adv_inception_resnet_v2`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('ens_adv_inception_resnet_v2', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/abs-1804-00097, + author = {Alexey Kurakin and + Ian J. Goodfellow and + Samy Bengio and + Yinpeng Dong and + Fangzhou Liao and + Ming Liang and + Tianyu Pang and + Jun Zhu and + Xiaolin Hu and + Cihang Xie and + Jianyu Wang and + Zhishuai Zhang and + Zhou Ren and + Alan L. Yuille and + Sangxia Huang and + Yao Zhao and + Yuzhe Zhao and + Zhonglin Han and + Junjiajia Long and + Yerkebulan Berdibekov and + Takuya Akiba and + Seiya Tokui and + Motoki Abe}, + title = {Adversarial Attacks and Defences Competition}, + journal = {CoRR}, + volume = {abs/1804.00097}, + year = {2018}, + url = {http://arxiv.org/abs/1804.00097}, + archivePrefix = {arXiv}, + eprint = {1804.00097}, + timestamp = {Thu, 31 Oct 2019 16:31:22 +0100}, + biburl = {https://dblp.org/rec/journals/corr/abs-1804-00097.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/ese-vovnet.mdx b/hfdocs/source/models/ese-vovnet.mdx new file mode 100644 index 00000000..8a854b1e --- /dev/null +++ b/hfdocs/source/models/ese-vovnet.mdx @@ -0,0 +1,159 @@ +# ESE-VoVNet + +**VoVNet** is a convolutional neural network that seeks to make [DenseNet](https://paperswithcode.com/method/densenet) more efficient by concatenating all features only once in the last feature map, which makes input size constant and enables enlarging new output channel. + +Read about [one-shot aggregation here](https://paperswithcode.com/method/one-shot-aggregation). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('ese_vovnet19b_dw', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `ese_vovnet19b_dw`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('ese_vovnet19b_dw', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{lee2019energy, + title={An Energy and GPU-Computation Efficient Backbone Network for Real-Time Object Detection}, + author={Youngwan Lee and Joong-won Hwang and Sangrok Lee and Yuseok Bae and Jongyoul Park}, + year={2019}, + eprint={1904.09730}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/fbnet.mdx b/hfdocs/source/models/fbnet.mdx new file mode 100644 index 00000000..dc355ee7 --- /dev/null +++ b/hfdocs/source/models/fbnet.mdx @@ -0,0 +1,143 @@ +# FBNet + +**FBNet** is a type of convolutional neural architectures discovered through [DNAS](https://paperswithcode.com/method/dnas) neural architecture search. It utilises a basic type of image model block inspired by [MobileNetv2](https://paperswithcode.com/method/mobilenetv2) that utilises depthwise convolutions and an inverted residual structure (see components). + +The principal building block is the [FBNet Block](https://paperswithcode.com/method/fbnet-block). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('fbnetc_100', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `fbnetc_100`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('fbnetc_100', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{wu2019fbnet, + title={FBNet: Hardware-Aware Efficient ConvNet Design via Differentiable Neural Architecture Search}, + author={Bichen Wu and Xiaoliang Dai and Peizhao Zhang and Yanghan Wang and Fei Sun and Yiming Wu and Yuandong Tian and Peter Vajda and Yangqing Jia and Kurt Keutzer}, + year={2019}, + eprint={1812.03443}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/gloun-inception-v3.mdx b/hfdocs/source/models/gloun-inception-v3.mdx new file mode 100644 index 00000000..0c287526 --- /dev/null +++ b/hfdocs/source/models/gloun-inception-v3.mdx @@ -0,0 +1,145 @@ +# (Gluon) Inception v3 + +**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifer](https://paperswithcode.com/method/auxiliary-classifier) to propagate label information lower down the network (along with the use of batch normalization for layers in the sidehead). The key building block is an [Inception Module](https://paperswithcode.com/method/inception-v3-module). + +The weights from this model were ported from [Gluon](https://cv.gluon.ai/model_zoo/classification.html). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('gluon_inception_v3', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `gluon_inception_v3`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('gluon_inception_v3', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/SzegedyVISW15, + author = {Christian Szegedy and + Vincent Vanhoucke and + Sergey Ioffe and + Jonathon Shlens and + Zbigniew Wojna}, + title = {Rethinking the Inception Architecture for Computer Vision}, + journal = {CoRR}, + volume = {abs/1512.00567}, + year = {2015}, + url = {http://arxiv.org/abs/1512.00567}, + archivePrefix = {arXiv}, + eprint = {1512.00567}, + timestamp = {Mon, 13 Aug 2018 16:49:07 +0200}, + biburl = {https://dblp.org/rec/journals/corr/SzegedyVISW15.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/gloun-resnet.mdx b/hfdocs/source/models/gloun-resnet.mdx new file mode 100644 index 00000000..ef9585ff --- /dev/null +++ b/hfdocs/source/models/gloun-resnet.mdx @@ -0,0 +1,571 @@ +# (Gluon) ResNet + +**Residual Networks**, or **ResNets**, learn residual functions with reference to the layer inputs, instead of learning unreferenced functions. Instead of hoping each few stacked layers directly fit a desired underlying mapping, residual nets let these layers fit a residual mapping. They stack [residual blocks](https://paperswithcode.com/method/residual-block) ontop of each other to form network: e.g. a ResNet-50 has fifty layers using these blocks. + +The weights from this model were ported from [Gluon](https://cv.gluon.ai/model_zoo/classification.html). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('gluon_resnet101_v1b', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `gluon_resnet101_v1b`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('gluon_resnet101_v1b', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/HeZRS15, + author = {Kaiming He and + Xiangyu Zhang and + Shaoqing Ren and + Jian Sun}, + title = {Deep Residual Learning for Image Recognition}, + journal = {CoRR}, + volume = {abs/1512.03385}, + year = {2015}, + url = {http://arxiv.org/abs/1512.03385}, + archivePrefix = {arXiv}, + eprint = {1512.03385}, + timestamp = {Wed, 17 Apr 2019 17:23:45 +0200}, + biburl = {https://dblp.org/rec/journals/corr/HeZRS15.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/gloun-resnext.mdx b/hfdocs/source/models/gloun-resnext.mdx new file mode 100644 index 00000000..4c8d64ab --- /dev/null +++ b/hfdocs/source/models/gloun-resnext.mdx @@ -0,0 +1,209 @@ +# (Gluon) ResNeXt + +A **ResNeXt** repeats a [building block](https://paperswithcode.com/method/resnext-block) that aggregates a set of transformations with the same topology. Compared to a [ResNet](https://paperswithcode.com/method/resnet), it exposes a new dimension, *cardinality* (the size of the set of transformations) $C$, as an essential factor in addition to the dimensions of depth and width. + +The weights from this model were ported from [Gluon](https://cv.gluon.ai/model_zoo/classification.html). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('gluon_resnext101_32x4d', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `gluon_resnext101_32x4d`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('gluon_resnext101_32x4d', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/XieGDTH16, + author = {Saining Xie and + Ross B. Girshick and + Piotr Doll{\'{a}}r and + Zhuowen Tu and + Kaiming He}, + title = {Aggregated Residual Transformations for Deep Neural Networks}, + journal = {CoRR}, + volume = {abs/1611.05431}, + year = {2016}, + url = {http://arxiv.org/abs/1611.05431}, + archivePrefix = {arXiv}, + eprint = {1611.05431}, + timestamp = {Mon, 13 Aug 2018 16:45:58 +0200}, + biburl = {https://dblp.org/rec/journals/corr/XieGDTH16.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/gloun-senet.mdx b/hfdocs/source/models/gloun-senet.mdx new file mode 100644 index 00000000..981cb644 --- /dev/null +++ b/hfdocs/source/models/gloun-senet.mdx @@ -0,0 +1,130 @@ +# (Gluon) SENet + +A **SENet** is a convolutional neural network architecture that employs [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block) to enable the network to perform dynamic channel-wise feature recalibration. + +The weights from this model were ported from [Gluon](https://cv.gluon.ai/model_zoo/classification.html). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('gluon_senet154', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `gluon_senet154`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('gluon_senet154', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{hu2019squeezeandexcitation, + title={Squeeze-and-Excitation Networks}, + author={Jie Hu and Li Shen and Samuel Albanie and Gang Sun and Enhua Wu}, + year={2019}, + eprint={1709.01507}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/gloun-seresnext.mdx b/hfdocs/source/models/gloun-seresnext.mdx new file mode 100644 index 00000000..409d36c1 --- /dev/null +++ b/hfdocs/source/models/gloun-seresnext.mdx @@ -0,0 +1,203 @@ +# (Gluon) SE-ResNeXt + +**SE ResNeXt** is a variant of a [ResNext](https://www.paperswithcode.com/method/resnext) that employs [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block) to enable the network to perform dynamic channel-wise feature recalibration. + +The weights from this model were ported from [Gluon](https://cv.gluon.ai/model_zoo/classification.html). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('gluon_seresnext101_32x4d', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `gluon_seresnext101_32x4d`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('gluon_seresnext101_32x4d', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{hu2019squeezeandexcitation, + title={Squeeze-and-Excitation Networks}, + author={Jie Hu and Li Shen and Samuel Albanie and Gang Sun and Enhua Wu}, + year={2019}, + eprint={1709.01507}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/gloun-xception.mdx b/hfdocs/source/models/gloun-xception.mdx new file mode 100644 index 00000000..f9f2df05 --- /dev/null +++ b/hfdocs/source/models/gloun-xception.mdx @@ -0,0 +1,133 @@ +# (Gluon) Xception + +**Xception** is a convolutional neural network architecture that relies solely on [depthwise separable convolution](https://paperswithcode.com/method/depthwise-separable-convolution) layers. + +The weights from this model were ported from [Gluon](https://cv.gluon.ai/model_zoo/classification.html). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('gluon_xception65', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `gluon_xception65`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('gluon_xception65', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{chollet2017xception, + title={Xception: Deep Learning with Depthwise Separable Convolutions}, + author={François Chollet}, + year={2017}, + eprint={1610.02357}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/hrnet.mdx b/hfdocs/source/models/hrnet.mdx new file mode 100644 index 00000000..b2fb918b --- /dev/null +++ b/hfdocs/source/models/hrnet.mdx @@ -0,0 +1,425 @@ +# HRNet + +**HRNet**, or **High-Resolution Net**, is a general purpose convolutional neural network for tasks like semantic segmentation, object detection and image classification. It is able to maintain high resolution representations through the whole process. We start from a high-resolution convolution stream, gradually add high-to-low resolution convolution streams one by one, and connect the multi-resolution streams in parallel. The resulting network consists of several ($4$ in the paper) stages and the $n$th stage contains $n$ streams corresponding to $n$ resolutions. The authors conduct repeated multi-resolution fusions by exchanging the information across the parallel streams over and over. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('hrnet_w18', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `hrnet_w18`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('hrnet_w18', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{sun2019highresolution, + title={High-Resolution Representations for Labeling Pixels and Regions}, + author={Ke Sun and Yang Zhao and Borui Jiang and Tianheng Cheng and Bin Xiao and Dong Liu and Yadong Mu and Xinggang Wang and Wenyu Liu and Jingdong Wang}, + year={2019}, + eprint={1904.04514}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/ig-resnext.mdx b/hfdocs/source/models/ig-resnext.mdx new file mode 100644 index 00000000..f16f3114 --- /dev/null +++ b/hfdocs/source/models/ig-resnext.mdx @@ -0,0 +1,276 @@ +# Instagram ResNeXt WSL + +A **ResNeXt** repeats a [building block](https://paperswithcode.com/method/resnext-block) that aggregates a set of transformations with the same topology. Compared to a [ResNet](https://paperswithcode.com/method/resnet), it exposes a new dimension, *cardinality* (the size of the set of transformations) $C$, as an essential factor in addition to the dimensions of depth and width. + +This model was trained on billions of Instagram images using thousands of distinct hashtags as labels exhibit excellent transfer learning performance. + +Please note the CC-BY-NC 4.0 license on theses weights, non-commercial use only. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('ig_resnext101_32x16d', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `ig_resnext101_32x16d`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('ig_resnext101_32x16d', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{mahajan2018exploring, + title={Exploring the Limits of Weakly Supervised Pretraining}, + author={Dhruv Mahajan and Ross Girshick and Vignesh Ramanathan and Kaiming He and Manohar Paluri and Yixuan Li and Ashwin Bharambe and Laurens van der Maaten}, + year={2018}, + eprint={1805.00932}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/inception-resnet-v2.mdx b/hfdocs/source/models/inception-resnet-v2.mdx new file mode 100644 index 00000000..e54166e9 --- /dev/null +++ b/hfdocs/source/models/inception-resnet-v2.mdx @@ -0,0 +1,139 @@ +# Inception ResNet v2 + +**Inception-ResNet-v2** is a convolutional neural architecture that builds on the Inception family of architectures but incorporates [residual connections](https://paperswithcode.com/method/residual-connection) (replacing the filter concatenation stage of the Inception architecture). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('inception_resnet_v2', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `inception_resnet_v2`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('inception_resnet_v2', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{szegedy2016inceptionv4, + title={Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning}, + author={Christian Szegedy and Sergey Ioffe and Vincent Vanhoucke and Alex Alemi}, + year={2016}, + eprint={1602.07261}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/inception-v3.mdx b/hfdocs/source/models/inception-v3.mdx new file mode 100644 index 00000000..4dae8aa2 --- /dev/null +++ b/hfdocs/source/models/inception-v3.mdx @@ -0,0 +1,152 @@ +# Inception v3 + +**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifer](https://paperswithcode.com/method/auxiliary-classifier) to propagate label information lower down the network (along with the use of batch normalization for layers in the sidehead). The key building block is an [Inception Module](https://paperswithcode.com/method/inception-v3-module). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('inception_v3', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `inception_v3`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('inception_v3', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/SzegedyVISW15, + author = {Christian Szegedy and + Vincent Vanhoucke and + Sergey Ioffe and + Jonathon Shlens and + Zbigniew Wojna}, + title = {Rethinking the Inception Architecture for Computer Vision}, + journal = {CoRR}, + volume = {abs/1512.00567}, + year = {2015}, + url = {http://arxiv.org/abs/1512.00567}, + archivePrefix = {arXiv}, + eprint = {1512.00567}, + timestamp = {Mon, 13 Aug 2018 16:49:07 +0200}, + biburl = {https://dblp.org/rec/journals/corr/SzegedyVISW15.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/inception-v4.mdx b/hfdocs/source/models/inception-v4.mdx new file mode 100644 index 00000000..f1721007 --- /dev/null +++ b/hfdocs/source/models/inception-v4.mdx @@ -0,0 +1,138 @@ +# Inception v4 + +**Inception-v4** is a convolutional neural network architecture that builds on previous iterations of the Inception family by simplifying the architecture and using more inception modules than [Inception-v3](https://paperswithcode.com/method/inception-v3). +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('inception_v4', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `inception_v4`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('inception_v4', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{szegedy2016inceptionv4, + title={Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning}, + author={Christian Szegedy and Sergey Ioffe and Vincent Vanhoucke and Alex Alemi}, + year={2016}, + eprint={1602.07261}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/legacy-se-resnet.mdx b/hfdocs/source/models/legacy-se-resnet.mdx new file mode 100644 index 00000000..bed5ed70 --- /dev/null +++ b/hfdocs/source/models/legacy-se-resnet.mdx @@ -0,0 +1,324 @@ +# (Legacy) SE-ResNet + +**SE ResNet** is a variant of a [ResNet](https://www.paperswithcode.com/method/resnet) that employs [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block) to enable the network to perform dynamic channel-wise feature recalibration. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('legacy_seresnet101', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `legacy_seresnet101`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('legacy_seresnet101', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{hu2019squeezeandexcitation, + title={Squeeze-and-Excitation Networks}, + author={Jie Hu and Li Shen and Samuel Albanie and Gang Sun and Enhua Wu}, + year={2019}, + eprint={1709.01507}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/legacy-se-resnext.mdx b/hfdocs/source/models/legacy-se-resnext.mdx new file mode 100644 index 00000000..33cfb63a --- /dev/null +++ b/hfdocs/source/models/legacy-se-resnext.mdx @@ -0,0 +1,234 @@ +# (Legacy) SE-ResNeXt + +**SE ResNeXt** is a variant of a [ResNeXt](https://www.paperswithcode.com/method/resnext) that employs [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block) to enable the network to perform dynamic channel-wise feature recalibration. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('legacy_seresnext101_32x4d', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `legacy_seresnext101_32x4d`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('legacy_seresnext101_32x4d', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{hu2019squeezeandexcitation, + title={Squeeze-and-Excitation Networks}, + author={Jie Hu and Li Shen and Samuel Albanie and Gang Sun and Enhua Wu}, + year={2019}, + eprint={1709.01507}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/legacy-senet.mdx b/hfdocs/source/models/legacy-senet.mdx new file mode 100644 index 00000000..abe3ffcd --- /dev/null +++ b/hfdocs/source/models/legacy-senet.mdx @@ -0,0 +1,141 @@ +# (Legacy) SENet + +A **SENet** is a convolutional neural network architecture that employs [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block) to enable the network to perform dynamic channel-wise feature recalibration. + +The weights from this model were ported from Gluon. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('legacy_senet154', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `legacy_senet154`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('legacy_senet154', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{hu2019squeezeandexcitation, + title={Squeeze-and-Excitation Networks}, + author={Jie Hu and Li Shen and Samuel Albanie and Gang Sun and Enhua Wu}, + year={2019}, + eprint={1709.01507}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/mixnet.mdx b/hfdocs/source/models/mixnet.mdx new file mode 100644 index 00000000..ec62ec00 --- /dev/null +++ b/hfdocs/source/models/mixnet.mdx @@ -0,0 +1,231 @@ +# MixNet + +**MixNet** is a type of convolutional neural network discovered via AutoML that utilises [MixConvs](https://paperswithcode.com/method/mixconv) instead of regular [depthwise convolutions](https://paperswithcode.com/method/depthwise-convolution). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('mixnet_l', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `mixnet_l`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('mixnet_l', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{tan2019mixconv, + title={MixConv: Mixed Depthwise Convolutional Kernels}, + author={Mingxing Tan and Quoc V. Le}, + year={2019}, + eprint={1907.09595}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/mnasnet.mdx b/hfdocs/source/models/mnasnet.mdx new file mode 100644 index 00000000..c6be000a --- /dev/null +++ b/hfdocs/source/models/mnasnet.mdx @@ -0,0 +1,176 @@ +# MnasNet + +**MnasNet** is a type of convolutional neural network optimized for mobile devices that is discovered through mobile neural architecture search, which explicitly incorporates model latency into the main objective so that the search can identify a model that achieves a good trade-off between accuracy and latency. The main building block is an [inverted residual block](https://paperswithcode.com/method/inverted-residual-block) (from [MobileNetV2](https://paperswithcode.com/method/mobilenetv2)). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('mnasnet_100', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `mnasnet_100`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('mnasnet_100', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{tan2019mnasnet, + title={MnasNet: Platform-Aware Neural Architecture Search for Mobile}, + author={Mingxing Tan and Bo Chen and Ruoming Pang and Vijay Vasudevan and Mark Sandler and Andrew Howard and Quoc V. Le}, + year={2019}, + eprint={1807.11626}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/mobilenet-v2.mdx b/hfdocs/source/models/mobilenet-v2.mdx new file mode 100644 index 00000000..812f991d --- /dev/null +++ b/hfdocs/source/models/mobilenet-v2.mdx @@ -0,0 +1,277 @@ +# MobileNet v2 + +**MobileNetV2** is a convolutional neural network architecture that seeks to perform well on mobile devices. It is based on an [inverted residual structure](https://paperswithcode.com/method/inverted-residual-block) where the residual connections are between the bottleneck layers. The intermediate expansion layer uses lightweight depthwise convolutions to filter features as a source of non-linearity. As a whole, the architecture of MobileNetV2 contains the initial fully convolution layer with 32 filters, followed by 19 residual bottleneck layers. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('mobilenetv2_100', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `mobilenetv2_100`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('mobilenetv2_100', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/abs-1801-04381, + author = {Mark Sandler and + Andrew G. Howard and + Menglong Zhu and + Andrey Zhmoginov and + Liang{-}Chieh Chen}, + title = {Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, + Detection and Segmentation}, + journal = {CoRR}, + volume = {abs/1801.04381}, + year = {2018}, + url = {http://arxiv.org/abs/1801.04381}, + archivePrefix = {arXiv}, + eprint = {1801.04381}, + timestamp = {Tue, 12 Jan 2021 15:30:06 +0100}, + biburl = {https://dblp.org/rec/journals/corr/abs-1801-04381.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/mobilenet-v3.mdx b/hfdocs/source/models/mobilenet-v3.mdx new file mode 100644 index 00000000..939dc85e --- /dev/null +++ b/hfdocs/source/models/mobilenet-v3.mdx @@ -0,0 +1,205 @@ +# MobileNet v3 + +**MobileNetV3** is a convolutional neural network that is designed for mobile phone CPUs. The network design includes the use of a [hard swish activation](https://paperswithcode.com/method/hard-swish) and [squeeze-and-excitation](https://paperswithcode.com/method/squeeze-and-excitation-block) modules in the [MBConv blocks](https://paperswithcode.com/method/inverted-residual-block). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('mobilenetv3_large_100', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `mobilenetv3_large_100`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('mobilenetv3_large_100', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/abs-1905-02244, + author = {Andrew Howard and + Mark Sandler and + Grace Chu and + Liang{-}Chieh Chen and + Bo Chen and + Mingxing Tan and + Weijun Wang and + Yukun Zhu and + Ruoming Pang and + Vijay Vasudevan and + Quoc V. Le and + Hartwig Adam}, + title = {Searching for MobileNetV3}, + journal = {CoRR}, + volume = {abs/1905.02244}, + year = {2019}, + url = {http://arxiv.org/abs/1905.02244}, + archivePrefix = {arXiv}, + eprint = {1905.02244}, + timestamp = {Tue, 12 Jan 2021 15:30:06 +0100}, + biburl = {https://dblp.org/rec/journals/corr/abs-1905-02244.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/nasnet.mdx b/hfdocs/source/models/nasnet.mdx new file mode 100644 index 00000000..3a0e601a --- /dev/null +++ b/hfdocs/source/models/nasnet.mdx @@ -0,0 +1,137 @@ +# NASNet + +**NASNet** is a type of convolutional neural network discovered through neural architecture search. The building blocks consist of normal and reduction cells. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('nasnetalarge', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `nasnetalarge`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('nasnetalarge', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{zoph2018learning, + title={Learning Transferable Architectures for Scalable Image Recognition}, + author={Barret Zoph and Vijay Vasudevan and Jonathon Shlens and Quoc V. Le}, + year={2018}, + eprint={1707.07012}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/noisy-student.mdx b/hfdocs/source/models/noisy-student.mdx new file mode 100644 index 00000000..397278d1 --- /dev/null +++ b/hfdocs/source/models/noisy-student.mdx @@ -0,0 +1,577 @@ +# Noisy Student (EfficientNet) + +**Noisy Student Training** is a semi-supervised learning approach. It extends the idea of self-training +and distillation with the use of equal-or-larger student models and noise added to the student during learning. It has three main steps: + +1. train a teacher model on labeled images +2. use the teacher to generate pseudo labels on unlabeled images +3. train a student model on the combination of labeled images and pseudo labeled images. + +The algorithm is iterated a few times by treating the student as a teacher to relabel the unlabeled data and training a new student. + +Noisy Student Training seeks to improve on self-training and distillation in two ways. First, it makes the student larger than, or at least equal to, the teacher so the student can better learn from a larger dataset. Second, it adds noise to the student so the noised student is forced to learn harder from the pseudo labels. To noise the student, it uses input noise such as RandAugment data augmentation, and model noise such as dropout and stochastic depth during training. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('tf_efficientnet_b0_ns', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `tf_efficientnet_b0_ns`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('tf_efficientnet_b0_ns', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{xie2020selftraining, + title={Self-training with Noisy Student improves ImageNet classification}, + author={Qizhe Xie and Minh-Thang Luong and Eduard Hovy and Quoc V. Le}, + year={2020}, + eprint={1911.04252}, + archivePrefix={arXiv}, + primaryClass={cs.LG} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/pnasnet.mdx b/hfdocs/source/models/pnasnet.mdx new file mode 100644 index 00000000..e5ec59c0 --- /dev/null +++ b/hfdocs/source/models/pnasnet.mdx @@ -0,0 +1,138 @@ +# PNASNet + +**Progressive Neural Architecture Search**, or **PNAS**, is a method for learning the structure of convolutional neural networks (CNNs). It uses a sequential model-based optimization (SMBO) strategy, where we search the space of cell structures, starting with simple (shallow) models and progressing to complex ones, pruning out unpromising structures as we go. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('pnasnet5large', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `pnasnet5large`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('pnasnet5large', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{liu2018progressive, + title={Progressive Neural Architecture Search}, + author={Chenxi Liu and Barret Zoph and Maxim Neumann and Jonathon Shlens and Wei Hua and Li-Jia Li and Li Fei-Fei and Alan Yuille and Jonathan Huang and Kevin Murphy}, + year={2018}, + eprint={1712.00559}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/regnetx.mdx b/hfdocs/source/models/regnetx.mdx new file mode 100644 index 00000000..e13caa35 --- /dev/null +++ b/hfdocs/source/models/regnetx.mdx @@ -0,0 +1,559 @@ +# RegNetX + +**RegNetX** is a convolutional network design space with simple, regular models with parameters: depth $d$, initial width $w\_{0} > 0$, and slope $w\_{a} > 0$, and generates a different block width $u\_{j}$ for each block $j < d$. The key restriction for the RegNet types of model is that there is a linear parameterisation of block widths (the design space only contains models with this linear structure): + +$$ u\_{j} = w\_{0} + w\_{a}\cdot{j} $$ + +For **RegNetX** we have additional restrictions: we set $b = 1$ (the bottleneck ratio), $12 \leq d \leq 28$, and $w\_{m} \geq 2$ (the width multiplier). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('regnetx_002', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `regnetx_002`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('regnetx_002', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{radosavovic2020designing, + title={Designing Network Design Spaces}, + author={Ilija Radosavovic and Raj Prateek Kosaraju and Ross Girshick and Kaiming He and Piotr Dollár}, + year={2020}, + eprint={2003.13678}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/regnety.mdx b/hfdocs/source/models/regnety.mdx new file mode 100644 index 00000000..c0a2e905 --- /dev/null +++ b/hfdocs/source/models/regnety.mdx @@ -0,0 +1,573 @@ +# RegNetY + +**RegNetY** is a convolutional network design space with simple, regular models with parameters: depth $d$, initial width $w\_{0} > 0$, and slope $w\_{a} > 0$, and generates a different block width $u\_{j}$ for each block $j < d$. The key restriction for the RegNet types of model is that there is a linear parameterisation of block widths (the design space only contains models with this linear structure): + +$$ u\_{j} = w\_{0} + w\_{a}\cdot{j} $$ + +For **RegNetX** authors have additional restrictions: we set $b = 1$ (the bottleneck ratio), $12 \leq d \leq 28$, and $w\_{m} \geq 2$ (the width multiplier). + +For **RegNetY** authors make one change, which is to include [Squeeze-and-Excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('regnety_002', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `regnety_002`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('regnety_002', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{radosavovic2020designing, + title={Designing Network Design Spaces}, + author={Ilija Radosavovic and Raj Prateek Kosaraju and Ross Girshick and Kaiming He and Piotr Dollár}, + year={2020}, + eprint={2003.13678}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/res2net.mdx b/hfdocs/source/models/res2net.mdx new file mode 100644 index 00000000..c546948c --- /dev/null +++ b/hfdocs/source/models/res2net.mdx @@ -0,0 +1,327 @@ +# Res2Net + +**Res2Net** is an image model that employs a variation on bottleneck residual blocks, [Res2Net Blocks](https://paperswithcode.com/method/res2net-block). The motivation is to be able to represent features at multiple scales. This is achieved through a novel building block for CNNs that constructs hierarchical residual-like connections within one single residual block. This represents multi-scale features at a granular level and increases the range of receptive fields for each network layer. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('res2net101_26w_4s', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `res2net101_26w_4s`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('res2net101_26w_4s', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{Gao_2021, + title={Res2Net: A New Multi-Scale Backbone Architecture}, + volume={43}, + ISSN={1939-3539}, + url={http://dx.doi.org/10.1109/TPAMI.2019.2938758}, + DOI={10.1109/tpami.2019.2938758}, + number={2}, + journal={IEEE Transactions on Pattern Analysis and Machine Intelligence}, + publisher={Institute of Electrical and Electronics Engineers (IEEE)}, + author={Gao, Shang-Hua and Cheng, Ming-Ming and Zhao, Kai and Zhang, Xin-Yu and Yang, Ming-Hsuan and Torr, Philip}, + year={2021}, + month={Feb}, + pages={652–662} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/res2next.mdx b/hfdocs/source/models/res2next.mdx new file mode 100644 index 00000000..58714dee --- /dev/null +++ b/hfdocs/source/models/res2next.mdx @@ -0,0 +1,142 @@ +# Res2NeXt + +**Res2NeXt** is an image model that employs a variation on [ResNeXt](https://paperswithcode.com/method/resnext) bottleneck residual blocks. The motivation is to be able to represent features at multiple scales. This is achieved through a novel building block for CNNs that constructs hierarchical residual-like connections within one single residual block. This represents multi-scale features at a granular level and increases the range of receptive fields for each network layer. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('res2next50', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `res2next50`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('res2next50', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{Gao_2021, + title={Res2Net: A New Multi-Scale Backbone Architecture}, + volume={43}, + ISSN={1939-3539}, + url={http://dx.doi.org/10.1109/TPAMI.2019.2938758}, + DOI={10.1109/tpami.2019.2938758}, + number={2}, + journal={IEEE Transactions on Pattern Analysis and Machine Intelligence}, + publisher={Institute of Electrical and Electronics Engineers (IEEE)}, + author={Gao, Shang-Hua and Cheng, Ming-Ming and Zhao, Kai and Zhang, Xin-Yu and Yang, Ming-Hsuan and Torr, Philip}, + year={2021}, + month={Feb}, + pages={652–662} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/resnest.mdx b/hfdocs/source/models/resnest.mdx new file mode 100644 index 00000000..1cf25105 --- /dev/null +++ b/hfdocs/source/models/resnest.mdx @@ -0,0 +1,475 @@ +# ResNeSt + +A **ResNeSt** is a variant on a [ResNet](https://paperswithcode.com/method/resnet), which instead stacks [Split-Attention blocks](https://paperswithcode.com/method/split-attention). The cardinal group representations are then concatenated along the channel dimension: $V = \text{Concat}${$V^{1},V^{2},\cdots{V}^{K}$}. As in standard residual blocks, the final output $Y$ of otheur Split-Attention block is produced using a shortcut connection: $Y=V+X$, if the input and output feature-map share the same shape. For blocks with a stride, an appropriate transformation $\mathcal{T}$ is applied to the shortcut connection to align the output shapes: $Y=V+\mathcal{T}(X)$. For example, $\mathcal{T}$ can be strided convolution or combined convolution-with-pooling. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('resnest101e', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `resnest101e`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('resnest101e', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{zhang2020resnest, + title={ResNeSt: Split-Attention Networks}, + author={Hang Zhang and Chongruo Wu and Zhongyue Zhang and Yi Zhu and Haibin Lin and Zhi Zhang and Yue Sun and Tong He and Jonas Mueller and R. Manmatha and Mu Li and Alexander Smola}, + year={2020}, + eprint={2004.08955}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/resnet-d.mdx b/hfdocs/source/models/resnet-d.mdx new file mode 100644 index 00000000..d858af0f --- /dev/null +++ b/hfdocs/source/models/resnet-d.mdx @@ -0,0 +1,330 @@ +# ResNet-D + +**ResNet-D** is a modification on the [ResNet](https://paperswithcode.com/method/resnet) architecture that utilises an [average pooling](https://paperswithcode.com/method/average-pooling) tweak for downsampling. The motivation is that in the unmodified ResNet, the [1×1 convolution](https://paperswithcode.com/method/1x1-convolution) for the downsampling block ignores 3/4 of input feature maps, so this is modified so no information will be ignored + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('resnet101d', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `resnet101d`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('resnet101d', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{he2018bag, + title={Bag of Tricks for Image Classification with Convolutional Neural Networks}, + author={Tong He and Zhi Zhang and Hang Zhang and Zhongyue Zhang and Junyuan Xie and Mu Li}, + year={2018}, + eprint={1812.01187}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/resnet.mdx b/hfdocs/source/models/resnet.mdx new file mode 100644 index 00000000..541079c8 --- /dev/null +++ b/hfdocs/source/models/resnet.mdx @@ -0,0 +1,445 @@ +# ResNet + +**Residual Networks**, or **ResNets**, learn residual functions with reference to the layer inputs, instead of learning unreferenced functions. Instead of hoping each few stacked layers directly fit a desired underlying mapping, residual nets let these layers fit a residual mapping. They stack [residual blocks](https://paperswithcode.com/method/residual-block) ontop of each other to form network: e.g. a ResNet-50 has fifty layers using these blocks. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('resnet18', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `resnet18`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('resnet18', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/HeZRS15, + author = {Kaiming He and + Xiangyu Zhang and + Shaoqing Ren and + Jian Sun}, + title = {Deep Residual Learning for Image Recognition}, + journal = {CoRR}, + volume = {abs/1512.03385}, + year = {2015}, + url = {http://arxiv.org/abs/1512.03385}, + archivePrefix = {arXiv}, + eprint = {1512.03385}, + timestamp = {Wed, 17 Apr 2019 17:23:45 +0200}, + biburl = {https://dblp.org/rec/journals/corr/HeZRS15.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/resnext.mdx b/hfdocs/source/models/resnext.mdx new file mode 100644 index 00000000..07b4254d --- /dev/null +++ b/hfdocs/source/models/resnext.mdx @@ -0,0 +1,250 @@ +# ResNeXt + +A **ResNeXt** repeats a [building block](https://paperswithcode.com/method/resnext-block) that aggregates a set of transformations with the same topology. Compared to a [ResNet](https://paperswithcode.com/method/resnet), it exposes a new dimension, *cardinality* (the size of the set of transformations) $C$, as an essential factor in addition to the dimensions of depth and width. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('resnext101_32x8d', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `resnext101_32x8d`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('resnext101_32x8d', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/XieGDTH16, + author = {Saining Xie and + Ross B. Girshick and + Piotr Doll{\'{a}}r and + Zhuowen Tu and + Kaiming He}, + title = {Aggregated Residual Transformations for Deep Neural Networks}, + journal = {CoRR}, + volume = {abs/1611.05431}, + year = {2016}, + url = {http://arxiv.org/abs/1611.05431}, + archivePrefix = {arXiv}, + eprint = {1611.05431}, + timestamp = {Mon, 13 Aug 2018 16:45:58 +0200}, + biburl = {https://dblp.org/rec/journals/corr/XieGDTH16.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/rexnet.mdx b/hfdocs/source/models/rexnet.mdx new file mode 100644 index 00000000..8c1307d7 --- /dev/null +++ b/hfdocs/source/models/rexnet.mdx @@ -0,0 +1,264 @@ +# RexNet + +**Rank Expansion Networks** (ReXNets) follow a set of new design principles for designing bottlenecks in image classification models. Authors refine each layer by 1) expanding the input channel size of the convolution layer and 2) replacing the [ReLU6s](https://www.paperswithcode.com/method/relu6). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('rexnet_100', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `rexnet_100`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('rexnet_100', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{han2020rexnet, + title={ReXNet: Diminishing Representational Bottleneck on Convolutional Neural Network}, + author={Dongyoon Han and Sangdoo Yun and Byeongho Heo and YoungJoon Yoo}, + year={2020}, + eprint={2007.00992}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/se-resnet.mdx b/hfdocs/source/models/se-resnet.mdx new file mode 100644 index 00000000..1473fd7e --- /dev/null +++ b/hfdocs/source/models/se-resnet.mdx @@ -0,0 +1,189 @@ +# SE-ResNet + +**SE ResNet** is a variant of a [ResNet](https://www.paperswithcode.com/method/resnet) that employs [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block) to enable the network to perform dynamic channel-wise feature recalibration. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('seresnet152d', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `seresnet152d`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('seresnet152d', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{hu2019squeezeandexcitation, + title={Squeeze-and-Excitation Networks}, + author={Jie Hu and Li Shen and Samuel Albanie and Gang Sun and Enhua Wu}, + year={2019}, + eprint={1709.01507}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/selecsls.mdx b/hfdocs/source/models/selecsls.mdx new file mode 100644 index 00000000..a07511a6 --- /dev/null +++ b/hfdocs/source/models/selecsls.mdx @@ -0,0 +1,203 @@ +# SelecSLS + +**SelecSLS** uses novel selective long and short range skip connections to improve the information flow allowing for a drastically faster network without compromising accuracy. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('selecsls42b', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `selecsls42b`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('selecsls42b', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{Mehta_2020, + title={XNect}, + volume={39}, + ISSN={1557-7368}, + url={http://dx.doi.org/10.1145/3386569.3392410}, + DOI={10.1145/3386569.3392410}, + number={4}, + journal={ACM Transactions on Graphics}, + publisher={Association for Computing Machinery (ACM)}, + author={Mehta, Dushyant and Sotnychenko, Oleksandr and Mueller, Franziska and Xu, Weipeng and Elgharib, Mohamed and Fua, Pascal and Seidel, Hans-Peter and Rhodin, Helge and Pons-Moll, Gerard and Theobalt, Christian}, + year={2020}, + month={Jul} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/seresnext.mdx b/hfdocs/source/models/seresnext.mdx new file mode 100644 index 00000000..9d3e9125 --- /dev/null +++ b/hfdocs/source/models/seresnext.mdx @@ -0,0 +1,234 @@ +# SE-ResNeXt + +**SE ResNeXt** is a variant of a [ResNext](https://www.paperswithcode.com/method/resneXt) that employs [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block) to enable the network to perform dynamic channel-wise feature recalibration. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('seresnext26d_32x4d', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `seresnext26d_32x4d`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('seresnext26d_32x4d', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{hu2019squeezeandexcitation, + title={Squeeze-and-Excitation Networks}, + author={Jie Hu and Li Shen and Samuel Albanie and Gang Sun and Enhua Wu}, + year={2019}, + eprint={1709.01507}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/skresnet.mdx b/hfdocs/source/models/skresnet.mdx new file mode 100644 index 00000000..2b9422d5 --- /dev/null +++ b/hfdocs/source/models/skresnet.mdx @@ -0,0 +1,179 @@ +# SK-ResNet + +**SK ResNet** is a variant of a [ResNet](https://www.paperswithcode.com/method/resnet) that employs a [Selective Kernel](https://paperswithcode.com/method/selective-kernel) unit. In general, all the large kernel convolutions in the original bottleneck blocks in ResNet are replaced by the proposed [SK convolutions](https://paperswithcode.com/method/selective-kernel-convolution), enabling the network to choose appropriate receptive field sizes in an adaptive manner. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('skresnet18', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `skresnet18`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('skresnet18', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{li2019selective, + title={Selective Kernel Networks}, + author={Xiang Li and Wenhai Wang and Xiaolin Hu and Jian Yang}, + year={2019}, + eprint={1903.06586}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/skresnext.mdx b/hfdocs/source/models/skresnext.mdx new file mode 100644 index 00000000..bec6ea5b --- /dev/null +++ b/hfdocs/source/models/skresnext.mdx @@ -0,0 +1,137 @@ +# SK-ResNeXt + +**SK ResNeXt** is a variant of a [ResNeXt](https://www.paperswithcode.com/method/resnext) that employs a [Selective Kernel](https://paperswithcode.com/method/selective-kernel) unit. In general, all the large kernel convolutions in the original bottleneck blocks in ResNext are replaced by the proposed [SK convolutions](https://paperswithcode.com/method/selective-kernel-convolution), enabling the network to choose appropriate receptive field sizes in an adaptive manner. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('skresnext50_32x4d', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `skresnext50_32x4d`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('skresnext50_32x4d', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{li2019selective, + title={Selective Kernel Networks}, + author={Xiang Li and Wenhai Wang and Xiaolin Hu and Jian Yang}, + year={2019}, + eprint={1903.06586}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/spnasnet.mdx b/hfdocs/source/models/spnasnet.mdx new file mode 100644 index 00000000..2af6c5ee --- /dev/null +++ b/hfdocs/source/models/spnasnet.mdx @@ -0,0 +1,129 @@ +# SPNASNet + +**Single-Path NAS** is a novel differentiable NAS method for designing hardware-efficient ConvNets in less than 4 hours. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('spnasnet_100', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `spnasnet_100`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('spnasnet_100', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{stamoulis2019singlepath, + title={Single-Path NAS: Designing Hardware-Efficient ConvNets in less than 4 Hours}, + author={Dimitrios Stamoulis and Ruizhou Ding and Di Wang and Dimitrios Lymberopoulos and Bodhi Priyantha and Jie Liu and Diana Marculescu}, + year={2019}, + eprint={1904.02877}, + archivePrefix={arXiv}, + primaryClass={cs.LG} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/ssl-resnet.mdx b/hfdocs/source/models/ssl-resnet.mdx new file mode 100644 index 00000000..ddb73f94 --- /dev/null +++ b/hfdocs/source/models/ssl-resnet.mdx @@ -0,0 +1,198 @@ +# SSL ResNet + +**Residual Networks**, or **ResNets**, learn residual functions with reference to the layer inputs, instead of learning unreferenced functions. Instead of hoping each few stacked layers directly fit a desired underlying mapping, residual nets let these layers fit a residual mapping. They stack [residual blocks](https://paperswithcode.com/method/residual-block) ontop of each other to form network: e.g. a ResNet-50 has fifty layers using these blocks. + +The model in this collection utilises semi-supervised learning to improve the performance of the model. The approach brings important gains to standard architectures for image, video and fine-grained classification. + +Please note the CC-BY-NC 4.0 license on theses weights, non-commercial use only. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('ssl_resnet18', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `ssl_resnet18`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('ssl_resnet18', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/abs-1905-00546, + author = {I. Zeki Yalniz and + Herv{\'{e}} J{\'{e}}gou and + Kan Chen and + Manohar Paluri and + Dhruv Mahajan}, + title = {Billion-scale semi-supervised learning for image classification}, + journal = {CoRR}, + volume = {abs/1905.00546}, + year = {2019}, + url = {http://arxiv.org/abs/1905.00546}, + archivePrefix = {arXiv}, + eprint = {1905.00546}, + timestamp = {Mon, 28 Sep 2020 08:19:37 +0200}, + biburl = {https://dblp.org/rec/journals/corr/abs-1905-00546.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/swsl-resnet.mdx b/hfdocs/source/models/swsl-resnet.mdx new file mode 100644 index 00000000..61749584 --- /dev/null +++ b/hfdocs/source/models/swsl-resnet.mdx @@ -0,0 +1,198 @@ +# SWSL ResNet + +**Residual Networks**, or **ResNets**, learn residual functions with reference to the layer inputs, instead of learning unreferenced functions. Instead of hoping each few stacked layers directly fit a desired underlying mapping, residual nets let these layers fit a residual mapping. They stack [residual blocks](https://paperswithcode.com/method/residual-block) ontop of each other to form network: e.g. a ResNet-50 has fifty layers using these blocks. + +The models in this collection utilise semi-weakly supervised learning to improve the performance of the model. The approach brings important gains to standard architectures for image, video and fine-grained classification. + +Please note the CC-BY-NC 4.0 license on theses weights, non-commercial use only. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('swsl_resnet18', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `swsl_resnet18`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('swsl_resnet18', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/abs-1905-00546, + author = {I. Zeki Yalniz and + Herv{\'{e}} J{\'{e}}gou and + Kan Chen and + Manohar Paluri and + Dhruv Mahajan}, + title = {Billion-scale semi-supervised learning for image classification}, + journal = {CoRR}, + volume = {abs/1905.00546}, + year = {2019}, + url = {http://arxiv.org/abs/1905.00546}, + archivePrefix = {arXiv}, + eprint = {1905.00546}, + timestamp = {Mon, 28 Sep 2020 08:19:37 +0200}, + biburl = {https://dblp.org/rec/journals/corr/abs-1905-00546.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/swsl-resnext.mdx b/hfdocs/source/models/swsl-resnext.mdx new file mode 100644 index 00000000..132aacd6 --- /dev/null +++ b/hfdocs/source/models/swsl-resnext.mdx @@ -0,0 +1,284 @@ +# SWSL ResNeXt + +A **ResNeXt** repeats a [building block](https://paperswithcode.com/method/resnext-block) that aggregates a set of transformations with the same topology. Compared to a [ResNet](https://paperswithcode.com/method/resnet), it exposes a new dimension, *cardinality* (the size of the set of transformations) $C$, as an essential factor in addition to the dimensions of depth and width. + +The models in this collection utilise semi-weakly supervised learning to improve the performance of the model. The approach brings important gains to standard architectures for image, video and fine-grained classification. + +Please note the CC-BY-NC 4.0 license on theses weights, non-commercial use only. + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('swsl_resnext101_32x16d', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `swsl_resnext101_32x16d`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('swsl_resnext101_32x16d', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/abs-1905-00546, + author = {I. Zeki Yalniz and + Herv{\'{e}} J{\'{e}}gou and + Kan Chen and + Manohar Paluri and + Dhruv Mahajan}, + title = {Billion-scale semi-supervised learning for image classification}, + journal = {CoRR}, + volume = {abs/1905.00546}, + year = {2019}, + url = {http://arxiv.org/abs/1905.00546}, + archivePrefix = {arXiv}, + eprint = {1905.00546}, + timestamp = {Mon, 28 Sep 2020 08:19:37 +0200}, + biburl = {https://dblp.org/rec/journals/corr/abs-1905-00546.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/tf-efficientnet-condconv.mdx b/hfdocs/source/models/tf-efficientnet-condconv.mdx new file mode 100644 index 00000000..57dfb8ee --- /dev/null +++ b/hfdocs/source/models/tf-efficientnet-condconv.mdx @@ -0,0 +1,256 @@ +# (Tensorflow) EfficientNet CondConv + +**EfficientNet** is a convolutional neural network architecture and scaling method that uniformly scales all dimensions of depth/width/resolution using a *compound coefficient*. Unlike conventional practice that arbitrary scales these factors, the EfficientNet scaling method uniformly scales network width, depth, and resolution with a set of fixed scaling coefficients. For example, if we want to use $2^N$ times more computational resources, then we can simply increase the network depth by $\alpha ^ N$, width by $\beta ^ N$, and image size by $\gamma ^ N$, where $\alpha, \beta, \gamma$ are constant coefficients determined by a small grid search on the original small model. EfficientNet uses a compound coefficient $\phi$ to uniformly scales network width, depth, and resolution in a principled way. + +The compound scaling method is justified by the intuition that if the input image is bigger, then the network needs more layers to increase the receptive field and more channels to capture more fine-grained patterns on the bigger image. + +The base EfficientNet-B0 network is based on the inverted bottleneck residual blocks of [MobileNetV2](https://paperswithcode.com/method/mobilenetv2), in addition to squeeze-and-excitation blocks. + +This collection of models amends EfficientNet by adding [CondConv](https://paperswithcode.com/method/condconv) convolutions. + +The weights from this model were ported from [Tensorflow/TPU](https://github.com/tensorflow/tpu). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('tf_efficientnet_cc_b0_4e', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `tf_efficientnet_cc_b0_4e`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('tf_efficientnet_cc_b0_4e', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/abs-1904-04971, + author = {Brandon Yang and + Gabriel Bender and + Quoc V. Le and + Jiquan Ngiam}, + title = {Soft Conditional Computation}, + journal = {CoRR}, + volume = {abs/1904.04971}, + year = {2019}, + url = {http://arxiv.org/abs/1904.04971}, + archivePrefix = {arXiv}, + eprint = {1904.04971}, + timestamp = {Thu, 25 Apr 2019 13:55:01 +0200}, + biburl = {https://dblp.org/rec/journals/corr/abs-1904-04971.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/tf-efficientnet-lite.mdx b/hfdocs/source/models/tf-efficientnet-lite.mdx new file mode 100644 index 00000000..24af2dda --- /dev/null +++ b/hfdocs/source/models/tf-efficientnet-lite.mdx @@ -0,0 +1,262 @@ +# (Tensorflow) EfficientNet Lite + +**EfficientNet** is a convolutional neural network architecture and scaling method that uniformly scales all dimensions of depth/width/resolution using a *compound coefficient*. Unlike conventional practice that arbitrary scales these factors, the EfficientNet scaling method uniformly scales network width, depth, and resolution with a set of fixed scaling coefficients. For example, if we want to use $2^N$ times more computational resources, then we can simply increase the network depth by $\alpha ^ N$, width by $\beta ^ N$, and image size by $\gamma ^ N$, where $\alpha, \beta, \gamma$ are constant coefficients determined by a small grid search on the original small model. EfficientNet uses a compound coefficient $\phi$ to uniformly scales network width, depth, and resolution in a principled way. + +The compound scaling method is justified by the intuition that if the input image is bigger, then the network needs more layers to increase the receptive field and more channels to capture more fine-grained patterns on the bigger image. + +The base EfficientNet-B0 network is based on the inverted bottleneck residual blocks of [MobileNetV2](https://paperswithcode.com/method/mobilenetv2). + +EfficientNet-Lite makes EfficientNet more suitable for mobile devices by introducing [ReLU6](https://paperswithcode.com/method/relu6) activation functions and removing [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation). + +The weights from this model were ported from [Tensorflow/TPU](https://github.com/tensorflow/tpu). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('tf_efficientnet_lite0', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `tf_efficientnet_lite0`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('tf_efficientnet_lite0', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{tan2020efficientnet, + title={EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks}, + author={Mingxing Tan and Quoc V. Le}, + year={2020}, + eprint={1905.11946}, + archivePrefix={arXiv}, + primaryClass={cs.LG} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/tf-efficientnet.mdx b/hfdocs/source/models/tf-efficientnet.mdx new file mode 100644 index 00000000..3284a982 --- /dev/null +++ b/hfdocs/source/models/tf-efficientnet.mdx @@ -0,0 +1,669 @@ +# (Tensorflow) EfficientNet + +**EfficientNet** is a convolutional neural network architecture and scaling method that uniformly scales all dimensions of depth/width/resolution using a *compound coefficient*. Unlike conventional practice that arbitrary scales these factors, the EfficientNet scaling method uniformly scales network width, depth, and resolution with a set of fixed scaling coefficients. For example, if we want to use $2^N$ times more computational resources, then we can simply increase the network depth by $\alpha ^ N$, width by $\beta ^ N$, and image size by $\gamma ^ N$, where $\alpha, \beta, \gamma$ are constant coefficients determined by a small grid search on the original small model. EfficientNet uses a compound coefficient $\phi$ to uniformly scales network width, depth, and resolution in a principled way. + +The compound scaling method is justified by the intuition that if the input image is bigger, then the network needs more layers to increase the receptive field and more channels to capture more fine-grained patterns on the bigger image. + +The base EfficientNet-B0 network is based on the inverted bottleneck residual blocks of [MobileNetV2](https://paperswithcode.com/method/mobilenetv2), in addition to [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block). + +The weights from this model were ported from [Tensorflow/TPU](https://github.com/tensorflow/tpu). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('tf_efficientnet_b0', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `tf_efficientnet_b0`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('tf_efficientnet_b0', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{tan2020efficientnet, + title={EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks}, + author={Mingxing Tan and Quoc V. Le}, + year={2020}, + eprint={1905.11946}, + archivePrefix={arXiv}, + primaryClass={cs.LG} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/tf-inception-v3.mdx b/hfdocs/source/models/tf-inception-v3.mdx new file mode 100644 index 00000000..2c721510 --- /dev/null +++ b/hfdocs/source/models/tf-inception-v3.mdx @@ -0,0 +1,154 @@ +# (Tensorflow) Inception v3 + +**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifer](https://paperswithcode.com/method/auxiliary-classifier) to propagate label information lower down the network (along with the use of batch normalization for layers in the sidehead). The key building block is an [Inception Module](https://paperswithcode.com/method/inception-v3-module). + +The weights from this model were ported from [Tensorflow/Models](https://github.com/tensorflow/models). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('tf_inception_v3', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `tf_inception_v3`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('tf_inception_v3', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/SzegedyVISW15, + author = {Christian Szegedy and + Vincent Vanhoucke and + Sergey Ioffe and + Jonathon Shlens and + Zbigniew Wojna}, + title = {Rethinking the Inception Architecture for Computer Vision}, + journal = {CoRR}, + volume = {abs/1512.00567}, + year = {2015}, + url = {http://arxiv.org/abs/1512.00567}, + archivePrefix = {arXiv}, + eprint = {1512.00567}, + timestamp = {Mon, 13 Aug 2018 16:49:07 +0200}, + biburl = {https://dblp.org/rec/journals/corr/SzegedyVISW15.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/tf-mixnet.mdx b/hfdocs/source/models/tf-mixnet.mdx new file mode 100644 index 00000000..bd506b98 --- /dev/null +++ b/hfdocs/source/models/tf-mixnet.mdx @@ -0,0 +1,200 @@ +# (Tensorflow) MixNet + +**MixNet** is a type of convolutional neural network discovered via AutoML that utilises [MixConvs](https://paperswithcode.com/method/mixconv) instead of regular [depthwise convolutions](https://paperswithcode.com/method/depthwise-convolution). + +The weights from this model were ported from [Tensorflow/TPU](https://github.com/tensorflow/tpu). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('tf_mixnet_l', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `tf_mixnet_l`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('tf_mixnet_l', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{tan2019mixconv, + title={MixConv: Mixed Depthwise Convolutional Kernels}, + author={Mingxing Tan and Quoc V. Le}, + year={2019}, + eprint={1907.09595}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/tf-mobilenet-v3.mdx b/hfdocs/source/models/tf-mobilenet-v3.mdx new file mode 100644 index 00000000..8ef878da --- /dev/null +++ b/hfdocs/source/models/tf-mobilenet-v3.mdx @@ -0,0 +1,387 @@ +# (Tensorflow) MobileNet v3 + +**MobileNetV3** is a convolutional neural network that is designed for mobile phone CPUs. The network design includes the use of a [hard swish activation](https://paperswithcode.com/method/hard-swish) and [squeeze-and-excitation](https://paperswithcode.com/method/squeeze-and-excitation-block) modules in the [MBConv blocks](https://paperswithcode.com/method/inverted-residual-block). + +The weights from this model were ported from [Tensorflow/Models](https://github.com/tensorflow/models). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('tf_mobilenetv3_large_075', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `tf_mobilenetv3_large_075`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('tf_mobilenetv3_large_075', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/abs-1905-02244, + author = {Andrew Howard and + Mark Sandler and + Grace Chu and + Liang{-}Chieh Chen and + Bo Chen and + Mingxing Tan and + Weijun Wang and + Yukun Zhu and + Ruoming Pang and + Vijay Vasudevan and + Quoc V. Le and + Hartwig Adam}, + title = {Searching for MobileNetV3}, + journal = {CoRR}, + volume = {abs/1905.02244}, + year = {2019}, + url = {http://arxiv.org/abs/1905.02244}, + archivePrefix = {arXiv}, + eprint = {1905.02244}, + timestamp = {Tue, 12 Jan 2021 15:30:06 +0100}, + biburl = {https://dblp.org/rec/journals/corr/abs-1905-02244.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/tresnet.mdx b/hfdocs/source/models/tresnet.mdx new file mode 100644 index 00000000..14f6959b --- /dev/null +++ b/hfdocs/source/models/tresnet.mdx @@ -0,0 +1,358 @@ +# TResNet + +A **TResNet** is a variant on a [ResNet](https://paperswithcode.com/method/resnet) that aim to boost accuracy while maintaining GPU training and inference efficiency. They contain several design tricks including a SpaceToDepth stem, [Anti-Alias downsampling](https://paperswithcode.com/method/anti-alias-downsampling), In-Place Activated BatchNorm, Blocks selection and [squeeze-and-excitation layers](https://paperswithcode.com/method/squeeze-and-excitation-block). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('tresnet_l', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `tresnet_l`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('tresnet_l', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@misc{ridnik2020tresnet, + title={TResNet: High Performance GPU-Dedicated Architecture}, + author={Tal Ridnik and Hussam Lawen and Asaf Noy and Emanuel Ben Baruch and Gilad Sharir and Itamar Friedman}, + year={2020}, + eprint={2003.13630}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/wide-resnet.mdx b/hfdocs/source/models/wide-resnet.mdx new file mode 100644 index 00000000..869c09b4 --- /dev/null +++ b/hfdocs/source/models/wide-resnet.mdx @@ -0,0 +1,169 @@ +# Wide ResNet + +**Wide Residual Networks** are a variant on [ResNets](https://paperswithcode.com/method/resnet) where we decrease depth and increase the width of residual networks. This is achieved through the use of [wide residual blocks](https://paperswithcode.com/method/wide-residual-block). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('wide_resnet101_2', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `wide_resnet101_2`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('wide_resnet101_2', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/ZagoruykoK16, + author = {Sergey Zagoruyko and + Nikos Komodakis}, + title = {Wide Residual Networks}, + journal = {CoRR}, + volume = {abs/1605.07146}, + year = {2016}, + url = {http://arxiv.org/abs/1605.07146}, + archivePrefix = {arXiv}, + eprint = {1605.07146}, + timestamp = {Mon, 13 Aug 2018 16:46:42 +0200}, + biburl = {https://dblp.org/rec/journals/corr/ZagoruykoK16.bib}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/models/xception.mdx b/hfdocs/source/models/xception.mdx new file mode 100644 index 00000000..9ce8d576 --- /dev/null +++ b/hfdocs/source/models/xception.mdx @@ -0,0 +1,230 @@ +# Xception + +**Xception** is a convolutional neural network architecture that relies solely on [depthwise separable convolution layers](https://paperswithcode.com/method/depthwise-separable-convolution). + +The weights from this model were ported from [Tensorflow/Models](https://github.com/tensorflow/models). + +## How do I use this model on an image? + +To load a pretrained model: + +```py +>>> import timm +>>> model = timm.create_model('xception', pretrained=True) +>>> model.eval() +``` + +To load and preprocess the image: + +```py +>>> import urllib +>>> from PIL import Image +>>> from timm.data import resolve_data_config +>>> from timm.data.transforms_factory import create_transform + +>>> config = resolve_data_config({}, model=model) +>>> transform = create_transform(**config) + +>>> url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") +>>> urllib.request.urlretrieve(url, filename) +>>> img = Image.open(filename).convert('RGB') +>>> tensor = transform(img).unsqueeze(0) # transform and add batch dimension +``` + +To get the model predictions: + +```py +>>> import torch +>>> with torch.no_grad(): +... out = model(tensor) +>>> probabilities = torch.nn.functional.softmax(out[0], dim=0) +>>> print(probabilities.shape) +>>> # prints: torch.Size([1000]) +``` + +To get the top-5 predictions class names: + +```py +>>> # Get imagenet class mappings +>>> url, filename = ("https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt", "imagenet_classes.txt") +>>> urllib.request.urlretrieve(url, filename) +>>> with open("imagenet_classes.txt", "r") as f: +... categories = [s.strip() for s in f.readlines()] + +>>> # Print top categories per image +>>> top5_prob, top5_catid = torch.topk(probabilities, 5) +>>> for i in range(top5_prob.size(0)): +... print(categories[top5_catid[i]], top5_prob[i].item()) +>>> # prints class names and probabilities like: +>>> # [('Samoyed', 0.6425196528434753), ('Pomeranian', 0.04062102362513542), ('keeshond', 0.03186424449086189), ('white wolf', 0.01739676296710968), ('Eskimo dog', 0.011717947199940681)] +``` + +Replace the model name with the variant you want to use, e.g. `xception`. You can find the IDs in the model summaries at the top of this page. + +To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. + +## How do I finetune this model? + +You can finetune any of the pre-trained models just by changing the classifier (the last layer). + +```py +>>> model = timm.create_model('xception', pretrained=True, num_classes=NUM_FINETUNE_CLASSES) +``` +To finetune on your own dataset, you have to write a training loop or adapt [timm's training +script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) to use your dataset. + +## How do I train this model? + +You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. + +## Citation + +```BibTeX +@article{DBLP:journals/corr/ZagoruykoK16, +@misc{chollet2017xception, + title={Xception: Deep Learning with Depthwise Separable Convolutions}, + author={François Chollet}, + year={2017}, + eprint={1610.02357}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/hfdocs/source/results.mdx b/hfdocs/source/results.mdx new file mode 100644 index 00000000..a06ff332 --- /dev/null +++ b/hfdocs/source/results.mdx @@ -0,0 +1,67 @@ +# Results + +CSV files containing an ImageNet-1K and out-of-distribution (OOD) test set validation results for all models with pretrained weights is located in the repository [results folder](https://github.com/rwightman/pytorch-image-models/tree/master/results). + +## Self-trained Weights + +The table below includes ImageNet-1k validation results of model weights that I've trained myself. It is not updated as frequently as the csv results outputs linked above. + +|Model | Acc@1 (Err) | Acc@5 (Err) | Param # (M) | Interpolation | Image Size | +|---|---|---|---|---|---| +| efficientnet_b3a | 82.242 (17.758) | 96.114 (3.886) | 12.23 | bicubic | 320 (1.0 crop) | +| efficientnet_b3 | 82.076 (17.924) | 96.020 (3.980) | 12.23 | bicubic | 300 | +| regnet_32 | 82.002 (17.998) | 95.906 (4.094) | 19.44 | bicubic | 224 | +| skresnext50d_32x4d | 81.278 (18.722) | 95.366 (4.634) | 27.5 | bicubic | 288 (1.0 crop) | +| seresnext50d_32x4d | 81.266 (18.734) | 95.620 (4.380) | 27.6 | bicubic | 224 | +| efficientnet_b2a | 80.608 (19.392) | 95.310 (4.690) | 9.11 | bicubic | 288 (1.0 crop) | +| resnet50d | 80.530 (19.470) | 95.160 (4.840) | 25.6 | bicubic | 224 | +| mixnet_xl | 80.478 (19.522) | 94.932 (5.068) | 11.90 | bicubic | 224 | +| efficientnet_b2 | 80.402 (19.598) | 95.076 (4.924) | 9.11 | bicubic | 260 | +| seresnet50 | 80.274 (19.726) | 95.070 (4.930) | 28.1 | bicubic | 224 | +| skresnext50d_32x4d | 80.156 (19.844) | 94.642 (5.358) | 27.5 | bicubic | 224 | +| cspdarknet53 | 80.058 (19.942) | 95.084 (4.916) | 27.6 | bicubic | 256 | +| cspresnext50 | 80.040 (19.960) | 94.944 (5.056) | 20.6 | bicubic | 224 | +| resnext50_32x4d | 79.762 (20.238) | 94.600 (5.400) | 25 | bicubic | 224 | +| resnext50d_32x4d | 79.674 (20.326) | 94.868 (5.132) | 25.1 | bicubic | 224 | +| cspresnet50 | 79.574 (20.426) | 94.712 (5.288) | 21.6 | bicubic | 256 | +| ese_vovnet39b | 79.320 (20.680) | 94.710 (5.290) | 24.6 | bicubic | 224 | +| resnetblur50 | 79.290 (20.710) | 94.632 (5.368) | 25.6 | bicubic | 224 | +| dpn68b | 79.216 (20.784) | 94.414 (5.586) | 12.6 | bicubic | 224 | +| resnet50 | 79.038 (20.962) | 94.390 (5.610) | 25.6 | bicubic | 224 | +| mixnet_l | 78.976 (21.024 | 94.184 (5.816) | 7.33 | bicubic | 224 | +| efficientnet_b1 | 78.692 (21.308) | 94.086 (5.914) | 7.79 | bicubic | 240 | +| efficientnet_es | 78.066 (21.934) | 93.926 (6.074) | 5.44 | bicubic | 224 | +| seresnext26t_32x4d | 77.998 (22.002) | 93.708 (6.292) | 16.8 | bicubic | 224 | +| seresnext26tn_32x4d | 77.986 (22.014) | 93.746 (6.254) | 16.8 | bicubic | 224 | +| efficientnet_b0 | 77.698 (22.302) | 93.532 (6.468) | 5.29 | bicubic | 224 | +| seresnext26d_32x4d | 77.602 (22.398) | 93.608 (6.392) | 16.8 | bicubic | 224 | +| mobilenetv2_120d | 77.294 (22.706 | 93.502 (6.498) | 5.8 | bicubic | 224 | +| mixnet_m | 77.256 (22.744) | 93.418 (6.582) | 5.01 | bicubic | 224 | +| resnet34d | 77.116 (22.884) | 93.382 (6.618) | 21.8 | bicubic | 224 | +| seresnext26_32x4d | 77.104 (22.896) | 93.316 (6.684) | 16.8 | bicubic | 224 | +| skresnet34 | 76.912 (23.088) | 93.322 (6.678) | 22.2 | bicubic | 224 | +| ese_vovnet19b_dw | 76.798 (23.202) | 93.268 (6.732) | 6.5 | bicubic | 224 | +| resnet26d | 76.68 (23.32) | 93.166 (6.834) | 16 | bicubic | 224 | +| densenetblur121d | 76.576 (23.424) | 93.190 (6.810) | 8.0 | bicubic | 224 | +| mobilenetv2_140 | 76.524 (23.476) | 92.990 (7.010) | 6.1 | bicubic | 224 | +| mixnet_s | 75.988 (24.012) | 92.794 (7.206) | 4.13 | bicubic | 224 | +| mobilenetv3_large_100 | 75.766 (24.234) | 92.542 (7.458) | 5.5 | bicubic | 224 | +| mobilenetv3_rw | 75.634 (24.366) | 92.708 (7.292) | 5.5 | bicubic | 224 | +| mnasnet_a1 | 75.448 (24.552) | 92.604 (7.396) | 3.89 | bicubic | 224 | +| resnet26 | 75.292 (24.708) | 92.57 (7.43) | 16 | bicubic | 224 | +| fbnetc_100 | 75.124 (24.876) | 92.386 (7.614) | 5.6 | bilinear | 224 | +| resnet34 | 75.110 (24.890) | 92.284 (7.716) | 22 | bilinear | 224 | +| mobilenetv2_110d | 75.052 (24.948) | 92.180 (7.820) | 4.5 | bicubic | 224 | +| seresnet34 | 74.808 (25.192) | 92.124 (7.876) | 22 | bilinear | 224 | +| mnasnet_b1 | 74.658 (25.342) | 92.114 (7.886) | 4.38 | bicubic | 224 | +| spnasnet_100 | 74.084 (25.916) | 91.818 (8.182) | 4.42 | bilinear | 224 | +| skresnet18 | 73.038 (26.962) | 91.168 (8.832) | 11.9 | bicubic | 224 | +| mobilenetv2_100 | 72.978 (27.022) | 91.016 (8.984) | 3.5 | bicubic | 224 | +| resnet18d | 72.260 (27.740) | 90.696 (9.304) | 11.7 | bicubic | 224 | +| seresnet18 | 71.742 (28.258) | 90.334 (9.666) | 11.8 | bicubic | 224 | + +## Ported and Other Weights + +For weights ported from other deep learning frameworks (Tensorflow, MXNet GluonCV) or copied from other PyTorch sources, please see the full results tables for ImageNet and various OOD test sets at in the [results tables](https://github.com/rwightman/pytorch-image-models/tree/master/results). + +Model code .py files contain links to original sources of models and weights. diff --git a/hfdocs/source/scripts.mdx b/hfdocs/source/scripts.mdx new file mode 100644 index 00000000..46404d81 --- /dev/null +++ b/hfdocs/source/scripts.mdx @@ -0,0 +1,35 @@ +# Scripts +A train, validation, inference, and checkpoint cleaning script included in the github root folder. Scripts are not currently packaged in the pip release. + +The training and validation scripts evolved from early versions of the [PyTorch Imagenet Examples](https://github.com/pytorch/examples). I have added significant functionality over time, including CUDA specific performance enhancements based on +[NVIDIA's APEX Examples](https://github.com/NVIDIA/apex/tree/master/examples). + +## Training Script + +The variety of training args is large and not all combinations of options (or even options) have been fully tested. For the training dataset folder, specify the folder to the base that contains a `train` and `validation` folder. + +To train an SE-ResNet34 on ImageNet, locally distributed, 4 GPUs, one process per GPU w/ cosine schedule, random-erasing prob of 50% and per-pixel random value: + +```bash +./distributed_train.sh 4 /data/imagenet --model seresnet34 --sched cosine --epochs 150 --warmup-epochs 5 --lr 0.4 --reprob 0.5 --remode pixel --batch-size 256 --amp -j 4 +``` + + + It is recommended to use PyTorch 1.9+ w/ PyTorch native AMP and DDP instead of APEX AMP. --amp defaults to native AMP as of timm ver 0.4.3. --apex-amp will force use of APEX components if they are installed. + + +## Validation / Inference Scripts + +Validation and inference scripts are similar in usage. One outputs metrics on a validation set and the other outputs topk class ids in a csv. Specify the folder containing validation images, not the base as in training script. + +To validate with the model's pretrained weights (if they exist): + +```bash +python validate.py /imagenet/validation/ --model seresnext26_32x4d --pretrained +``` + +To run inference from a checkpoint: + +```bash +python inference.py /imagenet/validation/ --model mobilenetv3_large_100 --checkpoint ./output/train/model_best.pth.tar +``` \ No newline at end of file diff --git a/hfdocs/source/training_hparam_examples.mdx b/hfdocs/source/training_hparam_examples.mdx new file mode 100644 index 00000000..e582cfc9 --- /dev/null +++ b/hfdocs/source/training_hparam_examples.mdx @@ -0,0 +1,63 @@ +# Training Examples + +## EfficientNet-B2 with RandAugment - 80.4 top-1, 95.1 top-5 + +These params are for dual Titan RTX cards with NVIDIA Apex installed: + +```bash +./distributed_train.sh 2 /imagenet/ --model efficientnet_b2 -b 128 --sched step --epochs 450 --decay-epochs 2.4 --decay-rate .97 --opt rmsproptf --opt-eps .001 -j 8 --warmup-lr 1e-6 --weight-decay 1e-5 --drop 0.3 --drop-path 0.2 --model-ema --model-ema-decay 0.9999 --aa rand-m9-mstd0.5 --remode pixel --reprob 0.2 --amp --lr .016 +``` + +## MixNet-XL with RandAugment - 80.5 top-1, 94.9 top-5 + +This params are for dual Titan RTX cards with NVIDIA Apex installed: + +```bash +./distributed_train.sh 2 /imagenet/ --model mixnet_xl -b 128 --sched step --epochs 450 --decay-epochs 2.4 --decay-rate .969 --opt rmsproptf --opt-eps .001 -j 8 --warmup-lr 1e-6 --weight-decay 1e-5 --drop 0.3 --drop-path 0.2 --model-ema --model-ema-decay 0.9999 --aa rand-m9-mstd0.5 --remode pixel --reprob 0.3 --amp --lr .016 --dist-bn reduce +``` + +## SE-ResNeXt-26-D and SE-ResNeXt-26-T + +These hparams (or similar) work well for a wide range of ResNet architecture, generally a good idea to increase the epoch # as the model size increases... ie approx 180-200 for ResNe(X)t50, and 220+ for larger. Increase batch size and LR proportionally for better GPUs or with AMP enabled. These params were for 2 1080Ti cards: + +```bash +./distributed_train.sh 2 /imagenet/ --model seresnext26t_32x4d --lr 0.1 --warmup-epochs 5 --epochs 160 --weight-decay 1e-4 --sched cosine --reprob 0.4 --remode pixel -b 112 +``` +## EfficientNet-B3 with RandAugment - 81.5 top-1, 95.7 top-5 + +The training of this model started with the same command line as EfficientNet-B2 w/ RA above. After almost three weeks of training the process crashed. The results weren't looking amazing so I resumed the training several times with tweaks to a few params (increase RE prob, decrease rand-aug, increase ema-decay). Nothing looked great. I ended up averaging the best checkpoints from all restarts. The result is mediocre at default res/crop but oddly performs much better with a full image test crop of 1.0. + +## EfficientNet-B0 with RandAugment - 77.7 top-1, 95.3 top-5 + +[Michael Klachko](https://github.com/michaelklachko) achieved these results with the command line for B2 adapted for larger batch size, with the recommended B0 dropout rate of 0.2. + +```bash +./distributed_train.sh 2 /imagenet/ --model efficientnet_b0 -b 384 --sched step --epochs 450 --decay-epochs 2.4 --decay-rate .97 --opt rmsproptf --opt-eps .001 -j 8 --warmup-lr 1e-6 --weight-decay 1e-5 --drop 0.2 --drop-path 0.2 --model-ema --model-ema-decay 0.9999 --aa rand-m9-mstd0.5 --remode pixel --reprob 0.2 --amp --lr .048 +``` +## ResNet50 with JSD loss and RandAugment (clean + 2x RA augs) - 79.04 top-1, 94.39 top-5 + +Trained on two older 1080Ti cards, this took a while. Only slightly, non statistically better ImageNet validation result than my first good AugMix training of 78.99. However, these weights are more robust on tests with ImageNetV2, ImageNet-Sketch, etc. Unlike my first AugMix runs, I've enabled SplitBatchNorm, disabled random erasing on the clean split, and cranked up random erasing prob on the 2 augmented paths. + +```bash +./distributed_train.sh 2 /imagenet -b 64 --model resnet50 --sched cosine --epochs 200 --lr 0.05 --amp --remode pixel --reprob 0.6 --aug-splits 3 --aa rand-m9-mstd0.5-inc1 --resplit --split-bn --jsd --dist-bn reduce +``` +## EfficientNet-ES (EdgeTPU-Small) with RandAugment - 78.066 top-1, 93.926 top-5 + +Trained by [Andrew Lavin](https://github.com/andravin) with 8 V100 cards. Model EMA was not used, final checkpoint is the average of 8 best checkpoints during training. + +```bash +./distributed_train.sh 8 /imagenet --model efficientnet_es -b 128 --sched step --epochs 450 --decay-epochs 2.4 --decay-rate .97 --opt rmsproptf --opt-eps .001 -j 8 --warmup-lr 1e-6 --weight-decay 1e-5 --drop 0.2 --drop-path 0.2 --aa rand-m9-mstd0.5 --remode pixel --reprob 0.2 --amp --lr .064 +``` +## MobileNetV3-Large-100 - 75.766 top-1, 92,542 top-5 + +```bash +./distributed_train.sh 2 /imagenet/ --model mobilenetv3_large_100 -b 512 --sched step --epochs 600 --decay-epochs 2.4 --decay-rate .973 --opt rmsproptf --opt-eps .001 -j 7 --warmup-lr 1e-6 --weight-decay 1e-5 --drop 0.2 --drop-path 0.2 --model-ema --model-ema-decay 0.9999 --aa rand-m9-mstd0.5 --remode pixel --reprob 0.2 --amp --lr .064 --lr-noise 0.42 0.9 +``` + +## ResNeXt-50 32x4d w/ RandAugment - 79.762 top-1, 94.60 top-5 +These params will also work well for SE-ResNeXt-50 and SK-ResNeXt-50 and likely 101. I used them for the SK-ResNeXt-50 32x4d that I trained with 2 GPU using a slightly higher LR per effective batch size (lr=0.18, b=192 per GPU). The cmd line below are tuned for 8 GPU training. + + +```bash +./distributed_train.sh 8 /imagenet --model resnext50_32x4d --lr 0.6 --warmup-epochs 5 --epochs 240 --weight-decay 1e-4 --sched cosine --reprob 0.4 --recount 3 --remode pixel --aa rand-m7-mstd0.5-inc1 -b 192 -j 6 --amp --dist-bn reduce +``` From 1199c5a1a4de8660ab30f0e5526e9ca9300579ab Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Sun, 25 Sep 2022 10:36:54 -0700 Subject: [PATCH 02/26] clip_laion2b models need 1e-5 eps for LayerNorm --- timm/models/vision_transformer.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/timm/models/vision_transformer.py b/timm/models/vision_transformer.py index 474ea23c..2a033b39 100644 --- a/timm/models/vision_transformer.py +++ b/timm/models/vision_transformer.py @@ -1216,7 +1216,8 @@ def vit_base_patch32_224_clip_laion2b(pretrained=False, **kwargs): """ ViT-B/32 Pretrained weights from CLIP image tower trained on LAION-2B image-text pairs. """ - model_kwargs = dict(patch_size=32, embed_dim=768, depth=12, num_heads=12, pre_norm=True, **kwargs) + model_kwargs = dict( + patch_size=32, embed_dim=768, depth=12, num_heads=12, pre_norm=True, norm_layer=nn.LayerNorm, **kwargs) model = _create_vision_transformer('vit_base_patch32_224_clip_laion2b', pretrained=pretrained, **model_kwargs) return model @@ -1226,7 +1227,8 @@ def vit_large_patch14_224_clip_laion2b(pretrained=False, **kwargs): """ ViT-Large model (ViT-L/14) Pretrained weights from CLIP image tower trained on LAION-2B image-text pairs. """ - model_kwargs = dict(patch_size=14, embed_dim=1024, depth=24, num_heads=16, pre_norm=True, **kwargs) + model_kwargs = dict( + patch_size=14, embed_dim=1024, depth=24, num_heads=16, pre_norm=True, norm_layer=nn.LayerNorm, **kwargs) model = _create_vision_transformer('vit_large_patch14_224_clip_laion2b', pretrained=pretrained, **model_kwargs) return model @@ -1236,7 +1238,8 @@ def vit_huge_patch14_224_clip_laion2b(pretrained=False, **kwargs): """ ViT-Huge model (ViT-H/14) from original paper (https://arxiv.org/abs/2010.11929). Pretrained weights from CLIP image tower trained on LAION-2B image-text pairs. """ - model_kwargs = dict(patch_size=14, embed_dim=1280, depth=32, num_heads=16, pre_norm=True, **kwargs) + model_kwargs = dict( + patch_size=14, embed_dim=1280, depth=32, num_heads=16, pre_norm=True, norm_layer=nn.LayerNorm, **kwargs) model = _create_vision_transformer('vit_huge_patch14_224_clip_laion2b', pretrained=pretrained, **model_kwargs) return model @@ -1247,6 +1250,7 @@ def vit_giant_patch14_224_clip_laion2b(pretrained=False, **kwargs): Pretrained weights from CLIP image tower trained on LAION-2B image-text pairs. """ model_kwargs = dict( - patch_size=14, embed_dim=1408, mlp_ratio=48/11, depth=40, num_heads=16, pre_norm=True, **kwargs) + patch_size=14, embed_dim=1408, mlp_ratio=48/11, depth=40, num_heads=16, + pre_norm=True, norm_layer=nn.LayerNorm, **kwargs) model = _create_vision_transformer('vit_giant_patch14_224_clip_laion2b', pretrained=pretrained, **model_kwargs) return model From 7327792f39e79c0714710d0fb09422bb25c24400 Mon Sep 17 00:00:00 2001 From: Alex Fafard Date: Tue, 27 Sep 2022 11:13:48 -0400 Subject: [PATCH 03/26] update to support pickle based dictionaries --- timm/data/parsers/class_map.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/timm/data/parsers/class_map.py b/timm/data/parsers/class_map.py index 6b6fe453..6cf3f57e 100644 --- a/timm/data/parsers/class_map.py +++ b/timm/data/parsers/class_map.py @@ -1,5 +1,5 @@ import os - +import pickle def load_class_map(map_or_filename, root=''): if isinstance(map_or_filename, dict): @@ -13,6 +13,9 @@ def load_class_map(map_or_filename, root=''): if class_map_ext == '.txt': with open(class_map_path) as f: class_to_idx = {v.strip(): k for k, v in enumerate(f)} + elif class_map_ext == '.pkl': + with open(class_map_path,'rb') as f: + class_to_idx = pickle.load(f) else: assert False, f'Unsupported class map file extension ({class_map_ext}).' return class_to_idx From 25059001a9f12aa8c5af97675e26b6d8f5eb88c3 Mon Sep 17 00:00:00 2001 From: nateraw Date: Mon, 3 Oct 2022 13:12:09 -0400 Subject: [PATCH 04/26] :construction: add repo_owner --- .github/workflows/build_pr_documentation.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_pr_documentation.yml b/.github/workflows/build_pr_documentation.yml index 19c62cff..9c482c5c 100644 --- a/.github/workflows/build_pr_documentation.yml +++ b/.github/workflows/build_pr_documentation.yml @@ -13,4 +13,5 @@ jobs: with: commit_sha: ${{ github.event.pull_request.head.sha }} pr_number: ${{ github.event.number }} - package: timm \ No newline at end of file + package: timm + repo_owner: rwightman \ No newline at end of file From 6c3d02a7e51ef834aa042cd2041709c04e6f8a44 Mon Sep 17 00:00:00 2001 From: nateraw Date: Mon, 3 Oct 2022 13:25:21 -0400 Subject: [PATCH 05/26] :construction: update inputs to build_pr_documentation workflow --- .github/workflows/build_pr_documentation.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_pr_documentation.yml b/.github/workflows/build_pr_documentation.yml index 9c482c5c..9b63f442 100644 --- a/.github/workflows/build_pr_documentation.yml +++ b/.github/workflows/build_pr_documentation.yml @@ -13,5 +13,6 @@ jobs: with: commit_sha: ${{ github.event.pull_request.head.sha }} pr_number: ${{ github.event.number }} - package: timm + package: pytorch-image-models + package_name: timm repo_owner: rwightman \ No newline at end of file From 96109a909bb0496bcf364b17e62121d97b6d293c Mon Sep 17 00:00:00 2001 From: nateraw Date: Mon, 3 Oct 2022 13:35:44 -0400 Subject: [PATCH 06/26] :construction: update docs path --- .github/workflows/build_pr_documentation.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_pr_documentation.yml b/.github/workflows/build_pr_documentation.yml index 9b63f442..07506b10 100644 --- a/.github/workflows/build_pr_documentation.yml +++ b/.github/workflows/build_pr_documentation.yml @@ -15,4 +15,5 @@ jobs: pr_number: ${{ github.event.number }} package: pytorch-image-models package_name: timm - repo_owner: rwightman \ No newline at end of file + repo_owner: rwightman + path_to_docs: hfdocs/source \ No newline at end of file From d4d915caf388118c23749ec6c342dca36a4837c5 Mon Sep 17 00:00:00 2001 From: nateraw Date: Mon, 3 Oct 2022 17:03:11 -0400 Subject: [PATCH 07/26] :construction: update path_to_docs in pr doc builder workflow --- .github/workflows/build_pr_documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_pr_documentation.yml b/.github/workflows/build_pr_documentation.yml index 07506b10..0020570a 100644 --- a/.github/workflows/build_pr_documentation.yml +++ b/.github/workflows/build_pr_documentation.yml @@ -16,4 +16,4 @@ jobs: package: pytorch-image-models package_name: timm repo_owner: rwightman - path_to_docs: hfdocs/source \ No newline at end of file + path_to_docs: pytorch-image-models/hfdocs/source \ No newline at end of file From 3a429d04ee6790322496c56511cabbff91f49a3d Mon Sep 17 00:00:00 2001 From: nateraw Date: Mon, 3 Oct 2022 17:07:24 -0400 Subject: [PATCH 08/26] :ambulance: supply --not_python_module for now --- .github/workflows/build_pr_documentation.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_pr_documentation.yml b/.github/workflows/build_pr_documentation.yml index 0020570a..00d398ad 100644 --- a/.github/workflows/build_pr_documentation.yml +++ b/.github/workflows/build_pr_documentation.yml @@ -16,4 +16,5 @@ jobs: package: pytorch-image-models package_name: timm repo_owner: rwightman - path_to_docs: pytorch-image-models/hfdocs/source \ No newline at end of file + path_to_docs: pytorch-image-models/hfdocs/source + additional_args: --not_python_module \ No newline at end of file From 2f1abc2cf91cfdc974bde4c1d2645c9f731f8148 Mon Sep 17 00:00:00 2001 From: nateraw Date: Tue, 4 Oct 2022 16:38:26 -0400 Subject: [PATCH 09/26] :construction_worker: add build_documentation workflow --- .github/workflows/build_documentation.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/build_documentation.yml diff --git a/.github/workflows/build_documentation.yml b/.github/workflows/build_documentation.yml new file mode 100644 index 00000000..11a98490 --- /dev/null +++ b/.github/workflows/build_documentation.yml @@ -0,0 +1,21 @@ +name: Build documentation + +on: + push: + branches: + - master + - doc-builder* + - v*-release + +jobs: + build: + uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main + with: + commit_sha: ${{ github.sha }} + package: pytorch-image-models + package_name: timm + repo_owner: rwightman + path_to_docs: pytorch-image-models/hfdocs/source + additional_args: --not_python_module + secrets: + token: ${{ secrets.HUGGINGFACE_PUSH }} From 8fda68aff69d6020ad734657d7e44c226db4456a Mon Sep 17 00:00:00 2001 From: Mohamed Rashad Date: Wed, 5 Oct 2022 16:26:06 +0200 Subject: [PATCH 10/26] Fix repo id bug This to fix this issue #1482 --- timm/models/vision_transformer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timm/models/vision_transformer.py b/timm/models/vision_transformer.py index 2a033b39..6ed70045 100644 --- a/timm/models/vision_transformer.py +++ b/timm/models/vision_transformer.py @@ -192,7 +192,7 @@ default_cfgs = { hf_hub_filename='open_clip_pytorch_model.bin', mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, num_classes=1024), 'vit_giant_patch14_224_clip_laion2b': _cfg( - hf_hub_id='CLIP-ViT-g-14-laion2B-s12B-b42K', + hf_hub_id='laion/CLIP-ViT-g-14-laion2B-s12B-b42K', hf_hub_filename='open_clip_pytorch_model.bin', mean=OPENAI_CLIP_MEAN, std=OPENAI_CLIP_STD, num_classes=1024), From 61538162505d744c4cebdd7e3c1fb0d094b887c5 Mon Sep 17 00:00:00 2001 From: nateraw Date: Wed, 5 Oct 2022 12:27:17 -0400 Subject: [PATCH 11/26] :construction: test doc-builder branch to fix build here --- .github/workflows/build_documentation.yml | 2 +- .github/workflows/build_pr_documentation.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_documentation.yml b/.github/workflows/build_documentation.yml index 11a98490..e06c3e4e 100644 --- a/.github/workflows/build_documentation.yml +++ b/.github/workflows/build_documentation.yml @@ -9,7 +9,7 @@ on: jobs: build: - uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main + uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@fix-issue-305 with: commit_sha: ${{ github.sha }} package: pytorch-image-models diff --git a/.github/workflows/build_pr_documentation.yml b/.github/workflows/build_pr_documentation.yml index 00d398ad..35693dc3 100644 --- a/.github/workflows/build_pr_documentation.yml +++ b/.github/workflows/build_pr_documentation.yml @@ -9,7 +9,7 @@ concurrency: jobs: build: - uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main + uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@fix-issue-305 with: commit_sha: ${{ github.event.pull_request.head.sha }} pr_number: ${{ github.event.number }} From d56f9f7a236bbd8b9143a822de32b5cc1f61ace3 Mon Sep 17 00:00:00 2001 From: nateraw Date: Wed, 5 Oct 2022 12:39:34 -0400 Subject: [PATCH 12/26] :bug: fix link --- hfdocs/source/models/adversarial-inception-v3.mdx | 2 +- hfdocs/source/models/advprop.mdx | 2 +- hfdocs/source/models/big-transfer.mdx | 2 +- hfdocs/source/models/csp-darknet.mdx | 2 +- hfdocs/source/models/csp-resnet.mdx | 2 +- hfdocs/source/models/csp-resnext.mdx | 2 +- hfdocs/source/models/densenet.mdx | 2 +- hfdocs/source/models/dla.mdx | 2 +- hfdocs/source/models/dpn.mdx | 2 +- hfdocs/source/models/ecaresnet.mdx | 2 +- hfdocs/source/models/efficientnet-pruned.mdx | 2 +- hfdocs/source/models/efficientnet.mdx | 2 +- hfdocs/source/models/ensemble-adversarial.mdx | 2 +- hfdocs/source/models/ese-vovnet.mdx | 2 +- hfdocs/source/models/fbnet.mdx | 2 +- hfdocs/source/models/gloun-inception-v3.mdx | 2 +- hfdocs/source/models/gloun-resnet.mdx | 2 +- hfdocs/source/models/gloun-resnext.mdx | 2 +- hfdocs/source/models/gloun-senet.mdx | 2 +- hfdocs/source/models/gloun-seresnext.mdx | 2 +- hfdocs/source/models/gloun-xception.mdx | 2 +- hfdocs/source/models/hrnet.mdx | 2 +- hfdocs/source/models/ig-resnext.mdx | 2 +- hfdocs/source/models/inception-resnet-v2.mdx | 2 +- hfdocs/source/models/inception-v3.mdx | 2 +- hfdocs/source/models/inception-v4.mdx | 2 +- hfdocs/source/models/legacy-se-resnet.mdx | 2 +- hfdocs/source/models/legacy-se-resnext.mdx | 2 +- hfdocs/source/models/legacy-senet.mdx | 2 +- hfdocs/source/models/mixnet.mdx | 2 +- hfdocs/source/models/mnasnet.mdx | 2 +- hfdocs/source/models/mobilenet-v2.mdx | 2 +- hfdocs/source/models/mobilenet-v3.mdx | 2 +- hfdocs/source/models/nasnet.mdx | 2 +- hfdocs/source/models/noisy-student.mdx | 2 +- hfdocs/source/models/pnasnet.mdx | 2 +- hfdocs/source/models/regnetx.mdx | 2 +- hfdocs/source/models/regnety.mdx | 2 +- hfdocs/source/models/res2net.mdx | 2 +- hfdocs/source/models/res2next.mdx | 2 +- hfdocs/source/models/resnest.mdx | 2 +- hfdocs/source/models/resnet-d.mdx | 2 +- hfdocs/source/models/resnet.mdx | 2 +- hfdocs/source/models/resnext.mdx | 2 +- hfdocs/source/models/rexnet.mdx | 2 +- hfdocs/source/models/se-resnet.mdx | 2 +- hfdocs/source/models/selecsls.mdx | 2 +- hfdocs/source/models/seresnext.mdx | 2 +- hfdocs/source/models/skresnet.mdx | 2 +- hfdocs/source/models/skresnext.mdx | 2 +- hfdocs/source/models/spnasnet.mdx | 2 +- hfdocs/source/models/ssl-resnet.mdx | 2 +- hfdocs/source/models/swsl-resnet.mdx | 2 +- hfdocs/source/models/swsl-resnext.mdx | 2 +- hfdocs/source/models/tf-efficientnet-condconv.mdx | 2 +- hfdocs/source/models/tf-efficientnet-lite.mdx | 2 +- hfdocs/source/models/tf-efficientnet.mdx | 2 +- hfdocs/source/models/tf-inception-v3.mdx | 2 +- hfdocs/source/models/tf-mixnet.mdx | 2 +- hfdocs/source/models/tf-mobilenet-v3.mdx | 2 +- hfdocs/source/models/tresnet.mdx | 2 +- hfdocs/source/models/wide-resnet.mdx | 2 +- hfdocs/source/models/xception.mdx | 2 +- 63 files changed, 63 insertions(+), 63 deletions(-) diff --git a/hfdocs/source/models/adversarial-inception-v3.mdx b/hfdocs/source/models/adversarial-inception-v3.mdx index eb17342c..06314435 100644 --- a/hfdocs/source/models/adversarial-inception-v3.mdx +++ b/hfdocs/source/models/adversarial-inception-v3.mdx @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/advprop.mdx b/hfdocs/source/models/advprop.mdx index 9a0ecfd7..de31177b 100644 --- a/hfdocs/source/models/advprop.mdx +++ b/hfdocs/source/models/advprop.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/big-transfer.mdx b/hfdocs/source/models/big-transfer.mdx index 25f557d7..4f353d9a 100644 --- a/hfdocs/source/models/big-transfer.mdx +++ b/hfdocs/source/models/big-transfer.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/csp-darknet.mdx b/hfdocs/source/models/csp-darknet.mdx index f6a0d38c..41124940 100644 --- a/hfdocs/source/models/csp-darknet.mdx +++ b/hfdocs/source/models/csp-darknet.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/csp-resnet.mdx b/hfdocs/source/models/csp-resnet.mdx index ae8f0ea3..4734b6f9 100644 --- a/hfdocs/source/models/csp-resnet.mdx +++ b/hfdocs/source/models/csp-resnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/csp-resnext.mdx b/hfdocs/source/models/csp-resnext.mdx index 54f07d91..a7697802 100644 --- a/hfdocs/source/models/csp-resnext.mdx +++ b/hfdocs/source/models/csp-resnext.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/densenet.mdx b/hfdocs/source/models/densenet.mdx index ee6e5d1a..4554fb12 100644 --- a/hfdocs/source/models/densenet.mdx +++ b/hfdocs/source/models/densenet.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/dla.mdx b/hfdocs/source/models/dla.mdx index e7e4673d..19825014 100644 --- a/hfdocs/source/models/dla.mdx +++ b/hfdocs/source/models/dla.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/dpn.mdx b/hfdocs/source/models/dpn.mdx index b7c9dbbb..946a6cfa 100644 --- a/hfdocs/source/models/dpn.mdx +++ b/hfdocs/source/models/dpn.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/ecaresnet.mdx b/hfdocs/source/models/ecaresnet.mdx index 3dd25371..9f913f84 100644 --- a/hfdocs/source/models/ecaresnet.mdx +++ b/hfdocs/source/models/ecaresnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/efficientnet-pruned.mdx b/hfdocs/source/models/efficientnet-pruned.mdx index 90f7f1aa..616cca7c 100644 --- a/hfdocs/source/models/efficientnet-pruned.mdx +++ b/hfdocs/source/models/efficientnet-pruned.mdx @@ -79,7 +79,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/efficientnet.mdx b/hfdocs/source/models/efficientnet.mdx index 21e6baaf..3bccfcfe 100644 --- a/hfdocs/source/models/efficientnet.mdx +++ b/hfdocs/source/models/efficientnet.mdx @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/ensemble-adversarial.mdx b/hfdocs/source/models/ensemble-adversarial.mdx index a20f43d9..09ee0e92 100644 --- a/hfdocs/source/models/ensemble-adversarial.mdx +++ b/hfdocs/source/models/ensemble-adversarial.mdx @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/ese-vovnet.mdx b/hfdocs/source/models/ese-vovnet.mdx index 8a854b1e..e67d0498 100644 --- a/hfdocs/source/models/ese-vovnet.mdx +++ b/hfdocs/source/models/ese-vovnet.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/fbnet.mdx b/hfdocs/source/models/fbnet.mdx index dc355ee7..6f76dae7 100644 --- a/hfdocs/source/models/fbnet.mdx +++ b/hfdocs/source/models/fbnet.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/gloun-inception-v3.mdx b/hfdocs/source/models/gloun-inception-v3.mdx index 0c287526..56d26e76 100644 --- a/hfdocs/source/models/gloun-inception-v3.mdx +++ b/hfdocs/source/models/gloun-inception-v3.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/gloun-resnet.mdx b/hfdocs/source/models/gloun-resnet.mdx index ef9585ff..da991649 100644 --- a/hfdocs/source/models/gloun-resnet.mdx +++ b/hfdocs/source/models/gloun-resnet.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/gloun-resnext.mdx b/hfdocs/source/models/gloun-resnext.mdx index 4c8d64ab..d6584b32 100644 --- a/hfdocs/source/models/gloun-resnext.mdx +++ b/hfdocs/source/models/gloun-resnext.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/gloun-senet.mdx b/hfdocs/source/models/gloun-senet.mdx index 981cb644..b9667c5d 100644 --- a/hfdocs/source/models/gloun-senet.mdx +++ b/hfdocs/source/models/gloun-senet.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/gloun-seresnext.mdx b/hfdocs/source/models/gloun-seresnext.mdx index 409d36c1..519e3780 100644 --- a/hfdocs/source/models/gloun-seresnext.mdx +++ b/hfdocs/source/models/gloun-seresnext.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/gloun-xception.mdx b/hfdocs/source/models/gloun-xception.mdx index f9f2df05..f0a7c324 100644 --- a/hfdocs/source/models/gloun-xception.mdx +++ b/hfdocs/source/models/gloun-xception.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/hrnet.mdx b/hfdocs/source/models/hrnet.mdx index b2fb918b..8828385d 100644 --- a/hfdocs/source/models/hrnet.mdx +++ b/hfdocs/source/models/hrnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/ig-resnext.mdx b/hfdocs/source/models/ig-resnext.mdx index f16f3114..0a95a973 100644 --- a/hfdocs/source/models/ig-resnext.mdx +++ b/hfdocs/source/models/ig-resnext.mdx @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/inception-resnet-v2.mdx b/hfdocs/source/models/inception-resnet-v2.mdx index e54166e9..6c932cd2 100644 --- a/hfdocs/source/models/inception-resnet-v2.mdx +++ b/hfdocs/source/models/inception-resnet-v2.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/inception-v3.mdx b/hfdocs/source/models/inception-v3.mdx index 4dae8aa2..50cd9ff4 100644 --- a/hfdocs/source/models/inception-v3.mdx +++ b/hfdocs/source/models/inception-v3.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/inception-v4.mdx b/hfdocs/source/models/inception-v4.mdx index f1721007..386eab71 100644 --- a/hfdocs/source/models/inception-v4.mdx +++ b/hfdocs/source/models/inception-v4.mdx @@ -72,7 +72,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/legacy-se-resnet.mdx b/hfdocs/source/models/legacy-se-resnet.mdx index bed5ed70..5bc42874 100644 --- a/hfdocs/source/models/legacy-se-resnet.mdx +++ b/hfdocs/source/models/legacy-se-resnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/legacy-se-resnext.mdx b/hfdocs/source/models/legacy-se-resnext.mdx index 33cfb63a..617b0827 100644 --- a/hfdocs/source/models/legacy-se-resnext.mdx +++ b/hfdocs/source/models/legacy-se-resnext.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/legacy-senet.mdx b/hfdocs/source/models/legacy-senet.mdx index abe3ffcd..42fc6d79 100644 --- a/hfdocs/source/models/legacy-senet.mdx +++ b/hfdocs/source/models/legacy-senet.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/mixnet.mdx b/hfdocs/source/models/mixnet.mdx index ec62ec00..785a28b8 100644 --- a/hfdocs/source/models/mixnet.mdx +++ b/hfdocs/source/models/mixnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/mnasnet.mdx b/hfdocs/source/models/mnasnet.mdx index c6be000a..90939284 100644 --- a/hfdocs/source/models/mnasnet.mdx +++ b/hfdocs/source/models/mnasnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/mobilenet-v2.mdx b/hfdocs/source/models/mobilenet-v2.mdx index 812f991d..db265ed3 100644 --- a/hfdocs/source/models/mobilenet-v2.mdx +++ b/hfdocs/source/models/mobilenet-v2.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/mobilenet-v3.mdx b/hfdocs/source/models/mobilenet-v3.mdx index 939dc85e..c4421808 100644 --- a/hfdocs/source/models/mobilenet-v3.mdx +++ b/hfdocs/source/models/mobilenet-v3.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/nasnet.mdx b/hfdocs/source/models/nasnet.mdx index 3a0e601a..f9e5b8ad 100644 --- a/hfdocs/source/models/nasnet.mdx +++ b/hfdocs/source/models/nasnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/noisy-student.mdx b/hfdocs/source/models/noisy-student.mdx index 397278d1..8a80f994 100644 --- a/hfdocs/source/models/noisy-student.mdx +++ b/hfdocs/source/models/noisy-student.mdx @@ -82,7 +82,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/pnasnet.mdx b/hfdocs/source/models/pnasnet.mdx index e5ec59c0..001c0923 100644 --- a/hfdocs/source/models/pnasnet.mdx +++ b/hfdocs/source/models/pnasnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/regnetx.mdx b/hfdocs/source/models/regnetx.mdx index e13caa35..5e031e03 100644 --- a/hfdocs/source/models/regnetx.mdx +++ b/hfdocs/source/models/regnetx.mdx @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/regnety.mdx b/hfdocs/source/models/regnety.mdx index c0a2e905..be0200ab 100644 --- a/hfdocs/source/models/regnety.mdx +++ b/hfdocs/source/models/regnety.mdx @@ -79,7 +79,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/res2net.mdx b/hfdocs/source/models/res2net.mdx index c546948c..4ad66112 100644 --- a/hfdocs/source/models/res2net.mdx +++ b/hfdocs/source/models/res2net.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/res2next.mdx b/hfdocs/source/models/res2next.mdx index 58714dee..1d356452 100644 --- a/hfdocs/source/models/res2next.mdx +++ b/hfdocs/source/models/res2next.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/resnest.mdx b/hfdocs/source/models/resnest.mdx index 1cf25105..43fed635 100644 --- a/hfdocs/source/models/resnest.mdx +++ b/hfdocs/source/models/resnest.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/resnet-d.mdx b/hfdocs/source/models/resnet-d.mdx index d858af0f..b2be2d3d 100644 --- a/hfdocs/source/models/resnet-d.mdx +++ b/hfdocs/source/models/resnet-d.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/resnet.mdx b/hfdocs/source/models/resnet.mdx index 541079c8..922549b4 100644 --- a/hfdocs/source/models/resnet.mdx +++ b/hfdocs/source/models/resnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/resnext.mdx b/hfdocs/source/models/resnext.mdx index 07b4254d..244e9fb1 100644 --- a/hfdocs/source/models/resnext.mdx +++ b/hfdocs/source/models/resnext.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/rexnet.mdx b/hfdocs/source/models/rexnet.mdx index 8c1307d7..714365f2 100644 --- a/hfdocs/source/models/rexnet.mdx +++ b/hfdocs/source/models/rexnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/se-resnet.mdx b/hfdocs/source/models/se-resnet.mdx index 1473fd7e..ef23583d 100644 --- a/hfdocs/source/models/se-resnet.mdx +++ b/hfdocs/source/models/se-resnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/selecsls.mdx b/hfdocs/source/models/selecsls.mdx index a07511a6..3a9366bc 100644 --- a/hfdocs/source/models/selecsls.mdx +++ b/hfdocs/source/models/selecsls.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/seresnext.mdx b/hfdocs/source/models/seresnext.mdx index 9d3e9125..ff5af012 100644 --- a/hfdocs/source/models/seresnext.mdx +++ b/hfdocs/source/models/seresnext.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/skresnet.mdx b/hfdocs/source/models/skresnet.mdx index 2b9422d5..ce182ed9 100644 --- a/hfdocs/source/models/skresnet.mdx +++ b/hfdocs/source/models/skresnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/skresnext.mdx b/hfdocs/source/models/skresnext.mdx index bec6ea5b..a3c36f5d 100644 --- a/hfdocs/source/models/skresnext.mdx +++ b/hfdocs/source/models/skresnext.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/spnasnet.mdx b/hfdocs/source/models/spnasnet.mdx index 2af6c5ee..4d0f90a7 100644 --- a/hfdocs/source/models/spnasnet.mdx +++ b/hfdocs/source/models/spnasnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/ssl-resnet.mdx b/hfdocs/source/models/ssl-resnet.mdx index ddb73f94..190afff1 100644 --- a/hfdocs/source/models/ssl-resnet.mdx +++ b/hfdocs/source/models/ssl-resnet.mdx @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/swsl-resnet.mdx b/hfdocs/source/models/swsl-resnet.mdx index 61749584..7789c17d 100644 --- a/hfdocs/source/models/swsl-resnet.mdx +++ b/hfdocs/source/models/swsl-resnet.mdx @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/swsl-resnext.mdx b/hfdocs/source/models/swsl-resnext.mdx index 132aacd6..9b309093 100644 --- a/hfdocs/source/models/swsl-resnext.mdx +++ b/hfdocs/source/models/swsl-resnext.mdx @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/tf-efficientnet-condconv.mdx b/hfdocs/source/models/tf-efficientnet-condconv.mdx index 57dfb8ee..d8f09940 100644 --- a/hfdocs/source/models/tf-efficientnet-condconv.mdx +++ b/hfdocs/source/models/tf-efficientnet-condconv.mdx @@ -81,7 +81,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/tf-efficientnet-lite.mdx b/hfdocs/source/models/tf-efficientnet-lite.mdx index 24af2dda..c2005695 100644 --- a/hfdocs/source/models/tf-efficientnet-lite.mdx +++ b/hfdocs/source/models/tf-efficientnet-lite.mdx @@ -81,7 +81,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/tf-efficientnet.mdx b/hfdocs/source/models/tf-efficientnet.mdx index 3284a982..ebac0f3c 100644 --- a/hfdocs/source/models/tf-efficientnet.mdx +++ b/hfdocs/source/models/tf-efficientnet.mdx @@ -79,7 +79,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/tf-inception-v3.mdx b/hfdocs/source/models/tf-inception-v3.mdx index 2c721510..71f0e0cf 100644 --- a/hfdocs/source/models/tf-inception-v3.mdx +++ b/hfdocs/source/models/tf-inception-v3.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/tf-mixnet.mdx b/hfdocs/source/models/tf-mixnet.mdx index bd506b98..6e92510c 100644 --- a/hfdocs/source/models/tf-mixnet.mdx +++ b/hfdocs/source/models/tf-mixnet.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/tf-mobilenet-v3.mdx b/hfdocs/source/models/tf-mobilenet-v3.mdx index 8ef878da..59f5cc2d 100644 --- a/hfdocs/source/models/tf-mobilenet-v3.mdx +++ b/hfdocs/source/models/tf-mobilenet-v3.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/tresnet.mdx b/hfdocs/source/models/tresnet.mdx index 14f6959b..27594ff1 100644 --- a/hfdocs/source/models/tresnet.mdx +++ b/hfdocs/source/models/tresnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/wide-resnet.mdx b/hfdocs/source/models/wide-resnet.mdx index 869c09b4..1a40c627 100644 --- a/hfdocs/source/models/wide-resnet.mdx +++ b/hfdocs/source/models/wide-resnet.mdx @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/xception.mdx b/hfdocs/source/models/xception.mdx index 9ce8d576..80b59b55 100644 --- a/hfdocs/source/models/xception.mdx +++ b/hfdocs/source/models/xception.mdx @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-models/scripts/) for training a new model afresh. +You can follow the [timm recipe scripts](scripts) for training a new model afresh. ## Citation From b8e3ffd498225d0372e9f0fe969d7810e41076e4 Mon Sep 17 00:00:00 2001 From: nateraw Date: Wed, 5 Oct 2022 12:40:44 -0400 Subject: [PATCH 13/26] :construction_worker: revert ci workflow to main --- .github/workflows/build_documentation.yml | 2 +- .github/workflows/build_pr_documentation.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_documentation.yml b/.github/workflows/build_documentation.yml index e06c3e4e..11a98490 100644 --- a/.github/workflows/build_documentation.yml +++ b/.github/workflows/build_documentation.yml @@ -9,7 +9,7 @@ on: jobs: build: - uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@fix-issue-305 + uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main with: commit_sha: ${{ github.sha }} package: pytorch-image-models diff --git a/.github/workflows/build_pr_documentation.yml b/.github/workflows/build_pr_documentation.yml index 35693dc3..00d398ad 100644 --- a/.github/workflows/build_pr_documentation.yml +++ b/.github/workflows/build_pr_documentation.yml @@ -9,7 +9,7 @@ concurrency: jobs: build: - uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@fix-issue-305 + uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main with: commit_sha: ${{ github.event.pull_request.head.sha }} pr_number: ${{ github.event.number }} From 09a77700f679175e20949083b7028b40874e87e1 Mon Sep 17 00:00:00 2001 From: nateraw Date: Wed, 5 Oct 2022 12:50:02 -0400 Subject: [PATCH 14/26] :construction_worker: bump back. it was actions outage not me --- .github/workflows/build_documentation.yml | 2 +- .github/workflows/build_pr_documentation.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_documentation.yml b/.github/workflows/build_documentation.yml index 11a98490..e06c3e4e 100644 --- a/.github/workflows/build_documentation.yml +++ b/.github/workflows/build_documentation.yml @@ -9,7 +9,7 @@ on: jobs: build: - uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main + uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@fix-issue-305 with: commit_sha: ${{ github.sha }} package: pytorch-image-models diff --git a/.github/workflows/build_pr_documentation.yml b/.github/workflows/build_pr_documentation.yml index 00d398ad..35693dc3 100644 --- a/.github/workflows/build_pr_documentation.yml +++ b/.github/workflows/build_pr_documentation.yml @@ -9,7 +9,7 @@ concurrency: jobs: build: - uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main + uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@fix-issue-305 with: commit_sha: ${{ github.event.pull_request.head.sha }} pr_number: ${{ github.event.number }} From 5f9eef712c96e55cc97d378433f2a17e4a9b0797 Mon Sep 17 00:00:00 2001 From: nateraw Date: Wed, 5 Oct 2022 13:05:17 -0400 Subject: [PATCH 15/26] :construction_worker: bump ci --- .github/workflows/build_documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_documentation.yml b/.github/workflows/build_documentation.yml index e06c3e4e..407bba29 100644 --- a/.github/workflows/build_documentation.yml +++ b/.github/workflows/build_documentation.yml @@ -18,4 +18,4 @@ jobs: path_to_docs: pytorch-image-models/hfdocs/source additional_args: --not_python_module secrets: - token: ${{ secrets.HUGGINGFACE_PUSH }} + token: ${{ secrets.HUGGINGFACE_PUSH }} \ No newline at end of file From 9343f6e431b2da08f271c7fb3d2ea831d799b88a Mon Sep 17 00:00:00 2001 From: nateraw Date: Wed, 5 Oct 2022 13:58:17 -0400 Subject: [PATCH 16/26] :construction_worker: update ci --- .github/workflows/build_pr_documentation.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build_pr_documentation.yml b/.github/workflows/build_pr_documentation.yml index 35693dc3..2e510981 100644 --- a/.github/workflows/build_pr_documentation.yml +++ b/.github/workflows/build_pr_documentation.yml @@ -17,4 +17,3 @@ jobs: package_name: timm repo_owner: rwightman path_to_docs: pytorch-image-models/hfdocs/source - additional_args: --not_python_module \ No newline at end of file From 8ef9c48cc5ea9f4dd473989091d89a2df24352ee Mon Sep 17 00:00:00 2001 From: nateraw Date: Thu, 6 Oct 2022 13:54:57 -0400 Subject: [PATCH 17/26] :construction_worker: use main branch of doc-builder thats fixed now --- .github/workflows/build_documentation.yml | 2 +- .github/workflows/build_pr_documentation.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_documentation.yml b/.github/workflows/build_documentation.yml index 407bba29..a6e99600 100644 --- a/.github/workflows/build_documentation.yml +++ b/.github/workflows/build_documentation.yml @@ -9,7 +9,7 @@ on: jobs: build: - uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@fix-issue-305 + uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main with: commit_sha: ${{ github.sha }} package: pytorch-image-models diff --git a/.github/workflows/build_pr_documentation.yml b/.github/workflows/build_pr_documentation.yml index 2e510981..4b1b5c9d 100644 --- a/.github/workflows/build_pr_documentation.yml +++ b/.github/workflows/build_pr_documentation.yml @@ -9,7 +9,7 @@ concurrency: jobs: build: - uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@fix-issue-305 + uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main with: commit_sha: ${{ github.event.pull_request.head.sha }} pr_number: ${{ github.event.number }} From df29d4687236f66d456798af280d8110e85b4d7f Mon Sep 17 00:00:00 2001 From: nateraw Date: Thu, 6 Oct 2022 14:00:50 -0400 Subject: [PATCH 18/26] :recycle: old doc links -> new doc links --- hfdocs/source/models/adversarial-inception-v3.mdx | 4 ++-- hfdocs/source/models/advprop.mdx | 4 ++-- hfdocs/source/models/big-transfer.mdx | 4 ++-- hfdocs/source/models/csp-darknet.mdx | 4 ++-- hfdocs/source/models/csp-resnet.mdx | 4 ++-- hfdocs/source/models/csp-resnext.mdx | 4 ++-- hfdocs/source/models/densenet.mdx | 4 ++-- hfdocs/source/models/dla.mdx | 4 ++-- hfdocs/source/models/dpn.mdx | 4 ++-- hfdocs/source/models/ecaresnet.mdx | 4 ++-- hfdocs/source/models/efficientnet-pruned.mdx | 4 ++-- hfdocs/source/models/efficientnet.mdx | 4 ++-- hfdocs/source/models/ensemble-adversarial.mdx | 4 ++-- hfdocs/source/models/ese-vovnet.mdx | 4 ++-- hfdocs/source/models/fbnet.mdx | 4 ++-- hfdocs/source/models/gloun-inception-v3.mdx | 4 ++-- hfdocs/source/models/gloun-resnet.mdx | 4 ++-- hfdocs/source/models/gloun-resnext.mdx | 4 ++-- hfdocs/source/models/gloun-senet.mdx | 4 ++-- hfdocs/source/models/gloun-seresnext.mdx | 4 ++-- hfdocs/source/models/gloun-xception.mdx | 4 ++-- hfdocs/source/models/hrnet.mdx | 4 ++-- hfdocs/source/models/ig-resnext.mdx | 4 ++-- hfdocs/source/models/inception-resnet-v2.mdx | 4 ++-- hfdocs/source/models/inception-v3.mdx | 4 ++-- hfdocs/source/models/inception-v4.mdx | 4 ++-- hfdocs/source/models/legacy-se-resnet.mdx | 4 ++-- hfdocs/source/models/legacy-se-resnext.mdx | 4 ++-- hfdocs/source/models/legacy-senet.mdx | 4 ++-- hfdocs/source/models/mixnet.mdx | 4 ++-- hfdocs/source/models/mnasnet.mdx | 4 ++-- hfdocs/source/models/mobilenet-v2.mdx | 4 ++-- hfdocs/source/models/mobilenet-v3.mdx | 4 ++-- hfdocs/source/models/nasnet.mdx | 4 ++-- hfdocs/source/models/noisy-student.mdx | 4 ++-- hfdocs/source/models/pnasnet.mdx | 4 ++-- hfdocs/source/models/regnetx.mdx | 4 ++-- hfdocs/source/models/regnety.mdx | 4 ++-- hfdocs/source/models/res2net.mdx | 4 ++-- hfdocs/source/models/res2next.mdx | 4 ++-- hfdocs/source/models/resnest.mdx | 4 ++-- hfdocs/source/models/resnet-d.mdx | 4 ++-- hfdocs/source/models/resnet.mdx | 4 ++-- hfdocs/source/models/resnext.mdx | 4 ++-- hfdocs/source/models/rexnet.mdx | 4 ++-- hfdocs/source/models/se-resnet.mdx | 4 ++-- hfdocs/source/models/selecsls.mdx | 4 ++-- hfdocs/source/models/seresnext.mdx | 4 ++-- hfdocs/source/models/skresnet.mdx | 4 ++-- hfdocs/source/models/skresnext.mdx | 4 ++-- hfdocs/source/models/spnasnet.mdx | 4 ++-- hfdocs/source/models/ssl-resnet.mdx | 4 ++-- hfdocs/source/models/swsl-resnet.mdx | 4 ++-- hfdocs/source/models/swsl-resnext.mdx | 4 ++-- hfdocs/source/models/tf-efficientnet-condconv.mdx | 4 ++-- hfdocs/source/models/tf-efficientnet-lite.mdx | 4 ++-- hfdocs/source/models/tf-efficientnet.mdx | 4 ++-- hfdocs/source/models/tf-inception-v3.mdx | 4 ++-- hfdocs/source/models/tf-mixnet.mdx | 4 ++-- hfdocs/source/models/tf-mobilenet-v3.mdx | 4 ++-- hfdocs/source/models/tresnet.mdx | 4 ++-- hfdocs/source/models/wide-resnet.mdx | 4 ++-- hfdocs/source/models/xception.mdx | 4 ++-- 63 files changed, 126 insertions(+), 126 deletions(-) diff --git a/hfdocs/source/models/adversarial-inception-v3.mdx b/hfdocs/source/models/adversarial-inception-v3.mdx index 06314435..fd7fce47 100644 --- a/hfdocs/source/models/adversarial-inception-v3.mdx +++ b/hfdocs/source/models/adversarial-inception-v3.mdx @@ -63,7 +63,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `adv_inception_v3`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/advprop.mdx b/hfdocs/source/models/advprop.mdx index de31177b..0743a1e4 100644 --- a/hfdocs/source/models/advprop.mdx +++ b/hfdocs/source/models/advprop.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `tf_efficientnet_b0_ap`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/big-transfer.mdx b/hfdocs/source/models/big-transfer.mdx index 4f353d9a..05255c35 100644 --- a/hfdocs/source/models/big-transfer.mdx +++ b/hfdocs/source/models/big-transfer.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `resnetv2_101x1_bitm`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/csp-darknet.mdx b/hfdocs/source/models/csp-darknet.mdx index 41124940..7accdbae 100644 --- a/hfdocs/source/models/csp-darknet.mdx +++ b/hfdocs/source/models/csp-darknet.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `cspdarknet53`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/csp-resnet.mdx b/hfdocs/source/models/csp-resnet.mdx index 4734b6f9..66971057 100644 --- a/hfdocs/source/models/csp-resnet.mdx +++ b/hfdocs/source/models/csp-resnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `cspresnet50`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/csp-resnext.mdx b/hfdocs/source/models/csp-resnext.mdx index a7697802..d9eb8383 100644 --- a/hfdocs/source/models/csp-resnext.mdx +++ b/hfdocs/source/models/csp-resnext.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `cspresnext50`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/densenet.mdx b/hfdocs/source/models/densenet.mdx index 4554fb12..cec9ba17 100644 --- a/hfdocs/source/models/densenet.mdx +++ b/hfdocs/source/models/densenet.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `densenet121`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/dla.mdx b/hfdocs/source/models/dla.mdx index 19825014..ab38d626 100644 --- a/hfdocs/source/models/dla.mdx +++ b/hfdocs/source/models/dla.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `dla102`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/dpn.mdx b/hfdocs/source/models/dpn.mdx index 946a6cfa..26d8a4a7 100644 --- a/hfdocs/source/models/dpn.mdx +++ b/hfdocs/source/models/dpn.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `dpn107`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/ecaresnet.mdx b/hfdocs/source/models/ecaresnet.mdx index 9f913f84..c5c1619e 100644 --- a/hfdocs/source/models/ecaresnet.mdx +++ b/hfdocs/source/models/ecaresnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `ecaresnet101d`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/efficientnet-pruned.mdx b/hfdocs/source/models/efficientnet-pruned.mdx index 616cca7c..75ad6cab 100644 --- a/hfdocs/source/models/efficientnet-pruned.mdx +++ b/hfdocs/source/models/efficientnet-pruned.mdx @@ -65,7 +65,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `efficientnet_b1_pruned`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -79,7 +79,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/efficientnet.mdx b/hfdocs/source/models/efficientnet.mdx index 3bccfcfe..f9e01962 100644 --- a/hfdocs/source/models/efficientnet.mdx +++ b/hfdocs/source/models/efficientnet.mdx @@ -63,7 +63,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `efficientnet_b0`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/ensemble-adversarial.mdx b/hfdocs/source/models/ensemble-adversarial.mdx index 09ee0e92..4781aa1f 100644 --- a/hfdocs/source/models/ensemble-adversarial.mdx +++ b/hfdocs/source/models/ensemble-adversarial.mdx @@ -63,7 +63,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `ens_adv_inception_resnet_v2`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/ese-vovnet.mdx b/hfdocs/source/models/ese-vovnet.mdx index e67d0498..d92a6034 100644 --- a/hfdocs/source/models/ese-vovnet.mdx +++ b/hfdocs/source/models/ese-vovnet.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `ese_vovnet19b_dw`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/fbnet.mdx b/hfdocs/source/models/fbnet.mdx index 6f76dae7..cdb3ba61 100644 --- a/hfdocs/source/models/fbnet.mdx +++ b/hfdocs/source/models/fbnet.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `fbnetc_100`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/gloun-inception-v3.mdx b/hfdocs/source/models/gloun-inception-v3.mdx index 56d26e76..edf3d870 100644 --- a/hfdocs/source/models/gloun-inception-v3.mdx +++ b/hfdocs/source/models/gloun-inception-v3.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `gluon_inception_v3`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/gloun-resnet.mdx b/hfdocs/source/models/gloun-resnet.mdx index da991649..8cd97056 100644 --- a/hfdocs/source/models/gloun-resnet.mdx +++ b/hfdocs/source/models/gloun-resnet.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `gluon_resnet101_v1b`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/gloun-resnext.mdx b/hfdocs/source/models/gloun-resnext.mdx index d6584b32..7420b3c7 100644 --- a/hfdocs/source/models/gloun-resnext.mdx +++ b/hfdocs/source/models/gloun-resnext.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `gluon_resnext101_32x4d`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/gloun-senet.mdx b/hfdocs/source/models/gloun-senet.mdx index b9667c5d..ee28d7c8 100644 --- a/hfdocs/source/models/gloun-senet.mdx +++ b/hfdocs/source/models/gloun-senet.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `gluon_senet154`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/gloun-seresnext.mdx b/hfdocs/source/models/gloun-seresnext.mdx index 519e3780..bb432155 100644 --- a/hfdocs/source/models/gloun-seresnext.mdx +++ b/hfdocs/source/models/gloun-seresnext.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `gluon_seresnext101_32x4d`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/gloun-xception.mdx b/hfdocs/source/models/gloun-xception.mdx index f0a7c324..0dee376e 100644 --- a/hfdocs/source/models/gloun-xception.mdx +++ b/hfdocs/source/models/gloun-xception.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `gluon_xception65`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/hrnet.mdx b/hfdocs/source/models/hrnet.mdx index 8828385d..c0d5ec2a 100644 --- a/hfdocs/source/models/hrnet.mdx +++ b/hfdocs/source/models/hrnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `hrnet_w18`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/ig-resnext.mdx b/hfdocs/source/models/ig-resnext.mdx index 0a95a973..0f2b2249 100644 --- a/hfdocs/source/models/ig-resnext.mdx +++ b/hfdocs/source/models/ig-resnext.mdx @@ -63,7 +63,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `ig_resnext101_32x16d`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/inception-resnet-v2.mdx b/hfdocs/source/models/inception-resnet-v2.mdx index 6c932cd2..c4eb1586 100644 --- a/hfdocs/source/models/inception-resnet-v2.mdx +++ b/hfdocs/source/models/inception-resnet-v2.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `inception_resnet_v2`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/inception-v3.mdx b/hfdocs/source/models/inception-v3.mdx index 50cd9ff4..cd21e5de 100644 --- a/hfdocs/source/models/inception-v3.mdx +++ b/hfdocs/source/models/inception-v3.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `inception_v3`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/inception-v4.mdx b/hfdocs/source/models/inception-v4.mdx index 386eab71..f9b4adf0 100644 --- a/hfdocs/source/models/inception-v4.mdx +++ b/hfdocs/source/models/inception-v4.mdx @@ -58,7 +58,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `inception_v4`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -72,7 +72,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/legacy-se-resnet.mdx b/hfdocs/source/models/legacy-se-resnet.mdx index 5bc42874..68ed5a30 100644 --- a/hfdocs/source/models/legacy-se-resnet.mdx +++ b/hfdocs/source/models/legacy-se-resnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `legacy_seresnet101`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/legacy-se-resnext.mdx b/hfdocs/source/models/legacy-se-resnext.mdx index 617b0827..8ff527f3 100644 --- a/hfdocs/source/models/legacy-se-resnext.mdx +++ b/hfdocs/source/models/legacy-se-resnext.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `legacy_seresnext101_32x4d`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/legacy-senet.mdx b/hfdocs/source/models/legacy-senet.mdx index 42fc6d79..9768d868 100644 --- a/hfdocs/source/models/legacy-senet.mdx +++ b/hfdocs/source/models/legacy-senet.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `legacy_senet154`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/mixnet.mdx b/hfdocs/source/models/mixnet.mdx index 785a28b8..2e058027 100644 --- a/hfdocs/source/models/mixnet.mdx +++ b/hfdocs/source/models/mixnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `mixnet_l`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/mnasnet.mdx b/hfdocs/source/models/mnasnet.mdx index 90939284..e49c06cc 100644 --- a/hfdocs/source/models/mnasnet.mdx +++ b/hfdocs/source/models/mnasnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `mnasnet_100`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/mobilenet-v2.mdx b/hfdocs/source/models/mobilenet-v2.mdx index db265ed3..507ec99d 100644 --- a/hfdocs/source/models/mobilenet-v2.mdx +++ b/hfdocs/source/models/mobilenet-v2.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `mobilenetv2_100`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/mobilenet-v3.mdx b/hfdocs/source/models/mobilenet-v3.mdx index c4421808..e1ff317b 100644 --- a/hfdocs/source/models/mobilenet-v3.mdx +++ b/hfdocs/source/models/mobilenet-v3.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `mobilenetv3_large_100`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/nasnet.mdx b/hfdocs/source/models/nasnet.mdx index f9e5b8ad..24715f69 100644 --- a/hfdocs/source/models/nasnet.mdx +++ b/hfdocs/source/models/nasnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `nasnetalarge`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/noisy-student.mdx b/hfdocs/source/models/noisy-student.mdx index 8a80f994..2d12e8c8 100644 --- a/hfdocs/source/models/noisy-student.mdx +++ b/hfdocs/source/models/noisy-student.mdx @@ -68,7 +68,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `tf_efficientnet_b0_ns`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -82,7 +82,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/pnasnet.mdx b/hfdocs/source/models/pnasnet.mdx index 001c0923..fff5851c 100644 --- a/hfdocs/source/models/pnasnet.mdx +++ b/hfdocs/source/models/pnasnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `pnasnet5large`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/regnetx.mdx b/hfdocs/source/models/regnetx.mdx index 5e031e03..8ff3e3d7 100644 --- a/hfdocs/source/models/regnetx.mdx +++ b/hfdocs/source/models/regnetx.mdx @@ -63,7 +63,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `regnetx_002`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/regnety.mdx b/hfdocs/source/models/regnety.mdx index be0200ab..51e64f55 100644 --- a/hfdocs/source/models/regnety.mdx +++ b/hfdocs/source/models/regnety.mdx @@ -65,7 +65,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `regnety_002`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -79,7 +79,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/res2net.mdx b/hfdocs/source/models/res2net.mdx index 4ad66112..751cf35d 100644 --- a/hfdocs/source/models/res2net.mdx +++ b/hfdocs/source/models/res2net.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `res2net101_26w_4s`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/res2next.mdx b/hfdocs/source/models/res2next.mdx index 1d356452..8c883dff 100644 --- a/hfdocs/source/models/res2next.mdx +++ b/hfdocs/source/models/res2next.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `res2next50`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/resnest.mdx b/hfdocs/source/models/resnest.mdx index 43fed635..1d64b12e 100644 --- a/hfdocs/source/models/resnest.mdx +++ b/hfdocs/source/models/resnest.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `resnest101e`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/resnet-d.mdx b/hfdocs/source/models/resnet-d.mdx index b2be2d3d..1f6b47b0 100644 --- a/hfdocs/source/models/resnet-d.mdx +++ b/hfdocs/source/models/resnet-d.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `resnet101d`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/resnet.mdx b/hfdocs/source/models/resnet.mdx index 922549b4..3f3641f7 100644 --- a/hfdocs/source/models/resnet.mdx +++ b/hfdocs/source/models/resnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `resnet18`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/resnext.mdx b/hfdocs/source/models/resnext.mdx index 244e9fb1..a905576c 100644 --- a/hfdocs/source/models/resnext.mdx +++ b/hfdocs/source/models/resnext.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `resnext101_32x8d`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/rexnet.mdx b/hfdocs/source/models/rexnet.mdx index 714365f2..09fb2144 100644 --- a/hfdocs/source/models/rexnet.mdx +++ b/hfdocs/source/models/rexnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `rexnet_100`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/se-resnet.mdx b/hfdocs/source/models/se-resnet.mdx index ef23583d..ba884bde 100644 --- a/hfdocs/source/models/se-resnet.mdx +++ b/hfdocs/source/models/se-resnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `seresnet152d`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/selecsls.mdx b/hfdocs/source/models/selecsls.mdx index 3a9366bc..12813ba8 100644 --- a/hfdocs/source/models/selecsls.mdx +++ b/hfdocs/source/models/selecsls.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `selecsls42b`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/seresnext.mdx b/hfdocs/source/models/seresnext.mdx index ff5af012..1f453496 100644 --- a/hfdocs/source/models/seresnext.mdx +++ b/hfdocs/source/models/seresnext.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `seresnext26d_32x4d`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/skresnet.mdx b/hfdocs/source/models/skresnet.mdx index ce182ed9..643a6cbc 100644 --- a/hfdocs/source/models/skresnet.mdx +++ b/hfdocs/source/models/skresnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `skresnet18`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/skresnext.mdx b/hfdocs/source/models/skresnext.mdx index a3c36f5d..ae499b34 100644 --- a/hfdocs/source/models/skresnext.mdx +++ b/hfdocs/source/models/skresnext.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `skresnext50_32x4d`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/spnasnet.mdx b/hfdocs/source/models/spnasnet.mdx index 4d0f90a7..a589b0fc 100644 --- a/hfdocs/source/models/spnasnet.mdx +++ b/hfdocs/source/models/spnasnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `spnasnet_100`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/ssl-resnet.mdx b/hfdocs/source/models/ssl-resnet.mdx index 190afff1..2e1d0a7a 100644 --- a/hfdocs/source/models/ssl-resnet.mdx +++ b/hfdocs/source/models/ssl-resnet.mdx @@ -63,7 +63,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `ssl_resnet18`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/swsl-resnet.mdx b/hfdocs/source/models/swsl-resnet.mdx index 7789c17d..2def3c86 100644 --- a/hfdocs/source/models/swsl-resnet.mdx +++ b/hfdocs/source/models/swsl-resnet.mdx @@ -63,7 +63,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `swsl_resnet18`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/swsl-resnext.mdx b/hfdocs/source/models/swsl-resnext.mdx index 9b309093..63c4f8b1 100644 --- a/hfdocs/source/models/swsl-resnext.mdx +++ b/hfdocs/source/models/swsl-resnext.mdx @@ -63,7 +63,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `swsl_resnext101_32x16d`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -77,7 +77,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/tf-efficientnet-condconv.mdx b/hfdocs/source/models/tf-efficientnet-condconv.mdx index d8f09940..320f20ff 100644 --- a/hfdocs/source/models/tf-efficientnet-condconv.mdx +++ b/hfdocs/source/models/tf-efficientnet-condconv.mdx @@ -67,7 +67,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `tf_efficientnet_cc_b0_4e`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -81,7 +81,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/tf-efficientnet-lite.mdx b/hfdocs/source/models/tf-efficientnet-lite.mdx index c2005695..30671ee7 100644 --- a/hfdocs/source/models/tf-efficientnet-lite.mdx +++ b/hfdocs/source/models/tf-efficientnet-lite.mdx @@ -67,7 +67,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `tf_efficientnet_lite0`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -81,7 +81,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/tf-efficientnet.mdx b/hfdocs/source/models/tf-efficientnet.mdx index ebac0f3c..986d3325 100644 --- a/hfdocs/source/models/tf-efficientnet.mdx +++ b/hfdocs/source/models/tf-efficientnet.mdx @@ -65,7 +65,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `tf_efficientnet_b0`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -79,7 +79,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/tf-inception-v3.mdx b/hfdocs/source/models/tf-inception-v3.mdx index 71f0e0cf..a5f402a9 100644 --- a/hfdocs/source/models/tf-inception-v3.mdx +++ b/hfdocs/source/models/tf-inception-v3.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `tf_inception_v3`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/tf-mixnet.mdx b/hfdocs/source/models/tf-mixnet.mdx index 6e92510c..d1ddda09 100644 --- a/hfdocs/source/models/tf-mixnet.mdx +++ b/hfdocs/source/models/tf-mixnet.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `tf_mixnet_l`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/tf-mobilenet-v3.mdx b/hfdocs/source/models/tf-mobilenet-v3.mdx index 59f5cc2d..3e8c6cba 100644 --- a/hfdocs/source/models/tf-mobilenet-v3.mdx +++ b/hfdocs/source/models/tf-mobilenet-v3.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `tf_mobilenetv3_large_075`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/tresnet.mdx b/hfdocs/source/models/tresnet.mdx index 27594ff1..f2d5729d 100644 --- a/hfdocs/source/models/tresnet.mdx +++ b/hfdocs/source/models/tresnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `tresnet_l`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/wide-resnet.mdx b/hfdocs/source/models/wide-resnet.mdx index 1a40c627..47969325 100644 --- a/hfdocs/source/models/wide-resnet.mdx +++ b/hfdocs/source/models/wide-resnet.mdx @@ -59,7 +59,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `wide_resnet101_2`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -73,7 +73,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation diff --git a/hfdocs/source/models/xception.mdx b/hfdocs/source/models/xception.mdx index 80b59b55..f67e482c 100644 --- a/hfdocs/source/models/xception.mdx +++ b/hfdocs/source/models/xception.mdx @@ -61,7 +61,7 @@ To get the top-5 predictions class names: Replace the model name with the variant you want to use, e.g. `xception`. You can find the IDs in the model summaries at the top of this page. -To extract image features with this model, follow the [timm feature extraction examples](https://rwightman.github.io/pytorch-image-models/feature_extraction/), just change the name of the model you want to use. +To extract image features with this model, follow the [timm feature extraction examples](../feature_extraction), just change the name of the model you want to use. ## How do I finetune this model? @@ -75,7 +75,7 @@ script](https://github.com/rwightman/pytorch-image-models/blob/master/train.py) ## How do I train this model? -You can follow the [timm recipe scripts](scripts) for training a new model afresh. +You can follow the [timm recipe scripts](../scripts) for training a new model afresh. ## Citation From af0c644c5d6b96ba2f282ca8f208945799c7ebfe Mon Sep 17 00:00:00 2001 From: nateraw Date: Thu, 6 Oct 2022 14:36:39 -0400 Subject: [PATCH 19/26] :construction_worker: remove --not_python_module flag --- .github/workflows/build_documentation.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build_documentation.yml b/.github/workflows/build_documentation.yml index a6e99600..54aa59b1 100644 --- a/.github/workflows/build_documentation.yml +++ b/.github/workflows/build_documentation.yml @@ -16,6 +16,5 @@ jobs: package_name: timm repo_owner: rwightman path_to_docs: pytorch-image-models/hfdocs/source - additional_args: --not_python_module secrets: token: ${{ secrets.HUGGINGFACE_PUSH }} \ No newline at end of file From 9914f744dc1eae8618b95e73335526458dc89149 Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Mon, 10 Oct 2022 21:49:18 -0700 Subject: [PATCH 20/26] Add more maxxvit weights includ ConvNeXt conv block based experiments. --- README.md | 15 +++++++++++++ timm/models/maxxvit.py | 49 ++++++++++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index d0f6cd0e..a8863d34 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,21 @@ And a big thanks to all GitHub sponsors who helped with some of my costs before ## What's New +### Oct 10, 2022 +* More weights in `maxxvit` series, incl first ConvNeXt block based `coatnext` and `maxxvit` experiments: + * `coatnext_nano_rw_224` - 82.0 @ 224 (G) -- (uses ConvNeXt conv block, no BatchNorm) + * `maxxvit_nano_rw_256` - 83.0 @ 256, 83.7 @ 320 (G) (uses ConvNeXt conv block, no BN) + * `maxvit_rmlp_small_rw_224` - 84.5 @ 224, 85.1 @ 320 (G) + * `maxxvit_small_rw_256` - 84.6 @ 256, 84.9 @ 288 (G) -- could be trained better, hparams need tuning (uses ConvNeXt block, no BN) + * `coatnet_rmlp_2_rw_224` - 84.6 @ 224, 85 @ 320 (T) + +### Sept 23, 2022 +* LAION-2B CLIP image towers supported as pretrained backbones for fine-tune or features (no classifier) + * vit_base_patch32_224_clip_laion2b + * vit_large_patch14_224_clip_laion2b + * vit_huge_patch14_224_clip_laion2b + * vit_giant_patch14_224_clip_laion2b + ### Sept 7, 2022 * Hugging Face [`timm` docs](https://huggingface.co/docs/hub/timm) home now exists, look for more here in the future * Add BEiT-v2 weights for base and large 224x224 models from https://github.com/microsoft/unilm/tree/master/beit2 diff --git a/timm/models/maxxvit.py b/timm/models/maxxvit.py index 1090e755..bd529245 100644 --- a/timm/models/maxxvit.py +++ b/timm/models/maxxvit.py @@ -95,10 +95,13 @@ default_cfgs = { 'coatnet_rmlp_0_rw_224': _cfg(url=''), 'coatnet_rmlp_1_rw_224': _cfg( url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights-maxx/coatnet_rmlp_1_rw_224_sw-9051e6c3.pth'), - 'coatnet_rmlp_2_rw_224': _cfg(url=''), + 'coatnet_rmlp_2_rw_224': _cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights-maxx/coatnet_rmlp_2_rw_224_sw-5ccfac55.pth'), 'coatnet_rmlp_3_rw_224': _cfg(url=''), 'coatnet_nano_cc_224': _cfg(url=''), - 'coatnext_nano_rw_224': _cfg(url=''), + 'coatnext_nano_rw_224': _cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights-maxx/coatnext_nano_rw_224_ad-22cb71c2.pth', + crop_pct=0.9), # Trying to be like the CoAtNet paper configs 'coatnet_0_224': _cfg(url=''), @@ -128,16 +131,22 @@ default_cfgs = { url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights-maxx/maxvit_rmlp_tiny_rw_256_sw-bbef0ff5.pth', input_size=(3, 256, 256), pool_size=(8, 8)), 'maxvit_rmlp_small_rw_224': _cfg( - url=''), + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights-maxx/maxvit_rmlp_small_rw_224_sw-6ef0ae4f.pth', + crop_pct=0.9, + ), 'maxvit_rmlp_small_rw_256': _cfg( url='', input_size=(3, 256, 256), pool_size=(8, 8)), 'maxvit_tiny_pm_256': _cfg(url='', input_size=(3, 256, 256), pool_size=(8, 8)), - 'maxxvit_nano_rw_256': _cfg(url='', input_size=(3, 256, 256), pool_size=(8, 8)), - 'maxxvit_tiny_rw_256': _cfg(url='', input_size=(3, 256, 256), pool_size=(8, 8)), - 'maxxvit_small_rw_256': _cfg(url='', input_size=(3, 256, 256), pool_size=(8, 8)), + 'maxxvit_rmlp_nano_rw_256': _cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights-maxx/maxxvit_rmlp_nano_rw_256_sw-0325d459.pth', + input_size=(3, 256, 256), pool_size=(8, 8)), + 'maxxvit_rmlp_tiny_rw_256': _cfg(url='', input_size=(3, 256, 256), pool_size=(8, 8)), + 'maxxvit_rmlp_small_rw_256': _cfg( + url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights-maxx/maxxvit_rmlp_small_rw_256_sw-37e217ff.pth', + input_size=(3, 256, 256), pool_size=(8, 8)), # Trying to be like the MaxViT paper configs 'maxvit_tiny_224': _cfg(url=''), @@ -334,13 +343,14 @@ def _next_cfg( rel_pos_dim=512, ): # For experimental models with convnext instead of mbconv + init_values = to_2tuple(init_values) return dict( conv_cfg=MaxxVitConvCfg( block_type='convnext', stride_mode=stride_mode, pool_type=pool_type, expand_output=False, - init_values=init_values, + init_values=init_values[0], norm_layer=conv_norm_layer, norm_layer_cl=conv_norm_layer_cl, ), @@ -348,7 +358,7 @@ def _next_cfg( expand_first=False, pool_type=pool_type, window_size=window_size, - init_values=init_values, + init_values=init_values[1], norm_layer=transformer_norm_layer, norm_layer_cl=transformer_norm_layer_cl, rel_pos_type=rel_pos_type, @@ -497,7 +507,10 @@ model_cfgs = dict( depths=(3, 4, 6, 3), stem_width=(32, 64), weight_init='normal', - **_next_cfg(), + **_next_cfg( + rel_pos_type='bias', + init_values=(1e-5, None) + ), ), # Trying to be like the CoAtNet paper configs @@ -612,7 +625,7 @@ model_cfgs = dict( **_rw_max_cfg(), ), - maxxvit_nano_rw_256=MaxxVitCfg( + maxxvit_rmlp_nano_rw_256=MaxxVitCfg( embed_dim=(64, 128, 256, 512), depths=(1, 2, 3, 1), block_type=('M',) * 4, @@ -620,14 +633,14 @@ model_cfgs = dict( weight_init='normal', **_next_cfg(), ), - maxxvit_tiny_rw_256=MaxxVitCfg( + maxxvit_rmlp_tiny_rw_256=MaxxVitCfg( embed_dim=(64, 128, 256, 512), depths=(2, 2, 5, 2), block_type=('M',) * 4, stem_width=(32, 64), **_next_cfg(), ), - maxxvit_small_rw_256=MaxxVitCfg( + maxxvit_rmlp_small_rw_256=MaxxVitCfg( embed_dim=(96, 192, 384, 768), depths=(2, 2, 5, 2), block_type=('M',) * 4, @@ -1861,18 +1874,18 @@ def maxvit_tiny_pm_256(pretrained=False, **kwargs): @register_model -def maxxvit_nano_rw_256(pretrained=False, **kwargs): - return _create_maxxvit('maxxvit_nano_rw_256', pretrained=pretrained, **kwargs) +def maxxvit_rmlp_nano_rw_256(pretrained=False, **kwargs): + return _create_maxxvit('maxxvit_rmlp_nano_rw_256', pretrained=pretrained, **kwargs) @register_model -def maxxvit_tiny_rw_256(pretrained=False, **kwargs): - return _create_maxxvit('maxxvit_tiny_rw_256', pretrained=pretrained, **kwargs) +def maxxvit_rmlp_tiny_rw_256(pretrained=False, **kwargs): + return _create_maxxvit('maxxvit_rmlp_tiny_rw_256', pretrained=pretrained, **kwargs) @register_model -def maxxvit_small_rw_256(pretrained=False, **kwargs): - return _create_maxxvit('maxxvit_small_rw_256', pretrained=pretrained, **kwargs) +def maxxvit_rmlp_small_rw_256(pretrained=False, **kwargs): + return _create_maxxvit('maxxvit_rmlp_small_rw_256', pretrained=pretrained, **kwargs) @register_model From cea8df3d0ccc32426651925ca1576a834407c1d3 Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Mon, 10 Oct 2022 21:49:52 -0700 Subject: [PATCH 21/26] Version 0.6.12 --- timm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timm/version.py b/timm/version.py index 3db07623..adfda343 100644 --- a/timm/version.py +++ b/timm/version.py @@ -1 +1 @@ -__version__ = '0.6.11' +__version__ = '0.6.12' From b944546200f81ebe5f688cb523aaf3423a437b81 Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Mon, 10 Oct 2022 22:13:05 -0700 Subject: [PATCH 22/26] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a8863d34..c4cb0258 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,12 @@ And a big thanks to all GitHub sponsors who helped with some of my costs before ### Oct 10, 2022 * More weights in `maxxvit` series, incl first ConvNeXt block based `coatnext` and `maxxvit` experiments: * `coatnext_nano_rw_224` - 82.0 @ 224 (G) -- (uses ConvNeXt conv block, no BatchNorm) - * `maxxvit_nano_rw_256` - 83.0 @ 256, 83.7 @ 320 (G) (uses ConvNeXt conv block, no BN) + * `maxxvit_rmlp_nano_rw_256` - 83.0 @ 256, 83.7 @ 320 (G) (uses ConvNeXt conv block, no BN) * `maxvit_rmlp_small_rw_224` - 84.5 @ 224, 85.1 @ 320 (G) - * `maxxvit_small_rw_256` - 84.6 @ 256, 84.9 @ 288 (G) -- could be trained better, hparams need tuning (uses ConvNeXt block, no BN) + * `maxxvit_rmlp_small_rw_256` - 84.6 @ 256, 84.9 @ 288 (G) -- could be trained better, hparams need tuning (uses ConvNeXt block, no BN) * `coatnet_rmlp_2_rw_224` - 84.6 @ 224, 85 @ 320 (T) - + * NOTE: official MaxVit weights (in1k) have been released https://github.com/google-research/maxvit, some extra work needed to port and adapt since my impl was in parallel and has a few small differences + ### Sept 23, 2022 * LAION-2B CLIP image towers supported as pretrained backbones for fine-tune or features (no classifier) * vit_base_patch32_224_clip_laion2b From bb49d02aae1c5958d7149bc3f240440e354305da Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Tue, 11 Oct 2022 13:13:06 -0700 Subject: [PATCH 23/26] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c4cb0258..e5094e73 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ And a big thanks to all GitHub sponsors who helped with some of my costs before * `maxvit_rmlp_small_rw_224` - 84.5 @ 224, 85.1 @ 320 (G) * `maxxvit_rmlp_small_rw_256` - 84.6 @ 256, 84.9 @ 288 (G) -- could be trained better, hparams need tuning (uses ConvNeXt block, no BN) * `coatnet_rmlp_2_rw_224` - 84.6 @ 224, 85 @ 320 (T) - * NOTE: official MaxVit weights (in1k) have been released https://github.com/google-research/maxvit, some extra work needed to port and adapt since my impl was in parallel and has a few small differences + * NOTE: official MaxVit weights (in1k) have been released at https://github.com/google-research/maxvit -- some extra work is needed to port and adapt since my impl was created independently of theirs and has a few small differences + the whole TF same padding fun. ### Sept 23, 2022 * LAION-2B CLIP image towers supported as pretrained backbones for fine-tune or features (no classifier) From edceac4aaf8e1857cc1523cbcd6991a47bde655c Mon Sep 17 00:00:00 2001 From: nateraw Date: Wed, 12 Oct 2022 13:02:33 -0400 Subject: [PATCH 24/26] :green_heart: fix ci build --- hfdocs/source/{_conf.yml => _config.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename hfdocs/source/{_conf.yml => _config.py} (100%) diff --git a/hfdocs/source/_conf.yml b/hfdocs/source/_config.py similarity index 100% rename from hfdocs/source/_conf.yml rename to hfdocs/source/_config.py From 30bafd7347a980cbadcf825768d50d5cac6f8b1c Mon Sep 17 00:00:00 2001 From: nateraw Date: Thu, 13 Oct 2022 17:08:33 -0400 Subject: [PATCH 25/26] :bookmark: add dev suffix to version tag --- timm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timm/version.py b/timm/version.py index adfda343..d5937fc3 100644 --- a/timm/version.py +++ b/timm/version.py @@ -1 +1 @@ -__version__ = '0.6.12' +__version__ = '0.6.12dev0' From 8c28363dc9d2ad6eb4889d993b861d806b2cea56 Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Fri, 14 Oct 2022 09:38:02 -0700 Subject: [PATCH 26/26] Version 0.7.dev0 for master --- timm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timm/version.py b/timm/version.py index d5937fc3..5f6ba7e0 100644 --- a/timm/version.py +++ b/timm/version.py @@ -1 +1 @@ -__version__ = '0.6.12dev0' +__version__ = '0.7.0dev0'