Update README.md
Browse files
README.md
CHANGED
@@ -1,8 +1,109 @@
|
|
1 |
---
|
2 |
tags:
|
3 |
- image-classification
|
|
|
4 |
- timm
|
|
|
|
|
|
|
|
|
|
|
5 |
library_name: timm
|
6 |
-
|
|
|
7 |
---
|
|
|
8 |
# Model card for wide_resnet50_2.tiatoolbox-pcam
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
tags:
|
3 |
- image-classification
|
4 |
+
- feature-extraction
|
5 |
- timm
|
6 |
+
- biology
|
7 |
+
- cancer
|
8 |
+
- histology
|
9 |
+
- TIA
|
10 |
+
- tiatoolbox
|
11 |
library_name: timm
|
12 |
+
pipeline_tag: image-classification
|
13 |
+
license: cc0-1.0
|
14 |
---
|
15 |
+
|
16 |
# Model card for wide_resnet50_2.tiatoolbox-pcam
|
17 |
+
|
18 |
+
A Wide-ResNet-B image classification model. \
|
19 |
+
Trained by [Tissue Image Analytics (TIA) Centre](https://warwick.ac.uk/fac/cross_fac/tia/) on "pcam" histology patches.
|
20 |
+
|
21 |
+
![](https://raw.githubusercontent.com/TissueImageAnalytics/tiatoolbox/develop/docs/tiatoolbox-logo.png)
|
22 |
+
|
23 |
+
## Model Details
|
24 |
+
|
25 |
+
- **Model Type:** Image classification / Feature backbone
|
26 |
+
- **Model Stats:**
|
27 |
+
- Params (M): 66.9
|
28 |
+
- Image size: 224 x 224 x 3
|
29 |
+
- **Dataset**: [Patch Camelyon (PCam)](https://github.com/basveeling/pcam/)
|
30 |
+
- **Original:** https://github.com/TissueImageAnalytics/tiatoolbox
|
31 |
+
- **License**: [Creative Commons Zero v1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/legalcode)
|
32 |
+
|
33 |
+
## Model Usage
|
34 |
+
|
35 |
+
### Image Classification
|
36 |
+
|
37 |
+
```python
|
38 |
+
from urllib.request import urlopen
|
39 |
+
from PIL import Image
|
40 |
+
import timm
|
41 |
+
|
42 |
+
# get example histology image
|
43 |
+
img = Image.open(
|
44 |
+
urlopen(
|
45 |
+
"https://github.com/owkin/HistoSSLscaling/raw/main/assets/example.tif"
|
46 |
+
)
|
47 |
+
)
|
48 |
+
|
49 |
+
# load model from the hub
|
50 |
+
model = timm.create_model(
|
51 |
+
model_name="hf-hub:1aurent/wide_resnet50_2.tiatoolbox-pcam",
|
52 |
+
pretrained=True,
|
53 |
+
).eval()
|
54 |
+
|
55 |
+
# get model specific transforms (normalization, resize)
|
56 |
+
data_config = timm.data.resolve_model_data_config(model)
|
57 |
+
transforms = timm.data.create_transform(**data_config, is_training=False)
|
58 |
+
|
59 |
+
data = transforms(img).unsqueeze(0) # input is a (batch_size, num_channels, img_size, img_size) shaped tensor
|
60 |
+
output = model(data) # output is a (batch_size, num_features) shaped tensor
|
61 |
+
```
|
62 |
+
|
63 |
+
### Image Embeddings
|
64 |
+
|
65 |
+
```python
|
66 |
+
from urllib.request import urlopen
|
67 |
+
from PIL import Image
|
68 |
+
import timm
|
69 |
+
|
70 |
+
# get example histology image
|
71 |
+
img = Image.open(
|
72 |
+
urlopen(
|
73 |
+
"https://github.com/owkin/HistoSSLscaling/raw/main/assets/example.tif"
|
74 |
+
)
|
75 |
+
)
|
76 |
+
|
77 |
+
# load model from the hub
|
78 |
+
model = timm.create_model(
|
79 |
+
model_name="hf-hub:1aurent/wide_resnet50_2.tiatoolbox-pcam",
|
80 |
+
pretrained=True,
|
81 |
+
num_classes=0,
|
82 |
+
).eval()
|
83 |
+
|
84 |
+
# get model specific transforms (normalization, resize)
|
85 |
+
data_config = timm.data.resolve_model_data_config(model)
|
86 |
+
transforms = timm.data.create_transform(**data_config, is_training=False)
|
87 |
+
|
88 |
+
data = transforms(img).unsqueeze(0) # input is a (batch_size, num_channels, img_size, img_size) shaped tensor
|
89 |
+
output = model(data) # output is a (batch_size, num_features) shaped tensor
|
90 |
+
```
|
91 |
+
|
92 |
+
## Citation
|
93 |
+
|
94 |
+
```bibtex
|
95 |
+
@article{Pocock2022,
|
96 |
+
author = {Pocock, Johnathan and Graham, Simon and Vu, Quoc Dang and Jahanifar, Mostafa and Deshpande, Srijay and Hadjigeorghiou, Giorgos and Shephard, Adam and Bashir, Raja Muhammad Saad and Bilal, Mohsin and Lu, Wenqi and Epstein, David and Minhas, Fayyaz and Rajpoot, Nasir M and Raza, Shan E Ahmed},
|
97 |
+
doi = {10.1038/s43856-022-00186-5},
|
98 |
+
issn = {2730-664X},
|
99 |
+
journal = {Communications Medicine},
|
100 |
+
month = {sep},
|
101 |
+
number = {1},
|
102 |
+
pages = {120},
|
103 |
+
publisher = {Springer US},
|
104 |
+
title = {{TIAToolbox as an end-to-end library for advanced tissue image analytics}},
|
105 |
+
url = {https://www.nature.com/articles/s43856-022-00186-5},
|
106 |
+
volume = {2},
|
107 |
+
year = {2022}
|
108 |
+
}
|
109 |
+
```
|