Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S2L-CM

Official implementation of S2L-CM: Scribble-supervised nuclei segmentation in histopathology images using contrastive regularization and pixel-level multiple instance learning.

The method has two stages:

  1. Warmup (100 epochs in the paper setup): train the scribble-supervised pixel-MIL model and save the warmup model and pseudo labels.
  2. Main training: initialize from the warmup artifacts and optimize the pixel-level MIL and multi-scale contrastive regularization objectives; best_model.pth is selected on the validation fold.

Installation

conda create -n s2lcm python=3.10 -y
conda activate s2lcm
pip install -r requirements.txt

Data layout

The original images and full masks are not redistributed. Obtain each source dataset according to its license, then arrange a data root as follows (the supplied YAML files use the same convention):

DATA_ROOT/
  images/MoNuSeg/
  labels/MoNuSeg/full/
  labels/MoNuSeg/train.csv
  labels/MoNuSeg/test.csv
  labels/MoNuSeg/scribble_manual/

data/manual_scribbles/monuseg/ contains the manual MoNuSeg scribbles used by the study. Other scribble variants can be generated from full masks using scripts in preprocessing/; generated labels must be placed under the corresponding labels/<dataset>/ directory. The original local locations are intentionally not encoded in this release.

Training

Run from s2l_cm/. --data_root replaces the historical machine-specific /Dataset/examples prefix and --output_root controls all outputs.

cd s2l_cm

# Stage 1: warmup. Saves the warmup checkpoint and pseudo labels.
python Train.py --stage warmup --dataset monu --fold 0 --p_heads 0,4 \
  --data_root /path/to/DATA_ROOT --output_root ../outputs --warmup_id warmup

# Stage 2: main S2L-CM training. Loads the Stage 1 artifacts and saves best_model.pth.
python Train.py --stage main --dataset monu --fold 0 --p_heads 0,4 --lambda_c 0.01 \
  --data_root /path/to/DATA_ROOT --output_root ../outputs --warmup_id warmup \
  --exp_id s2l_cm

Repeat for all folds and report the aggregate evaluation. Dataset settings are in s2l_cm/data_setting/ for MoNuSeg, CPM17, TNBC, and PAIP2023.

The paper MoNuSeg configuration is also provided as executable scripts:

DATA_ROOT=/path/to/DATA_ROOT FOLD=0 DEVICE=0 bash scripts/train_monuseg_warmup.sh
DATA_ROOT=/path/to/DATA_ROOT FOLD=0 DEVICE=0 bash scripts/train_monuseg_main.sh

Parameter count

The number of trainable parameters depends on the encoder and the selected projection heads. Report the exact configuration with:

python tools/count_parameters.py --encoder resnet34 --p-heads 0,4

Preprocessing

preprocessing/ contains the dataset preprocessing and automatic scribble-generation scripts used during development. They retain their dataset-specific input assumptions; update only the input/output arguments for your locally obtained source data. Do not commit source images, full masks, trained models, experiment logs, or generated pseudo labels.

Citation

@article{oh2025s2l,
  title={S2L-CM: Scribble-supervised nuclei segmentation in histopathology images using contrastive regularization and pixel-level multiple instance learning},
  author={Oh, Hyun-Jic and Min, Seonghui and Jeong, Won-Ki},
  journal={Computers in Biology and Medicine},
  volume={192},
  pages={110293},
  year={2025},
  publisher={Elsevier}
}

About

Official implementation of a paper accepted by Computers in Biology and Medicine (CIBM)

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages