SemiSAM-O1: Semi-Supervised 3D Medical Image Segmentation with Only One Labeled Template

May 6, 2026 ยท View on GitHub

The official repo of "SemiSAM-O1: How far can we push the boundary of annotation-efficient medical image segmentation?".

image

๐Ÿ‘€ Overview

SemiSAM-O1 is an annotation-efficient semi-supervised medical image segmentation framework that learns from only one labeled volume. Instead of relying on repeated interaction with foundation models during training, SemiSAM-O1 uses the foundation model once offline as a feature extractor, propagates annotation via prototype similarity, and teratively improves pseudo-labels with uncertainty-guided refinement.

  • ๐Ÿš€ Strong performance under extreme low-label setting
  • โšก๏ธ Significantly reduced training cost
  • ๐Ÿ”„ A self-improving training loop

๐Ÿงฉ Method

image

๐Ÿ”ง Usage

Requirements

  • Python 3.10+
  • PyTorch 2.0+
  • SAM-Med3D-turbo checkpoint (pretrained_ckpt/sam_med3d_turbo.pth)
  • Dependencies: h5py, tensorboardX, SimpleITK, medpy, tqdm, scipy, scikit-image

Data Preparation

Organize data in HDF5 format under data/<dataset>/:

data/<dataset>/
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ sample1.h5    # keys: 'image' (3D float), 'label' (3D uint8)
โ”‚   โ”œโ”€โ”€ sample2.h5
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ train.txt         # one sample name per line (without .h5 extension)
โ”œโ”€โ”€ val.txt
โ””โ”€โ”€ test.txt

Training

All commands run from code/ directory. Requires sam_med3d_turbo.pth in pretrained_ckpt/ (download from SAM-Med3D).

cd code
# LA dataset, 3 rounds

# Mean Teacher (MT) 
python train_SemiSAM_O1.py \
    --root_path ../data/LA \
    --exp SemiSAM_O1/LA \
    --backbone mt \
    --max_iterations 15000 \
    --num_rounds 3 \
    --sam_ckpt pretrained_ckpt/sam_med3d_turbo.pth \
    --seed 1337

# Uncertainty-Aware Mean Teacher (UAMT)
python train_SemiSAM_O1.py \
    --root_path ../data/LA \
    --exp SemiSAM_O1/LA \
    --backbone uamt \
    --max_iterations 15000 \
    --num_rounds 3 \
    --sam_ckpt pretrained_ckpt/sam_med3d_turbo.pth \
    --seed 1337

# Deep Adversarial Network (DAN)
python train_SemiSAM_O1.py \
    --root_path ../data/LA \
    --exp SemiSAM_O1/LA \
    --backbone dan \
    --max_iterations 15000 \
    --num_rounds 3 \
    --sam_ckpt pretrained_ckpt/sam_med3d_turbo.pth \
    --seed 1337

# Dual-Task Consistency (DTC) โ€” automatically uses unet_3D_sdf
python train_SemiSAM_O1.py \
    --root_path ../data/LA \
    --exp SemiSAM_O1/LA \
    --backbone dtc \
    --max_iterations 15000 \
    --num_rounds 3 \
    --sam_ckpt pretrained_ckpt/sam_med3d_turbo.pth \
    --seed 1337

Models are saved to ../model/{exp}_{BACKBONE}_1label_1/{model}/.

Key Arguments

ArgumentDefaultDescription
--backboneuamtSSL backbone: mt, uamt, dan, dtc
--max_iterations15000Training iterations per round
--num_rounds3Number of iterative refinement rounds
--labeled_num1Number of labeled samples
--knn_k5K for KNN pseudo-label refinement
--uncertainty_quantile0.9Uncertainty threshold for KNN refinement
--num_classes2Number of segmentation classes
--sam_ckptpretrained_ckpt/sam_med3d_turbo.pthSAM-Med3D checkpoint

Testing

Pretrained weights are already placed in model/ directory. Run from code/:

cd code

python test_baseline.py --root_path ../data/LA --exp LA_O1/MT --model unet_3D --num_classes 2
python test_baseline.py --root_path ../data/LA --exp LA_O1/UAMT --model unet_3D --num_classes 2
python test_baseline.py --root_path ../data/LA --exp LA_O1/DAN --model unet_3D --num_classes 2
python test_baseline.py --root_path ../data/LA --exp LA_O1/DTC --model unet_3D_sdf --num_classes 2

To save predictions as NIfTI, add --save_pred output_dir/.

Metrics reported: Dice, Jaccard, 95% Hausdorff Distance (95HD), Average Surface Distance (ASD).

๐Ÿ–‹๏ธ Citation

@article{zhang2026semisam-o1,
  title={SemiSAM-O1: How far can we push the boundary of annotation-efficient medical image segmentation?},
  author={Zhang, Yichi and Xue, Le and Xu, Bichun and Luo, Judong and Wu, Zhigang and Fu, Yu and Hu, Zixin and Cheng, Yuan and Qi, Yuan},
  journal={arXiv preprint arXiv:2604.24109},
  year={2026}
}