跳至内容

COCO-Seg 数据集

COCO-Seg数据集是 COCO(Common Objects in Context,上下文中的常见物体)数据集的扩展,专门用于辅助物体实例分割研究。它使用与 COCO 相同的图像,但引入了更详细的分割注释。该数据集是从事实例分割任务的研究人员和开发人员的重要资源,尤其是在训练YOLO 模型方面。

COCO-Seg 预训练模型

模型 尺寸
(像素)
mAPbox
50-95
mAPmask
50-95
速度
CPUONNX
(ms)
速度
A100 TensorRT
(毫秒)
params
(M)
FLOPs
(B)
YOLOv8n-seg 640 36.7 30.5 96.1 1.21 3.4 12.6
YOLOv8s-seg 640 44.6 36.8 155.7 1.47 11.8 42.6
YOLOv8m-seg 640 49.9 40.8 317.0 2.18 27.3 110.2
YOLOv8l-seg 640 52.3 42.6 572.4 2.79 46.0 220.5
YOLOv8x-seg 640 53.4 43.4 712.1 4.02 71.8 344.1

主要功能

  • COCO-Seg 保留了 COCO 的原始 330K 图像。
  • 该数据集包含与原始 COCO 数据集相同的 80 个对象类别。
  • 注释现在包括针对图像中每个对象的更详细的实例分割掩码。
  • COCO-Seg 提供了标准化的评估指标,如用于物体检测的平均精度(mAP)和用于实例分割任务的平均召回率(mAR),从而能够有效地比较模型性能。

数据集结构

COCO-Seg 数据集分为三个子集:

  1. Train2017:该子集包含 118K 幅图像,用于训练实例分割模型。
  2. Val2017:该子集包含 5K 幅图像,用于模型训练过程中的验证。
  3. Test2017:该子集包含 20K 幅图像,用于测试和基准测试训练有素的模型。该子集的地面实况注释不公开,其结果将提交给COCO 评估服务器进行性能评估。

应用

COCO-Seg 广泛用于训练和评估实例分割中的深度学习模型,如YOLO 模型。大量的注释图像、对象类别的多样性以及标准化的评估指标使其成为计算机视觉研究人员和从业人员不可或缺的资源。

数据集 YAML

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

ultralytics/cfg/datasets/coco.yaml

# Ultralytics YOLO 🚀, AGPL-3.0 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.1 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: ../datasets/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 to https://competitions.codalab.org/competitions/20794

# 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 ultralytics.utils.downloads import download
  from pathlib import Path

  # Download labels
  segments = True  # segment or box labels
  dir = Path(yaml['path'])  # dataset root dir
  url = 'https://github.com/ultralytics/yolov5/releases/download/v1.0/'
  urls = [url + ('coco2017labels-segments.zip' if segments else 'coco2017labels.zip')]  # labels
  download(urls, dir=dir.parent)
  # Download data
  urls = ['http://images.cocodataset.org/zips/train2017.zip',  # 19G, 118k images
          'http://images.cocodataset.org/zips/val2017.zip',  # 1G, 5k images
          'http://images.cocodataset.org/zips/test2017.zip']  # 7G, 41k images (optional)
  download(urls, dir=dir / 'images', threads=3)

使用方法

要在图像大小为 640 的 COCO-Seg 数据集上训练YOLOv8n-seg 模型 100 次,可以使用以下代码片段。有关可用参数的完整列表,请参阅模型训练页面。

列车示例

from ultralytics import YOLO

# Load a model
model = YOLO('yolov8n-seg.pt')  # load a pretrained model (recommended for training)

# Train the model
results = model.train(data='coco-seg.yaml', epochs=100, imgsz=640)
# Start training from a pretrained *.pt model
yolo detect train data=coco-seg.yaml model=yolov8n.pt epochs=100 imgsz=640

图片和注释示例

COCO-Seg 和它的前身 COCO 一样,包含一组不同的图像,其中有各种物体类别和复杂场景。不过,COCO-Seg 为图像中的每个物体引入了更详细的实例分割掩码。下面是数据集中的一些图像示例及其相应的实例分割掩码:

数据集样本图像

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

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

引文和致谢

如果您在研究或开发工作中使用 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 数据集网站



创建于 2023-11-12,更新于 2024-04-17
作者:glenn-jocher(4),RizwanMunawar(1),Laughing-q(1)

评论