Update README.md
Browse files
README.md
CHANGED
@@ -9,6 +9,7 @@ tags:
|
|
9 |
|
10 |
# Cellpose Nuclei Segmentation Model Trained With High Grade Serous Ovarian Cancer Dataset!
|
11 |
|
|
|
12 |
# Dataset classes
|
13 |
|
14 |
```
|
@@ -21,34 +22,23 @@ nuclei_classes = {
|
|
21 |
5: "macrophage_cytoplasm",
|
22 |
6: "macrophage_nucleus",
|
23 |
}
|
24 |
-
|
25 |
-
tissue_classes = {
|
26 |
-
0: "background",
|
27 |
-
1: "stroma",
|
28 |
-
2: "omentum",
|
29 |
-
3: "tumor",
|
30 |
-
4: "hemorragia",
|
31 |
-
5: "necrosis",
|
32 |
-
6: "serum",
|
33 |
-
}
|
34 |
```
|
35 |
|
36 |
-
# Usage
|
37 |
|
38 |
-
## Install cellseg_models.pytorch and albumentations
|
39 |
```
|
40 |
pip install cellseg-models-pytorch
|
41 |
pip install albumentations
|
42 |
```
|
43 |
|
44 |
-
## Load trained model
|
45 |
```python
|
46 |
from cellseg_models_pytorch.models.cellpose import CellPose
|
47 |
|
48 |
model = CellPose.from_pretrained("csmp-hub/cellpose-histo-hgsc-nuc-v1")
|
49 |
```
|
50 |
|
51 |
-
## Run inference for one image
|
52 |
```python
|
53 |
from albumentations import Resize, Compose
|
54 |
from cellseg_models_pytorch.utils import FileHandler
|
@@ -67,7 +57,7 @@ out = model.post_process(prob)
|
|
67 |
# out = {"nuc": [(nuc instances (H, W), nuc types (H, W))], "cyto": None, "tissue": None}
|
68 |
```
|
69 |
|
70 |
-
## Run inference for image batch
|
71 |
```python
|
72 |
from cellseg_models_pytorch.utils import FileHandler
|
73 |
|
@@ -92,7 +82,7 @@ out = model.post_process(prob)
|
|
92 |
#}
|
93 |
```
|
94 |
|
95 |
-
## Visualize output
|
96 |
```python
|
97 |
from matplotlib import pyplot as plt
|
98 |
from skimage.color import label2rgb
|
@@ -105,6 +95,8 @@ ax[2].imshow(label2rgb(out["nuc"][0][1], bg_label=0)) # type_map
|
|
105 |
|
106 |
## Citation
|
107 |
|
|
|
|
|
108 |
@misc{csmp2022,
|
109 |
title={{cellseg_models.pytorch}: Cell/Nuclei Segmentation Models and Benchmark.},
|
110 |
author={Oskari Lehtonen},
|
@@ -112,7 +104,10 @@ ax[2].imshow(label2rgb(out["nuc"][0][1], bg_label=0)) # type_map
|
|
112 |
doi = {10.5281/zenodo.7064617}
|
113 |
year={2022}
|
114 |
}
|
|
|
115 |
|
|
|
|
|
116 |
@article{Stringer2020,
|
117 |
title = {Cellpose: a generalist algorithm for cellular segmentation},
|
118 |
volume = {18},
|
@@ -127,3 +122,4 @@ ax[2].imshow(label2rgb(out["nuc"][0][1], bg_label=0)) # type_map
|
|
127 |
month = dec,
|
128 |
pages = {100–106}
|
129 |
}
|
|
|
|
9 |
|
10 |
# Cellpose Nuclei Segmentation Model Trained With High Grade Serous Ovarian Cancer Dataset!
|
11 |
|
12 |
+
|
13 |
# Dataset classes
|
14 |
|
15 |
```
|
|
|
22 |
5: "macrophage_cytoplasm",
|
23 |
6: "macrophage_nucleus",
|
24 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
```
|
26 |
|
|
|
27 |
|
28 |
+
## 1. Install cellseg_models.pytorch and albumentations
|
29 |
```
|
30 |
pip install cellseg-models-pytorch
|
31 |
pip install albumentations
|
32 |
```
|
33 |
|
34 |
+
## 2. Load trained model
|
35 |
```python
|
36 |
from cellseg_models_pytorch.models.cellpose import CellPose
|
37 |
|
38 |
model = CellPose.from_pretrained("csmp-hub/cellpose-histo-hgsc-nuc-v1")
|
39 |
```
|
40 |
|
41 |
+
## 3. Run inference for one image
|
42 |
```python
|
43 |
from albumentations import Resize, Compose
|
44 |
from cellseg_models_pytorch.utils import FileHandler
|
|
|
57 |
# out = {"nuc": [(nuc instances (H, W), nuc types (H, W))], "cyto": None, "tissue": None}
|
58 |
```
|
59 |
|
60 |
+
## 3.1 Run inference for image batch
|
61 |
```python
|
62 |
from cellseg_models_pytorch.utils import FileHandler
|
63 |
|
|
|
82 |
#}
|
83 |
```
|
84 |
|
85 |
+
## 4. Visualize output
|
86 |
```python
|
87 |
from matplotlib import pyplot as plt
|
88 |
from skimage.color import label2rgb
|
|
|
95 |
|
96 |
## Citation
|
97 |
|
98 |
+
cellseg_models.pytorch:
|
99 |
+
```
|
100 |
@misc{csmp2022,
|
101 |
title={{cellseg_models.pytorch}: Cell/Nuclei Segmentation Models and Benchmark.},
|
102 |
author={Oskari Lehtonen},
|
|
|
104 |
doi = {10.5281/zenodo.7064617}
|
105 |
year={2022}
|
106 |
}
|
107 |
+
```
|
108 |
|
109 |
+
Cellpose original paper:
|
110 |
+
```
|
111 |
@article{Stringer2020,
|
112 |
title = {Cellpose: a generalist algorithm for cellular segmentation},
|
113 |
volume = {18},
|
|
|
122 |
month = dec,
|
123 |
pages = {100–106}
|
124 |
}
|
125 |
+
```
|