Update README.md
Browse files
README.md
CHANGED
@@ -39,6 +39,7 @@ Trained by [Tissue Image Analytics (TIA) Centre](https://warwick.ac.uk/fac/cross
|
|
39 |
```python
|
40 |
from urllib.request import urlopen
|
41 |
from PIL import Image
|
|
|
42 |
import timm
|
43 |
|
44 |
# get example histology image
|
@@ -54,6 +55,9 @@ model = timm.create_model(
|
|
54 |
pretrained=True,
|
55 |
).eval()
|
56 |
|
|
|
|
|
|
|
57 |
# get model specific transforms (normalization, resize)
|
58 |
data_config = timm.data.resolve_model_data_config(model)
|
59 |
transforms = timm.data.create_transform(**data_config, is_training=False)
|
@@ -67,6 +71,7 @@ output = model(data) # output is a (batch_size, num_features) shaped tensor
|
|
67 |
```python
|
68 |
from urllib.request import urlopen
|
69 |
from PIL import Image
|
|
|
70 |
import timm
|
71 |
|
72 |
# get example histology image
|
@@ -83,6 +88,9 @@ model = timm.create_model(
|
|
83 |
num_classes=0,
|
84 |
).eval()
|
85 |
|
|
|
|
|
|
|
86 |
# get model specific transforms (normalization, resize)
|
87 |
data_config = timm.data.resolve_model_data_config(model)
|
88 |
transforms = timm.data.create_transform(**data_config, is_training=False)
|
|
|
39 |
```python
|
40 |
from urllib.request import urlopen
|
41 |
from PIL import Image
|
42 |
+
import torch.nn as nn
|
43 |
import timm
|
44 |
|
45 |
# get example histology image
|
|
|
55 |
pretrained=True,
|
56 |
).eval()
|
57 |
|
58 |
+
# disable norm5's activation, as per torchvision's implementation
|
59 |
+
model.features.norm5.act == nn.Identity()
|
60 |
+
|
61 |
# get model specific transforms (normalization, resize)
|
62 |
data_config = timm.data.resolve_model_data_config(model)
|
63 |
transforms = timm.data.create_transform(**data_config, is_training=False)
|
|
|
71 |
```python
|
72 |
from urllib.request import urlopen
|
73 |
from PIL import Image
|
74 |
+
import torch.nn as nn
|
75 |
import timm
|
76 |
|
77 |
# get example histology image
|
|
|
88 |
num_classes=0,
|
89 |
).eval()
|
90 |
|
91 |
+
# disable norm5's activation, as per torchvision's implementation
|
92 |
+
model.features.norm5.act == nn.Identity()
|
93 |
+
|
94 |
# get model specific transforms (normalization, resize)
|
95 |
data_config = timm.data.resolve_model_data_config(model)
|
96 |
transforms = timm.data.create_transform(**data_config, is_training=False)
|