This guide allows you to reproduce the experiments used to verify that BiaPy's instance-segmentation representations (e.g., CellPose, StarDist, HoVer-Net) behave identically to their original implementations. These experiments use the DSB2018 dataset (2D nuclei).
Available Sanity Checks
| Sanity check | Configuration file | Representation (PROBLEM.INSTANCE_SEG.DATA_CHANNELS) |
|---|
cellpose | sanity_cellpose.yaml | ['F', 'Gh', 'Gv'] (foreground + CellPose flows) |
omnipose | sanity_omnipose.yaml | ['Db', 'Gh', 'Gv'] (Omnipose distance + flows) |
stardist | sanity_stardist.yaml | ['Db', 'R'] (object probability + star-convex distances) |
embedseg | sanity_embedseg.yaml | ['E_offset', 'E_sigma', 'E_seediness'] (EmbedSeg) |
hovernet | sanity_hovernet.yaml | ['F', 'H', 'V'] (HoVer-Net horizontal/vertical maps) |
Prerequisites
- BiaPy Repository: A clone of the BiaPy repository is required as the script
run_sanity_experiments.py locates main.py automatically. - Environment: The BiaPy environment must be installed and activated.
- Hardware: A GPU is strongly recommended. You can fall back to CPU using
--gpu "", but training is not practical on CPU. - Data: Download the DSB2018 dataset and checkpoints from Zenodo (10.5281/zenodo.21649394).
Data Layout Requirements
DSB2018 Dataset Structure:
dsb2018/
├── train/
│ ├── images/ # raw images
│ └── masks/ # instance labels
└── test/
├── images/
└── masks/
Checkpoints Structure:
All checkpoints must be in a single directory (or subdirectories) and filenames must contain the experiment job name (e.g., sanity_cellpose-checkpoint-best.pth).
checkpoints/
├── sanity_cellpose-checkpoint-best.pth
├── sanity_embedseg-checkpoint-best.pth
├── sanity_hovernet-checkpoint-best.pth
├── sanity_omnipose-checkpoint-best.pth
└── sanity_stardist-checkpoint-best.pth
conda activate BiaPy_env
# Run only inference for a specific experiment
python run_sanity_experiments.py \
--experiment cellpose \
--output_dir /path/to/output \
--checkpoint_dir /path/to/checkpoints \
--data_dir /path/to/dsb2018