rwightman HF staff commited on
Commit
4ef6c6f
·
verified ·
1 Parent(s): 985dc1c
Files changed (4) hide show
  1. README.md +150 -0
  2. config.json +41 -0
  3. model.safetensors +3 -0
  4. pytorch_model.bin +3 -0
README.md ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - image-classification
4
+ - timm
5
+ library_name: timm
6
+ license: apache-2.0
7
+ datasets:
8
+ - imagenet-1k
9
+ ---
10
+ # Model card for ese_vovnet57b.ra4_e3600_r256_in1k
11
+
12
+ A VoVNet-v2 image classification model. Pretrained on ImageNet-1k in `timm` by Ross Wightman using MobileNetV4 inspired RA4 recipe.
13
+
14
+ ## Model Details
15
+ - **Model Type:** Image classification / feature backbone
16
+ - **Model Stats:**
17
+ - Params (M): 38.6
18
+ - GMACs: 11.7
19
+ - Activations (M): 9.8
20
+ - Image size: train = 256 x 256, test = 320 x 320
21
+ - **Papers:**
22
+ - An Energy and GPU-Computation Efficient Backbone Network: https://arxiv.org/abs/1904.09730
23
+ - CenterMask : Real-Time Anchor-Free Instance Segmentation: https://arxiv.org/abs/1911.06667
24
+ - ResNet strikes back: An improved training procedure in timm: https://arxiv.org/abs/2110.00476
25
+ - MobileNetV4 -- Universal Models for the Mobile Ecosystem: https://arxiv.org/abs/2404.10518
26
+ - **Dataset:** ImageNet-1k
27
+ - **Original:** https://github.com/huggingface/pytorch-image-models
28
+
29
+ ## Model Usage
30
+ ### Image Classification
31
+ ```python
32
+ from urllib.request import urlopen
33
+ from PIL import Image
34
+ import timm
35
+
36
+ img = Image.open(urlopen(
37
+ 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
38
+ ))
39
+
40
+ model = timm.create_model('ese_vovnet57b.ra4_e3600_r256_in1k', pretrained=True)
41
+ model = model.eval()
42
+
43
+ # get model specific transforms (normalization, resize)
44
+ data_config = timm.data.resolve_model_data_config(model)
45
+ transforms = timm.data.create_transform(**data_config, is_training=False)
46
+
47
+ output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batch of 1
48
+
49
+ top5_probabilities, top5_class_indices = torch.topk(output.softmax(dim=1) * 100, k=5)
50
+ ```
51
+
52
+ ### Feature Map Extraction
53
+ ```python
54
+ from urllib.request import urlopen
55
+ from PIL import Image
56
+ import timm
57
+
58
+ img = Image.open(urlopen(
59
+ 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
60
+ ))
61
+
62
+ model = timm.create_model(
63
+ 'ese_vovnet57b.ra4_e3600_r256_in1k',
64
+ pretrained=True,
65
+ features_only=True,
66
+ )
67
+ model = model.eval()
68
+
69
+ # get model specific transforms (normalization, resize)
70
+ data_config = timm.data.resolve_model_data_config(model)
71
+ transforms = timm.data.create_transform(**data_config, is_training=False)
72
+
73
+ output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batch of 1
74
+
75
+ for o in output:
76
+ # print shape of each feature map in output
77
+ # e.g.:
78
+ # torch.Size([1, 64, 128, 128])
79
+ # torch.Size([1, 256, 64, 64])
80
+ # torch.Size([1, 512, 32, 32])
81
+ # torch.Size([1, 768, 16, 16])
82
+ # torch.Size([1, 1024, 8, 8])
83
+
84
+ print(o.shape)
85
+ ```
86
+
87
+ ### Image Embeddings
88
+ ```python
89
+ from urllib.request import urlopen
90
+ from PIL import Image
91
+ import timm
92
+
93
+ img = Image.open(urlopen(
94
+ 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
95
+ ))
96
+
97
+ model = timm.create_model(
98
+ 'ese_vovnet57b.ra4_e3600_r256_in1k',
99
+ pretrained=True,
100
+ num_classes=0, # remove classifier nn.Linear
101
+ )
102
+ model = model.eval()
103
+
104
+ # get model specific transforms (normalization, resize)
105
+ data_config = timm.data.resolve_model_data_config(model)
106
+ transforms = timm.data.create_transform(**data_config, is_training=False)
107
+
108
+ output = model(transforms(img).unsqueeze(0)) # output is (batch_size, num_features) shaped tensor
109
+
110
+ # or equivalently (without needing to set num_classes=0)
111
+
112
+ output = model.forward_features(transforms(img).unsqueeze(0))
113
+ # output is unpooled, a (1, 1024, 8, 8) shaped tensor
114
+
115
+ output = model.forward_head(output, pre_logits=True)
116
+ # output is a (1, num_features) shaped tensor
117
+ ```
118
+
119
+ ## Citation
120
+ ```bibtex
121
+ @inproceedings{lee2019energy,
122
+ title = {An Energy and GPU-Computation Efficient Backbone Network for Real-Time Object Detection},
123
+ author = {Lee, Youngwan and Hwang, Joong-won and Lee, Sangrok and Bae, Yuseok and Park, Jongyoul},
124
+ booktitle = {Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops},
125
+ year = {2019}
126
+ }
127
+ ```
128
+ ```bibtex
129
+ @article{lee2019centermask,
130
+ title={CenterMask: Real-Time Anchor-Free Instance Segmentation},
131
+ author={Lee, Youngwan and Park, Jongyoul},
132
+ booktitle={CVPR},
133
+ year={2020}
134
+ }
135
+ ```
136
+ ```bibtex
137
+ @inproceedings{wightman2021resnet,
138
+ title={ResNet strikes back: An improved training procedure in timm},
139
+ author={Wightman, Ross and Touvron, Hugo and Jegou, Herve},
140
+ booktitle={NeurIPS 2021 Workshop on ImageNet: Past, Present, and Future}
141
+ }
142
+ ```
143
+ ```bibtex
144
+ @article{qin2024mobilenetv4,
145
+ title={MobileNetV4-Universal Models for the Mobile Ecosystem},
146
+ author={Qin, Danfeng and Leichner, Chas and Delakis, Manolis and Fornoni, Marco and Luo, Shixin and Yang, Fan and Wang, Weijun and Banbury, Colby and Ye, Chengxi and Akin, Berkin and others},
147
+ journal={arXiv preprint arXiv:2404.10518},
148
+ year={2024}
149
+ }
150
+ ```
config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architecture": "ese_vovnet57b",
3
+ "num_classes": 1000,
4
+ "num_features": 1024,
5
+ "pretrained_cfg": {
6
+ "tag": "ra4_e3600_r256_in1k",
7
+ "custom_load": false,
8
+ "input_size": [
9
+ 3,
10
+ 256,
11
+ 256
12
+ ],
13
+ "test_input_size": [
14
+ 3,
15
+ 320,
16
+ 320
17
+ ],
18
+ "fixed_input_size": false,
19
+ "interpolation": "bicubic",
20
+ "crop_pct": 0.95,
21
+ "test_crop_pct": 1.0,
22
+ "crop_mode": "center",
23
+ "mean": [
24
+ 0.5,
25
+ 0.5,
26
+ 0.5
27
+ ],
28
+ "std": [
29
+ 0.5,
30
+ 0.5,
31
+ 0.5
32
+ ],
33
+ "num_classes": 1000,
34
+ "pool_size": [
35
+ 8,
36
+ 8
37
+ ],
38
+ "first_conv": "stem.0.conv",
39
+ "classifier": "head.fc"
40
+ }
41
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7a31e6582f51f4952c6895132e2e6bd2cad73ba9b5bde1e7a0b2567d134c2075
3
+ size 154600712
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4ac05dc73a1e51c8b2ad41e723f3d42c2f479d60912d2b0c493fa57fe3bac84a
3
+ size 154692810