1aurent commited on
Commit
a860d1b
1 Parent(s): 1d6175d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +104 -1
README.md CHANGED
@@ -1,8 +1,111 @@
1
  ---
2
  tags:
3
  - image-classification
 
4
  - timm
 
 
 
 
 
5
  library_name: timm
6
- license: apache-2.0
 
 
 
7
  ---
 
8
  # Model card for densenet161.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 densenet161.tiatoolbox-pcam
19
+
20
+ A DenseNet 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): 26.7
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 timm
43
+
44
+ # get example histology image
45
+ img = Image.open(
46
+ urlopen(
47
+ "https://github.com/owkin/HistoSSLscaling/raw/main/assets/example.tif"
48
+ )
49
+ )
50
+
51
+ # load model from the hub
52
+ model = timm.create_model(
53
+ model_name="hf-hub:1aurent/densenet161.tiatoolbox-pcam",
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)
60
+
61
+ data = transforms(img).unsqueeze(0) # input is a (batch_size, num_channels, img_size, img_size) shaped tensor
62
+ output = model(data) # output is a (batch_size, num_features) shaped tensor
63
+ ```
64
+
65
+ ### Image Embeddings
66
+
67
+ ```python
68
+ from urllib.request import urlopen
69
+ from PIL import Image
70
+ import timm
71
+
72
+ # get example histology image
73
+ img = Image.open(
74
+ urlopen(
75
+ "https://github.com/owkin/HistoSSLscaling/raw/main/assets/example.tif"
76
+ )
77
+ )
78
+
79
+ # load model from the hub
80
+ model = timm.create_model(
81
+ model_name="hf-hub:1aurent/densenet161.tiatoolbox-pcam",
82
+ pretrained=True,
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)
89
+
90
+ data = transforms(img).unsqueeze(0) # input is a (batch_size, num_channels, img_size, img_size) shaped tensor
91
+ output = model(data) # output is a (batch_size, num_features) shaped tensor
92
+ ```
93
+
94
+ ## Citation
95
+
96
+ ```bibtex
97
+ @article{Pocock2022,
98
+ 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},
99
+ doi = {10.1038/s43856-022-00186-5},
100
+ issn = {2730-664X},
101
+ journal = {Communications Medicine},
102
+ month = {sep},
103
+ number = {1},
104
+ pages = {120},
105
+ publisher = {Springer US},
106
+ title = {{TIAToolbox as an end-to-end library for advanced tissue image analytics}},
107
+ url = {https://www.nature.com/articles/s43856-022-00186-5},
108
+ volume = {2},
109
+ year = {2022}
110
+ }
111
+ ```