【MaskRCNN】CoCo数据简单介绍

使用json直接load查看

使用debug,对json文件进行查看。 

import os
import json

json_file = r'E:\data\coco2014\annotations\instances_minival2014.json'
val=json.load(open(json_file, 'r'))
print("end")

具体查看的结果如下:

从上图中可以看出共有4个list,分别是annotations,categories,images,licenses和一个dict,是info。下面分别查看这几个数据。

annotations

第一条数据具体形式如下:

<class 'dict'>: {'id': 156, 'area': 2765.1486500000005, 'image_id': 558840, 'category_id': 58, 'segmentation': [[239.97, 260.24, 222.04, 270.49, 199.84, 253.41, 213.5, 227.79, 259.62, 200.46, 274.13, 202.17, 277.55, 210.71, 249.37, 253.41, 237.41, 264.51, 242.54, 261.95, 228.87, 271.34]], 'bbox': [199.84, 200.46, 77.71, 70.88], 'iscrowd': 0}

categories

共有80类前景。

第一条数据形式如下:

<class 'dict'>: {'id': 1, 'name': 'person', 'supercategory': 'person'}

images

记录图像的相关信息。

第一条数据形式如下:

<class 'dict'>: {'id': 391895, 'date_captured': '2013-11-14 11:18:45', 'coco_url': 'http://images.cocodataset.org/val2014/COCO_val2014_000000391895.jpg', 'height': 360, 'flickr_url': 'http://farm9.staticflickr.com/8186/8119368305_4e622c8349_z.jpg', 'file_name': 'COCO_val2014_000000391895.jpg', 'license': 3, 'width': 640}

licenses

info

使用 https://github.com/cocodataset/cocoapi

from pycocotools.coco import COCO
json_file = r'E:\data\coco2014\annotations\instances_minival2014.json'
coco = COCO(json_file)

anns

和上面的annotations是一样的。

{'segmentation': [[239.97, 260.24, 222.04, 270.49, 199.84, 253.41, 213.5, 227.79, 259.62, 200.46, 274.13, 202.17, 277.55, 210.71, 249.37, 253.41, 237.41, 264.51, 242.54, 261.95, 228.87, 271.34]], 'area': 2765.1486500000005, 'iscrowd': 0, 'image_id': 558840, 'bbox': [199.84, 200.46, 77.71, 70.88], 'category_id': 58, 'id': 156}

包括分割边界segmentation,面积area,拥挤程度iscrowd,图像id是image_id,边界框bbox,类别种类category_id,标签id是id(这个id表示所有图片一共有多少目标,然后给每个目标进行编号,这就是每个目标的唯一标识码)

catToImg

包含有多少类别,比如上图所示,含有第58类的数据图片id有2918条。

cats

{'supercategory': 'person', 'id': 1, 'name': 'person'}

类别的英文名supercategory,类别的id即“id”,类别的名字为name。

dataset

dataset中包含info,license,images,annotations,categories,这5个就是上面使用json的load方法读取的。

imgToAnnos

每个图像中包含哪些目标物体,当中包含了目标物体的详细信息。

imgs

imgs中就包含了图像的图像id,以及图像的位置,宽高等信息。

参考

https://zhuanlan.zhihu.com/p/29393415

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值