coco数据集详解

什么是COCO数据集?

MS COCO的全称是Microsoft Common Objects in Context,起源于微软于2014年出资标注的Microsoft COCO数据集,与ImageNet竞赛一样,被视为是计算机视觉领域最受关注和最权威的比赛之一。

COCO数据集是一个可用于图像检测(image detection),语义分割(semantic segmentation)和图像标题生成(image captioning)的大规模数据集。它有超过330K张图像(其中220K张是有标注的图像),包含150万个目标,80个目标类别(object categories:行人、汽车、大象等),91种材料类别(stuff categoris:草、墙、天空等),每张图像包含五句图像的语句描述,且有250,000个带关键点标注的行人。

官网:https://cocodataset.org/

COCO种类

person
bicycle
car
motorbike
aeroplane
bus
train
truck
boat
traffic light
fire hydrant
stop sign
parking meter
bench
bird
cat
dog
horse
sheep
cow
elephant
bear
zebra
giraffe
backpack
umbrella
handbag
tie
suitcase
frisbee
skis
snowboard
sports ball
kite
baseball bat
baseball glove
skateboard
surfboard
tennis racket
bottle
wine glass
cup
fork
knife
spoon
bowl
banana
apple
sandwich
orange
broccoli
carrot
hot dog
pizza
donut
cake
chair
sofa
pottedplant
bed
diningtable
toilet
tvmonitor
laptop
mouse
remote
keyboard
cell phone
microwave
oven
toaster
sink
refrigerator
book
clock
vase
scissors
teddy bear
hair drier
toothbrush

COCO 格式

COCO 数据集由五个信息部分组成,提供了整个数据集的信息。COCO 物体检测数据集的格式记录在 COCO 数据格式中。

  • info:有关数据集的一般信息。
  • licenses:数据集中图像的许可信息。
  • images:数据集中图像的列表。
  • annotations:数据集中所有图像中存在的注释(包括边界框)的列表。
  • categories:标签类别列表。

要创建自定义标签清单,需要使用 COCO 清单文件中的 imagesannotations 和 categories 列表。其他两个部分(infolicences)不是必需的。下面是一个 COCO 清单文件示例。

{
    "info": {
        "description": "COCO 2017 Dataset","url": "http://cocodataset.org","version": "1.0","year": 2017,"contributor": "COCO Consortium","date_created": "2017/09/01"
    },
    "licenses": [
        {"url": "http://creativecommons.org/licenses/by/2.0/","id": 4,"name": "Attribution License"}
    ],
    "images": [
        {"id": 242287, "license": 4, "coco_url": "http://images.cocodataset.org/val2017/xxxxxxxxxxxx.jpg", "flickr_url": "http://farm3.staticflickr.com/2626/xxxxxxxxxxxx.jpg", "width": 426, "height": 640, "file_name": "xxxxxxxxx.jpg", "date_captured": "2013-11-15 02:41:42"},
        {"id": 245915, "license": 4, "coco_url": "http://images.cocodataset.org/val2017/nnnnnnnnnnnn.jpg", "flickr_url": "http://farm1.staticflickr.com/88/xxxxxxxxxxxx.jpg", "width": 640, "height": 480, "file_name": "nnnnnnnnnn.jpg", "date_captured": "2013-11-18 02:53:27"}
    ],
    "annotations": [
        {"id": 125686, "category_id": 0, "iscrowd": 0, "segmentation": [[164.81, 417.51,......167.55, 410.64]], "image_id": 242287, "area": 42061.80340000001, "bbox": [19.23, 383.18, 314.5, 244.46]},
        {"id": 1409619, "category_id": 0, "iscrowd": 0, "segmentation": [[376.81, 238.8,........382.74, 241.17]], "image_id": 245915, "area": 3556.2197000000015, "bbox": [399, 251, 155, 101]},
        {"id": 1410165, "category_id": 1, "iscrowd": 0, "segmentation": [[486.34, 239.01,..........495.95, 244.39]], "image_id": 245915, "area": 1775.8932499999994, "bbox": [86, 65, 220, 334]}
    ],
    "categories": [
        {"supercategory": "speaker","id": 0,"name": "echo"},
        {"supercategory": "speaker","id": 1,"name": "echo dot"}
    ]
}

图像列表

COCO 数据集引用的图像列在图像数组中。每个图像对象都包含了有关该图像的信息,例如图像文件名。在以下示例图像对象中,请注意以下信息以及创建 Amazon Rekognition Custom Labels 清单文件需要哪些字段。

  • id:(必需)图像的唯一标识符。id 字段映射到注释数组(存储边界框信息的地方)中的 id 字段。
  • license:(非必需)映射到许可证数组。
  • coco_url:(可选)图像的位置。
  • flickr_url:(非必需)图像在 Flickr 上的位置。
  • width:(必需)图像的宽度。
  • height:(必需)图像的高度。
  • file_name:(必需)图像文件名。在本示例中,file_name 与 id 匹配,但 COCO 数据集对此不作要求。
  • date_captured:(必需)图像拍摄的日期和时间。
{
    "id": 245915,
    "license": 4,
    "coco_url": "http://images.cocodataset.org/val2017/nnnnnnnnnnnn.jpg",
    "flickr_url": "http://farm1.staticflickr.com/88/nnnnnnnnnnnnnnnnnnn.jpg",
    "width": 640,
    "height": 480,
    "file_name": "000000245915.jpg",
    "date_captured": "2013-11-18 02:53:27"
}

注释(边界框)列表

所有图像上的所有物体的边界框信息都存储在注释列表中。单个注释对象包含单个物体的边界框信息以及该物体在图像上的标签。图像上物体的每个实例都有一个注释对象。

在以下示例中,请注意以下信息以及创建 Amazon Rekognition Custom Labels 清单文件需要哪些字段。

  • id:(非必需)注释的标识符。
  • image_id:(必需)对应于图像数组中的图像 id
  • category_id:(必需)用于标识边界框内物体的标签的标识符。它映射到类别数组的 id 字段。
  • iscrowd:(非必需)指定图像中是否包含物体群。
  • segmentation:(非必需)图像中物体的分段信息。Amazon Rekognition Custom Labels 不支持分段。
  • area:(非必需)注释的区域。
  • bbox:(必需)包含图像中物体的边界框的坐标(以像素为单位)。
{
    "id": 245915,
    "license": 4,
    "coco_url": "http://images.cocodataset.org/val2017/nnnnnnnnnnnn.jpg",
    "flickr_url": "http://farm1.staticflickr.com/88/nnnnnnnnnnnnnnnnnnn.jpg",
    "width": 640,
    "height": 480,
    "file_name": "000000245915.jpg",
    "date_captured": "2013-11-18 02:53:27"
}

类别列表

标签信息存储在类别数组中。在以下示例类别对象中,请注意以下信息以及创建 Amazon Rekognition Custom Labels 清单文件需要哪些字段。

  • supercategory:(非必需)标签的父类别。
  • id:(必需)标签标识符。id 字段映射到 annotation 对象中的 category_id 字段。在以下示例中,echo dot 的标识符为 2。
  • name:(必需)标签名称。
{"supercategory": "speaker","id": 2,"name": "echo dot"}

COCO数据集的下载

下载网址:官网下载链接

posted @ 2024-06-11 22:47  牛奔  阅读(450)  评论(0编辑  收藏  举报