Skip to main content

Automatic multiple sclerosis lesion segmentation in MRI using YOLO11-seg

Project description

Python License

🧠💻 YOLO-MSLesSeg: Automatic Multiple Sclerosis Lesion Segmentation with YOLO11-seg

yolo_mslesseg is a Python package that provides a complete pipeline for the automatic segmentation and evaluation of multiple sclerosis lesions in MRI images, using YOLO11-seg models. The system is based on the MSLesSeg Competition (ICPR 2024) dataset, an international benchmark for the validation of automatic methods for multiple sclerosis lesion segmentation.

The package introduces an approach that combines deep learning models with different image enhancement techniques as a preprocessing stage, with the goal of quantifying lesions consistently and reducing the variability associated with manual segmentation.

Table of Contents


Visual Examples

Below are representative examples of the outputs generated by the pipeline. These visualisations allow a direct appreciation of the type of segmentations produced by the model and their anatomical consistency across the different viewing planes. A GIF is also included that traverses all slices of a patient, showing the consistency of predictions across the entire volume.

Segmentation across the three anatomical planes

The following example corresponds to a reference patient (P1) and shows the overlay of the automatic segmentation on the FLAIR image in the axial, coronal, and sagittal planes.

Complete patient sequence

The following animation shows the segmentation generated for another reference patient (P42) across all slices of the volume in the axial plane.


Pipeline Overview

The complete process consists of eight sequential stages, automated via the run_pipeline.py script:

  1. Download and preparation of the official MSLesSeg dataset.
  2. Preprocessing and slice extraction in a format compatible with the YOLO model.
  3. Training of the YOLO11-seg model (optional).
  4. Generation of two-dimensional predictions.
  5. Reconstruction of three-dimensional volumes from predicted slices.
  6. Combination of volumes predicted across different planes (consensus).
  7. Quantitative evaluation using performance metrics.
  8. Computation of global experiment results.

Each module can be executed independently or through the global pipeline, ensuring flexibility for debugging or experimentation.


Installation

Dependencies

  • Python 3.10+
  • numpy, opencv-python, nibabel, matplotlib, ultralytics, requests, tqdm, pyyaml, scipy, scikit-learn, pandas, polars, psutil

Note: PyTorch is required but must be installed separately to allow GPU/CPU variant selection. Follow the official instructions.

User installation

pip install yolo-mslesseg

Repository Structure

The repository is organised as follows:

📦 yolo_mslesseg/
│
├── run_pipeline.py          # Entry point for the full pipeline
├── 📁 configs/              # Per-stage configuration classes
├── 📁 scripts/              # Pipeline stage scripts
├── 📁 utils/                # Utilities and enhancement algorithms
└── 📁 extras/               # Additional utility scripts

Running the Pipeline

Once installed, run the full pipeline with:

yolo_mslesseg --plane axial --modality FLAIR --num_slices P50 --enhancement CLAHE --k_folds 5 --epochs 50 --full

Note: Both yolo_mslesseg and yolo-mslesseg are valid commands.

Note: yolo-mslesseg is a CLI-first package. The recommended way to run experiments is through the command line as shown above. Programmatic use via import is supported for advanced users building custom workflows.

For the full list of arguments and stage-by-stage execution, see the GitHub repository.


References

  • Ultralytics (2025). YOLO11 documentation.
  • Guarnera, F., Rondinella, A., Crispino, E., et al. (2025). MSLesSeg: Baseline and benchmarking of a new Multiple Sclerosis lesion segmentation dataset. Scientific Data, 12, 920. https://doi.org/10.1038/s41597-025-05250-y.

License

This project is licensed under the MIT License.


Citation

If you use this work, please cite it once a reference is available. A citable reference will be added upon publication.

@article{rozenblum2026yolomslesseg,
    author = {Jiménez-Partinen, Ariadna and Rozenblum, Sebastián and
 Pascual-González, Mario and Ordóñez-Walkowiak, María Paulina and
 Guirado-Osorio, Víctor and Molina-Cabello, Miguel A.},
    title = {YOLO-MSLesSeg: Automated Multiple Sclerosis Lesion Segmentation
 in MRI with Image Enhancement Techniques},
    journal = {},
    year = {2026},
    doi = {}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yolo_mslesseg-0.2.1.tar.gz (86.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yolo_mslesseg-0.2.1-py3-none-any.whl (118.2 kB view details)

Uploaded Python 3

File details

Details for the file yolo_mslesseg-0.2.1.tar.gz.

File metadata

  • Download URL: yolo_mslesseg-0.2.1.tar.gz
  • Upload date:
  • Size: 86.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for yolo_mslesseg-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8348cb221155dad461f64c298e2bf0237ba6385bc37659d0b91c0e3efe30b9f6
MD5 b76a11f392535e2ef36f9b883717e499
BLAKE2b-256 35427e44f727fcce0ab9f798d62b3be0d3e7b073fb388aca5e6985ea6aefa2a8

See more details on using hashes here.

File details

Details for the file yolo_mslesseg-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: yolo_mslesseg-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 118.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for yolo_mslesseg-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 696502040e792a78268d92d241baa7c999e59752de8a712dec4a8e1d847216fe
MD5 dbe27f7818a996f9e390b92f0be08619
BLAKE2b-256 90b6696da9ee17e056f65a546ec35a02a9847e39824419efb84211a0bc4de52a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page