CytoNucs pretrained models
Pretrained models of CytoNucs: nested instance segmentation with StarDist and prompted mask refinement. Every object of every level (e.g. nuclei and cells) gets an instance mask, and every child object is linked to its parent. Code, training and evaluation: https://github.com/podtyazhki1337/Cyto-Nucs-Stardist-2D-3D
Models
| Folder | Data | Levels (inner first) | Input | Weights file | Test scores (AP inner / AP outer / linked JTPR) |
|---|---|---|---|---|---|
tissuenet_e7_b32 |
TissueNet v1.1 | nucleus, cell | 2D RGB: nuclear stain in green, membrane stain in blue (dataset_prep/tissuenet_to_cytonucs.py) |
weights_best.weights.h5 |
test 0.652 / 0.534 / 0.886; held-out 0.580 / 0.472 / 0.853 |
helacytonuc_e7_clean |
HeLaCytoNuc, cleaned split | nucleus, cell | 2D RGB: cytoplasm in red, nuclei in blue | weights_best.weights.h5 |
hand-drawn test 0.493 / 0.324 / 0.736; CellProfiler test 0.698 / 0.424 / 0.838 |
bbbc020_e7 |
BBBC020 | nucleus, cell | 2D RGB: the collection's merged image <image>_(c1+c5).TIF (CD11b in red, DAPI in blue), native resolution |
weights_best.weights.h5 |
test 0.525 / 0.464 / 0.923 |
kits_e8 |
KiTS23 | mass (tumour or cyst), kidney | 3D CT, HU clipped and resampled to 3 x 0.78 x 0.78 mm (dataset_prep/kits23_to_cytonucs.py) |
weights_best.weights.h5 |
test 0.166 / 0.838 / 0.621 |
h3l_syn |
synthetic three-level volumes | nucleolus, nucleus, cell | 3D RGB (dataset_prep/synthetic/) |
weights_final.weights.h5 |
test 0.171 / 0.539 / 0.596 (nucleolus / nucleus / cell); JTPR nucleolus-nucleus 0.553, nucleus-cell 0.838 |
Partial annotation, synthetic volumes (three levels)
Trained on variants of the synthetic data set whose training annotation is reduced (dataset_prep/sparse_tiles.py;
data: Podtyazhki1337/cytonucs-synthetic). Weights
file weights_final.weights.h5 (epoch 120), quality gates per pair in weights_final.weights.h5.pairs.json. Test scores:
AP nucleolus / nucleus / cell; JTPR nucleolus-nucleus, nucleus-cell.
| Folder | Training annotation | AP | JTPR |
|---|---|---|---|
syn_drop_l3 |
nucleoli in 30 of the 60 training volumes | 0.082 / 0.522 / 0.583 | 0.364, 0.842 |
syn_drop_l3_rerun |
the same, retrained (the nesting-loss arm of the ablation) | 0.066 / 0.477 / 0.578 | 0.368, 0.830 |
syn_drop_l3_nonest |
the same, without the nesting losses | 0.051 / 0.489 / 0.570 | 0.323, 0.828 |
syn_sparse_l3 |
nucleoli in 10 % of the nuclei | 0.036 / 0.516 / 0.585 | 0.363, 0.828 |
syn_drop_l2 |
nuclei in 30 of the 60 training volumes | 0.142 / 0.485 / 0.596 | 0.503, 0.828 |
syn_sparse_l2_l3 |
nucleoli in 25 % of the nuclei, nuclei in 25 % of the cells | 0.050 / 0.494 / 0.560 | 0.393, 0.828 |
h3l_syn_2l: the two-level model (nucleus, cell) on the same synthetic data, weights_best.weights.h5 (epoch 120):
test AP 0.587 / 0.671, JTPR 0.874.
HeLa spheroid (3D, in-house data)
3D RGB volumes of a HeLa spheroid at half XY resolution (Z step about 2.5 XY pixels), nuclei and cells; the volumes
and annotations will be released with the paper. Scores on the two held-out test blocks (evaluate_blocks.py,
StarDist tiling): AP nucleus / AP cell / linked JTPR.
| Folder | Training | Test |
|---|---|---|
e_zaug |
initialised from a synthetic pretraining, 30 % synthetic crops | 0.332 / 0.258 / 0.661 |
p_all |
from scratch, full annotation | 0.263 / 0.228 / 0.571 |
p_k50_s0, p_k20_s0, p_k5_s0 |
nuclei annotated in 50 / 20 / 5 training cells | 0.159 / 0.190 / 0.500; 0.133 / 0.167 / 0.482; 0.077 / 0.254 / 0.357 |
p_two |
nuclei and cells annotated in different blocks | 0.132 / 0.147 / 0.357 |
p_cells_only |
cells only (one level) | cell AP 0.208 |
Scores of the paper (seed 0 of each recipe). Each folder holds the weights, their architecture signature,
geometry.json (ray sets, grids and data settings measured at the start of training) and config.json (the
configuration of the paper's scores: bbbc020_e7 carries the settings calibrated on its validation split; the
helacytonuc_e7_clean settings calibrated after training are in weights_best.weights.h5.inference.json, the
three-level model's quality gates per pair in weights_final.weights.h5.pairs.json).
Usage
git clone https://github.com/podtyazhki1337/Cyto-Nucs-Stardist-2D-3D.git && cd Cyto-Nucs-Stardist-2D-3D
pip install -r requirements.txt
hf download Podtyazhki1337/cytonucs --include "helacytonuc_e7_clean/*" --local-dir models
python predict.py --config models/helacytonuc_e7_clean/config.json \
--weights models/helacytonuc_e7_clean/weights_best.weights.h5 --input my_images/ --output my_labels/
my_labels/<level>/<name> holds the instance labels of every level, my_labels/parents/<stem>.json the parent of
every object of the innermost level. Images are normalised to their 1st / 99.8th percentiles and tiled as needed; they
need the channels and, for 3D, the voxel size the model was trained on (table above).
Licence
The code is MIT-licensed. The weights are released for research use. Models trained on data with a non-commercial
licence inherit its terms: TissueNet (tissuenet_e7_b32, modified Apache 2.0, non-commercial) and KiTS23 (kits_e8,
CC BY-NC-SA 4.0). HeLaCytoNuc is CC BY 4.0 (De et al., RODARE 2024, doi:10.14278/rodare.3001); BBBC020 is from the
Broad Bioimage Benchmark Collection (Ljosa et al., Nature Methods 2012).
Citation
The paper describing CytoNucs is in preparation; a citation will be added here.