跳至内容

COCO128 数据集

导言

UltralyticsCOCO128 是一个小型但用途广泛的物体检测数据集,由 COCO train 2017 集的前 128 幅图像组成。该数据集是测试和调试物体检测模型或试验新检测方法的理想之选。该数据集由 128 幅图像组成,小到易于管理,大到足以测试训练管道是否存在错误,并在训练更大的数据集之前进行合理性检查。



观看: Ultralytics COCO 数据集概览

本数据集用于Ultralytics HUB 和 YOLO11.

数据集 YAML

YAML(另一种标记语言)文件用于定义数据集配置。它包含数据集的路径、类和其他相关信息。就 COCO128 数据集而言,YAML 文件中的 coco128.yaml 文件保存在 https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/coco128.yaml.

ultralytics.yaml

# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

# COCO128 dataset https://www.kaggle.com/datasets/ultralytics/coco128 (first 128 images from COCO train2017) by Ultralytics
# Documentation: https://docs.ultralytics.com/datasets/detect/coco/
# Example usage: yolo train data=coco128.yaml
# parent
# ├── ultralytics
# └── datasets
#     └── coco128  ← downloads here (7 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: ../datasets/coco128 # dataset root dir
train: images/train2017 # train images (relative to 'path') 128 images
val: images/train2017 # val images (relative to 'path') 128 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/coco128.zip

使用方法

要在 COCO128 数据集上对 YOLO11n 模型进行 100次历时训练(图像大小为 640),可以使用以下代码片段。有关可用参数的完整列表,请参阅模型训练页面。

列车示例

from ultralytics import YOLO

# Load a model
model = YOLO("yolo11n.pt")  # load a pretrained model (recommended for training)

# Train the model
results = model.train(data="coco128.yaml", epochs=100, imgsz=640)
# Start training from a pretrained *.pt model
yolo detect train data=coco128.yaml model=yolo11n.pt epochs=100 imgsz=640

图片和注释示例

下面是 COCO128 数据集中的一些图像示例及其相应的注释:

数据集样本图像

  • 镶嵌图像:该图像展示了由马赛克数据集图像组成的训练批次。马赛克是一种在训练过程中使用的技术,可将多幅图像合并为单幅图像,以增加每个训练批次中物体和场景的多样性。这有助于提高模型对不同物体尺寸、长宽比和环境的泛化能力。

该示例展示了 COCO128 数据集中图像的多样性和复杂性,以及在训练过程中使用镶嵌技术的好处。

引文和致谢

如果您在研究或开发工作中使用 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 联盟为计算机视觉界创建并维护这一宝贵资源。有关 COCO 数据集及其创建者的更多信息,请访问COCO 数据集网站

常见问题

Ultralytics COCO128 数据集的用途是什么?

Ultralytics COCO128 数据集是一个紧凑的子集,包含 COCO train 2017 数据集中的前 128 幅图像。它主要用于测试和调试对象检测模型、实验新的检测方法,以及在扩展到更大数据集之前验证训练管道。它的大小易于管理,非常适合快速迭代,同时还能提供足够的多样性,成为一个有意义的测试案例。

如何使用 COCO128 数据集训练YOLO11 模型?

要在 COCO128 数据集上训练YOLO11 模型,可以使用Python 或CLI 命令。具体方法如下:

from ultralytics import YOLO

    # Load a pretrained model
    model = YOLO("yolo11n.pt")

    # Train the model
    results = model.train(data="coco128.yaml", epochs=100, imgsz=640)
    ```

=== "CLI"

`bash
    yolo detect train data=coco128.yaml model=yolo11n.pt epochs=100 imgsz=640
    `

For more training options and parameters, refer to the [Training](../../modes/train.md) documentation.

### What are the benefits of using mosaic augmentation with COCO128?

Mosaic augmentation, as shown in the sample images, combines multiple training images into a single composite image. This technique offers several benefits when training with COCO128:

- Increases the variety of objects and contexts within each training batch
- Improves model generalization across different object sizes and aspect ratios
- Enhances detection performance for objects at various scales
- Maximizes the utility of a small dataset by creating more diverse training samples

This technique is particularly valuable for smaller datasets like COCO128, helping models learn more robust features from limited data.

### How does COCO128 compare to other COCO dataset variants?

COCO128 (128 images) sits between [COCO8](../detect/coco8.md) (8 images) and the full [COCO](../detect/coco.md) dataset (118K+ images) in terms of size:

- **COCO8**: Contains just 8 images (4 train, 4 val) - ideal for quick tests and debugging
- **COCO128**: Contains 128 images - balanced between size and diversity
- **Full COCO**: Contains 118K+ training images - comprehensive but resource-intensive

COCO128 provides a good middle ground, offering more diversity than COCO8 while remaining much more manageable than the full COCO dataset for experimentation and initial model development.

### Can I use COCO128 for tasks other than object detection?

While COCO128 is primarily designed for object detection, the dataset's annotations can be adapted for other computer vision tasks:

- **Instance segmentation**: Using the segmentation masks provided in the annotations
- **Keypoint detection**: For images containing people with keypoint annotations
- **Transfer learning**: As a starting point for fine-tuning models for custom tasks

For specialized tasks like [segmentation](../../tasks/segment.md), consider using purpose-built variants like [COCO8-seg](../segment/coco8-seg.md) which include the appropriate annotations.
📅创建于 8 天前 ✏️已更新 0 天前

评论