Link to this sectionCOCO-Seg 数据集#
COCO-Seg 数据集提供了 COCO (Common Objects in Context) 实例分割掩码——包含 118,287 张训练图像和 5,000 张验证图像,涵盖 80 个对象类别,且采用 Ultralytics YOLO 标签格式。它使用 COCO 的原始图像和原生分割标注,并转换为 YOLO 训练格式,这使其成为研究人员和开发者进行 instance segmentation 任务的重要资源。
Link to this sectionCOCO-Seg 预训练模型#
| 模型 | 尺寸 (像素) | mAPbox 50-95(e2e) | mAPmask 50-95(e2e) | 速度 CPU ONNX (ms) | 速度 T4 TensorRT10 (ms) | 参数量 (M) | FLOPs (B) |
|---|---|---|---|---|---|---|---|
| YOLO26n-seg | 640 | 39.6 | 33.9 | 53.3 ± 0.5 | 2.1 ± 0.0 | 2.7 | 9.1 |
| YOLO26s-seg | 640 | 47.3 | 40.0 | 118.4 ± 0.9 | 3.3 ± 0.0 | 10.4 | 34.2 |
| YOLO26m-seg | 640 | 52.5 | 44.1 | 328.2 ± 2.4 | 6.7 ± 0.1 | 23.6 | 121.5 |
| YOLO26l-seg | 640 | 54.4 | 45.5 | 387.0 ± 3.7 | 8.0 ± 0.1 | 28.0 | 139.8 |
| YOLO26x-seg | 640 | 56.5 | 47.0 | 787.0 ± 6.8 | 16.4 ± 0.1 | 62.8 | 313.5 |
Link to this section主要特性#
- COCO-Seg 为 123,287 张带标注的 COCO train2017/val2017 图像(118,287 张训练集 + 5,000 张验证集)提供了实例分割掩码,这些图像来自 COCO 更广泛的约 330K 张图像版本。
- 该数据集包含与原始 COCO 数据集相同的 80 个目标类别。
- 标注以 YOLO 多边形标签格式提供实例分割掩码。
- COCO-Seg 提供用于评估实例分割性能的标准化 mAP 和 mAR 指标,从而能够有效对比模型性能。
- 下载大小:首次使用时约为 20.3 GB(
train2017.zip+val2017.zip+ 标签)。7 GB 的test2017.zip不会自动获取,因为这些图像的真实标注是保密的,仅在进行 test-dev2017 提交 时才需要。
Link to this section数据集结构#
COCO-Seg 数据集被划分为三个子集:
- Train2017:用于训练实例分割模型的 118,287 张图像。
- Val2017:模型开发过程中用于验证的 5,000 张图像。
- Test-dev2017:test2017 中 40,670 张图像里的 20,288 张,用于基准测试。此子集的真实标注不公开,因此必须将预测结果提交至 COCO evaluation server 进行评分。
对于更小规模的实验需求,请查看 COCO128-Seg(128 张图像)和 COCO8-Seg(8 张图像)子集。
Link to this section应用#
COCO-Seg 被广泛用于训练和评估 deep learning 模型在 instance segmentation 任务上的表现,例如 YOLO 模型。大量的标注图像、多样的对象类别以及标准化的评估指标,使其成为 computer vision 研究人员和从业者不可或缺的资源。完整的 COCO-Seg 标注也可以在 Ultralytics Platform 上浏览和管理。
Link to this section数据集 YAML#
YAML 文件用于定义数据集配置。它包含有关数据集路径、类别和其他相关信息。对于 COCO-Seg 数据集,coco.yaml 文件维护在 https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco.yaml。
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
# COCO 2017 dataset https://cocodataset.org by Microsoft
# Documentation: https://docs.ultralytics.com/datasets/detect/coco
# Example usage: yolo train data=coco.yaml
# parent
# ├── ultralytics
# └── datasets
# └── coco ← downloads here (20.3 GB)
# 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: coco # dataset root dir
train: train2017.txt # train images (relative to 'path') 118287 images
val: val2017.txt # val images (relative to 'path') 5000 images
test: test-dev2017.txt # 20288 of 40670 images, submit via https://cocodataset.org/#detection-eval
# Classes
names:
0: person
1: bicycle
2: car
3: motorcycle
4: airplane
5: bus
6: train
7: truck
8: boat
9: traffic light
10: fire hydrant
11: stop sign
12: parking meter
13: bench
14: bird
15: cat
16: dog
17: horse
18: sheep
19: cow
20: elephant
21: bear
22: zebra
23: giraffe
24: backpack
25: umbrella
26: handbag
27: tie
28: suitcase
29: frisbee
30: skis
31: snowboard
32: sports ball
33: kite
34: baseball bat
35: baseball glove
36: skateboard
37: surfboard
38: tennis racket
39: bottle
40: wine glass
41: cup
42: fork
43: knife
44: spoon
45: bowl
46: banana
47: apple
48: sandwich
49: orange
50: broccoli
51: carrot
52: hot dog
53: pizza
54: donut
55: cake
56: chair
57: couch
58: potted plant
59: bed
60: dining table
61: toilet
62: tv
63: laptop
64: mouse
65: remote
66: keyboard
67: cell phone
68: microwave
69: oven
70: toaster
71: sink
72: refrigerator
73: book
74: clock
75: vase
76: scissors
77: teddy bear
78: hair drier
79: toothbrush
# Download script/URL (optional)
download: |
from pathlib import Path
from ultralytics.utils import ASSETS_URL
from ultralytics.utils.downloads import download
# Download labels
segments = True # segment or box labels
dir = Path(yaml["path"]) # dataset root dir
urls = [ASSETS_URL + ("/coco2017labels-segments.zip" if segments else "/coco2017labels.zip")] # labels
download(urls, dir=dir.parent)
# Download data (test2017.zip excluded: ground truth is withheld, only used for the eval-server test-dev split)
urls = [
"http://images.cocodataset.org/zips/train2017.zip", # 19G, 118k images
"http://images.cocodataset.org/zips/val2017.zip", # 1G, 5k images
]
download(urls, dir=dir / "images", threads=3)Link to this section用法#
若要在 COCO-Seg 数据集上以 640 图像尺寸训练 YOLO26n-seg 模型 100 个轮次,你可以使用以下代码片段。有关可用参数的完整列表,请参考模型训练页面。
from ultralytics import YOLO
# Load a model
model = YOLO("yolo26n-seg.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="coco.yaml", epochs=100, imgsz=640)Link to this section样本图像和标注#
COCO-Seg 包含与 COCO 相同且多样的图像、对象类别和复杂场景,并以 YOLO 标签格式提供实例分割掩码。以下是该数据集中的图像示例,以及它们对应的实例分割掩码:

- 马赛克图像:此图像展示了由马赛克数据集图像组成的训练批次。马赛克增强 是一种在训练期间使用的技术,它将多张图像合并为一张图像,以增加每个训练批次中对象和场景的多样性。这有助于模型提高对不同对象大小、宽高比和上下文的泛化能力。
Link to this section引用与致谢#
如果你在研究或开发工作中使用了 COCO-Seg 数据集,请引用原始的 COCO 论文并注明对 COCO-Seg 的扩展:
@misc{lin2015microsoft,
title={Microsoft COCO: Common Objects in Context},
author={Tsung-Yi Lin and Michael Maire and Serge Belongie and Lubomir Bourdev and Ross Girshick and James Hays and Pietro Perona and Deva Ramanan and C. Lawrence Zitnick and Piotr Dollár},
year={2015},
eprint={1405.0312},
archivePrefix={arXiv},
primaryClass={cs.CV}
}我们衷心感谢 COCO 联盟为计算机视觉社区创建并维护了这一宝贵的资源。有关 COCO 数据集及其创建者的更多信息,请访问 COCO 数据集网站。
Link to this section常见问题解答#
Link to this section什么是 COCO-Seg 数据集,它与原始的 COCO 数据集有何不同?#
COCO-Seg 是 Ultralytics YOLO 格式包装的 COCO (Common Objects in Context) 原生实例分割掩码,涵盖了相同的 118,287 张 train2017 图像和 5,000 张 val2017 图像。原始 COCO 标注已经包含了所有 80 个对象类别的多边形掩码;COCO-Seg 将其转换为用于 object instance segmentation 训练的 YOLO 标签格式。
Link to this section如何使用 COCO-Seg 数据集训练 YOLO26 模型?#
若要使用图像尺寸 640 在 COCO-Seg 数据集上训练 YOLO26n-seg 模型 100 个 epoch,你可以使用以下代码片段。有关可用训练参数的详细列表,请参阅模型 Training 页面。
from ultralytics import YOLO
# Load a model
model = YOLO("yolo26n-seg.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="coco.yaml", epochs=100, imgsz=640)Link to this sectionCOCO-Seg 数据集的主要功能是什么?#
COCO-Seg 数据集包含以下几个主要功能:
- 为 123,287 张带标注的 COCO train2017/val2017 图像(118,287 张训练集 + 5,000 张验证集)提供实例分割掩码。
- 标注了与原始 COCO 数据集相同的 80 个对象类别。
- 以 YOLO 多边形标签格式提供实例分割掩码。
- 使用标准化的评估指标,例如平均 Precision (mAP) 和平均 Recall (mAR),用于 instance segmentation 任务。
Link to this sectionCOCO-Seg 有哪些可用的预训练模型,其性能指标如何?#
COCO-Seg 数据集支持多个具有不同性能指标的预训练 YOLO26 分割模型。以下是现有模型及其关键指标的摘要:
| 模型 | 尺寸 (像素) | mAPbox 50-95(e2e) | mAPmask 50-95(e2e) | 速度 CPU ONNX (ms) | 速度 T4 TensorRT10 (ms) | 参数量 (M) | FLOPs (B) |
|---|---|---|---|---|---|---|---|
| YOLO26n-seg | 640 | 39.6 | 33.9 | 53.3 ± 0.5 | 2.1 ± 0.0 | 2.7 | 9.1 |
| YOLO26s-seg | 640 | 47.3 | 40.0 | 118.4 ± 0.9 | 3.3 ± 0.0 | 10.4 | 34.2 |
| YOLO26m-seg | 640 | 52.5 | 44.1 | 328.2 ± 2.4 | 6.7 ± 0.1 | 23.6 | 121.5 |
| YOLO26l-seg | 640 | 54.4 | 45.5 | 387.0 ± 3.7 | 8.0 ± 0.1 | 28.0 | 139.8 |
| YOLO26x-seg | 640 | 56.5 | 47.0 | 787.0 ± 6.8 | 16.4 ± 0.1 | 62.8 | 313.5 |
这些模型的范围从轻量级的 YOLO26n-seg 到性能更强的 YOLO26x-seg,在速度和准确性之间提供不同的权衡,以满足各种应用需求。有关模型选择的更多信息,请访问 Ultralytics 模型页面。
Link to this sectionCOCO-Seg 数据集是如何构建的,它包含哪些子集?#
COCO-Seg 数据集为了满足特定的训练和评估需求,被划分为三个子集:
- Train2017:包含 118,287 张主要用于训练实例分割模型的图像。
- Val2017:包含在训练过程中用于验证的 5,000 张图像。
- Test-dev2017:包含 20,288 张(从 40,670 张 test2017 图像中选出),用于测试和基准评估已训练的模型。请注意,此子集的真实标注不公开,性能结果需提交至 COCO evaluation server 进行评估。
对于更小规模的实验需求,你也可以考虑 COCO128-Seg dataset(128 张图像)或 COCO8-Seg dataset,这是一个仅包含 COCO train 2017 集中 8 张图像的紧凑版本。