kaczmarj commited on
Commit
691b3d8
·
verified ·
1 Parent(s): 6678899

Upload 4 files

Browse files
Files changed (4) hide show
  1. README.md +47 -0
  2. model.onnx +3 -0
  3. model.safetensors +3 -0
  4. torchscript_model.pt +3 -0
README.md CHANGED
@@ -1,3 +1,50 @@
1
  ---
2
  license: cc-by-4.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: cc-by-4.0
3
  ---
4
+ # Metastasis classification (CAMELYON16)
5
+
6
+ This model classifies an H&E-stained digital pathology image of axillary lymph nodes as not containing metastasis or containing metastasis. It was trained by Jakub Kaczmarzyk.
7
+
8
+ Inputs: Bag of patches with 128um edge length, embedded with CTransPath.
9
+
10
+ Output classes: no-metastasis, metastasis
11
+
12
+ ## Data
13
+
14
+ CAMELYON16 was used to train the model. The whole slide images were tiled into 128x128um patches, and each patch was encoded using CTransPath (this produces 768-dimensional embeddings).
15
+
16
+ Train and validation splits were stratified by metastasis status. The test set is pre-defined in the CAMELYON16 dataset.
17
+
18
+ Samples sizes:
19
+ - Train: 243 slides
20
+ - Validation: 27 slides
21
+ - Test: 129 slides
22
+
23
+ ## Reusing this model
24
+
25
+ To use this model on the command line, see [WSInfer-MIL](https://github.com/kaczmarj/wsinfer-mil).
26
+
27
+ Alternatively, you may use PyTorch on ONNX to run the model. First, embed 128um x 128um patches using CTransPath. Then pass the bag of embeddings to the model.
28
+
29
+ ```python
30
+ import onnxruntime as ort
31
+ import numpy as np
32
+ embedding = np.ones((1_000, 768), dtype="float32")
33
+ ort_sess = ort.InferenceSession("model.onnx")
34
+ logits, attention = ort_sess.run(["logits", "attention"], {'input': embedding})
35
+ ```
36
+
37
+ ## Model performance
38
+
39
+ The model achieves an AUC of 0.91 in the test set of CAMELYON16. Below, please find a confusion matrix, where predicted classes are columns, and true values are rows.
40
+
41
+ | | No-Met | Met |
42
+ |--------|--------|-----|
43
+ | No-Met | 77 | 3 |
44
+ | Met | 12 | 37 |
45
+
46
+ # Intended uses
47
+
48
+ This model is ONLY intended for research purposes.
49
+
50
+ **This model may not be used for clinical purposes.** This model is distributed without warranties, either express or implied.
model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:601b12b18bc89defb9dca1529b34fd756202ead2c493e5c02880050492fe1071
3
+ size 1319403
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:46c8d091f7fee4b01d6a1330874507e5e3eb80a2a82dcab8c2f967532d694d20
3
+ size 1317820
torchscript_model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b3e58653c39af79b5d2111ca1661c2c7e9bd12656ef8a11f1319a8aceaddac9c
3
+ size 1338936