COCO-Seg 数据集#
COCO-Seg 数据集提供 COCO(上下文中的常见对象)实例分割掩码——包含 80 个对象类别的 118,287 张训练图像和 5,000 张验证图像,采用 Ultralytics YOLO 标签格式。这些图像使用 COCO 的原始图像和原生分割标注,并转换为适用于 YOLO 训练的格式,因此对于从事实例分割任务的研究人员和开发者来说,这是一项重要资源。
COCO-Seg 预训练模型#
| 模型 | 尺寸 (像素) | mAP框 50-95(e2e) | mAP掩码 50-95(e2e) | 速度 CPU ONNX (毫秒) | 速度 T4 TensorRT10 (毫秒) | 参数量 (M) | FLOPs (B) |
|---|---|---|---|---|---|---|---|
| YOLO26n-seg | 640 | 39.6 | 33.9 | 53.3 ± 0.5 | 2.1 ± 0.0 | 2.7 | 9.3 |
| YOLO26s-seg | 640 | 47.3 | 40.0 | 118.4 ± 0.9 | 3.3 ± 0.0 | 10.4 | 34.5 |
| YOLO26m-seg | 640 | 52.5 | 44.1 | 328.2 ± 2.4 | 6.7 ± 0.1 | 23.6 | 121.7 |
| YOLO26l-seg | 640 | 54.4 | 45.5 | 387.0 ± 3.7 | 8.0 ± 0.1 | 28.0 | 140.1 |
| YOLO26x-seg | 640 | 56.5 | 47.0 | 787.0 ± 6.8 | 16.4 ± 0.1 | 62.8 | 314.0 |
主要特性#
- COCO-Seg 为 COCO train2017/val2017 中 123,287 张带标注图像提供实例分割掩码(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 时需要。
数据集结构#
COCO-Seg 数据集分为三个子集:
- Train2017:118,287 张图像,用于训练实例分割模型。
- Val2017:5,000 张图像,用于模型开发期间的验证。
- Test-dev2017:40,670 张 test2017 图像中的 20,288 张,用于基准测试。该子集的真实标注不公开,因此必须将预测结果提交至 COCO 评估服务器进行评分。
如需进行小规模实验,请参阅 COCO128-Seg(128 张图像)和 COCO8-Seg(8 张图像)子集。
应用#
COCO-Seg 广泛用于训练和评估深度学习模型在实例分割任务上的表现,例如 YOLO 模型。大量带标注图像、丰富的对象类别以及标准化的评估指标,使其成为计算机视觉研究人员和从业者不可或缺的资源。完整的 COCO-Seg 标注还可以在 Ultralytics Platform 上浏览和管理。
数据集 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)使用方法#
要在 COCO-Seg 数据集上训练 YOLO26n-seg 模型,训练 100 个轮次,图像大小设置为 640,可以使用以下代码片段。如需查看可用参数的完整列表,请参阅模型的训练页面。
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)示例图像和标注#
COCO-Seg 包含与 COCO 相同的多样化图像、对象类别和复杂场景,并以 YOLO 标签格式提供实例分割掩码。以下是数据集中的一些图像示例及其对应的实例分割掩码:

- 拼接图像:此图展示了由数据集拼接图像组成的训练批次。图像拼接是一种在训练期间使用的技术,它将多张图像组合成一张图像,以增加每个训练批次中对象和场景的多样性。这有助于模型泛化到不同的对象大小、宽高比和上下文。
引用和致谢#
如果你在研究或开发工作中使用 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 Consortium 表示感谢,感谢其为计算机视觉社区创建并维护了这项宝贵资源。有关 COCO 数据集及其创建者的更多信息,请访问 COCO 数据集网站。
常见问题#
COCO-Seg 是 COCO 原生实例分割掩码的 Ultralytics YOLO 格式打包版本,针对相同的 118,287 张 train2017 图像和 5,000 张 val2017 图像。原始 COCO 标注已经为全部 80 个对象类别包含这些多边形掩码;COCO-Seg 将其转换为用于对象实例分割训练的 YOLO 标签格式。
要在 COCO-Seg 数据集上训练 YOLO26n-seg 模型,训练 100 个轮次,图像大小设置为 640,可以使用以下代码片段。如需查看可用训练参数的详细列表,请参阅模型的训练页面。
训练示例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)COCO-Seg 数据集支持多个性能指标各不相同的 YOLO26 实例分割预训练模型。以下是可用模型及其主要指标的概览:
模型 尺寸
(像素)mAP框
50-95(e2e)mAP掩码
50-95(e2e)速度
CPU ONNX
(毫秒)速度
T4 TensorRT10
(毫秒)参数量
(M)FLOPs
(B)YOLO26n-seg 640 39.6 33.9 53.3 ± 0.5 2.1 ± 0.0 2.7 9.3 YOLO26s-seg 640 47.3 40.0 118.4 ± 0.9 3.3 ± 0.0 10.4 34.5 YOLO26m-seg 640 52.5 44.1 328.2 ± 2.4 6.7 ± 0.1 23.6 121.7 YOLO26l-seg 640 54.4 45.5 387.0 ± 3.7 8.0 ± 0.1 28.0 140.1 YOLO26x-seg 640 56.5 47.0 787.0 ± 6.8 16.4 ± 0.1 62.8 314.0 这些模型涵盖轻量级的 YOLO26n-seg 到功能更强大的 YOLO26x-seg,在速度和精度之间提供不同的权衡,以满足各种应用需求。有关模型选择的更多信息,请访问 Ultralytics 模型页面。
COCO-Seg 数据集分为三个子集,以满足特定的训练和评估需求:
- Train2017:包含 118,287 张图像,主要用于训练实例分割模型。
- Val2017:包含 5,000 张图像,用于训练过程中的验证。
- Test-dev2017:包含 40,670 张 test2017 图像中的 20,288 张,用于测试和基准评估训练好的模型。请注意,该子集的真实标注不公开,性能结果需提交至 COCO 评估服务器进行评估。
如需进行小规模实验,你还可以考虑 COCO128-Seg 数据集(128 张图像)或 COCO8-Seg 数据集,后者是一个精简版本,仅包含 COCO train 2017 集中的 8 张图像。



