Ultralytics YOLO27: 加入候补名单。
开始使用

脑肿瘤数据集#

Open Brain Tumor Dataset In Colab

Ultralytics 脑肿瘤数据集是一个目标检测数据集,包含 1,116 张来自 MRI 和 CT 扫描的医学图像(893 张用于训练,223 张用于验证),分为 2 个类别:negative(无肿瘤)和 positive(有肿瘤)。你可以使用该数据集训练计算机视觉模型,在扫描图像中定位脑肿瘤,为早期诊断、治疗规划等医疗保健应用提供支持。



观看: 使用 Ultralytics Platform 和 Ultralytics YOLO26 检测脑肿瘤 | 目标检测 🚀

数据集结构#

脑肿瘤数据集包含 1,116 张图像,按 brain-tumor.yaml 配置划分为两个预定义子集:

划分图像标注
训练893是
验证223是

每张图像都标注为以下 2 个类别之一:

  • negative:未显示脑肿瘤的图像
  • positive:显示脑肿瘤的图像

首次训练时,数据集会从 Ultralytics GitHub 资源自动下载(4.21 MB),因此无需手动设置。

访问 Ultralytics Platform 上的脑肿瘤数据集,浏览带有标注叠加层的图像,在 Charts 选项卡中查看类别分布和边界框热力图,还可以克隆数据集,在云端训练自己的模型。

应用场景#

利用计算机视觉进行脑肿瘤检测,有助于早期诊断、制定治疗方案和监测肿瘤进展。检测模型通过分析 MRI 或 CT 扫描图像定位肿瘤,为及时医疗干预和个性化治疗提供支持。

医疗专业人员可以使用这项技术来:

  • 缩短诊断时间并提高准确性
  • 通过精确定位肿瘤辅助制定手术方案
  • 长期监测治疗效果
  • 支持肿瘤学和神经学研究

数据集 YAML#

YAML 文件定义数据集配置,包括路径、类别和其他相关信息。对于脑肿瘤数据集,brain-tumor.yaml 文件由 https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/brain-tumor.yaml 维护。

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.zip

用法#

如需在脑肿瘤数据集上以 640 的图像尺寸训练一个 YOLO26n 模型,训练 100 个周期,请使用下面的代码片段。

训练示例
from ultralytics import YOLO

# 加载模型
model = YOLO("yolo26n.pt")  # 加载预训练模型(推荐用于训练)

# 训练模型
results = model.train(data="brain-tumor.yaml", epochs=100, imgsz=640)
推理示例
from ultralytics import YOLO

# 加载模型
model = YOLO("path/to/best.pt")  # 加载经过脑肿瘤数据集微调的模型

# 使用模型进行推理
results = model.predict("https://ultralytics.com/assets/brain-tumor-sample.jpg")

示例图像和标注#

脑肿瘤数据集包含有肿瘤和无肿瘤的脑部 MRI 与 CT 扫描图像。下面是该数据集中的一张示例图像及其标注。

脑肿瘤数据集示例图像

  • 马赛克图像:这个训练批次展示了经过马赛克增强的数据集图像。马赛克增强会在训练期间将多张图像合并为一张,提高批次多样性,使模型能够更好地适应不同大小、形状和位置的肿瘤,从而支持医学图像分析。

引用与致谢#

该数据集采用 AGPL-3.0 许可证发布。

如果你在研究或开发工作中使用此数据集,请按规范引用:

引用
@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}
}

常见问题#

  • 脑肿瘤数据集包含 1,116 张图像,分为两个子集:包含 893 张图像的训练集和包含 223 张图像的验证集,每张图像都有对应标注。这种划分有助于开发稳健、准确的脑肿瘤检测计算机视觉模型。更多信息请参阅数据集结构部分。

  • 脑肿瘤数据集包含 2 个类别:negative(未显示脑肿瘤的图像)和 positive(显示脑肿瘤的图像)。这种二元标注使检测模型既能定位肿瘤,也能标记未发现肿瘤的扫描图像。

  • 首次使用 data="brain-tumor.yaml" 进行训练时,脑肿瘤数据集(4.21 MB)会从 Ultralytics GitHub 资源自动下载,无需手动下载。你可以在检测数据集概览中浏览相关数据集。

  • 你可以通过 Python 和 CLI 两种方式,在脑肿瘤数据集上训练 YOLO26 模型 100 个轮次,图像尺寸设为 640px。以下是两种方式的示例:

    训练示例
    from ultralytics import YOLO
    
    # 加载模型
    model = YOLO("yolo26n.pt")  # 加载预训练模型(推荐用于训练)
    
    # 训练模型
    results = model.train(data="brain-tumor.yaml", epochs=100, imgsz=640)

    有关可用参数的详细列表,请参阅训练页面。

  • 在 AI 项目中使用脑肿瘤数据集,有助于脑肿瘤的早期诊断和治疗方案制定。它通过计算机视觉自动识别脑肿瘤,促进准确、及时的医疗干预,并支持个性化治疗策略。这有助于改善患者预后并提升临床效率。

  • 你可以通过 Python 或 CLI 执行经过微调的 YOLO26 模型的推理。以下是示例:

    推理示例
    from ultralytics import YOLO
    
    # 加载模型
    model = YOLO("path/to/best.pt")  # 加载经过脑肿瘤数据集微调的模型
    
    # 使用模型进行推理
    results = model.predict("https://ultralytics.com/assets/brain-tumor-sample.jpg")
  • 脑肿瘤数据集的 YAML 配置文件位于 brain-tumor.yaml。该文件包含在此数据集上训练和评估模型所需的路径、类别和其他相关信息。

评论11

提出问题、分享结果,或帮助其他人。

    1. Paula DerrengerPaula DerrengerUltralytics(已编辑)

      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/destination

      Replace path/to/destination with 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! 🚀

  1. G-qingqianG-qingqianGitHub

    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: @.***>

    1. Glenn JocherGlenn JocherUltralytics

      The packaged brain-tumor zip 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 generate train.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).

  2. G-qingqianG-qingqianGitHub

    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.

    1. Glenn JocherGlenn JocherUltralytics

      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
  3. pizzas17pizzas17GitHub

    How could I download this dataset on COCO format or how could I convert it? (Since I wish to have an EDA on it

  4. xySun17xySun17GitHub

    How can i train the yoloV8 using this dataset without loading the pre-trained weights?

    1. Paula DerrengerPaula DerrengerUltralytics(已编辑)

      @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=640

      This 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! 🚀

      1
    2. xySun17xySun17GitHub

      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'"

    3. Paula DerrengerPaula DerrengerUltralytics(已编辑)

      Hello @xySun17,

      Thank you for reaching out! It looks like the issue might be related to the dataset path configuration in your brain-tumor.yaml file. Here are a few steps to troubleshoot and resolve this:

      1. Verify Dataset Path: Ensure that the paths specified in your brain-tumor.yaml file correctly point to the locations of your dataset images. For example:

        path: /home/ros/datasets/brain-tumor
        train: images/train
        val: images/val
      2. Check Directory Structure: Confirm that the directory structure matches what is specified in the YAML file. The images/train and images/val directories should exist within /home/ros/datasets/brain-tumor.

      3. Update Configuration: If the dataset is located in a different directory, update the path in the YAML file accordingly. For instance, if your dataset is in /home/ros/my-datasets/brain-tumor, update the path to:

        path: /home/ros/my-datasets/brain-tumor
      4. 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.

      5. 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.yaml should 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.zip

      If 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! 🚀