Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: cellpose
|
| 4 |
+
tags:
|
| 5 |
+
- cellpose
|
| 6 |
+
- cpsam
|
| 7 |
+
- segmentation
|
| 8 |
+
- microscopy
|
| 9 |
+
- toxoplasma
|
| 10 |
+
- spacr
|
| 11 |
+
pipeline_tag: image-segmentation
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Toxoplasma PV v1
|
| 15 |
+
|
| 16 |
+
Cellpose-SAM (`cpsam`) fine-tune that segments **Toxoplasma gondii parasitophorous
|
| 17 |
+
vacuoles (PVs)** in fluorescence microscopy fields.
|
| 18 |
+
|
| 19 |
+
Trained on images of *Toxoplasma* tachyzoite PVs stained with **goat
|
| 20 |
+
anti-Toxoplasma-biotin**, and on *Toxoplasma* tachyzoites **expressing DsRed in
|
| 21 |
+
the PV lumen**.
|
| 22 |
+
|
| 23 |
+
## Use in spaCR
|
| 24 |
+
|
| 25 |
+
Select **Toxoplasma PV v1** as the pathogen model in the Mask module. spaCR
|
| 26 |
+
downloads the checkpoint on first use. Equivalent to passing the checkpoint
|
| 27 |
+
path as `pathogen_model`.
|
| 28 |
+
|
| 29 |
+
```python
|
| 30 |
+
from spacr.core import preprocess_generate_masks
|
| 31 |
+
preprocess_generate_masks({..., "pathogen_model": "<path to cpsam_v2_toxo_r2>"})
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
## Performance
|
| 35 |
+
|
| 36 |
+
Held-out NAS set (n=11 fields, 624 objects), against the stock `cpsam` weights:
|
| 37 |
+
|
| 38 |
+
| metric | vanilla cpsam | this model |
|
| 39 |
+
|---|---:|---:|
|
| 40 |
+
| F1 @ IoU 0.5 | 0.713 | **0.867** |
|
| 41 |
+
| mAP (0.5–0.9) | 0.322 | **0.595** |
|
| 42 |
+
| Aggregated Jaccard | 0.426 | **0.808** |
|
| 43 |
+
|
| 44 |
+
Per-IoU on the round-2 held-out set:
|
| 45 |
+
|
| 46 |
+
| IoU | precision | recall | F1 | AP |
|
| 47 |
+
|---|---:|---:|---:|---:|
|
| 48 |
+
| 0.5 | 0.843 | 0.886 | 0.864 | 0.802 |
|
| 49 |
+
| 0.7 | 0.768 | 0.808 | 0.788 | 0.658 |
|
| 50 |
+
| 0.9 | 0.311 | 0.327 | 0.319 | 0.170 |
|
| 51 |
+
|
| 52 |
+
Round 2 vs round 1 — round 2 bought **generalisation**, not in-domain accuracy:
|
| 53 |
+
|
| 54 |
+
| set | n | round 1 F1 | round 2 F1 | Δ |
|
| 55 |
+
|---|---:|---:|---:|---:|
|
| 56 |
+
| NAS held-out (in-domain) | 11 | 0.8668 | 0.8641 | −0.003 |
|
| 57 |
+
| curated-new (cross-condition) | 40 | 0.8625 | **0.8848** | +0.022 |
|
| 58 |
+
|
| 59 |
+
The in-domain set is 11 fields, so that −0.003 is inside noise. The
|
| 60 |
+
cross-condition gain is the real result (AJI 0.784 → 0.920).
|
| 61 |
+
|
| 62 |
+
## Training
|
| 63 |
+
|
| 64 |
+
115 image/mask pairs (104 train / 11 test), 100 epochs, base `cpsam_v2`.
|
| 65 |
+
|
| 66 |
+
## Limitations
|
| 67 |
+
|
| 68 |
+
Accuracy falls sharply above IoU 0.8 — boundaries are approximate, so this is
|
| 69 |
+
suited to **counting and area** rather than precise morphometry. Trained on the
|
| 70 |
+
two stains named above; other labels are untested.
|