COCO数据集中图像都是一样的,标注信息annotations的不同,表示不同的任务。分为:
- instances——实例分割
- person_keypoints——关键点分割
- stuff——语义分割
- captions——图片的配文,是一句话
每个类别分别包含train,val。
做实例分割任务时,使用instance_train201X.json文件作为标签信息。下面详细介绍。
1、annotations中json文件数据类型
{
"info" : info,
"images" : [image],
"annotations" : [annotation],
"licenses" : [license],
}
info{
"year" : int,
"version" : str,
"description" : str,
"contributor" : str,
"url" : str,
"date_created" : datetime,
}
image{
"id" : int,
"width" : int,
"height" : int,
"file_name" : str,
"license" : int,
"flickr_url" : str,
"coco_url" : str,
"date_captured" : datetime,
}
license{
"id" : int,
"name" : str,
"url" : str,
}
2、以instance_train2014.json文件为例解析 Object Instance Annotations
每个实例注释包含一系列字段,包括对象的类别ID和分割掩码(segmentation mask)。分割格式取决于实例是否代表单个对象(iscrowd = 0,在这种情况下使用多边形)或对象集合(iscrowd = 1,在这种情况下使用RLE)。请注意,单个对象(iscrowd = 0)可能需要多个多边形,例如,如果被遮挡。人群注释(Crowd annotations)(iscrowd = 1)用于标记大量对象(例如一群人)。此外,还为每个对象提供了一个封闭的边界框(框坐标是从左上角的图像角度测量的,并且是0索引的)。最后,注解结构的类别字段存储了类别ID到类别和超类别名称的映射。 See also theDetection Challenge.
{
"info": #info信息
{ #数据集信息
"description": "COCO 2014 Dataset", # 描述
"url": "http://cocodataset.org", # 链接
"version": "1.0", # 版本
"year": 2014, # 年份
"contributor": "COCO Consortium", # 贡献者
"date_created": "2017/09/01" # 创建日期
},
"images": #图片信息,数组包含了多张图像
[ { #每张图像的具体信息
"license": 5,
"file_name": "COCO_train2014_000000057870.jpg",
"coco_url": "http://images.cocodataset.org/train2014/COCO_train2014_000000057870.jpg",
"height": 480,
"width": 640,
"date_captured": "2013-11-14 16:28:13",
"flickr_url": "http://farm4.staticflickr.com/3153/2970773875_164f0c0b83_z.jpg",
"id": 57870