Downloads · 30 days
0
einarolafsson/toxoplasma-from-hoechst-cpsam
toxoplasma-from-hoechst-cpsam is a image segmentation model from einarolafsson. Use it for the image segmentation task on the model card, and read the license before you ship it in a product. It is set up for spacr. The card lists the license as mit.
Segments Toxoplasma gondii parasitophorous vacuoles from the Hoechst (nuclear) channel alone — no parasite-specific stain required. A cross-channel model: it is given the nuclear image and predicts where the parasites…
Downloads · 30 days
0
Access
Public
Updated Sep 19, 2026
Repo size
1.2 GB
Likes
0
Public
Click a slice to open those files.
Other1.2 GB · 100%
From the Hugging Face model README
Segments Toxoplasma gondii parasitophorous vacuoles from the Hoechst (nuclear) channel alone — no parasite-specific stain required. A cross-channel model: it is given the nuclear image and predicts where the parasites are.
toxoplasma_from_hoechst_v1toxoplasma_from_hoechst_pvThis model is distributed through the spaCR Model Zoo. spaCR is an open-source package for spatial phenotype analysis of CRISPR screens and microscopy images.
pip install spacr
Launch the GUI and open the Model Zoo:
spacr
Find Toxoplasma from Hoechst (cross-channel) in the model list and press Download. The Model Zoo verifies the checkpoint's SHA-256 after download, so a truncated or substituted file is rejected rather than silently used.
from spacr import model_zoo
entry = next(e for e in model_zoo.catalogue() if e.key == "toxoplasma_from_hoechst_v1")
path = model_zoo.install(entry, dest="~/spacr_models")
print(path) # verified local checkpoint
Point spaCR's mask generation at the downloaded checkpoint:
from spacr.core import preprocess_generate_masks
settings = {
"src": "/path/to/images",
"pathogen": "cellpose",
"pathogen_model": str(path), # the checkpoint fetched above
"pathogen_diameter": 12,
}
preprocess_generate_masks(settings)
In the GUI the same thing is under Make masks — choose the downloaded model in the Cellpose model field for the relevant object.
API: :func:spacr.core.preprocess_generate_masks,
:func:spacr.spacr_cellpose.generate_masks_from_imgs
| model | train | train obj. | test | test obj. | CV | F1 @ IoU 0.5 | AJI | Dice | final train loss | final val loss | val - train | best epoch |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| stock cpsam_v2 (no fine-tuning) | — | — | 463 | 6116 | — | 0.0023 | 0.0063 | 0.0159 | — | — | — | — |
| this model | 2567 | not recorded | 463 | 6116 | no (single well-grouped split) | 0.5689 | 0.4213 | 0.5464 | 0.0096 | 0.0111 | +0.0015 | 50 / 100 |
Scored on a well-grouped held-out split of 463 fields never seen in training (no well appears in both train and test), including fields with no parasites, so false positives are counted. That is a 252x improvement in F1 over stock.
Per host cell line (held-out):
| host | n | F1 | AJI |
|---|---|---|---|
| HFF | 159 | 0.5280 | 0.4576 |
| HeLa | 151 | 0.6803 | 0.5356 |
| THP1 | 153 | 0.4053 | 0.2707 |
Checkpoint scores: ep10 0.4962, ep20 0.4261, ep30 0.4342, ep40 0.3940, ep50 0.5689, ep60 0.5499, ep70 0.5609, ep80 0.5631, ep90 0.5593, ep100 0.5594.

Loss is on a log scale. Train and validation tracking each other is the overfitting check: a validation curve that turns up while train keeps falling is the signature to look for.
Objects are reference (ground-truth) objects. Training-set object counts were not recorded at training time; the held-out counts come from the scoring bundle.
Predicting parasites from Hoechst is the harder cross-channel direction — stock Cellpose-SAM scores only 0.0023 here. Compare with Toxoplasma from Cell Mask, the same task driven from the host cell mask.
2567 training fields and 463 held-out fields, split by well
(training/split_by_well.csv) so no well leaks across the split. Targets are PV-regenerated
masks (masks_pv). Hosts: HFF, HeLa and THP1.
Trained for 100 epochs from stock cpsam_v2, AdamW, lr 1e-05,
weight decay 0.1, batch 1.
| path | what |
|---|---|
toxoplasma_from_hoechst_pv | the checkpoint |
training/epoch_history.csv | per-epoch losses + pixel metrics |
training/loss_per_epoch.csv | slim loss view |
training/run_config.json | exact hyperparameters, versions, GPU |
training/split_by_well.csv | the well-grouped split |
training/training_curves.png | loss and checkpoint-metric curves |
evaluation/report.json | full scorecard, all checkpoints, per host |
evaluation/metrics.csv | F1/AJI/Dice per checkpoint and per host |
evaluation/best_perimage.csv | per-image scores for the best checkpoint |
evaluation/comparison_vs_stock_summary.csv | this model vs stock cpsam_v2 |
evaluation/stock_cpsam_v2_summary.csv | the stock baseline |
spacr.model_zoo — catalogue(), install(), fetch(), verify()spacr.core.preprocess_generate_masks