Link to this sectionCOCO8 数据集#
Link to this section简介#
Ultralytics COCO8 数据集是一个精简但功能强大的目标检测数据集,由 COCO train 2017 集中的前 8 张图像组成——其中 4 张用于训练,4 张用于验证。该数据集专为快速测试、调试以及 YOLO 模型和训练流水线的实验而设计。其小巧的体积使其非常易于管理,同时其多样性确保了它在扩展到大型数据集之前成为一种有效的完整性检查手段。
Watch: Ultralytics COCO Dataset Overview
COCO8 与 Ultralytics Platform 和 YOLO26 完全兼容,能够无缝集成到你的计算机视觉工作流中。
Link to this section数据集 YAML#
The COCO8 dataset configuration is defined in a YAML (Yet Another Markup Language) file, which specifies dataset paths, class names, and other essential metadata. You can review the official coco8.yaml file in the Ultralytics GitHub repository.
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
# COCO8 dataset (first 8 images from COCO train2017) by Ultralytics
# Documentation: https://docs.ultralytics.com/datasets/detect/coco8
# Example usage: yolo train data=coco8.yaml
# parent
# ├── ultralytics
# └── datasets
# └── coco8 ← downloads here (1 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: coco8 # dataset root dir
train: images/train # train images (relative to 'path') 4 images
val: images/val # val images (relative to 'path') 4 images
test: # test images (optional)
# 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: https://github.com/ultralytics/assets/releases/download/v0.0.0/coco8.zipLink to this section用法#
若要在 COCO8 数据集上训练一个 YOLO26n 模型,进行 100 个 epoch,图像尺寸为 640,请参考以下示例。有关训练选项的完整列表,请查看 YOLO 训练文档。
from ultralytics import YOLO
# Load a pretrained YOLO26n model
model = YOLO("yolo26n.pt")
# Train the model on COCO8
results = model.train(data="coco8.yaml", epochs=100, imgsz=640)Link to this section样本图像和标注#
以下是 COCO8 数据集中马赛克增强训练批次的示例:
- 马赛克图像:此图像展示了一个训练批次,其中通过马赛克增强将多个数据集图像组合在一起。马赛克增强增加了每个批次内对象和场景的多样性,有助于模型更好地泛化到各种对象尺寸、纵横比和背景。
该技术对于像 COCO8 这样的小型数据集特别有用,因为它能在训练过程中最大化每张图像的价值。
Link to this section引用与致谢#
如果你在研究或开发中使用了 COCO 数据集,请引用以下论文:
@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 对计算机视觉社区持续做出的贡献。
Link to this section常见问题解答#
Link to this sectionUltralytics COCO8 数据集的用途是什么?#
Ultralytics COCO8 数据集旨在用于快速测试和调试目标检测模型。它仅包含 8 张图像(4 张用于训练,4 张用于验证),非常适合在扩展到大型数据集之前验证你的 YOLO 训练流水线并确保一切按预期运行。探索 COCO8 YAML 配置以获取更多详情。
Link to this section如何使用 COCO8 数据集训练 YOLO26 模型?#
你可以使用 Python 或 CLI 在 COCO8 上训练 YOLO26 模型:
from ultralytics import YOLO
# Load a pretrained YOLO26n model
model = YOLO("yolo26n.pt")
# Train the model on COCO8
results = model.train(data="coco8.yaml", epochs=100, imgsz=640)有关其他训练选项,请参考 YOLO 训练文档。
Link to this section为什么我应该使用 Ultralytics Platform 来管理我的 COCO8 训练?#
Ultralytics Platform 为包括 COCO8 在内的 YOLO 模型简化了数据集管理、训练和部署。借助云端训练、实时监控和直观的数据集处理等功能,HUB 让你可以一键启动实验,免去了手动设置的麻烦。了解更多关于 Ultralytics Platform 的信息,以及它如何加速你的计算机视觉项目。
Link to this section在 COCO8 数据集训练中使用马赛克增强有什么好处?#
如 COCO8 训练中所用的马赛克增强,会在每个批次中将多张图像组合成一张。这增加了对象和背景的多样性,有助于你的 YOLO 模型更好地泛化到新场景。马赛克增强对于小型数据集特别有价值,因为它最大化了每个训练步骤中可用的信息。更多相关信息,请参阅训练指南。
Link to this section如何验证我在 COCO8 数据集上训练的 YOLO26 模型?#
要在 COCO8 上训练后验证你的 YOLO26 模型,请使用 Python 或 CLI 中的模型验证命令。这将使用标准指标评估模型的性能。获取逐步说明,请访问 YOLO 验证文档。