Views
No views yet

1git clone https://github.com/Westlake-AI/MogaNet
2cd MogaNet1from urllib.request import urlopen
2from PIL import Image
3import timm
4import models
5
6img = Image.open(
7 urlopen('https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'))
8
9model = timm.create_model('moganet_xtiny_1k', pretrained=True)
10model = model.eval()
11
12# get model specific transforms (normalization, resize)
13data_config = timm.data.resolve_model_data_config(model)
14transforms = timm.data.create_transform(**data_config, is_training=False)
15
16output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batch of 1
17
18top5_probabilities, top5_class_indices = torch.topk(output.softmax(dim=1) * 100, k=5)1from urllib.request import urlopen
2from PIL import Image
3import timm
4
5img = Image.open(
6 urlopen('https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'))
7
8model = timm.create_model(
9 'moganet_xtiny_1k',
10 pretrained=True,
11 fork_feat=True,
12)
13model = model.eval()
14
15# get model specific transforms (normalization, resize)
16data_config = timm.data.resolve_model_data_config(model)
17transforms = timm.data.create_transform(**data_config, is_training=False)
18
19output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batch of 1
20
21for o in output:
22 # print shape of each feature map in output
23 print(o.shape)| Model | Resolution | Params (M) | Flops (G) | Top-1 / top-5 (%) | Download |
|---|---|---|---|---|---|
| moganet_xtiny_224_in1k | 224x224 | 2.97 | 0.80 | 76.5 / 93.4 | GitHub | Hugging Face🤗 |
| moganet_xtiny_256_in1k | 256x256 | 2.97 | 1.04 | 77.2 / 93.8 | GitHub | Hugging Face🤗 |
| moganet_tiny_224_in1k | 224x224 | 5.20 | 1.10 | 79.0 / 94.6 | GitHub | Hugging Face🤗 |
| moganet_tiny_256_in1k | 256x256 | 5.20 | 1.44 | 79.6 / 94.9 | GitHub | Hugging Face🤗 |
| moganet_small_224_in1k | 224x224 | 25.3 | 4.97 | 83.4 / 96.9 | GitHub | Hugging Face🤗 |
| moganet_base_224_in1k | 224x224 | 43.9 | 9.93 | 84.3 / 97.0 | GitHub | Hugging Face🤗 |
| moganet_large_224_in1k | 224x224 | 82.5 | 15.9 | 84.7 / 97.1 | GitHub | Hugging Face🤗 |
| moganet_xlarge_224_in1k | 224x224 | 180.8 | 34.5 | 85.1 / 97.4 | GitHub | Hugging Face🤗 |
1@article{Li2022MogaNet,
2 title={Efficient Multi-order Gated Aggregation Network},
3 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},
4 journal={ArXiv},
5 year={2022},
6 volume={abs/2211.03295}
7}