Skip to content

Yuxin-Du-Lab/SegVol-for-SegFM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SegVol-for-SegFM

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

Inference Map

segvol pre

Training Map

segvvol train

Get start with source code

Requirements

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

Validation

  1. Download our preliminary checkpoint (2000 epochs ckpt) first and set the ckpt_path var in validation.py. (Trained on 10% dataset and support box prompt only)

  2. 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"
]
  1. Run:
python validation.py

Training

GPU memory requirement for finetuning: 24GB for 4 batch size

  1. Train based on the FM3D10% 2000 epochs SegVol checkpoint: Download our preliminary checkpoint (2000 epochs ckpt) first and set the resume_checkpoint var 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_checkpoint var in train.py.

  2. Download SegFM ALL or 10% trainset, set train_root_path var in train.py.

  3. 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"
]
  1. Run
torchrun --nproc_per_node=N train.py

Evaluation with Docker Image

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors