Brain Tumor Dataset
The Ultralytics Brain Tumor dataset is an object detection dataset of 1,116 medical images (893 for training and 223 for validation) from MRI and CT scans, labeled across 2 classes: negative (no tumor) and positive (tumor present). It lets you train computer vision models to locate brain tumors in scans, supporting early diagnosis and treatment planning in healthcare applications.
Watch: Brain Tumor Detection using Ultralytics Platform with Ultralytics YOLO26 | Object Detection 🚀
Dataset Structure#
The brain tumor dataset contains 1,116 images split into two predefined subsets, defined by the brain-tumor.yaml configuration:
| Split | Images | Annotations |
|---|---|---|
| Train | 893 | Yes |
| Validation | 223 | Yes |
Every image is labeled with one of 2 classes:
negative: images without a brain tumorpositive: images showing a brain tumor
The dataset downloads automatically (4.21 MB) from Ultralytics GitHub assets the first time you train, so no manual setup is required.
Explore Brain Tumor on Ultralytics Platform to browse the images with their annotation overlays, view the class distribution and bounding-box heatmaps in the Charts tab, and clone it to train your own model in the cloud.
Applications#
Brain tumor detection with computer vision enables early diagnosis, treatment planning, and tumor-progression monitoring. By analyzing MRI or CT scans, detection models locate tumors, supporting timely medical intervention and personalized treatment.
Medical professionals can use this technology to:
- Reduce diagnostic time and improve accuracy
- Assist in surgical planning by precisely locating tumors
- Monitor treatment effectiveness over time
- Support research in oncology and neurology
Dataset YAML#
A YAML file defines the dataset configuration, including paths, classes, and other relevant information. For the brain tumor dataset, the brain-tumor.yaml file is maintained at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/brain-tumor.yaml.
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
# Brain-tumor dataset by Ultralytics
# Documentation: https://docs.ultralytics.com/datasets/detect/brain-tumor
# Example usage: yolo train data=brain-tumor.yaml
# parent
# ├── ultralytics
# └── datasets
# └── brain-tumor ← downloads here (4.21 MB)
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: brain-tumor # dataset root dir
train: images/train # train images (relative to 'path') 893 images
val: images/val # val images (relative to 'path') 223 images
# Classes
names:
0: negative
1: positive
# Download script/URL (optional)
download: https://github.com/ultralytics/assets/releases/download/v0.0.0/brain-tumor.zipUsage#
To train a YOLO26n model on the brain tumor dataset for 100 epochs with an image size of 640, use the code snippets below.
from ultralytics import YOLO
# Load a model
model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="brain-tumor.yaml", epochs=100, imgsz=640)from ultralytics import YOLO
# Load a model
model = YOLO("path/to/best.pt") # load a brain-tumor fine-tuned model
# Inference using the model
results = model.predict("https://ultralytics.com/assets/brain-tumor-sample.jpg")Sample Images and Annotations#
The brain tumor dataset contains MRI and CT brain scans with and without tumors. Below is an example image from the dataset with its annotations.

- Mosaiced Image: This training batch shows mosaiced dataset images. Mosaicing combines multiple images into one during training, increasing batch diversity so the model generalizes better across tumor sizes, shapes, and locations for medical image analysis.
Citations and Acknowledgments#
The dataset has been made available under the AGPL-3.0 License.
If you use this dataset in your research or development work, please cite it appropriately:
@dataset{Ultralytics_Brain_Tumor_Dataset_2023,
author = {Ultralytics},
title = {Brain Tumor Detection Dataset},
year = {2023},
publisher = {Ultralytics},
url = {https://docs.ultralytics.com/datasets/detect/brain-tumor}
}FAQ#
The brain tumor dataset contains 1,116 images divided into two subsets: a training set of 893 images and a validation set of 223 images, each with paired annotations. This structured division supports developing robust and accurate computer vision models for detecting brain tumors. For more information, see the Dataset Structure section.
The brain tumor dataset has 2 classes:
negative(images without a brain tumor) andpositive(images showing a brain tumor). This binary labeling lets a detection model both locate a tumor and flag scans where none is present.The brain tumor dataset (4.21 MB) downloads automatically from Ultralytics GitHub assets the first time you train with
data="brain-tumor.yaml"— no manual download is required. You can browse related datasets in the detection datasets overview.You can train a YOLO26 model on the brain tumor dataset for 100 epochs with an image size of 640px using both Python and CLI methods. Below are the examples for both:
Train Examplefrom ultralytics import YOLO # Load a model model = YOLO("yolo26n.pt") # load a pretrained model (recommended for training) # Train the model results = model.train(data="brain-tumor.yaml", epochs=100, imgsz=640)For a detailed list of available arguments, refer to the Training page.
Using the brain tumor dataset in AI projects enables early diagnosis and treatment planning for brain tumors. It helps in automating brain tumor identification through computer vision, facilitating accurate and timely medical interventions, and supporting personalized treatment strategies. It can help improve patient outcomes and clinical efficiency.
Inference using a fine-tuned YOLO26 model can be performed with either Python or CLI approaches. Here are the examples:
Inference Examplefrom ultralytics import YOLO # Load a model model = YOLO("path/to/best.pt") # load a brain-tumor fine-tuned model # Inference using the model results = model.predict("https://ultralytics.com/assets/brain-tumor-sample.jpg")The YAML configuration file for the brain tumor dataset can be found at brain-tumor.yaml. This file includes paths, classes, and additional relevant information necessary for training and evaluating models on this dataset.
Comments11
Ask a question, share your results, or help someone else.
ZoltinZyc
how can i download this datasett??
1
Paula DerrengerUltralytics(edited)Hey there! 😊 The easiest way is to train with
data=brain-tumor.yaml, which downloads the dataset automatically the first time. To download it manually, use:wget https://github.com/ultralytics/assets/releases/download/v0.0.0/brain-tumor.zip unzip brain-tumor.zip -d path/to/destinationReplace
path/to/destinationwith the directory where you'd like the dataset stored. Once you have the dataset, you're all set to start training or inferencing with YOLO models on brain tumor images!Should you need further guidance, feel free to ask. Happy coding! 🚀
G-qingqian
Thank you for your reply. I noticed that in the original dataset, the images in the train folder do have ID prefixes, but the images in the val folder are all prefixed with val1_, making it impossible to distinguish which patient the data belongs to. Therefore, I cannot redivide the dataset. Could you please provide data with complete identifiers? ---- Replied Message ---- FromGlenn @.>Date1/18/2026 @.>@.>, @.>SubjectRe: [ultralytics/ultralytics] zh/datasets/detect/brain-tumor/ (Discussion #9988) The packaged brain-tumor dataset split is provided at the image-folder level and doesn’t ship patient IDs/metadata, so we can’t guarantee a patient-disjoint (no same patient in both train/val) split; if you need patient-wise separation, you’ll need to rebuild the split from patient identifiers and point a custom YAML to *.txt image lists (supported by Ultralytics YOLO), e.g. see the provided config in the Brain Tumor dataset docs and the brain-tumor.yaml in the repo.
my-brain-tumor.yaml path: /data/brain-tumor train: splits/train.txt # one image path per line (ideally grouped by patient ID when you create it) val: splits/val.txt names: 0: negative 1: positive
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
Glenn JocherUltralyticsThe packaged
brain-tumorzip only includes image-level labels with anonymized filenames (no patient IDs/metadata), so we can’t provide “complete identifiers” or guarantee a patient-disjoint re-split; for patient-wise splitting you’ll need to rebuild from a source that includes patient IDs (e.g., your DICOM/NIfTI originals) and then generatetrain.txt/val.txt, and if you just need stronger evaluation without IDs you can use our K-Fold Cross Validation guide—please keep follow-ups here in the GitHub discussion (we can’t provide support over email/DM).
G-qingqian
Can your dataset ensure that the data are independently and identically distributed by patient? That is, there will be no data from the same patient in both the training set and the validation set.
Glenn JocherUltralyticsThe packaged
brain-tumordataset split is provided at the image-folder level and doesn’t ship patient IDs/metadata, so we can’t guarantee a patient-disjoint (no same patient in both train/val) split; if you need patient-wise separation, you’ll need to rebuild the split from patient identifiers and point a custom YAML to*.txtimage lists (supported by Ultralytics YOLO), e.g. see the provided config in the Brain Tumor dataset docs and the brain-tumor.yaml in the repo.# my-brain-tumor.yaml path: /data/brain-tumor train: splits/train.txt # one image path per line (ideally grouped by patient ID when you create it) val: splits/val.txt names: 0: negative 1: positive
pizzas17
How could I download this dataset on COCO format or how could I convert it? (Since I wish to have an EDA on it
xySun17
How can i train the yoloV8 using this dataset without loading the pre-trained weights?
Paula DerrengerUltralytics(edited)@xySun17 hello!
To train YOLO26 without loading the pre-trained weights, you can initialize the model from scratch by specifying the model architecture file (e.g.,
yolo26n.yaml) instead of the pre-trained weights file. Here’s how you can do it:Python
from ultralytics import YOLO # Load a model architecture without pre-trained weights model = YOLO("yolo26n.yaml") # build a new model from YAML # Train the model results = model.train(data="brain-tumor.yaml", epochs=100, imgsz=640)CLI
# Train from scratch using the model architecture file yolo detect train data=brain-tumor.yaml model=yolo26n.yaml epochs=100 imgsz=640This approach ensures that the model starts training with random weights rather than pre-trained ones. If you encounter any issues, please ensure you are using the latest version of the Ultralytics package and provide a minimum reproducible example if the problem persists. You can find more details on creating a reproducible example here.
Feel free to reach out if you have any further questions. Happy training! 🚀
1xySun17
Thank you!! However, there is another problem, that is, why it says the path of dataset is not found? I already downloaded the dataset files and changed the path in "brain-tumor.yaml" file.
The threw error was follows: "Dataset 'brain-tumor.yaml' images not found ⚠️, missing path '/valid/images' Note dataset download directory is '/home/ros/datasets'. You can update this in '/home/ros/.config/Ultralytics/settings.yaml'"
Paula DerrengerUltralytics(edited)Hello @xySun17,
Thank you for reaching out! It looks like the issue might be related to the dataset path configuration in your
brain-tumor.yamlfile. Here are a few steps to troubleshoot and resolve this:-
Verify Dataset Path: Ensure that the paths specified in your
brain-tumor.yamlfile correctly point to the locations of your dataset images. For example:path: /home/ros/datasets/brain-tumor train: images/train val: images/val -
Check Directory Structure: Confirm that the directory structure matches what is specified in the YAML file. The
images/trainandimages/valdirectories should exist within/home/ros/datasets/brain-tumor. -
Update Configuration: If the dataset is located in a different directory, update the
pathin the YAML file accordingly. For instance, if your dataset is in/home/ros/my-datasets/brain-tumor, update thepathto:path: /home/ros/my-datasets/brain-tumor -
Reproducible Example: If the issue persists, providing a minimum reproducible example can greatly help in diagnosing the problem. You can find guidance on creating a reproducible example here.
-
Latest Version: Ensure you are using the latest version of the Ultralytics package. You can update it using:
pip install --upgrade ultralytics
Here’s an example of how your
brain-tumor.yamlshould look:# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license # Brain-tumor dataset by Ultralytics # Documentation: https://docs.ultralytics.com/datasets/detect/brain-tumor/ # Example usage: yolo train data=brain-tumor.yaml path: /home/ros/datasets/brain-tumor # dataset root dir train: images/train # train images (relative to 'path') val: images/val # val images (relative to 'path') # Classes names: 0: negative 1: positive # Download script/URL (optional) download: https://github.com/ultralytics/assets/releases/download/v0.0.0/brain-tumor.zipIf you follow these steps and still encounter issues, please share more details or any error messages you receive. This will help us assist you better.
Best regards and happy coding! 🚀
-



