DongHyunKim
commited on
Commit
•
fa75fae
1
Parent(s):
1ecbc1b
Update README.md
Browse files
README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
---
|
|
|
|
|
|
|
2 |
tags:
|
3 |
- image-classification
|
4 |
- timm
|
5 |
- rdnet
|
6 |
-
library_name: timm
|
7 |
-
datasets:
|
8 |
-
- imagenet-1k
|
9 |
---
|
10 |
# Model card for rdnet_large.nv_in1k
|
11 |
|
@@ -29,6 +29,7 @@ from urllib.request import urlopen
|
|
29 |
from PIL import Image
|
30 |
import timm
|
31 |
import torch
|
|
|
32 |
|
33 |
img = Image.open(urlopen(
|
34 |
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
|
@@ -51,6 +52,7 @@ top5_probabilities, top5_class_indices = torch.topk(output.softmax(dim=1) * 100,
|
|
51 |
from urllib.request import urlopen
|
52 |
from PIL import Image
|
53 |
import timm
|
|
|
54 |
|
55 |
img = Image.open(urlopen(
|
56 |
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
|
@@ -72,12 +74,10 @@ output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batc
|
|
72 |
for o in output:
|
73 |
# print shape of each feature map in output
|
74 |
# e.g.:
|
75 |
-
#
|
76 |
-
#
|
77 |
-
#
|
78 |
-
#
|
79 |
-
# torch.Size([1, 512, 14, 14])
|
80 |
-
# torch.Size([1, 512, 7, 7])
|
81 |
|
82 |
print(o.shape)
|
83 |
```
|
@@ -87,6 +87,7 @@ for o in output:
|
|
87 |
from urllib.request import urlopen
|
88 |
from PIL import Image
|
89 |
import timm
|
|
|
90 |
|
91 |
img = Image.open(urlopen(
|
92 |
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
|
@@ -108,7 +109,7 @@ output = model(transforms(img).unsqueeze(0)) # output is (batch_size, num_featu
|
|
108 |
# or equivalently (without needing to set num_classes=0)
|
109 |
|
110 |
output = model.forward_features(transforms(img).unsqueeze(0))
|
111 |
-
# output is unpooled, a (1,
|
112 |
|
113 |
output = model.forward_head(output, pre_logits=True)
|
114 |
# output is a (1, num_features) shaped tensor
|
|
|
1 |
---
|
2 |
+
datasets:
|
3 |
+
- imagenet-1k
|
4 |
+
library_name: timm
|
5 |
tags:
|
6 |
- image-classification
|
7 |
- timm
|
8 |
- rdnet
|
|
|
|
|
|
|
9 |
---
|
10 |
# Model card for rdnet_large.nv_in1k
|
11 |
|
|
|
29 |
from PIL import Image
|
30 |
import timm
|
31 |
import torch
|
32 |
+
import rdnet # register rdnet models to timm
|
33 |
|
34 |
img = Image.open(urlopen(
|
35 |
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
|
|
|
52 |
from urllib.request import urlopen
|
53 |
from PIL import Image
|
54 |
import timm
|
55 |
+
import rdnet # register rdnet models to timm
|
56 |
|
57 |
img = Image.open(urlopen(
|
58 |
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
|
|
|
74 |
for o in output:
|
75 |
# print shape of each feature map in output
|
76 |
# e.g.:
|
77 |
+
# torch.Size([1, 528, 56, 56])
|
78 |
+
# torch.Size([1, 840, 28, 28])
|
79 |
+
# torch.Size([1, 1528, 14, 14])
|
80 |
+
# torch.Size([1, 2000, 7, 7])
|
|
|
|
|
81 |
|
82 |
print(o.shape)
|
83 |
```
|
|
|
87 |
from urllib.request import urlopen
|
88 |
from PIL import Image
|
89 |
import timm
|
90 |
+
import rdnet # register rdnet models to timm
|
91 |
|
92 |
img = Image.open(urlopen(
|
93 |
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
|
|
|
109 |
# or equivalently (without needing to set num_classes=0)
|
110 |
|
111 |
output = model.forward_features(transforms(img).unsqueeze(0))
|
112 |
+
# output is unpooled, a (1, 2000, 7, 7) shaped tensor
|
113 |
|
114 |
output = model.forward_head(output, pre_logits=True)
|
115 |
# output is a (1, num_features) shaped tensor
|