CoolFace
Modelpublic

einarolafsson/live-cell-segmentation-cpsam

sourceHugging Facecc-by-nc-4.0updated 1d agoView on Hugging Face
0likes
Model Card

Light-microscopy cell segmentation (Cellpose-SAM fine-tune, epoch 37)

Cellpose-SAM cpsam_v2 fine-tuned on transmitted-light microscopy -- phase contrast, brightfield, DIC and quantitative phase -- from 14 public datasets. Built for spaCR.

Read this first

It does not beat stock cpsam_v2 overall, and it missed the bar set before it was scored.

stock cpsam_v2this model
test F1 @ IoU 0.5, all 2,199 fields0.7380.694-0.044
test F1, only datasets stock was not trained on0.8850.960+0.075

Both are true because of LIVECell: it is 1020 of the 2,199 test fields and the densest by far, so it dominates the pooled score -- and it is the one large dataset stock Cellpose-SAM was itself trained on (5% of its samples, per the Cellpose-SAM paper's Methods; see training/WHAT_STOCK_CPSAM_HAS_SEEN.md). Stock's LIVECell score is partly memorisation, and this model loses 0.053 there.

Use it for brightfield, DIC, quantitative phase, and phase contrast from instruments other than the Incucyte. Do not use it in place of stock on LIVECell-style Incucyte phase contrast, where stock is better.

The pre-registered bar, and the result

Fixed at 11:47 on 2026-09-21, before any test score existed (training/PROMOTION_BAR.md): overall F1 +0.02 over stock; no modality losing more than 0.02; no dataset losing more than 0.05. All three were missed -- overall -0.044, phase -0.046, LIVECell -0.053. Published anyway, as the bar said it would be.

Test set, by modality

modalityfieldsstockthis modeldelta
brightfield2880.9120.964+0.051
dic230.6410.667+0.026
phase18880.7350.689-0.046
ALL21990.7380.694-0.044

Test set, by dataset

datasetfieldsstockthis modeldeltastock trained on it?
bbbc009_dic20.3700.397+0.026
bbbc030_dic120.8720.913+0.042
ctcbfhsc_brightfield80.9361.000+0.064
ctcbfmusc_brightfield500.7520.802+0.050
ctcdichela90.9230.950+0.027
ctcphcpsc20.8730.883+0.010
ctcphcu373150.9480.935-0.013
deepsea_phase7400.9130.980+0.067
livecell_phase10200.7240.671-0.053yes
qpiphaseadherent310.7140.837+0.124
revvity_brightfield220.0000.799+0.799
yeastmicrostructuresbrightfield1480.9840.993+0.009
yeaz_brightfield600.9950.995-0.000yes
yeaz_phase800.9860.988+0.001yes

Revvity is not a real +0.80. Stock scores 0.000 on all 22 Revvity fields, which are the only RGB images in the set; stock almost certainly mishandles the three-channel input. Both models were given identical input, but that row should not be read as a finding.

Train, valid and test

splitfields scoredF1 @ 0.5
train (a 1,000-field sample spread across every source)10000.865
valid20300.696
test21990.694

The train figure is higher, but the samples differ in make-up -- valid and test are about half LIVECell, the train sample is spread evenly -- so the gap is not purely overfitting.

There is no per-epoch loss curve. The trainer writes losses when a run ends and neither run ended: the first was stopped at epoch 30 to free the GPU, the second was ended by a machine reboot. Epoch 37 is the last checkpoint written. This is stated rather than reconstructed.

Data

einarolafsson/live-cell-segmentation-dataset -- 11,007 fields, 6,778 train / 2,030 valid / 2,199 test, split by acquisition so no well, dish or time-lapse spans two sets.

Contents

  • weights/live_cell_v1 -- epoch-37 weights
  • training/ -- splits, manifest, run records, the pre-registered bar and its addenda
  • qc/ -- per-field test scores for this model and stock, side-by-side by dataset and modality

Use with spaCR

python
from huggingface_hub import hf_hub_download
from spacr.core import preprocess_generate_masks
w = hf_hub_download("einarolafsson/live-cell-segmentation-cpsam", "weights/live_cell_v1")
preprocess_generate_masks({"src": "/path/to/plate", "custom_model": w})

Recipe: base cpsam_v2, lr 1e-5, batch 4, bsize 256, mintrainmasks 1, weight decay 0.1, cellpose 4.2.1.1, RTX 3090. Non-commercial: LIVECell and Revvity-25 are CC BY-NC.