Update README.md
Browse files
README.md
CHANGED
@@ -1,8 +1,113 @@
|
|
1 |
---
|
2 |
tags:
|
3 |
- image-classification
|
|
|
4 |
- timm
|
|
|
|
|
|
|
|
|
|
|
5 |
library_name: timm
|
6 |
-
|
|
|
|
|
|
|
7 |
---
|
|
|
8 |
# Model card for mobilenetv2_100.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 |
+
datasets:
|
15 |
+
- 1aurent/PatchCamelyon
|
16 |
---
|
17 |
+
|
18 |
# Model card for mobilenetv2_100.tiatoolbox-pcam
|
19 |
+
|
20 |
+
A MobileNet-v2 image classification model. \
|
21 |
+
Trained by [Tissue Image Analytics (TIA) Centre](https://warwick.ac.uk/fac/cross_fac/tia/) on "pcam" histology patches.
|
22 |
+
|
23 |
+
![](https://raw.githubusercontent.com/TissueImageAnalytics/tiatoolbox/develop/docs/tiatoolbox-logo.png)
|
24 |
+
|
25 |
+
## Model Details
|
26 |
+
|
27 |
+
- **Model Type:** Image classification / Feature backbone
|
28 |
+
- **Model Stats:**
|
29 |
+
- Params (M): 2.26
|
30 |
+
- Image size: 96 x 96 x 3
|
31 |
+
- **Dataset**: [Patch Camelyon (PCam)](https://github.com/basveeling/pcam/)
|
32 |
+
- **Original:** https://github.com/TissueImageAnalytics/tiatoolbox
|
33 |
+
- **License**: [Creative Commons Zero v1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/legalcode)
|
34 |
+
|
35 |
+
## Model Usage
|
36 |
+
|
37 |
+
### Image Classification
|
38 |
+
|
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
|
46 |
+
img = Image.open(
|
47 |
+
urlopen(
|
48 |
+
"https://github.com/owkin/HistoSSLscaling/raw/main/assets/example.tif"
|
49 |
+
)
|
50 |
+
)
|
51 |
+
|
52 |
+
# load model from the hub
|
53 |
+
model = timm.create_model(
|
54 |
+
model_name="hf-hub:1aurent/mobilenetv2_100.tiatoolbox-pcam",
|
55 |
+
pretrained=True,
|
56 |
+
).eval()
|
57 |
+
|
58 |
+
# get model specific transforms (normalization, resize)
|
59 |
+
data_config = timm.data.resolve_model_data_config(model)
|
60 |
+
transforms = timm.data.create_transform(**data_config, is_training=False)
|
61 |
+
|
62 |
+
data = transforms(img).unsqueeze(0) # input is a (batch_size, num_channels, img_size, img_size) shaped tensor
|
63 |
+
output = model(data) # output is a (batch_size, num_features) shaped tensor
|
64 |
+
```
|
65 |
+
|
66 |
+
### Image Embeddings
|
67 |
+
|
68 |
+
```python
|
69 |
+
from urllib.request import urlopen
|
70 |
+
from PIL import Image
|
71 |
+
import torch.nn as nn
|
72 |
+
import timm
|
73 |
+
|
74 |
+
# get example histology image
|
75 |
+
img = Image.open(
|
76 |
+
urlopen(
|
77 |
+
"https://github.com/owkin/HistoSSLscaling/raw/main/assets/example.tif"
|
78 |
+
)
|
79 |
+
)
|
80 |
+
|
81 |
+
# load model from the hub
|
82 |
+
model = timm.create_model(
|
83 |
+
model_name="hf-hub:1aurent/mobilenetv2_100.tiatoolbox-pcam",
|
84 |
+
pretrained=True,
|
85 |
+
num_classes=0,
|
86 |
+
).eval()
|
87 |
+
|
88 |
+
# get model specific transforms (normalization, resize)
|
89 |
+
data_config = timm.data.resolve_model_data_config(model)
|
90 |
+
transforms = timm.data.create_transform(**data_config, is_training=False)
|
91 |
+
|
92 |
+
data = transforms(img).unsqueeze(0) # input is a (batch_size, num_channels, img_size, img_size) shaped tensor
|
93 |
+
output = model(data) # output is a (batch_size, num_features) shaped tensor
|
94 |
+
```
|
95 |
+
|
96 |
+
## Citation
|
97 |
+
|
98 |
+
```bibtex
|
99 |
+
@article{Pocock2022,
|
100 |
+
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},
|
101 |
+
doi = {10.1038/s43856-022-00186-5},
|
102 |
+
issn = {2730-664X},
|
103 |
+
journal = {Communications Medicine},
|
104 |
+
month = {sep},
|
105 |
+
number = {1},
|
106 |
+
pages = {120},
|
107 |
+
publisher = {Springer US},
|
108 |
+
title = {{TIAToolbox as an end-to-end library for advanced tissue image analytics}},
|
109 |
+
url = {https://www.nature.com/articles/s43856-022-00186-5},
|
110 |
+
volume = {2},
|
111 |
+
year = {2022}
|
112 |
+
}
|
113 |
+
```
|