🧠💻 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
- Pipeline overview
- Installation
- Repository structure
- Running the pipeline
- References
- License
- Citation
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:
- Download and preparation of the official MSLesSeg dataset.
- Preprocessing and slice extraction in a format compatible with the YOLO model.
- Training of the YOLO11-seg model (optional).
- Generation of two-dimensional predictions.
- Reconstruction of three-dimensional volumes from predicted slices.
- Combination of volumes predicted across different planes (consensus).
- Quantitative evaluation using performance metrics.
- 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_mslessegandyolo-mslessegare valid commands.
Note:
yolo-mslessegis a CLI-first package. The recommended way to run experiments is through the command line as shown above. Programmatic use viaimportis 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 in your research, please cite:
@inproceedings{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},
booktitle = {Soft Computing Models in Industrial and Environmental Applications},
series = {Communications in Computer and Information Science},
volume = {3046},
pages = {574--585},
publisher = {Springer, Cham},
year = {2026},
doi = {10.1007/978-3-032-29254-4_46}
}
Metadata
Release files for yolo-mslesseg 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| yolo_mslesseg-0.2.2.tar.gz | 86.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yolo_mslesseg-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 204.8 kB
Release files / yolo_mslesseg-0.2.2.tar.gz
| Download URL | yolo_mslesseg-0.2.2.tar.gz |
|---|---|
| Size | 86.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
111c11dfd44c920774731a20301671cab25dbfd086efe4caf136e684441db727
|
|
BLAKE2b-256 checksum How to use checksums |
e0263b275358731f8435b12f09f2d56f3401d8e76803f97c2801971c3a89cf8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / yolo_mslesseg-0.2.2-py3-none-any.whl
| Download URL | yolo_mslesseg-0.2.2-py3-none-any.whl |
|---|---|
| Size | 118.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3be3fd39960899d8bf850fb572a3e600dd9c4454cce7193642cddcac11c891e4
|
|
BLAKE2b-256 checksum How to use checksums |
61c55475a60524f0f247dc3cc61b3fbc44ba3c86199a86dfd7b99bf54394f72a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|