Image Classification
timm
English
vision
Lupin1998 commited on
Commit
df727d1
1 Parent(s): 2774b32

update moganet_xtiny_224_in1k

Browse files
Files changed (1) hide show
  1. README.md +94 -0
README.md CHANGED
@@ -1,3 +1,97 @@
1
  ---
 
 
 
 
 
2
  license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ tags:
3
+ - image-classification
4
+ datasets:
5
+ - imagenet
6
+ library_tag: MogaNet
7
  license: apache-2.0
8
  ---
9
+
10
+ # Model card for moganet_xtiny_224_in1k
11
+
12
+ MogaNet a new family of efficient ConvNets with preferable parameter-performance trade-offs, which is trained on ImageNet-1k (1 million images, 1,000 classes). It was first introduced in the paper [MogaNet](https://arxiv.org/abs/2211.03295) and released in [Westlake/MogaNet](https://github.com/Westlake-AI/MogaNet) and [Westlake/openmixup](https://github.com/Westlake-AI/openmixup).
13
+
14
+ ## Description
15
+
16
+ Since the recent success of Vision Transformers (ViTs), explorations toward ViT-style architectures have triggered the resurgence of ConvNets. In this work, we explore the representation ability of modern ConvNets from a novel view of multi-order game-theoretic interaction, which reflects inter-variable interaction effects w.r.t. contexts of different scales based on game theory. Within the modern ConvNet framework, we tailor the two feature mixers with conceptually simple yet effective depthwise convolutions to facilitate middle-order information across spatial and channel spaces respectively. In this light, a new family of pure ConvNet architecture, dubbed MogaNet, is proposed, which shows excellent scalability and attains competitive results among state-of-the-art models with more efficient use of parameters on ImageNet and multifarious typical vision benchmarks, including COCO object detection, ADE20K semantic segmentation, 2D\&3D human pose estimation and video prediction.Typically, MogaNet hits 80.0\% and 87.8\% top-1 accuracy with 5.2M and 181M parameters on ImageNet, outperforming ParC-Net-S and ConvNeXt-L while saving 59\% FLOPs and 17M parameters.
17
+
18
+ ## Model Usage
19
+
20
+ Setup before using the model.
21
+ ```bash
22
+ git clone https://github.com/Westlake-AI/MogaNet
23
+ cd MogaNet
24
+ ```
25
+
26
+ ### Image Classification
27
+ ```python
28
+ from urllib.request import urlopen
29
+ from PIL import Image
30
+ import timm
31
+ import models
32
+
33
+ img = Image.open(
34
+ urlopen('https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'))
35
+
36
+ model = timm.create_model('moganet_xtiny_1k', pretrained=True)
37
+ model = model.eval()
38
+
39
+ # get model specific transforms (normalization, resize)
40
+ data_config = timm.data.resolve_model_data_config(model)
41
+ transforms = timm.data.create_transform(**data_config, is_training=False)
42
+
43
+ output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batch of 1
44
+
45
+ top5_probabilities, top5_class_indices = torch.topk(output.softmax(dim=1) * 100, k=5)
46
+ ```
47
+
48
+ ### Feature Map Extraction
49
+ ```python
50
+ from urllib.request import urlopen
51
+ from PIL import Image
52
+ import timm
53
+
54
+ img = Image.open(
55
+ urlopen('https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'))
56
+
57
+ model = timm.create_model(
58
+ 'moganet_xtiny_1k',
59
+ pretrained=True,
60
+ fork_feat=True,
61
+ )
62
+ model = model.eval()
63
+
64
+ # get model specific transforms (normalization, resize)
65
+ data_config = timm.data.resolve_model_data_config(model)
66
+ transforms = timm.data.create_transform(**data_config, is_training=False)
67
+
68
+ output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batch of 1
69
+
70
+ for o in output:
71
+ # print shape of each feature map in output
72
+ print(o.shape)
73
+ ```
74
+
75
+ ## Model Comparison
76
+
77
+ | Model | Resolution | Params (M) | Flops (G) | Top-1 / top-5 (%) | Download |
78
+ |---|:---:|:---:|:---:|:---:|:---:|
79
+ | moganet_xtiny_224_in1k | 224x224 | 2.97 | 0.80 | 76.5 / 93.4 | [GitHub](https://github.com/Westlake-AI/MogaNet/releases/download/moganet-in1k-weights/moganet_xtiny_sz224_8xbs128_ep300.pth.tar) \| [Hugging Face🤗](https://huggingface.co/MogaNet/moganet_xtiny_224_in1k) |
80
+ | moganet_xtiny_256_in1k | 256x256 | 2.97 | 1.04 | 77.2 / 93.8 | [GitHub](https://github.com/Westlake-AI/MogaNet/releases/download/moganet-in1k-weights/moganet_xtiny_sz256_8xbs128_ep300.pth.tar) \| [Hugging Face🤗](https://huggingface.co/MogaNet/moganet_xtiny_256_in1k) |
81
+ | moganet_tiny_224_in1k | 224x224 | 5.20 | 1.10 | 79.0 / 94.6 | [GitHub](https://github.com/Westlake-AI/MogaNet/releases/download/moganet-in1k-weights/moganet_tiny_sz224_8xbs128_ep300.pth.tar) \| [Hugging Face🤗](https://huggingface.co/MogaNet/moganet_tiny_224_in1k) |
82
+ | moganet_tiny_256_in1k | 256x256 | 5.20 | 1.44 | 79.6 / 94.9 | [GitHub](https://github.com/Westlake-AI/MogaNet/releases/download/moganet-in1k-weights/moganet_tiny_sz256_8xbs128_ep300.pth.tar) \| [Hugging Face🤗](https://huggingface.co/MogaNet/moganet_tiny_256_in1k) |
83
+ | moganet_small_224_in1k | 224x224 | 25.3 | 4.97 | 83.4 / 96.9 | [GitHub](https://github.com/Westlake-AI/MogaNet/releases/download/moganet-in1k-weights/moganet_small_sz224_8xbs128_ep300.pth.tar) \| [Hugging Face🤗](https://huggingface.co/MogaNet/moganet_small_224_in1k) |
84
+ | moganet_base_224_in1k | 224x224 | 43.9 | 9.93 | 84.3 / 97.0 | [GitHub](https://github.com/Westlake-AI/MogaNet/releases/download/moganet-in1k-weights/moganet_base_sz224_8xbs128_ep300.pth.tar) \| [Hugging Face🤗](https://huggingface.co/MogaNet/moganet_base_224_in1k) |
85
+ | moganet_large_224_in1k | 224x224 | 82.5 | 15.9 | 84.7 / 97.1 | [GitHub](https://github.com/Westlake-AI/MogaNet/releases/download/moganet-in1k-weights/moganet_large_sz224_8xbs64_ep300.pth.tar) \| [Hugging Face🤗](https://huggingface.co/MogaNet/moganet_large_224_in1k) |
86
+ | moganet_xlarge_224_in1k | 224x224 | 180.8 | 34.5 | 85.1 / 97.4 | [GitHub](https://github.com/Westlake-AI/MogaNet/releases/download/moganet-in1k-weights/moganet_xlarge_sz224_8xbs64_ep300.pth.tar) \| [Hugging Face🤗](https://huggingface.co/MogaNet/moganet_xlarge_224_in1k) |
87
+
88
+ ## Citation
89
+ ```bibtex
90
+ @article{Li2022MogaNet,
91
+ title={Efficient Multi-order Gated Aggregation Network},
92
+ author={Siyuan Li and Zedong Wang and Zicheng Liu and Cheng Tan and Haitao Lin and Di Wu and Zhiyuan Chen and Jiangbin Zheng and Stan Z. Li},
93
+ journal={ArXiv},
94
+ year={2022},
95
+ volume={abs/2211.03295}
96
+ }
97
+ ```