From 9e7412527629d29524376b8f88d3bfc9348676a5 Mon Sep 17 00:00:00 2001 From: Guillem Cucurull Date: Thu, 11 Mar 2021 16:52:13 +0000 Subject: [PATCH] Model index files and script to generate it --- modelindex/.templates/code_snippets.md | 62 ++ .../models/adversarial-inception-v3.md | 89 +++ modelindex/.templates/models/advprop.md | 384 ++++++++++++ modelindex/.templates/models/big-transfer.md | 255 ++++++++ modelindex/.templates/models/csp-darknet.md | 74 +++ modelindex/.templates/models/csp-resnet.md | 72 +++ modelindex/.templates/models/csp-resnext.md | 72 +++ modelindex/.templates/models/densenet.md | 261 ++++++++ modelindex/.templates/models/dla.md | 482 +++++++++++++++ modelindex/.templates/models/dpn.md | 209 +++++++ modelindex/.templates/models/ecaresnet.md | 200 +++++++ .../.templates/models/efficientnet-pruned.md | 123 ++++ modelindex/.templates/models/efficientnet.md | 254 ++++++++ .../.templates/models/ensemble-adversarial.md | 89 +++ modelindex/.templates/models/ese-vovnet.md | 77 +++ modelindex/.templates/models/fbnet.md | 69 +++ .../.templates/models/gloun-inception-v3.md | 71 +++ modelindex/.templates/models/gloun-resnet.md | 393 ++++++++++++ modelindex/.templates/models/gloun-resnext.md | 119 ++++ modelindex/.templates/models/gloun-senet.md | 56 ++ .../.templates/models/gloun-seresnext.md | 113 ++++ .../.templates/models/gloun-xception.md | 57 ++ modelindex/.templates/models/hrnet.md | 303 ++++++++++ modelindex/.templates/models/ig-resnext.md | 178 ++++++ .../.templates/models/inception-resnet-v2.md | 65 ++ modelindex/.templates/models/inception-v3.md | 78 +++ modelindex/.templates/models/inception-v4.md | 64 ++ .../.templates/models/legacy-se-resnet.md | 218 +++++++ .../.templates/models/legacy-se-resnext.md | 144 +++++ modelindex/.templates/models/legacy-senet.md | 67 +++ modelindex/.templates/models/mixnet.md | 133 +++++ modelindex/.templates/models/mnasnet.md | 94 +++ modelindex/.templates/models/mobilenet-v2.md | 179 ++++++ modelindex/.templates/models/mobilenet-v3.md | 123 ++++ modelindex/.templates/models/nasnet.md | 65 ++ modelindex/.templates/models/noisy-student.md | 456 ++++++++++++++ modelindex/.templates/models/pnasnet.md | 64 ++ modelindex/.templates/models/regnetx.md | 397 ++++++++++++ modelindex/.templates/models/regnety.md | 411 +++++++++++++ modelindex/.templates/models/res2net.md | 213 +++++++ modelindex/.templates/models/res2next.md | 68 +++ modelindex/.templates/models/resnest.md | 359 +++++++++++ modelindex/.templates/models/resnet-d.md | 208 +++++++ modelindex/.templates/models/resnet.md | 307 ++++++++++ modelindex/.templates/models/resnext.md | 152 +++++ modelindex/.templates/models/rexnet.md | 174 ++++++ modelindex/.templates/models/se-resnet.md | 107 ++++ modelindex/.templates/models/selecsls.md | 113 ++++ modelindex/.templates/models/seresnext.md | 144 +++++ modelindex/.templates/models/skresnet.md | 97 +++ modelindex/.templates/models/skresnext.md | 63 ++ modelindex/.templates/models/spnasnet.md | 55 ++ modelindex/.templates/models/ssl-resnet.md | 116 ++++ modelindex/.templates/models/ssl-resnext.md | 186 ++++++ modelindex/.templates/models/swsl-resnet.md | 116 ++++ modelindex/.templates/models/swsl-resnext.md | 186 ++++++ .../models/tf-efficientnet-condconv.md | 164 +++++ .../.templates/models/tf-efficientnet-lite.md | 154 +++++ .../.templates/models/tf-efficientnet.md | 503 ++++++++++++++++ .../.templates/models/tf-inception-v3.md | 78 +++ modelindex/.templates/models/tf-mixnet.md | 108 ++++ .../.templates/models/tf-mobilenet-v3.md | 271 +++++++++ modelindex/.templates/models/tresnet.md | 255 ++++++++ .../.templates/models/vision-transformer.md | 278 +++++++++ modelindex/.templates/models/wide-resnet.md | 87 +++ modelindex/.templates/models/xception.md | 130 ++++ modelindex/generate_readmes.py | 60 ++ modelindex/model-index.yml | 14 + modelindex/models/adversarial-inception-v3.md | 150 +++++ modelindex/models/advprop.md | 445 ++++++++++++++ modelindex/models/big-transfer.md | 316 ++++++++++ modelindex/models/csp-darknet.md | 135 +++++ modelindex/models/csp-resnet.md | 133 +++++ modelindex/models/csp-resnext.md | 133 +++++ modelindex/models/densenet.md | 322 ++++++++++ modelindex/models/dla.md | 543 +++++++++++++++++ modelindex/models/dpn.md | 270 +++++++++ modelindex/models/ecaresnet.md | 261 ++++++++ modelindex/models/efficientnet-pruned.md | 184 ++++++ modelindex/models/efficientnet.md | 315 ++++++++++ modelindex/models/ensemble-adversarial.md | 150 +++++ modelindex/models/ese-vovnet.md | 138 +++++ modelindex/models/fbnet.md | 130 ++++ modelindex/models/gloun-inception-v3.md | 132 ++++ modelindex/models/gloun-resnet.md | 454 ++++++++++++++ modelindex/models/gloun-resnext.md | 180 ++++++ modelindex/models/gloun-senet.md | 117 ++++ modelindex/models/gloun-seresnext.md | 174 ++++++ modelindex/models/gloun-xception.md | 118 ++++ modelindex/models/hrnet.md | 364 +++++++++++ modelindex/models/ig-resnext.md | 239 ++++++++ modelindex/models/inception-resnet-v2.md | 126 ++++ modelindex/models/inception-v3.md | 139 +++++ modelindex/models/inception-v4.md | 125 ++++ modelindex/models/legacy-se-resnet.md | 279 +++++++++ modelindex/models/legacy-se-resnext.md | 205 +++++++ modelindex/models/legacy-senet.md | 128 ++++ modelindex/models/mixnet.md | 194 ++++++ modelindex/models/mnasnet.md | 155 +++++ modelindex/models/mobilenet-v2.md | 240 ++++++++ modelindex/models/mobilenet-v3.md | 184 ++++++ modelindex/models/nasnet.md | 126 ++++ modelindex/models/noisy-student.md | 517 ++++++++++++++++ modelindex/models/pnasnet.md | 125 ++++ modelindex/models/regnetx.md | 458 ++++++++++++++ modelindex/models/regnety.md | 472 +++++++++++++++ modelindex/models/res2net.md | 274 +++++++++ modelindex/models/res2next.md | 129 ++++ modelindex/models/resnest.md | 420 +++++++++++++ modelindex/models/resnet-d.md | 269 +++++++++ modelindex/models/resnet.md | 368 ++++++++++++ modelindex/models/resnext.md | 213 +++++++ modelindex/models/rexnet.md | 235 ++++++++ modelindex/models/se-resnet.md | 168 ++++++ modelindex/models/selecsls.md | 174 ++++++ modelindex/models/seresnext.md | 205 +++++++ modelindex/models/skresnet.md | 158 +++++ modelindex/models/skresnext.md | 124 ++++ modelindex/models/spnasnet.md | 116 ++++ modelindex/models/ssl-resnet.md | 177 ++++++ modelindex/models/ssl-resnext.md | 247 ++++++++ modelindex/models/swsl-resnet.md | 177 ++++++ modelindex/models/swsl-resnext.md | 247 ++++++++ modelindex/models/tf-efficientnet-condconv.md | 225 +++++++ modelindex/models/tf-efficientnet-lite.md | 215 +++++++ modelindex/models/tf-efficientnet.md | 564 ++++++++++++++++++ modelindex/models/tf-inception-v3.md | 139 +++++ modelindex/models/tf-mixnet.md | 169 ++++++ modelindex/models/tf-mobilenet-v3.md | 332 +++++++++++ modelindex/models/tresnet.md | 316 ++++++++++ modelindex/models/vision-transformer.md | 339 +++++++++++ modelindex/models/wide-resnet.md | 148 +++++ modelindex/models/xception.md | 191 ++++++ modelindex/requirements-modelindex.txt | 2 + 134 files changed, 26603 insertions(+) create mode 100644 modelindex/.templates/code_snippets.md create mode 100644 modelindex/.templates/models/adversarial-inception-v3.md create mode 100644 modelindex/.templates/models/advprop.md create mode 100644 modelindex/.templates/models/big-transfer.md create mode 100644 modelindex/.templates/models/csp-darknet.md create mode 100644 modelindex/.templates/models/csp-resnet.md create mode 100644 modelindex/.templates/models/csp-resnext.md create mode 100644 modelindex/.templates/models/densenet.md create mode 100644 modelindex/.templates/models/dla.md create mode 100644 modelindex/.templates/models/dpn.md create mode 100644 modelindex/.templates/models/ecaresnet.md create mode 100644 modelindex/.templates/models/efficientnet-pruned.md create mode 100644 modelindex/.templates/models/efficientnet.md create mode 100644 modelindex/.templates/models/ensemble-adversarial.md create mode 100644 modelindex/.templates/models/ese-vovnet.md create mode 100644 modelindex/.templates/models/fbnet.md create mode 100644 modelindex/.templates/models/gloun-inception-v3.md create mode 100644 modelindex/.templates/models/gloun-resnet.md create mode 100644 modelindex/.templates/models/gloun-resnext.md create mode 100644 modelindex/.templates/models/gloun-senet.md create mode 100644 modelindex/.templates/models/gloun-seresnext.md create mode 100644 modelindex/.templates/models/gloun-xception.md create mode 100644 modelindex/.templates/models/hrnet.md create mode 100644 modelindex/.templates/models/ig-resnext.md create mode 100644 modelindex/.templates/models/inception-resnet-v2.md create mode 100644 modelindex/.templates/models/inception-v3.md create mode 100644 modelindex/.templates/models/inception-v4.md create mode 100644 modelindex/.templates/models/legacy-se-resnet.md create mode 100644 modelindex/.templates/models/legacy-se-resnext.md create mode 100644 modelindex/.templates/models/legacy-senet.md create mode 100644 modelindex/.templates/models/mixnet.md create mode 100644 modelindex/.templates/models/mnasnet.md create mode 100644 modelindex/.templates/models/mobilenet-v2.md create mode 100644 modelindex/.templates/models/mobilenet-v3.md create mode 100644 modelindex/.templates/models/nasnet.md create mode 100644 modelindex/.templates/models/noisy-student.md create mode 100644 modelindex/.templates/models/pnasnet.md create mode 100644 modelindex/.templates/models/regnetx.md create mode 100644 modelindex/.templates/models/regnety.md create mode 100644 modelindex/.templates/models/res2net.md create mode 100644 modelindex/.templates/models/res2next.md create mode 100644 modelindex/.templates/models/resnest.md create mode 100644 modelindex/.templates/models/resnet-d.md create mode 100644 modelindex/.templates/models/resnet.md create mode 100644 modelindex/.templates/models/resnext.md create mode 100644 modelindex/.templates/models/rexnet.md create mode 100644 modelindex/.templates/models/se-resnet.md create mode 100644 modelindex/.templates/models/selecsls.md create mode 100644 modelindex/.templates/models/seresnext.md create mode 100644 modelindex/.templates/models/skresnet.md create mode 100644 modelindex/.templates/models/skresnext.md create mode 100644 modelindex/.templates/models/spnasnet.md create mode 100644 modelindex/.templates/models/ssl-resnet.md create mode 100644 modelindex/.templates/models/ssl-resnext.md create mode 100644 modelindex/.templates/models/swsl-resnet.md create mode 100644 modelindex/.templates/models/swsl-resnext.md create mode 100644 modelindex/.templates/models/tf-efficientnet-condconv.md create mode 100644 modelindex/.templates/models/tf-efficientnet-lite.md create mode 100644 modelindex/.templates/models/tf-efficientnet.md create mode 100644 modelindex/.templates/models/tf-inception-v3.md create mode 100644 modelindex/.templates/models/tf-mixnet.md create mode 100644 modelindex/.templates/models/tf-mobilenet-v3.md create mode 100644 modelindex/.templates/models/tresnet.md create mode 100644 modelindex/.templates/models/vision-transformer.md create mode 100644 modelindex/.templates/models/wide-resnet.md create mode 100644 modelindex/.templates/models/xception.md create mode 100644 modelindex/generate_readmes.py create mode 100644 modelindex/model-index.yml create mode 100644 modelindex/models/adversarial-inception-v3.md create mode 100644 modelindex/models/advprop.md create mode 100644 modelindex/models/big-transfer.md create mode 100644 modelindex/models/csp-darknet.md create mode 100644 modelindex/models/csp-resnet.md create mode 100644 modelindex/models/csp-resnext.md create mode 100644 modelindex/models/densenet.md create mode 100644 modelindex/models/dla.md create mode 100644 modelindex/models/dpn.md create mode 100644 modelindex/models/ecaresnet.md create mode 100644 modelindex/models/efficientnet-pruned.md create mode 100644 modelindex/models/efficientnet.md create mode 100644 modelindex/models/ensemble-adversarial.md create mode 100644 modelindex/models/ese-vovnet.md create mode 100644 modelindex/models/fbnet.md create mode 100644 modelindex/models/gloun-inception-v3.md create mode 100644 modelindex/models/gloun-resnet.md create mode 100644 modelindex/models/gloun-resnext.md create mode 100644 modelindex/models/gloun-senet.md create mode 100644 modelindex/models/gloun-seresnext.md create mode 100644 modelindex/models/gloun-xception.md create mode 100644 modelindex/models/hrnet.md create mode 100644 modelindex/models/ig-resnext.md create mode 100644 modelindex/models/inception-resnet-v2.md create mode 100644 modelindex/models/inception-v3.md create mode 100644 modelindex/models/inception-v4.md create mode 100644 modelindex/models/legacy-se-resnet.md create mode 100644 modelindex/models/legacy-se-resnext.md create mode 100644 modelindex/models/legacy-senet.md create mode 100644 modelindex/models/mixnet.md create mode 100644 modelindex/models/mnasnet.md create mode 100644 modelindex/models/mobilenet-v2.md create mode 100644 modelindex/models/mobilenet-v3.md create mode 100644 modelindex/models/nasnet.md create mode 100644 modelindex/models/noisy-student.md create mode 100644 modelindex/models/pnasnet.md create mode 100644 modelindex/models/regnetx.md create mode 100644 modelindex/models/regnety.md create mode 100644 modelindex/models/res2net.md create mode 100644 modelindex/models/res2next.md create mode 100644 modelindex/models/resnest.md create mode 100644 modelindex/models/resnet-d.md create mode 100644 modelindex/models/resnet.md create mode 100644 modelindex/models/resnext.md create mode 100644 modelindex/models/rexnet.md create mode 100644 modelindex/models/se-resnet.md create mode 100644 modelindex/models/selecsls.md create mode 100644 modelindex/models/seresnext.md create mode 100644 modelindex/models/skresnet.md create mode 100644 modelindex/models/skresnext.md create mode 100644 modelindex/models/spnasnet.md create mode 100644 modelindex/models/ssl-resnet.md create mode 100644 modelindex/models/ssl-resnext.md create mode 100644 modelindex/models/swsl-resnet.md create mode 100644 modelindex/models/swsl-resnext.md create mode 100644 modelindex/models/tf-efficientnet-condconv.md create mode 100644 modelindex/models/tf-efficientnet-lite.md create mode 100644 modelindex/models/tf-efficientnet.md create mode 100644 modelindex/models/tf-inception-v3.md create mode 100644 modelindex/models/tf-mixnet.md create mode 100644 modelindex/models/tf-mobilenet-v3.md create mode 100644 modelindex/models/tresnet.md create mode 100644 modelindex/models/vision-transformer.md create mode 100644 modelindex/models/wide-resnet.md create mode 100644 modelindex/models/xception.md create mode 100644 modelindex/requirements-modelindex.txt diff --git a/modelindex/.templates/code_snippets.md b/modelindex/.templates/code_snippets.md new file mode 100644 index 00000000..cf2791cd --- /dev/null +++ b/modelindex/.templates/code_snippets.md @@ -0,0 +1,62 @@ +## How do I use this model on an image? +To load a pretrained model: + +```python +import timm +model = timm.create_model('{{ model_name }}', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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. `{{ model_name }}`. 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). +```python +model = timm.create_model('{{ model_name }}', pretrained=True).reset_classifier(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. diff --git a/modelindex/.templates/models/adversarial-inception-v3.md b/modelindex/.templates/models/adversarial-inception-v3.md new file mode 100644 index 00000000..115df0d3 --- /dev/null +++ b/modelindex/.templates/models/adversarial-inception-v3.md @@ -0,0 +1,89 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/advprop.md b/modelindex/.templates/models/advprop.md new file mode 100644 index 00000000..7a472d0c --- /dev/null +++ b/modelindex/.templates/models/advprop.md @@ -0,0 +1,384 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/big-transfer.md b/modelindex/.templates/models/big-transfer.md new file mode 100644 index 00000000..99a920d7 --- /dev/null +++ b/modelindex/.templates/models/big-transfer.md @@ -0,0 +1,255 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/csp-darknet.md b/modelindex/.templates/models/csp-darknet.md new file mode 100644 index 00000000..e1589e40 --- /dev/null +++ b/modelindex/.templates/models/csp-darknet.md @@ -0,0 +1,74 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/csp-resnet.md b/modelindex/.templates/models/csp-resnet.md new file mode 100644 index 00000000..317e11ad --- /dev/null +++ b/modelindex/.templates/models/csp-resnet.md @@ -0,0 +1,72 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/csp-resnext.md b/modelindex/.templates/models/csp-resnext.md new file mode 100644 index 00000000..0b1220ca --- /dev/null +++ b/modelindex/.templates/models/csp-resnext.md @@ -0,0 +1,72 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/densenet.md b/modelindex/.templates/models/densenet.md new file mode 100644 index 00000000..5239bda7 --- /dev/null +++ b/modelindex/.templates/models/densenet.md @@ -0,0 +1,261 @@ +# Summary + +**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) + +{% include 'code_snippets.md' %} + +## 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}} +} +``` + + diff --git a/modelindex/.templates/models/dla.md b/modelindex/.templates/models/dla.md new file mode 100644 index 00000000..79e47f90 --- /dev/null +++ b/modelindex/.templates/models/dla.md @@ -0,0 +1,482 @@ +# Summary + +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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/dpn.md b/modelindex/.templates/models/dpn.md new file mode 100644 index 00000000..613f7b21 --- /dev/null +++ b/modelindex/.templates/models/dpn.md @@ -0,0 +1,209 @@ +# Summary + +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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/ecaresnet.md b/modelindex/.templates/models/ecaresnet.md new file mode 100644 index 00000000..72006e68 --- /dev/null +++ b/modelindex/.templates/models/ecaresnet.md @@ -0,0 +1,200 @@ +# Summary + +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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/efficientnet-pruned.md b/modelindex/.templates/models/efficientnet-pruned.md new file mode 100644 index 00000000..5dd011ad --- /dev/null +++ b/modelindex/.templates/models/efficientnet-pruned.md @@ -0,0 +1,123 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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{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}} +} +``` + + diff --git a/modelindex/.templates/models/efficientnet.md b/modelindex/.templates/models/efficientnet.md new file mode 100644 index 00000000..ca764368 --- /dev/null +++ b/modelindex/.templates/models/efficientnet.md @@ -0,0 +1,254 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/ensemble-adversarial.md b/modelindex/.templates/models/ensemble-adversarial.md new file mode 100644 index 00000000..3c71af04 --- /dev/null +++ b/modelindex/.templates/models/ensemble-adversarial.md @@ -0,0 +1,89 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/ese-vovnet.md b/modelindex/.templates/models/ese-vovnet.md new file mode 100644 index 00000000..e2aaa47f --- /dev/null +++ b/modelindex/.templates/models/ese-vovnet.md @@ -0,0 +1,77 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/fbnet.md b/modelindex/.templates/models/fbnet.md new file mode 100644 index 00000000..aedc02a6 --- /dev/null +++ b/modelindex/.templates/models/fbnet.md @@ -0,0 +1,69 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/gloun-inception-v3.md b/modelindex/.templates/models/gloun-inception-v3.md new file mode 100644 index 00000000..16739f34 --- /dev/null +++ b/modelindex/.templates/models/gloun-inception-v3.md @@ -0,0 +1,71 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/gloun-resnet.md b/modelindex/.templates/models/gloun-resnet.md new file mode 100644 index 00000000..f738c51a --- /dev/null +++ b/modelindex/.templates/models/gloun-resnet.md @@ -0,0 +1,393 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/gloun-resnext.md b/modelindex/.templates/models/gloun-resnext.md new file mode 100644 index 00000000..76e75d1b --- /dev/null +++ b/modelindex/.templates/models/gloun-resnext.md @@ -0,0 +1,119 @@ +# Summary + +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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/gloun-senet.md b/modelindex/.templates/models/gloun-senet.md new file mode 100644 index 00000000..cee50e29 --- /dev/null +++ b/modelindex/.templates/models/gloun-senet.md @@ -0,0 +1,56 @@ +# Summary + +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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/gloun-seresnext.md b/modelindex/.templates/models/gloun-seresnext.md new file mode 100644 index 00000000..c494b755 --- /dev/null +++ b/modelindex/.templates/models/gloun-seresnext.md @@ -0,0 +1,113 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/gloun-xception.md b/modelindex/.templates/models/gloun-xception.md new file mode 100644 index 00000000..c45b166c --- /dev/null +++ b/modelindex/.templates/models/gloun-xception.md @@ -0,0 +1,57 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/hrnet.md b/modelindex/.templates/models/hrnet.md new file mode 100644 index 00000000..b99b5f4a --- /dev/null +++ b/modelindex/.templates/models/hrnet.md @@ -0,0 +1,303 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/ig-resnext.md b/modelindex/.templates/models/ig-resnext.md new file mode 100644 index 00000000..0bfbae9d --- /dev/null +++ b/modelindex/.templates/models/ig-resnext.md @@ -0,0 +1,178 @@ +# Summary + +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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/inception-resnet-v2.md b/modelindex/.templates/models/inception-resnet-v2.md new file mode 100644 index 00000000..64842417 --- /dev/null +++ b/modelindex/.templates/models/inception-resnet-v2.md @@ -0,0 +1,65 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/inception-v3.md b/modelindex/.templates/models/inception-v3.md new file mode 100644 index 00000000..0a5bac55 --- /dev/null +++ b/modelindex/.templates/models/inception-v3.md @@ -0,0 +1,78 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/inception-v4.md b/modelindex/.templates/models/inception-v4.md new file mode 100644 index 00000000..e10a3df5 --- /dev/null +++ b/modelindex/.templates/models/inception-v4.md @@ -0,0 +1,64 @@ +# Summary + +**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). +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/legacy-se-resnet.md b/modelindex/.templates/models/legacy-se-resnet.md new file mode 100644 index 00000000..940533be --- /dev/null +++ b/modelindex/.templates/models/legacy-se-resnet.md @@ -0,0 +1,218 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/legacy-se-resnext.md b/modelindex/.templates/models/legacy-se-resnext.md new file mode 100644 index 00000000..89ceaed9 --- /dev/null +++ b/modelindex/.templates/models/legacy-se-resnext.md @@ -0,0 +1,144 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/legacy-senet.md b/modelindex/.templates/models/legacy-senet.md new file mode 100644 index 00000000..7abcdd0e --- /dev/null +++ b/modelindex/.templates/models/legacy-senet.md @@ -0,0 +1,67 @@ +# Summary + +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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/mixnet.md b/modelindex/.templates/models/mixnet.md new file mode 100644 index 00000000..0e4cba6d --- /dev/null +++ b/modelindex/.templates/models/mixnet.md @@ -0,0 +1,133 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/mnasnet.md b/modelindex/.templates/models/mnasnet.md new file mode 100644 index 00000000..c0399ab3 --- /dev/null +++ b/modelindex/.templates/models/mnasnet.md @@ -0,0 +1,94 @@ +# Summary + +**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)). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/mobilenet-v2.md b/modelindex/.templates/models/mobilenet-v2.md new file mode 100644 index 00000000..8cc6aa40 --- /dev/null +++ b/modelindex/.templates/models/mobilenet-v2.md @@ -0,0 +1,179 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/mobilenet-v3.md b/modelindex/.templates/models/mobilenet-v3.md new file mode 100644 index 00000000..9c1ccb43 --- /dev/null +++ b/modelindex/.templates/models/mobilenet-v3.md @@ -0,0 +1,123 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/nasnet.md b/modelindex/.templates/models/nasnet.md new file mode 100644 index 00000000..b79f777f --- /dev/null +++ b/modelindex/.templates/models/nasnet.md @@ -0,0 +1,65 @@ +# Summary + +**NASNet** is a type of convolutional neural network discovered through neural architecture search. The building blocks consist of normal and reduction cells. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/noisy-student.md b/modelindex/.templates/models/noisy-student.md new file mode 100644 index 00000000..38f90d43 --- /dev/null +++ b/modelindex/.templates/models/noisy-student.md @@ -0,0 +1,456 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/pnasnet.md b/modelindex/.templates/models/pnasnet.md new file mode 100644 index 00000000..07bcbe37 --- /dev/null +++ b/modelindex/.templates/models/pnasnet.md @@ -0,0 +1,64 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/regnetx.md b/modelindex/.templates/models/regnetx.md new file mode 100644 index 00000000..301c3aaf --- /dev/null +++ b/modelindex/.templates/models/regnetx.md @@ -0,0 +1,397 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/regnety.md b/modelindex/.templates/models/regnety.md new file mode 100644 index 00000000..3acfac3c --- /dev/null +++ b/modelindex/.templates/models/regnety.md @@ -0,0 +1,411 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/res2net.md b/modelindex/.templates/models/res2net.md new file mode 100644 index 00000000..4ec3653f --- /dev/null +++ b/modelindex/.templates/models/res2net.md @@ -0,0 +1,213 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/res2next.md b/modelindex/.templates/models/res2next.md new file mode 100644 index 00000000..06aa474d --- /dev/null +++ b/modelindex/.templates/models/res2next.md @@ -0,0 +1,68 @@ +# Summary + +**Res2Net** 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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/resnest.md b/modelindex/.templates/models/resnest.md new file mode 100644 index 00000000..49c60641 --- /dev/null +++ b/modelindex/.templates/models/resnest.md @@ -0,0 +1,359 @@ +# Summary + +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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/resnet-d.md b/modelindex/.templates/models/resnet-d.md new file mode 100644 index 00000000..0eed8048 --- /dev/null +++ b/modelindex/.templates/models/resnet-d.md @@ -0,0 +1,208 @@ +# Summary + +**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 + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/resnet.md b/modelindex/.templates/models/resnet.md new file mode 100644 index 00000000..3d4dd2b1 --- /dev/null +++ b/modelindex/.templates/models/resnet.md @@ -0,0 +1,307 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/resnext.md b/modelindex/.templates/models/resnext.md new file mode 100644 index 00000000..dc1fb426 --- /dev/null +++ b/modelindex/.templates/models/resnext.md @@ -0,0 +1,152 @@ +# Summary + +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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/rexnet.md b/modelindex/.templates/models/rexnet.md new file mode 100644 index 00000000..8f9feff0 --- /dev/null +++ b/modelindex/.templates/models/rexnet.md @@ -0,0 +1,174 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/se-resnet.md b/modelindex/.templates/models/se-resnet.md new file mode 100644 index 00000000..b6619a0c --- /dev/null +++ b/modelindex/.templates/models/se-resnet.md @@ -0,0 +1,107 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/selecsls.md b/modelindex/.templates/models/selecsls.md new file mode 100644 index 00000000..2b756435 --- /dev/null +++ b/modelindex/.templates/models/selecsls.md @@ -0,0 +1,113 @@ +# Summary + +**SelecSLS** uses novel selective long and short range skip connections to improve the information flow allowing for a drastically faster network without compromising accuracy. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/seresnext.md b/modelindex/.templates/models/seresnext.md new file mode 100644 index 00000000..d2510101 --- /dev/null +++ b/modelindex/.templates/models/seresnext.md @@ -0,0 +1,144 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/skresnet.md b/modelindex/.templates/models/skresnet.md new file mode 100644 index 00000000..851ebf6b --- /dev/null +++ b/modelindex/.templates/models/skresnet.md @@ -0,0 +1,97 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/skresnext.md b/modelindex/.templates/models/skresnext.md new file mode 100644 index 00000000..a354bade --- /dev/null +++ b/modelindex/.templates/models/skresnext.md @@ -0,0 +1,63 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/spnasnet.md b/modelindex/.templates/models/spnasnet.md new file mode 100644 index 00000000..3e4f281e --- /dev/null +++ b/modelindex/.templates/models/spnasnet.md @@ -0,0 +1,55 @@ +# Summary + +**Single-Path NAS** is a novel differentiable NAS method for designing hardware-efficient ConvNets in less than 4 hours. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/ssl-resnet.md b/modelindex/.templates/models/ssl-resnet.md new file mode 100644 index 00000000..d05cb901 --- /dev/null +++ b/modelindex/.templates/models/ssl-resnet.md @@ -0,0 +1,116 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/ssl-resnext.md b/modelindex/.templates/models/ssl-resnext.md new file mode 100644 index 00000000..74ec5ce8 --- /dev/null +++ b/modelindex/.templates/models/ssl-resnext.md @@ -0,0 +1,186 @@ +# Summary + +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 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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/swsl-resnet.md b/modelindex/.templates/models/swsl-resnet.md new file mode 100644 index 00000000..15b3e6ec --- /dev/null +++ b/modelindex/.templates/models/swsl-resnet.md @@ -0,0 +1,116 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/swsl-resnext.md b/modelindex/.templates/models/swsl-resnext.md new file mode 100644 index 00000000..86b81f81 --- /dev/null +++ b/modelindex/.templates/models/swsl-resnext.md @@ -0,0 +1,186 @@ +# Summary + +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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/tf-efficientnet-condconv.md b/modelindex/.templates/models/tf-efficientnet-condconv.md new file mode 100644 index 00000000..ba7a2bc1 --- /dev/null +++ b/modelindex/.templates/models/tf-efficientnet-condconv.md @@ -0,0 +1,164 @@ +# Summary + +**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. + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/tf-efficientnet-lite.md b/modelindex/.templates/models/tf-efficientnet-lite.md new file mode 100644 index 00000000..04bfcb8c --- /dev/null +++ b/modelindex/.templates/models/tf-efficientnet-lite.md @@ -0,0 +1,154 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/tf-efficientnet.md b/modelindex/.templates/models/tf-efficientnet.md new file mode 100644 index 00000000..2b94078a --- /dev/null +++ b/modelindex/.templates/models/tf-efficientnet.md @@ -0,0 +1,503 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/tf-inception-v3.md b/modelindex/.templates/models/tf-inception-v3.md new file mode 100644 index 00000000..19d26ef6 --- /dev/null +++ b/modelindex/.templates/models/tf-inception-v3.md @@ -0,0 +1,78 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/tf-mixnet.md b/modelindex/.templates/models/tf-mixnet.md new file mode 100644 index 00000000..bf45ff39 --- /dev/null +++ b/modelindex/.templates/models/tf-mixnet.md @@ -0,0 +1,108 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/tf-mobilenet-v3.md b/modelindex/.templates/models/tf-mobilenet-v3.md new file mode 100644 index 00000000..b444e475 --- /dev/null +++ b/modelindex/.templates/models/tf-mobilenet-v3.md @@ -0,0 +1,271 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/tresnet.md b/modelindex/.templates/models/tresnet.md new file mode 100644 index 00000000..ce078f10 --- /dev/null +++ b/modelindex/.templates/models/tresnet.md @@ -0,0 +1,255 @@ +# Summary + +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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/vision-transformer.md b/modelindex/.templates/models/vision-transformer.md new file mode 100644 index 00000000..4388b527 --- /dev/null +++ b/modelindex/.templates/models/vision-transformer.md @@ -0,0 +1,278 @@ +# Summary + +The **Vision Transformer** is a model for image classification that employs a Transformer-like architecture over patches of the image. This includes the use of [Multi-Head Attention](https://paperswithcode.com/method/multi-head-attention), [Scaled Dot-Product Attention](https://paperswithcode.com/method/scaled) and other architectural features seen in the [Transformer](https://paperswithcode.com/method/transformer) architecture traditionally used for NLP. + +{% include 'code_snippets.md' %} + +## 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{dosovitskiy2020image, + title={An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale}, + author={Alexey Dosovitskiy and Lucas Beyer and Alexander Kolesnikov and Dirk Weissenborn and Xiaohua Zhai and Thomas Unterthiner and Mostafa Dehghani and Matthias Minderer and Georg Heigold and Sylvain Gelly and Jakob Uszkoreit and Neil Houlsby}, + year={2020}, + eprint={2010.11929}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + diff --git a/modelindex/.templates/models/wide-resnet.md b/modelindex/.templates/models/wide-resnet.md new file mode 100644 index 00000000..4800d704 --- /dev/null +++ b/modelindex/.templates/models/wide-resnet.md @@ -0,0 +1,87 @@ +# Summary + +**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). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/.templates/models/xception.md b/modelindex/.templates/models/xception.md new file mode 100644 index 00000000..be3e36ba --- /dev/null +++ b/modelindex/.templates/models/xception.md @@ -0,0 +1,130 @@ +# Summary + +**Xception** is a convolutional neural network architecture that relies solely on [depthwise separable convolution layers](https://paperswithcode.com/method/depthwise-separable-convolution). + +{% include 'code_snippets.md' %} + +## 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} +} +``` + + diff --git a/modelindex/generate_readmes.py b/modelindex/generate_readmes.py new file mode 100644 index 00000000..88847d1c --- /dev/null +++ b/modelindex/generate_readmes.py @@ -0,0 +1,60 @@ +import argparse +from pathlib import Path + +from jinja2 import Environment, FileSystemLoader + +import modelindex + + +def generate_readmes(templates_path: Path, dest_path: Path): + """Add the code snippet template to the readmes""" + readme_templates_path = templates_path / "models" + code_template_path = templates_path / "code_snippets.md" + + env = Environment( + loader=FileSystemLoader([readme_templates_path, readme_templates_path.parent]), + ) + + for readme in readme_templates_path.iterdir(): + if readme.suffix == ".md": + template = env.get_template(readme.name) + + # get the first model_name for this model family + mi = modelindex.load(str(readme)) + model_name = mi.models[0].name + + full_content = template.render(model_name=model_name) + + # generate full_readme + with open(dest_path / readme.name, "w") as f: + f.write(full_content) + + +def main(): + parser = argparse.ArgumentParser(description="Model index generation config") + parser.add_argument( + "-t", + "--templates", + default=Path(__file__).parent / ".templates", + type=str, + help="Location of the markdown templates", + ) + parser.add_argument( + "-d", + "--dest", + default=Path(__file__).parent / "models", + type=str, + help="Destination folder that contains the generated model-index files.", + ) + args = parser.parse_args() + templates_path = Path(args.templates) + dest_readmes_path = Path(args.dest) + + generate_readmes( + templates_path, + dest_readmes_path, + ) + + +if __name__ == "__main__": + main() diff --git a/modelindex/model-index.yml b/modelindex/model-index.yml new file mode 100644 index 00000000..2cd87d93 --- /dev/null +++ b/modelindex/model-index.yml @@ -0,0 +1,14 @@ +Import: +- ./models/*.md +Library: + Name: PyTorch Image Models + Headline: PyTorch image models, scripts, pretrained weights + Website: https://rwightman.github.io/pytorch-image-models/ + Repository: https://github.com/rwightman/pytorch-image-models + Docs: https://rwightman.github.io/pytorch-image-models/ + README: "# PyTorch Image Models\r\n\r\nPyTorch Image Models (TIMM) is a library\ + \ for state-of-the-art image classification. With this library you can:\r\n\r\n\ + - Choose from 300+ pre-trained state-of-the-art image classification models.\r\ + \n- Train models afresh on research datasets such as ImageNet using provided scripts.\r\ + \n- Finetune pre-trained models on your own datasets, including the latest cutting\ + \ edge models." diff --git a/modelindex/models/adversarial-inception-v3.md b/modelindex/models/adversarial-inception-v3.md new file mode 100644 index 00000000..69ea31f9 --- /dev/null +++ b/modelindex/models/adversarial-inception-v3.md @@ -0,0 +1,150 @@ +# Summary + +**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). + +## How do I use this model on an image? +To load a pretrained model: + +```python +import timm +model = timm.create_model('adv_inception_v3', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('adv_inception_v3', pretrained=True).reset_classifier(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/modelindex/models/advprop.md b/modelindex/models/advprop.md new file mode 100644 index 00000000..92757d54 --- /dev/null +++ b/modelindex/models/advprop.md @@ -0,0 +1,445 @@ +# Summary + +**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. + +## How do I use this model on an image? +To load a pretrained model: + +```python +import timm +model = timm.create_model('tf_efficientnet_b1_ap', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_b1_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). +```python +model = timm.create_model('tf_efficientnet_b1_ap', pretrained=True).reset_classifier(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/modelindex/models/big-transfer.md b/modelindex/models/big-transfer.md new file mode 100644 index 00000000..bea0a9d5 --- /dev/null +++ b/modelindex/models/big-transfer.md @@ -0,0 +1,316 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('resnetv2_152x4_bitm', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_152x4_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). +```python +model = timm.create_model('resnetv2_152x4_bitm', pretrained=True).reset_classifier(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/modelindex/models/csp-darknet.md b/modelindex/models/csp-darknet.md new file mode 100644 index 00000000..a567ac44 --- /dev/null +++ b/modelindex/models/csp-darknet.md @@ -0,0 +1,135 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('cspdarknet53', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('cspdarknet53', pretrained=True).reset_classifier(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/modelindex/models/csp-resnet.md b/modelindex/models/csp-resnet.md new file mode 100644 index 00000000..56bbb990 --- /dev/null +++ b/modelindex/models/csp-resnet.md @@ -0,0 +1,133 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('cspresnet50', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('cspresnet50', pretrained=True).reset_classifier(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/modelindex/models/csp-resnext.md b/modelindex/models/csp-resnext.md new file mode 100644 index 00000000..a9e19107 --- /dev/null +++ b/modelindex/models/csp-resnext.md @@ -0,0 +1,133 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('cspresnext50', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('cspresnext50', pretrained=True).reset_classifier(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/modelindex/models/densenet.md b/modelindex/models/densenet.md new file mode 100644 index 00000000..98b11f34 --- /dev/null +++ b/modelindex/models/densenet.md @@ -0,0 +1,322 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('densenetblur121d', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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. `densenetblur121d`. 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). +```python +model = timm.create_model('densenetblur121d', pretrained=True).reset_classifier(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/modelindex/models/dla.md b/modelindex/models/dla.md new file mode 100644 index 00000000..645bb285 --- /dev/null +++ b/modelindex/models/dla.md @@ -0,0 +1,543 @@ +# Summary + +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: + +```python +import timm +model = timm.create_model('dla60', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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. `dla60`. 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). +```python +model = timm.create_model('dla60', pretrained=True).reset_classifier(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/modelindex/models/dpn.md b/modelindex/models/dpn.md new file mode 100644 index 00000000..9675bf69 --- /dev/null +++ b/modelindex/models/dpn.md @@ -0,0 +1,270 @@ +# Summary + +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: + +```python +import timm +model = timm.create_model('dpn68', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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. `dpn68`. 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). +```python +model = timm.create_model('dpn68', pretrained=True).reset_classifier(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/modelindex/models/ecaresnet.md b/modelindex/models/ecaresnet.md new file mode 100644 index 00000000..4f32b678 --- /dev/null +++ b/modelindex/models/ecaresnet.md @@ -0,0 +1,261 @@ +# Summary + +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: + +```python +import timm +model = timm.create_model('ecaresnet101d', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('ecaresnet101d', pretrained=True).reset_classifier(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/modelindex/models/efficientnet-pruned.md b/modelindex/models/efficientnet-pruned.md new file mode 100644 index 00000000..a02ffc6e --- /dev/null +++ b/modelindex/models/efficientnet-pruned.md @@ -0,0 +1,184 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('efficientnet_b1_pruned', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('efficientnet_b1_pruned', pretrained=True).reset_classifier(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{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/modelindex/models/efficientnet.md b/modelindex/models/efficientnet.md new file mode 100644 index 00000000..541c3848 --- /dev/null +++ b/modelindex/models/efficientnet.md @@ -0,0 +1,315 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('efficientnet_b2a', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_b2a`. 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). +```python +model = timm.create_model('efficientnet_b2a', pretrained=True).reset_classifier(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/modelindex/models/ensemble-adversarial.md b/modelindex/models/ensemble-adversarial.md new file mode 100644 index 00000000..3c97829a --- /dev/null +++ b/modelindex/models/ensemble-adversarial.md @@ -0,0 +1,150 @@ +# Summary + +**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). + +## How do I use this model on an image? +To load a pretrained model: + +```python +import timm +model = timm.create_model('ens_adv_inception_resnet_v2', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('ens_adv_inception_resnet_v2', pretrained=True).reset_classifier(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/modelindex/models/ese-vovnet.md b/modelindex/models/ese-vovnet.md new file mode 100644 index 00000000..716f9a72 --- /dev/null +++ b/modelindex/models/ese-vovnet.md @@ -0,0 +1,138 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('ese_vovnet39b', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_vovnet39b`. 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). +```python +model = timm.create_model('ese_vovnet39b', pretrained=True).reset_classifier(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/modelindex/models/fbnet.md b/modelindex/models/fbnet.md new file mode 100644 index 00000000..68645e80 --- /dev/null +++ b/modelindex/models/fbnet.md @@ -0,0 +1,130 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('fbnetc_100', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('fbnetc_100', pretrained=True).reset_classifier(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/modelindex/models/gloun-inception-v3.md b/modelindex/models/gloun-inception-v3.md new file mode 100644 index 00000000..ed8c0ead --- /dev/null +++ b/modelindex/models/gloun-inception-v3.md @@ -0,0 +1,132 @@ +# Summary + +**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. + +## How do I use this model on an image? +To load a pretrained model: + +```python +import timm +model = timm.create_model('gluon_inception_v3', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('gluon_inception_v3', pretrained=True).reset_classifier(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/modelindex/models/gloun-resnet.md b/modelindex/models/gloun-resnet.md new file mode 100644 index 00000000..6f1f7e1f --- /dev/null +++ b/modelindex/models/gloun-resnet.md @@ -0,0 +1,454 @@ +# Summary + +**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. + +## How do I use this model on an image? +To load a pretrained model: + +```python +import timm +model = timm.create_model('gluon_resnet101_v1b', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('gluon_resnet101_v1b', pretrained=True).reset_classifier(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/modelindex/models/gloun-resnext.md b/modelindex/models/gloun-resnext.md new file mode 100644 index 00000000..e5afb7b8 --- /dev/null +++ b/modelindex/models/gloun-resnext.md @@ -0,0 +1,180 @@ +# Summary + +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. + +## How do I use this model on an image? +To load a pretrained model: + +```python +import timm +model = timm.create_model('gluon_resnext50_32x4d', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_resnext50_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). +```python +model = timm.create_model('gluon_resnext50_32x4d', pretrained=True).reset_classifier(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/modelindex/models/gloun-senet.md b/modelindex/models/gloun-senet.md new file mode 100644 index 00000000..90f76082 --- /dev/null +++ b/modelindex/models/gloun-senet.md @@ -0,0 +1,117 @@ +# Summary + +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: + +```python +import timm +model = timm.create_model('gluon_senet154', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('gluon_senet154', pretrained=True).reset_classifier(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/modelindex/models/gloun-seresnext.md b/modelindex/models/gloun-seresnext.md new file mode 100644 index 00000000..590ec9a5 --- /dev/null +++ b/modelindex/models/gloun-seresnext.md @@ -0,0 +1,174 @@ +# Summary + +**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. + +## How do I use this model on an image? +To load a pretrained model: + +```python +import timm +model = timm.create_model('gluon_seresnext50_32x4d', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_seresnext50_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). +```python +model = timm.create_model('gluon_seresnext50_32x4d', pretrained=True).reset_classifier(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/modelindex/models/gloun-xception.md b/modelindex/models/gloun-xception.md new file mode 100644 index 00000000..78ab0201 --- /dev/null +++ b/modelindex/models/gloun-xception.md @@ -0,0 +1,118 @@ +# Summary + +**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. + +## How do I use this model on an image? +To load a pretrained model: + +```python +import timm +model = timm.create_model('gluon_xception65', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('gluon_xception65', pretrained=True).reset_classifier(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/modelindex/models/hrnet.md b/modelindex/models/hrnet.md new file mode 100644 index 00000000..ed6f147b --- /dev/null +++ b/modelindex/models/hrnet.md @@ -0,0 +1,364 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('hrnet_w18_small', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_small`. 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). +```python +model = timm.create_model('hrnet_w18_small', pretrained=True).reset_classifier(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/modelindex/models/ig-resnext.md b/modelindex/models/ig-resnext.md new file mode 100644 index 00000000..8d117c7f --- /dev/null +++ b/modelindex/models/ig-resnext.md @@ -0,0 +1,239 @@ +# Summary + +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: + +```python +import timm +model = timm.create_model('ig_resnext101_32x32d', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_32x32d`. 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). +```python +model = timm.create_model('ig_resnext101_32x32d', pretrained=True).reset_classifier(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/modelindex/models/inception-resnet-v2.md b/modelindex/models/inception-resnet-v2.md new file mode 100644 index 00000000..04c74e83 --- /dev/null +++ b/modelindex/models/inception-resnet-v2.md @@ -0,0 +1,126 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('inception_resnet_v2', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('inception_resnet_v2', pretrained=True).reset_classifier(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/modelindex/models/inception-v3.md b/modelindex/models/inception-v3.md new file mode 100644 index 00000000..cd785c8c --- /dev/null +++ b/modelindex/models/inception-v3.md @@ -0,0 +1,139 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('inception_v3', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('inception_v3', pretrained=True).reset_classifier(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/modelindex/models/inception-v4.md b/modelindex/models/inception-v4.md new file mode 100644 index 00000000..4a4c060d --- /dev/null +++ b/modelindex/models/inception-v4.md @@ -0,0 +1,125 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('inception_v4', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('inception_v4', pretrained=True).reset_classifier(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/modelindex/models/legacy-se-resnet.md b/modelindex/models/legacy-se-resnet.md new file mode 100644 index 00000000..36428958 --- /dev/null +++ b/modelindex/models/legacy-se-resnet.md @@ -0,0 +1,279 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('legacy_seresnet101', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('legacy_seresnet101', pretrained=True).reset_classifier(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/modelindex/models/legacy-se-resnext.md b/modelindex/models/legacy-se-resnext.md new file mode 100644 index 00000000..fe39c731 --- /dev/null +++ b/modelindex/models/legacy-se-resnext.md @@ -0,0 +1,205 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('legacy_seresnext101_32x4d', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('legacy_seresnext101_32x4d', pretrained=True).reset_classifier(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/modelindex/models/legacy-senet.md b/modelindex/models/legacy-senet.md new file mode 100644 index 00000000..7bebb080 --- /dev/null +++ b/modelindex/models/legacy-senet.md @@ -0,0 +1,128 @@ +# Summary + +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: + +```python +import timm +model = timm.create_model('legacy_senet154', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('legacy_senet154', pretrained=True).reset_classifier(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/modelindex/models/mixnet.md b/modelindex/models/mixnet.md new file mode 100644 index 00000000..7735dc09 --- /dev/null +++ b/modelindex/models/mixnet.md @@ -0,0 +1,194 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('mixnet_xl', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_xl`. 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). +```python +model = timm.create_model('mixnet_xl', pretrained=True).reset_classifier(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/modelindex/models/mnasnet.md b/modelindex/models/mnasnet.md new file mode 100644 index 00000000..c7779ad9 --- /dev/null +++ b/modelindex/models/mnasnet.md @@ -0,0 +1,155 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('semnasnet_100', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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. `semnasnet_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). +```python +model = timm.create_model('semnasnet_100', pretrained=True).reset_classifier(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/modelindex/models/mobilenet-v2.md b/modelindex/models/mobilenet-v2.md new file mode 100644 index 00000000..3a8574e0 --- /dev/null +++ b/modelindex/models/mobilenet-v2.md @@ -0,0 +1,240 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('mobilenetv2_100', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('mobilenetv2_100', pretrained=True).reset_classifier(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/modelindex/models/mobilenet-v3.md b/modelindex/models/mobilenet-v3.md new file mode 100644 index 00000000..1c7ecdd3 --- /dev/null +++ b/modelindex/models/mobilenet-v3.md @@ -0,0 +1,184 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('mobilenetv3_rw', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_rw`. 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). +```python +model = timm.create_model('mobilenetv3_rw', pretrained=True).reset_classifier(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/modelindex/models/nasnet.md b/modelindex/models/nasnet.md new file mode 100644 index 00000000..a29cc73f --- /dev/null +++ b/modelindex/models/nasnet.md @@ -0,0 +1,126 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('nasnetalarge', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('nasnetalarge', pretrained=True).reset_classifier(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/modelindex/models/noisy-student.md b/modelindex/models/noisy-student.md new file mode 100644 index 00000000..c30e2354 --- /dev/null +++ b/modelindex/models/noisy-student.md @@ -0,0 +1,517 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('tf_efficientnet_b3_ns', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_b3_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). +```python +model = timm.create_model('tf_efficientnet_b3_ns', pretrained=True).reset_classifier(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/modelindex/models/pnasnet.md b/modelindex/models/pnasnet.md new file mode 100644 index 00000000..29b08ac3 --- /dev/null +++ b/modelindex/models/pnasnet.md @@ -0,0 +1,125 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('pnasnet5large', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('pnasnet5large', pretrained=True).reset_classifier(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/modelindex/models/regnetx.md b/modelindex/models/regnetx.md new file mode 100644 index 00000000..f20b2007 --- /dev/null +++ b/modelindex/models/regnetx.md @@ -0,0 +1,458 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('regnetx_040', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_040`. 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). +```python +model = timm.create_model('regnetx_040', pretrained=True).reset_classifier(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/modelindex/models/regnety.md b/modelindex/models/regnety.md new file mode 100644 index 00000000..c8e50a93 --- /dev/null +++ b/modelindex/models/regnety.md @@ -0,0 +1,472 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('regnety_002', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('regnety_002', pretrained=True).reset_classifier(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/modelindex/models/res2net.md b/modelindex/models/res2net.md new file mode 100644 index 00000000..da552786 --- /dev/null +++ b/modelindex/models/res2net.md @@ -0,0 +1,274 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('res2net101_26w_4s', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('res2net101_26w_4s', pretrained=True).reset_classifier(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/modelindex/models/res2next.md b/modelindex/models/res2next.md new file mode 100644 index 00000000..f918baa9 --- /dev/null +++ b/modelindex/models/res2next.md @@ -0,0 +1,129 @@ +# Summary + +**Res2Net** 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: + +```python +import timm +model = timm.create_model('res2next50', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('res2next50', pretrained=True).reset_classifier(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/modelindex/models/resnest.md b/modelindex/models/resnest.md new file mode 100644 index 00000000..66ff5482 --- /dev/null +++ b/modelindex/models/resnest.md @@ -0,0 +1,420 @@ +# Summary + +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: + +```python +import timm +model = timm.create_model('resnest50d_4s2x40d', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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. `resnest50d_4s2x40d`. 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). +```python +model = timm.create_model('resnest50d_4s2x40d', pretrained=True).reset_classifier(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/modelindex/models/resnet-d.md b/modelindex/models/resnet-d.md new file mode 100644 index 00000000..14ab169d --- /dev/null +++ b/modelindex/models/resnet-d.md @@ -0,0 +1,269 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('resnet50d', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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. `resnet50d`. 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). +```python +model = timm.create_model('resnet50d', pretrained=True).reset_classifier(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/modelindex/models/resnet.md b/modelindex/models/resnet.md new file mode 100644 index 00000000..0cad2a3e --- /dev/null +++ b/modelindex/models/resnet.md @@ -0,0 +1,368 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('resnet26', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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. `resnet26`. 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). +```python +model = timm.create_model('resnet26', pretrained=True).reset_classifier(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/modelindex/models/resnext.md b/modelindex/models/resnext.md new file mode 100644 index 00000000..048b3a98 --- /dev/null +++ b/modelindex/models/resnext.md @@ -0,0 +1,213 @@ +# Summary + +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: + +```python +import timm +model = timm.create_model('resnext101_32x8d', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('resnext101_32x8d', pretrained=True).reset_classifier(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/modelindex/models/rexnet.md b/modelindex/models/rexnet.md new file mode 100644 index 00000000..9c4ed0db --- /dev/null +++ b/modelindex/models/rexnet.md @@ -0,0 +1,235 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('rexnet_100', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('rexnet_100', pretrained=True).reset_classifier(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/modelindex/models/se-resnet.md b/modelindex/models/se-resnet.md new file mode 100644 index 00000000..3f872ce2 --- /dev/null +++ b/modelindex/models/se-resnet.md @@ -0,0 +1,168 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('seresnet152d', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('seresnet152d', pretrained=True).reset_classifier(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/modelindex/models/selecsls.md b/modelindex/models/selecsls.md new file mode 100644 index 00000000..08a41890 --- /dev/null +++ b/modelindex/models/selecsls.md @@ -0,0 +1,174 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('selecsls42b', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('selecsls42b', pretrained=True).reset_classifier(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/modelindex/models/seresnext.md b/modelindex/models/seresnext.md new file mode 100644 index 00000000..28c7bfae --- /dev/null +++ b/modelindex/models/seresnext.md @@ -0,0 +1,205 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('seresnext26d_32x4d', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('seresnext26d_32x4d', pretrained=True).reset_classifier(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/modelindex/models/skresnet.md b/modelindex/models/skresnet.md new file mode 100644 index 00000000..b67735e8 --- /dev/null +++ b/modelindex/models/skresnet.md @@ -0,0 +1,158 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('skresnet18', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('skresnet18', pretrained=True).reset_classifier(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/modelindex/models/skresnext.md b/modelindex/models/skresnext.md new file mode 100644 index 00000000..ab8091fa --- /dev/null +++ b/modelindex/models/skresnext.md @@ -0,0 +1,124 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('skresnext50_32x4d', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('skresnext50_32x4d', pretrained=True).reset_classifier(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/modelindex/models/spnasnet.md b/modelindex/models/spnasnet.md new file mode 100644 index 00000000..2506bfc5 --- /dev/null +++ b/modelindex/models/spnasnet.md @@ -0,0 +1,116 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('spnasnet_100', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('spnasnet_100', pretrained=True).reset_classifier(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/modelindex/models/ssl-resnet.md b/modelindex/models/ssl-resnet.md new file mode 100644 index 00000000..116ee868 --- /dev/null +++ b/modelindex/models/ssl-resnet.md @@ -0,0 +1,177 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('ssl_resnet50', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_resnet50`. 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). +```python +model = timm.create_model('ssl_resnet50', pretrained=True).reset_classifier(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/modelindex/models/ssl-resnext.md b/modelindex/models/ssl-resnext.md new file mode 100644 index 00000000..dabd874a --- /dev/null +++ b/modelindex/models/ssl-resnext.md @@ -0,0 +1,247 @@ +# Summary + +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 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: + +```python +import timm +model = timm.create_model('ssl_resnext101_32x16d', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_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). +```python +model = timm.create_model('ssl_resnext101_32x16d', pretrained=True).reset_classifier(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/modelindex/models/swsl-resnet.md b/modelindex/models/swsl-resnet.md new file mode 100644 index 00000000..68a8b365 --- /dev/null +++ b/modelindex/models/swsl-resnet.md @@ -0,0 +1,177 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('swsl_resnet18', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('swsl_resnet18', pretrained=True).reset_classifier(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/modelindex/models/swsl-resnext.md b/modelindex/models/swsl-resnext.md new file mode 100644 index 00000000..7f40830b --- /dev/null +++ b/modelindex/models/swsl-resnext.md @@ -0,0 +1,247 @@ +# Summary + +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: + +```python +import timm +model = timm.create_model('swsl_resnext101_32x4d', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_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). +```python +model = timm.create_model('swsl_resnext101_32x4d', pretrained=True).reset_classifier(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/modelindex/models/tf-efficientnet-condconv.md b/modelindex/models/tf-efficientnet-condconv.md new file mode 100644 index 00000000..51aad524 --- /dev/null +++ b/modelindex/models/tf-efficientnet-condconv.md @@ -0,0 +1,225 @@ +# Summary + +**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. + +## How do I use this model on an image? +To load a pretrained model: + +```python +import timm +model = timm.create_model('tf_efficientnet_cc_b1_8e', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_b1_8e`. 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). +```python +model = timm.create_model('tf_efficientnet_cc_b1_8e', pretrained=True).reset_classifier(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/modelindex/models/tf-efficientnet-lite.md b/modelindex/models/tf-efficientnet-lite.md new file mode 100644 index 00000000..c953ac06 --- /dev/null +++ b/modelindex/models/tf-efficientnet-lite.md @@ -0,0 +1,215 @@ +# Summary + +**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). + +## How do I use this model on an image? +To load a pretrained model: + +```python +import timm +model = timm.create_model('tf_efficientnet_lite3', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_lite3`. 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). +```python +model = timm.create_model('tf_efficientnet_lite3', pretrained=True).reset_classifier(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/modelindex/models/tf-efficientnet.md b/modelindex/models/tf-efficientnet.md new file mode 100644 index 00000000..b1859de0 --- /dev/null +++ b/modelindex/models/tf-efficientnet.md @@ -0,0 +1,564 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('tf_efficientnet_b1', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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_b1`. 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). +```python +model = timm.create_model('tf_efficientnet_b1', pretrained=True).reset_classifier(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/modelindex/models/tf-inception-v3.md b/modelindex/models/tf-inception-v3.md new file mode 100644 index 00000000..de0b3ebd --- /dev/null +++ b/modelindex/models/tf-inception-v3.md @@ -0,0 +1,139 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('tf_inception_v3', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('tf_inception_v3', pretrained=True).reset_classifier(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/modelindex/models/tf-mixnet.md b/modelindex/models/tf-mixnet.md new file mode 100644 index 00000000..564758bc --- /dev/null +++ b/modelindex/models/tf-mixnet.md @@ -0,0 +1,169 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('tf_mixnet_l', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('tf_mixnet_l', pretrained=True).reset_classifier(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/modelindex/models/tf-mobilenet-v3.md b/modelindex/models/tf-mobilenet-v3.md new file mode 100644 index 00000000..839b5fc0 --- /dev/null +++ b/modelindex/models/tf-mobilenet-v3.md @@ -0,0 +1,332 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('tf_mobilenetv3_large_075', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('tf_mobilenetv3_large_075', pretrained=True).reset_classifier(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/modelindex/models/tresnet.md b/modelindex/models/tresnet.md new file mode 100644 index 00000000..17e1fef0 --- /dev/null +++ b/modelindex/models/tresnet.md @@ -0,0 +1,316 @@ +# Summary + +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: + +```python +import timm +model = timm.create_model('tresnet_l', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('tresnet_l', pretrained=True).reset_classifier(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/modelindex/models/vision-transformer.md b/modelindex/models/vision-transformer.md new file mode 100644 index 00000000..a1e75f9f --- /dev/null +++ b/modelindex/models/vision-transformer.md @@ -0,0 +1,339 @@ +# Summary + +The **Vision Transformer** is a model for image classification that employs a Transformer-like architecture over patches of the image. This includes the use of [Multi-Head Attention](https://paperswithcode.com/method/multi-head-attention), [Scaled Dot-Product Attention](https://paperswithcode.com/method/scaled) and other architectural features seen in the [Transformer](https://paperswithcode.com/method/transformer) architecture traditionally used for NLP. + +## How do I use this model on an image? +To load a pretrained model: + +```python +import timm +model = timm.create_model('vit_large_patch16_384', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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. `vit_large_patch16_384`. 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). +```python +model = timm.create_model('vit_large_patch16_384', pretrained=True).reset_classifier(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{dosovitskiy2020image, + title={An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale}, + author={Alexey Dosovitskiy and Lucas Beyer and Alexander Kolesnikov and Dirk Weissenborn and Xiaohua Zhai and Thomas Unterthiner and Mostafa Dehghani and Matthias Minderer and Georg Heigold and Sylvain Gelly and Jakob Uszkoreit and Neil Houlsby}, + year={2020}, + eprint={2010.11929}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} +``` + + \ No newline at end of file diff --git a/modelindex/models/wide-resnet.md b/modelindex/models/wide-resnet.md new file mode 100644 index 00000000..1e3b27fe --- /dev/null +++ b/modelindex/models/wide-resnet.md @@ -0,0 +1,148 @@ +# Summary + +**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: + +```python +import timm +model = timm.create_model('wide_resnet101_2', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('wide_resnet101_2', pretrained=True).reset_classifier(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/modelindex/models/xception.md b/modelindex/models/xception.md new file mode 100644 index 00000000..b2316e1f --- /dev/null +++ b/modelindex/models/xception.md @@ -0,0 +1,191 @@ +# Summary + +**Xception** is a convolutional neural network architecture that relies solely on [depthwise separable convolution layers](https://paperswithcode.com/method/depthwise-separable-convolution). + +## How do I use this model on an image? +To load a pretrained model: + +```python +import timm +model = timm.create_model('xception', pretrained=True) +model.eval() +``` + +To load and preprocess the image: +```python +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: +```python +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: +```python +# 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). +```python +model = timm.create_model('xception', pretrained=True).reset_classifier(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/modelindex/requirements-modelindex.txt b/modelindex/requirements-modelindex.txt new file mode 100644 index 00000000..bd5040cf --- /dev/null +++ b/modelindex/requirements-modelindex.txt @@ -0,0 +1,2 @@ +model-index==0.1.10 +jinja2==2.11.2