TL;DR: VesselFM is a foundation model for universal 3D blood vessel segmentation. It is trained on three heterogeneous data sources: a large, curated annotated dataset, synthetic data generated through domain randomization, and data sampled from a flow matching-based deep generative model. These data sources provide enough diversity to enable vesselFM to achieve exceptional zero-shot blood vessel segmentation, even in completely unseen domains. For details, please refer to our manuscript.
First, set up a conda environment and install dependencies:
conda create -n vesselfm python=3.9
conda activate vesselfm
pip install -e .
To run vesselFM's inference for zero-shot segmentation:
The easiest way is using the command-line interface:
python -m vesselfm.cli --input-folder /path/to/images --output-folder /path/to/output
Or, if you have installed the package:
vesselfm-infer --input-folder /path/to/images --output-folder /path/to/output
Dask Integration for Large Datasets: VesselFM now includes built-in Dask support for parallel processing of large image datasets. Dask provides three types of parallelism:
- Multi-image parallelism (default): Automatically parallelizes loading and preprocessing of multiple images
- Chunk-level parallelism: Splits individual large images into chunks, processes them in parallel, and merges results with Gaussian blending
- Multi-GPU parallelism (new): Distributes chunks across multiple GPUs for accelerated processing of single large images
To control Dask behavior:
# Disable Dask completely (use sequential processing)
python -m vesselfm.cli --input-folder /path/to/images --output-folder /path/to/output --disable-dask
# Specify number of workers (default: auto-detect based on CPU cores)
python -m vesselfm.cli --input-folder /path/to/images --output-folder /path/to/output --dask-workers 4
# Enable chunk-level parallelism for individual images (processes image chunks in parallel)
python -m vesselfm.cli --input-folder /path/to/images --output-folder /path/to/output --enable-dask-chunking
# Disable chunk-level parallelism (use traditional sliding window)
python -m vesselfm.cli --input-folder /path/to/images --output-folder /path/to/output --disable-dask-chunking
# Enable multi-GPU processing (distributes chunks across all available GPUs)
python -m vesselfm.cli --input-folder /path/to/images --output-folder /path/to/output --enable-multi-gpu
# Specify which GPUs to use (e.g., GPUs 0 and 2)
python -m vesselfm.cli --input-folder /path/to/images --output-folder /path/to/output --enable-multi-gpu --gpu-ids 0 2
Note: Chunk-level parallelism is enabled by default in the configuration and is particularly beneficial for very large 3D volumes (>500MB). Multi-GPU processing is especially effective for single large images when multiple GPUs are available.
OME.ZARR Support: VesselFM now supports the OME.ZARR format, a cloud-optimized format for storing large multidimensional imaging data. This format is particularly well-suited for very large images that don't fit in memory. To use OME.ZARR format:
# Process OME.ZARR files (automatically detected by file extension)
python -m vesselfm.cli --input-folder /path/to/zarr/files --output-folder /path/to/output
# The output will also be saved in OME.ZARR format if the input was OME.ZARR
Note: To use OME.ZARR format, install the required dependencies: pip install ome-zarr zarr
For more control, adjust the config file (see #TODO) and run:
python vesselfm/seg/inference.py
Additional information on inference, pre-training, and fine-tuning are available here. Checkpoints will be downloaded automatically and are also available on Hugging Face 🤗.
We also provide individual instructions for generating our three proposed data sources.
If you find our work useful for your research, please cite:
@InProceedings{Wittmann_2025_CVPR,
author = {Wittmann, Bastian and Wattenberg, Yannick and Amiranashvili, Tamaz and Shit, Suprosanna and Menze, Bjoern},
title = {vesselFM: A Foundation Model for Universal 3D Blood Vessel Segmentation},
booktitle = {Proceedings of the Computer Vision and Pattern Recognition Conference (CVPR)},
month = {June},
year = {2025},
pages = {20874-20884}
}Code in this repository is licensed under GNU General Public License v3.0. Model weights are released under Open RAIL++-M License and are restricted to research and non-commercial use only. Model use must comply with potential licenses, regulations, and restrictions arising from the use of named data sets during model training.