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-1k
|
@@ -14,7 +14,7 @@ An official MaxViT image classification model. Pretrained in tensorflow on Image
|
|
14 |
|
15 |
Ported from official Tensorflow implementation (https://github.com/google-research/maxvit) to PyTorch by Ross Wightman.
|
16 |
|
17 |
-
### Model Variants in [maxxvit.py](https://github.com/
|
18 |
|
19 |
MaxxViT covers a number of related model architectures that share a common structure including:
|
20 |
- CoAtNet - Combining MBConv (depthwise-separable) convolutional blocks in early stages with self-attention transformer blocks in later stages.
|
@@ -45,8 +45,9 @@ from urllib.request import urlopen
|
|
45 |
from PIL import Image
|
46 |
import timm
|
47 |
|
48 |
-
img = Image.open(
|
49 |
-
|
|
|
50 |
|
51 |
model = timm.create_model('maxvit_xlarge_tf_384.in21k_ft_in1k', pretrained=True)
|
52 |
model = model.eval()
|
@@ -66,8 +67,9 @@ from urllib.request import urlopen
|
|
66 |
from PIL import Image
|
67 |
import timm
|
68 |
|
69 |
-
img = Image.open(
|
70 |
-
|
|
|
71 |
|
72 |
model = timm.create_model(
|
73 |
'maxvit_xlarge_tf_384.in21k_ft_in1k',
|
@@ -84,12 +86,13 @@ output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batc
|
|
84 |
|
85 |
for o in output:
|
86 |
# print shape of each feature map in output
|
87 |
-
# e.g.:
|
88 |
-
# torch.Size([1,
|
89 |
-
# torch.Size([1,
|
90 |
-
# torch.Size([1,
|
91 |
-
# torch.Size([1,
|
92 |
-
# torch.Size([1,
|
|
|
93 |
print(o.shape)
|
94 |
```
|
95 |
|
@@ -99,8 +102,9 @@ from urllib.request import urlopen
|
|
99 |
from PIL import Image
|
100 |
import timm
|
101 |
|
102 |
-
img = Image.open(
|
103 |
-
|
|
|
104 |
|
105 |
model = timm.create_model(
|
106 |
'maxvit_xlarge_tf_384.in21k_ft_in1k',
|
@@ -118,10 +122,10 @@ output = model(transforms(img).unsqueeze(0)) # output is (batch_size, num_featu
|
|
118 |
# or equivalently (without needing to set num_classes=0)
|
119 |
|
120 |
output = model.forward_features(transforms(img).unsqueeze(0))
|
121 |
-
# output is unpooled
|
122 |
|
123 |
output = model.forward_head(output, pre_logits=True)
|
124 |
-
# output is (
|
125 |
```
|
126 |
|
127 |
## Model Comparison
|
@@ -229,7 +233,7 @@ output = model.forward_head(output, pre_logits=True)
|
|
229 |
publisher = {GitHub},
|
230 |
journal = {GitHub repository},
|
231 |
doi = {10.5281/zenodo.4414861},
|
232 |
-
howpublished = {\url{https://github.com/
|
233 |
}
|
234 |
```
|
235 |
```bibtex
|
|
|
2 |
tags:
|
3 |
- image-classification
|
4 |
- timm
|
5 |
+
library_name: timm
|
6 |
license: apache-2.0
|
7 |
datasets:
|
8 |
- imagenet-1k
|
|
|
14 |
|
15 |
Ported from official Tensorflow implementation (https://github.com/google-research/maxvit) to PyTorch by Ross Wightman.
|
16 |
|
17 |
+
### Model Variants in [maxxvit.py](https://github.com/huggingface/pytorch-image-models/blob/main/timm/models/maxxvit.py)
|
18 |
|
19 |
MaxxViT covers a number of related model architectures that share a common structure including:
|
20 |
- CoAtNet - Combining MBConv (depthwise-separable) convolutional blocks in early stages with self-attention transformer blocks in later stages.
|
|
|
45 |
from PIL import Image
|
46 |
import timm
|
47 |
|
48 |
+
img = Image.open(urlopen(
|
49 |
+
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
|
50 |
+
))
|
51 |
|
52 |
model = timm.create_model('maxvit_xlarge_tf_384.in21k_ft_in1k', pretrained=True)
|
53 |
model = model.eval()
|
|
|
67 |
from PIL import Image
|
68 |
import timm
|
69 |
|
70 |
+
img = Image.open(urlopen(
|
71 |
+
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
|
72 |
+
))
|
73 |
|
74 |
model = timm.create_model(
|
75 |
'maxvit_xlarge_tf_384.in21k_ft_in1k',
|
|
|
86 |
|
87 |
for o in output:
|
88 |
# print shape of each feature map in output
|
89 |
+
# e.g.:
|
90 |
+
# torch.Size([1, 192, 192, 192])
|
91 |
+
# torch.Size([1, 192, 96, 96])
|
92 |
+
# torch.Size([1, 384, 48, 48])
|
93 |
+
# torch.Size([1, 768, 24, 24])
|
94 |
+
# torch.Size([1, 1536, 12, 12])
|
95 |
+
|
96 |
print(o.shape)
|
97 |
```
|
98 |
|
|
|
102 |
from PIL import Image
|
103 |
import timm
|
104 |
|
105 |
+
img = Image.open(urlopen(
|
106 |
+
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
|
107 |
+
))
|
108 |
|
109 |
model = timm.create_model(
|
110 |
'maxvit_xlarge_tf_384.in21k_ft_in1k',
|
|
|
122 |
# or equivalently (without needing to set num_classes=0)
|
123 |
|
124 |
output = model.forward_features(transforms(img).unsqueeze(0))
|
125 |
+
# output is unpooled, a (1, 1536, 12, 12) shaped tensor
|
126 |
|
127 |
output = model.forward_head(output, pre_logits=True)
|
128 |
+
# output is a (1, num_features) shaped tensor
|
129 |
```
|
130 |
|
131 |
## Model Comparison
|
|
|
233 |
publisher = {GitHub},
|
234 |
journal = {GitHub repository},
|
235 |
doi = {10.5281/zenodo.4414861},
|
236 |
+
howpublished = {\url{https://github.com/huggingface/pytorch-image-models}}
|
237 |
}
|
238 |
```
|
239 |
```bibtex
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:75ca0177c5184aaa141aad9adc646bd4f41f4a5ec118fb9ee8fc5454169cbfda
|
3 |
+
size 1902608790
|