This repo is the SegFM version of SegVol for SegFM. SegFM is CVPR 2025: Foundation Models for Interactive 3D Biomedical Image Segmentation.
Origin repo of SegVol: https://github.com/BAAI-DCAI/SegVol
CVPR Descriptive Video: CVPR25SegFM Webinar: 05 SegVol | Yuxin Du
The pytorch v1.13.1 (or a higher version) is needed first. Following install key requirements using commands:
pip install 'monai[all]==0.9.0'
pip install einops==0.6.1
pip install transformers==4.18.0
OR
conda env create -f environment.yml
-
Download our preliminary checkpoint (2000 epochs ckpt) first and set the
ckpt_pathvar in validation.py. (Trained on 10% dataset and support box prompt only) -
Download SegFM validation set and build val_samples.json file to index validation npz files like this:
[
"/path/to/xxx.npz",
"/path/to/yyy.npz"
]
- Run:
python validation.py
-
Train based on the FM3D10% 2000 epochs SegVol checkpoint: Download our preliminary checkpoint (2000 epochs ckpt) first and set the
resume_checkpointvar in train.py. (Trained on 10% dataset and support box prompt only)OR
Train based on original SegVol checkpoint: Download the original checkpoint first and set the
resume_checkpointvar in train.py. -
Download SegFM ALL or 10% trainset, set
train_root_pathvar in train.py. -
Download SegFM validation set and build val_samples.json file to index validation npz files like this:
(Sampling to reduce the val duration)
[
"/path/to/xxx.npz",
"/path/to/yyy.npz"
]
- Run
torchrun --nproc_per_node=N train.py
Download and load the docker image (FM3D10% 2000 epochs SegVol) passwd:fm3d, place all test cts.npz in inputs, and run the command:
docker container run --gpus "device=0" -m 8G --name segvol --rm -v $PWD/inputs/:/workspace/inputs/ -v $PWD/outputs/:/workspace/outputs/ segvol:lastest
The prediction results will be saved in outputs

