1aurent commited on
Commit
4c755f6
1 Parent(s): 8c1def1

Update README.md

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