DongHyunKim
commited on
Commit
•
e3de7bf
1
Parent(s):
31a7836
Update README.md
Browse files
README.md
CHANGED
@@ -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
|
|
|
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, 408, 56, 56])
|
78 |
+
# torch.Size([1, 584, 28, 28])
|
79 |
+
# torch.Size([1, 1000, 14, 14])
|
80 |
+
# torch.Size([1, 1760, 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, 1760, 7, 7) shaped tensor
|
113 |
|
114 |
output = model.forward_head(output, pre_logits=True)
|
115 |
# output is a (1, num_features) shaped tensor
|