Cellpose-SAM fine-tuned for bacterial segmentation in mouse colon tissue

Fine-tuned weights for Cellpose-SAM (cpsam) to segment individual bacteria in Zeiss Airyscan confocal images of mouse colon tissue sections.

Model description

The base model (cpsam) was fine-tuned on manually annotated BFP-channel patches from 16-bit TIFF stacks acquired on a Zeiss LSM 900 Airyscan at 100× magnification. Images contain bacteria expressing a BFP constitutive reporter, embedded in colon tissue with fecal autofluorescence.

Key imaging parameters:

  • Pixel size: 0.035 µm/px
  • Expected bacterial diameter: 43 px (1.5 µm)
  • Input channel: BFP (constitutive, used for segmentation only)
  • Stack size: (4, 6323, 6344) uint16

Available model runs

Run Train patches Val patches Cells annotated AP@0.5 base AP@0.5 fine-tuned
4stacks_5x5_norm 75 25 3,913 0.641 0.724
5stacks 35 8 4,641 0.885 0.842
1stack

4stacks_5x5_norm is the recommended model (largest annotated patch set, best AP improvement over base).

How to use

from cellpose import models
import numpy as np

# Load fine-tuned model
model = models.CellposeModel(
    pretrained_model="path/to/models/finetuned/4stacks_5x5_norm/models/cpsam_4stacks_5x5_norm",
    gpu=True
)

# bfp_norm: float32 [0, 1] normalised BFP channel (2D array)
masks, flows, styles = model.predict(
    [bfp_norm],
    diameter=43,        # round(1.5 / 0.035)
    channels=[0, 0],
    normalize=True
)

Important: always normalise the BFP channel before inference (normalize=True or manual p1–p99 stretch). Measure fluorescence intensities from the raw uint16 stack, not the normalised image.

Training details

  • Base model: cpsam (Cellpose-SAM)
  • Epochs: 100
  • Learning rate: 1e-5
  • Weight decay: 0.1
  • Batch size: 1
  • Framework: Cellpose 4.x (train.train_seg)
  • Hardware: NVIDIA GPU (CUDA 12.6)
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support