Update model config and README
Browse files- README.md +21 -17
- model.safetensors +3 -0
README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
tags:
|
3 |
- image-classification
|
4 |
- timm
|
5 |
-
|
6 |
license: apache-2.0
|
7 |
datasets:
|
8 |
- imagenet-12k
|
@@ -12,7 +12,7 @@ datasets:
|
|
12 |
A timm specific MaxxViT-V2 (w/ a MLP Log-CPB (continuous log-coordinate relative position bias motivated by Swin-V2) image classification model. Trained in `timm` on ImageNet-12k (a 11821 class subset of full ImageNet-22k) by Ross Wightman.
|
13 |
|
14 |
|
15 |
-
### Model Variants in [maxxvit.py](https://github.com/
|
16 |
|
17 |
MaxxViT covers a number of related model architectures that share a common structure including:
|
18 |
- CoAtNet - Combining MBConv (depthwise-separable) convolutional blocks in early stages with self-attention transformer blocks in later stages.
|
@@ -44,8 +44,9 @@ from urllib.request import urlopen
|
|
44 |
from PIL import Image
|
45 |
import timm
|
46 |
|
47 |
-
img = Image.open(
|
48 |
-
|
|
|
49 |
|
50 |
model = timm.create_model('maxxvitv2_rmlp_base_rw_224.sw_in12k', pretrained=True)
|
51 |
model = model.eval()
|
@@ -65,8 +66,9 @@ from urllib.request import urlopen
|
|
65 |
from PIL import Image
|
66 |
import timm
|
67 |
|
68 |
-
img = Image.open(
|
69 |
-
|
|
|
70 |
|
71 |
model = timm.create_model(
|
72 |
'maxxvitv2_rmlp_base_rw_224.sw_in12k',
|
@@ -83,12 +85,13 @@ output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batc
|
|
83 |
|
84 |
for o in output:
|
85 |
# print shape of each feature map in output
|
86 |
-
# e.g.:
|
87 |
-
# torch.Size([1, 128,
|
88 |
-
# torch.Size([1, 128,
|
89 |
-
# torch.Size([1, 256,
|
90 |
-
# torch.Size([1, 512,
|
91 |
-
# torch.Size([1, 1024,
|
|
|
92 |
print(o.shape)
|
93 |
```
|
94 |
|
@@ -98,8 +101,9 @@ from urllib.request import urlopen
|
|
98 |
from PIL import Image
|
99 |
import timm
|
100 |
|
101 |
-
img = Image.open(
|
102 |
-
|
|
|
103 |
|
104 |
model = timm.create_model(
|
105 |
'maxxvitv2_rmlp_base_rw_224.sw_in12k',
|
@@ -117,10 +121,10 @@ output = model(transforms(img).unsqueeze(0)) # output is (batch_size, num_featu
|
|
117 |
# or equivalently (without needing to set num_classes=0)
|
118 |
|
119 |
output = model.forward_features(transforms(img).unsqueeze(0))
|
120 |
-
# output is unpooled
|
121 |
|
122 |
output = model.forward_head(output, pre_logits=True)
|
123 |
-
# output is (
|
124 |
```
|
125 |
|
126 |
## Model Comparison
|
@@ -228,7 +232,7 @@ output = model.forward_head(output, pre_logits=True)
|
|
228 |
publisher = {GitHub},
|
229 |
journal = {GitHub repository},
|
230 |
doi = {10.5281/zenodo.4414861},
|
231 |
-
howpublished = {\url{https://github.com/
|
232 |
}
|
233 |
```
|
234 |
```bibtex
|
|
|
2 |
tags:
|
3 |
- image-classification
|
4 |
- timm
|
5 |
+
library_name: timm
|
6 |
license: apache-2.0
|
7 |
datasets:
|
8 |
- imagenet-12k
|
|
|
12 |
A timm specific MaxxViT-V2 (w/ a MLP Log-CPB (continuous log-coordinate relative position bias motivated by Swin-V2) image classification model. Trained in `timm` on ImageNet-12k (a 11821 class subset of full ImageNet-22k) by Ross Wightman.
|
13 |
|
14 |
|
15 |
+
### Model Variants in [maxxvit.py](https://github.com/huggingface/pytorch-image-models/blob/main/timm/models/maxxvit.py)
|
16 |
|
17 |
MaxxViT covers a number of related model architectures that share a common structure including:
|
18 |
- CoAtNet - Combining MBConv (depthwise-separable) convolutional blocks in early stages with self-attention transformer blocks in later stages.
|
|
|
44 |
from PIL import Image
|
45 |
import timm
|
46 |
|
47 |
+
img = Image.open(urlopen(
|
48 |
+
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
|
49 |
+
))
|
50 |
|
51 |
model = timm.create_model('maxxvitv2_rmlp_base_rw_224.sw_in12k', pretrained=True)
|
52 |
model = model.eval()
|
|
|
66 |
from PIL import Image
|
67 |
import timm
|
68 |
|
69 |
+
img = Image.open(urlopen(
|
70 |
+
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
|
71 |
+
))
|
72 |
|
73 |
model = timm.create_model(
|
74 |
'maxxvitv2_rmlp_base_rw_224.sw_in12k',
|
|
|
85 |
|
86 |
for o in output:
|
87 |
# print shape of each feature map in output
|
88 |
+
# e.g.:
|
89 |
+
# torch.Size([1, 128, 112, 112])
|
90 |
+
# torch.Size([1, 128, 56, 56])
|
91 |
+
# torch.Size([1, 256, 28, 28])
|
92 |
+
# torch.Size([1, 512, 14, 14])
|
93 |
+
# torch.Size([1, 1024, 7, 7])
|
94 |
+
|
95 |
print(o.shape)
|
96 |
```
|
97 |
|
|
|
101 |
from PIL import Image
|
102 |
import timm
|
103 |
|
104 |
+
img = Image.open(urlopen(
|
105 |
+
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
|
106 |
+
))
|
107 |
|
108 |
model = timm.create_model(
|
109 |
'maxxvitv2_rmlp_base_rw_224.sw_in12k',
|
|
|
121 |
# or equivalently (without needing to set num_classes=0)
|
122 |
|
123 |
output = model.forward_features(transforms(img).unsqueeze(0))
|
124 |
+
# output is unpooled, a (1, 1024, 7, 7) shaped tensor
|
125 |
|
126 |
output = model.forward_head(output, pre_logits=True)
|
127 |
+
# output is a (1, num_features) shaped tensor
|
128 |
```
|
129 |
|
130 |
## Model Comparison
|
|
|
232 |
publisher = {GitHub},
|
233 |
journal = {GitHub repository},
|
234 |
doi = {10.5281/zenodo.4414861},
|
235 |
+
howpublished = {\url{https://github.com/huggingface/pytorch-image-models}}
|
236 |
}
|
237 |
```
|
238 |
```bibtex
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f8b5da1955a85786e005c593940127d0d265358e62a1b5f76a2b00a945101480
|
3 |
+
size 508803836
|