Toxoplasma PV segmentation β round 6 (Cellpose-SAM)
Segments Toxoplasma gondii parasitophorous vacuoles. Round 6 retrains round 5 on the same 556 curated fields with cellpose 4.2.1.1, now with a held-out validation set (per-epoch validation loss and accuracy) and a separate test set. Built for spaCR.
Data
| set | fields | objects | role |
|---|---|---|---|
| train | 437 | 15550 | fitted |
| validation | 108 | 8959 | per-epoch validation; one source-grouped CV fold |
| test | 11 | 683 | the 11 fixed NAS anchor wells, never trained on, used every round since r1 |
Per-field assignment: training/split.csv.
Results β test set (11 anchor wells)
| model | F1 @ IoU 0.5 | precision | recall | mAP | AJI | Dice |
|---|---|---|---|---|---|---|
| stock cpsam_v2 | 0.7648 | 0.7539 | 0.776 | 0.362 | 0.505 | 0.6431 |
| r6 | 0.8602 | 0.8468 | 0.8741 | 0.5061 | 0.8026 | 0.9059 |
Validation fold (r6): F1 0.8237, AJI 0.7927, Dice 0.8936.
5-fold cross-validation (same data, grouped by source): F1 0.8168 Β± 0.028,
AJI 0.7516, Dice 0.8424. Per-fold, per-image results and per-epoch histories
are in cv/.
Training: 100 epochs; best validation loss 0.08639681519438185 at epoch 20; final train loss 0.0461, final validation loss 0.12872041770909468.
Contents
weights/cpsam_v2_toxo_r6β final weightstraining/epoch_history.csvβ per-epoch train and validation loss, pixel accuracy, Dice, IoU, MCCtraining/split.csv,training/training_curves.png,training/report.jsonqc/β per-image metrics for r6 and stock (*_perimage.csv),summary.json,comparison_vs_stock.csvcv/β 5-fold CV: aggregate, per-fold per-image and per-IoU metrics, per-epoch histories
Pixel accuracy is foreground classification on the training crops; F1/AJI/Dice above are the segmentation-quality numbers.
Environment
| cellpose | 4.2.1.1 |
| torch | 2.10.0+cu128 |
| GPU | NVIDIA GeForce RTX 3090 Ti |
| base weights | cpsam_v2 |
Use with spaCR
pip install spacr # or: conda install -c conda-forge spacr
from huggingface_hub import hf_hub_download
from spacr.core import preprocess_generate_masks
w = hf_hub_download("einarolafsson/toxoplasma-pv-segmentation-cpsam-r6", "weights/cpsam_v2_toxo_r6")
preprocess_generate_masks({"src": "/path/to/plate", "pathogen_channel": 2, "custom_model": w})
Source: https://github.com/EinarOlafsson/spacr Β· PyPI Β· conda-forge Β· Training data: einarolafsson/toxoplasma-pv-segmentation-dataset