Diffusion-based-Segmentation  by JuliaWolleb

PyTorch code for diffusion-based medical image segmentation

created 3 years ago
300 stars

Top 89.7% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides the official PyTorch implementation for "Diffusion Models for Implicit Image Segmentation Ensembles," a novel semantic segmentation method for medical images. It targets researchers and practitioners in medical imaging and computer vision seeking advanced segmentation techniques with built-in uncertainty quantification. The primary benefit is improved segmentation performance through implicit ensembling and detailed pixel-wise uncertainty maps.

How It Works

The method adapts diffusion models for image segmentation by conditioning the diffusion process on the input image. During training, the ground truth segmentation is used, with the image acting as a prior. In the sampling process, the image prior is applied at each step, enabling the generation of a distribution of segmentation masks. This stochasticity allows for the creation of uncertainty maps and an implicit ensemble of segmentations, enhancing overall accuracy.

Quick Start & Requirements

  • Install: pip install -r requirements.txt (specific requirements not detailed in README).
  • Data Format: Requires NIfTI (.nii.gz) files organized by slice, with segmentation masks as the last channel. A mini-example is provided.
  • Dependencies: PyTorch, Visdom (for visualization). CUDA is implied for PyTorch.
  • Training: python3 scripts/segmentation_train.py --data_dir ./data/training $TRAIN_FLAGS $MODEL_FLAGS $DIFFUSION_FLAGS
  • Sampling: python scripts/segmentation_sample.py --data_dir ./data/testing --model_path ./results/savedmodel.pt --num_ensemble=5 $MODEL_FLAGS $DIFFUSION_FLAGS
  • Resources: Training and sampling likely require significant GPU resources and time, typical for diffusion models.

Highlighted Details

  • Leverages diffusion models for implicit image segmentation.
  • Generates pixel-wise uncertainty maps.
  • Evaluated on the BRATS2020 dataset for brain tumor segmentation.
  • Achieves good segmentation results compared to state-of-the-art models.

Maintenance & Community

  • The project is associated with the authors of the cited paper.
  • No specific community channels (Discord, Slack) or roadmap are mentioned.

Licensing & Compatibility

  • The README does not explicitly state a license. The code is presented as the "official PyTorch implementation."

Limitations & Caveats

  • The README does not detail specific hardware requirements (e.g., GPU memory, CUDA version) or provide a comprehensive list of dependencies beyond mentioning PyTorch and Visdom.
  • The data loading script is specific to the BRATS2020 dataset structure, requiring adaptation for other datasets.
Health Check
Last commit

2 years ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
4 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.