DataSet

  • COCO json--person_keypoints
    • person_keypoins.json 结构
    • one image
    • person_keypoint.json
    • keypoint
    • Display above image(ID=391895) label

COCO json–person_keypoints

person_keypoins.json 结构


“info”, “licenses”,"categories"全局通用
“images”跟“annotations”放着图片跟label信息,用image id匹配。
具体结构请看下文:

one image

person_keypoint.json

{"categories": [{"skeleton": [[16,14],[14,12],[17, 5],[15,13],[12,13],[6 ,12],[7 ,13],[6 , 7],[6 , 8],[7 , 9],[8 ,10],[9 ,11],[2 , 3],[1 , 2],[1 , 3],[2 , 4],[3 , 5],[4 , 6],[5 , 7]],"name": "person", # 子类(具体类别)"supercategory": "person", # 主类"id": 1, # class id"keypoints": ["nose","left_eye","right_eye","left_ear","right_ear","left_shoulder","right_shoulder","left_elbow","right_elbow","left_wrist","right_wrist","left_hip","right_hip","left_knee","right_knee","left_ankle","right_ankle"]}],"licenses": [{"id": 1,"name": "Attribution-NonCommercial-ShareAlike License","url": "http://creativecommons.org/licenses/by-nc-sa/2.0/"},{"id": 2,"name": "Attribution-NonCommercial License","url": "http://creativecommons.org/licenses/by-nc/2.0/"},{"id": 3,"name": "Attribution-NonCommercial-NoDerivs License","url": "http://creativecommons.org/licenses/by-nc-nd/2.0/"},{"id": 4,"name": "Attribution License","url": "http://creativecommons.org/licenses/by/2.0/"},{"id": 5,"name": "Attribution-ShareAlike License","url": "http://creativecommons.org/licenses/by-sa/2.0/"},{"id": 6,"name": "Attribution-NoDerivs License","url": "http://creativecommons.org/licenses/by-nd/2.0/"},{"id": 7,"name": "No known copyright restrictions","url": "http://flickr.com/commons/usage/"},{"id": 8,"name": "United States Government Work","url": "http://www.usa.gov/copyright.shtml"}],"annotations": [{"iscrowd": 0,"bbox": [339.88, 22.16, 153.88, 300.73 # [x,y,w,h] 对象定位框],"image_id": 391895, # match the images: "id" "segmentation": [[352.55, 146.82, # 多边形(对象mask)第一个点 x,y, 如果对象被遮挡,对象被分成多个区域353.61, 137.66,356.07, 112.66,......353.61, 152.25,353.26, 149.43],[450.45, 196.54,461.71, 195.13,466.29, 209.22,......449.04, 229.57,448.33, 199.29]],"num_keypoints": 14,"id": 202758,"category_id": 1, "keypoints": [# 如果关键点在物体segment内,则认为可见.# v=0 表示这个关键点没有标注(这种情况下x=y=v=0)# v=1 表示这个关键点标注了但是不可见(被遮挡了)# v=2 表示这个关键点标注了同时也可见368,  61,   1,369,  52,   2,0,     0,   0,382,  48,   2,0,     0,   0,368,  84,   2,435,  81,   2,362, 125,   2,446, 125,   2,360, 153,   2,0,     0,   0,397, 167,   1,439, 166,   1,369, 193,   2,461, 234,   2,361, 246,   2,474, 287,   2],"area": 14107.2713},{"iscrowd": 0,"bbox": [471.64,172.82,35.92,48.1],"image_id": 391895,"segmentation": [[477.41, 217.71,475.06, 212.15,......478.27, 218.57]],"num_keypoints": 0,"id": 1260346,"category_id": 1,"keypoints": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"area": 708.26055}],"images": [{"id": 391895, # match the annotations: "image_id" "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}],"info": {"version": "1.0","description": "COCO 2014 Dataset","year": 2014,"contributor": "COCO Consortium","url": "http://cocodataset.org","date_created": "2017/09/01"}
}

keypoint

“keypoints”是长度为3K的数组,K是对某类定义的关键点总数,这里人体的keypoint就是17个.位置为[x,y],关键点可见性v.
(1-‘nose’ 2-‘left_eye’ 3-‘right_eye’ 4-‘left_ear’ 5-‘right_ear’ 6-‘left_shoulder’ 7-‘right_shoulder’ 8-‘left_elbow’ -‘right_elbow’ 10-‘left_wrist’ 11-‘right_wrist’ 12-‘left_hip’ 13-‘right_hip’ 14-‘left_knee’ 15-‘right_knee’ 16-‘left_ankle’ 17-‘right_ankle’ )

OpenPose的姿态识别用了COCO数据库,coco有17个keypoint, OpenPose增加了一个, 用两侧肩膀生成一个中心点代表脖子,就是如下图openpose编号为1的人体中心点.

Display above image(ID=391895) label

# -*- coding:utf-8 -*-from __future__ import print_function
from pycocotools.coco import COCO
import os, sys, zipfile
import shutil
import numpy as np
import skimage.io as io
import matplotlib.pyplot as plt
import pylab
pylab.rcParams['figure.figsize'] = (8.0, 10.0)annFile='./pickOne_person_keypoints_2014_.json'
coco=COCO(annFile)# display COCO categories and supercategories
cats = coco.loadCats(coco.getCatIds())
nms=[cat['name'] for cat in cats]
print('COCO categories: \n{}\n'.format(' '.join(nms)))nms = set([cat['supercategory'] for cat in cats])
print('COCO supercategories: \n{}'.format(' '.join(nms)))imgIds = coco.getImgIds(imgIds = [391895])
# imgIds = coco.getImgIds()
img = coco.loadImgs(imgIds[0])[0]
dataDir = '../data/mscoco2014'
dataType = 'val2014'
I = io.imread('%s/%s/%s'%(dataDir,dataType,img['file_name']))plt.axis('off')
plt.imshow(I)
plt.show()# load and display instance annotations
# 加载实例掩膜
# catIds = coco.getCatIds(catNms=['person','dog','skateboard']);
# catIds=coco.getCatIds()
catIds=[]
for ann in coco.dataset['annotations']:if ann['image_id']==imgIds[0]:catIds.append(ann['category_id'])plt.imshow(I); plt.axis('off')
annIds = coco.getAnnIds(imgIds=img['id'], catIds=catIds, iscrowd=None)
anns = coco.loadAnns(annIds)
coco.showAnns(anns)# initialize COCO api for person keypoints annotations
annFile = '{}/annotations/person_keypoints_{}.json'.format(dataDir,dataType)
coco_kps=COCO(annFile)# load and display keypoints annotations
# 加载肢体关键点
plt.imshow(I); plt.axis('off')
ax = plt.gca()
annIds = coco_kps.getAnnIds(imgIds=img['id'], catIds=catIds, iscrowd=None)
anns = coco_kps.loadAnns(annIds)
coco_kps.showAnns(anns)# initialize COCO api for caption annotations
annFile = '{}/annotations/captions_{}.json'.format(dataDir,dataType)
coco_caps=COCO(annFile)# load and display caption annotations
# 加载文本描述
annIds = coco_caps.getAnnIds(imgIds=img['id']);
anns = coco_caps.loadAnns(annIds)
coco_caps.showAnns(anns)
plt.imshow(I); plt.axis('off'); plt.show()

original image

segment & kepoints

caption annotations
A man with a red helmet on a small moped on a dirt road.
Man riding a motor bike on a dirt road on the countryside.
A man riding on the back of a motorcycle.
A dirt path with a young person on a motor bike rests to the foreground of a verdant area with a bridge and a background of cloud-wreathed mountains.
A man in a red shirt and a red hat is on a motorcycle on a hill side.

git: https://github.com/Frizy-up/openpose-plus/tree/master

COCO Dataset person_keypoints.json 解析相关推荐

  1. MS COCO数据集标注格式解析

    COCO是微软提供的一个图像识别的数据集.其中包括3个tasks,分别是object instances, object keypoints, 和image captions,存储格式为JSON. 基 ...

  2. json解析和字符串解析_高效创建和解析定界字符串

    json解析和字符串解析 描述 (Description) Converting a delimited string into a dataset or transforming it into u ...

  3. JsonHelper Json转xml,Json转DataSet,DataSet转Json

    2019独角兽企业重金招聘Python工程师标准>>> using System; using System.Collections.Generic; using System.Da ...

  4. android Json解析详解

    JSON的定义: 一种轻量级的数据交换格式,具有良好的可读和便于快速编写的特性.业内主流技术为其提供了完整的解决方案(有点类似于正则表达式 ,获得了当今大部分语 言的支持),从而可以在不同平台间进行数 ...

  5. json解析:[1]gson解析json

    客户端与服务器进行数据交互时,常常需要将数据在服务器端将数据转化成字符串并在客户端对json数据进行解析生成对象.但是用jsonObject和jsonArray解析相对麻烦.利用Gson和阿里的fas ...

  6. spring boot2 修改默认json解析器Jackson为fastjson

    fastjson是阿里出的,尽管近年fasjson爆出过几次严重漏洞,但是平心而论,fastjson的性能的确很有优势,尤其是大数据量时的性能优势,所以fastjson依然是我们的首选:spring ...

  7. 安卓取map集合转换为json_android json解析成map格式

    "discount": { "3": "34", "4": "33", "5": ...

  8. 关于浮点数的json解析

    近期在工作中遇到个问题 通过post请求从其他系统(好像是C#写的)获得json字符串 {"geometry":{"rings":[[[40426489.331 ...

  9. Android Json解析方法

    为什么80%的码农都做不了架构师?>>>    关于Json Json:JavaScript Object Notation Json数据是一系列的键值对集合,相对XML体积小 Js ...

最新文章

  1. 【agc019F】Yes or No
  2. 公布自己的pods到CocoaPods trunk 及问题记录
  3. An error was encountered while running(Domain=LaunchSerivcesError, Code=0)
  4. static变量的作用(转)
  5. 05mycat父子表
  6. docker启动nginx代理不上_用 docker-compose 启动 nginx, network 为 host, nginx 无法启动是怎么回事?...
  7. 【交换机在江湖】第十章 接口配置锦囊妙计之二----端口隔离
  8. 教你快速填充Excel中不同的数据,别再一个个向下拉动啦
  9. TCP、UDP、CoAP、LwM2M、MQTT简单对比
  10. Java版Spring Cloud B2B2C o2o鸿鹄云商平台--概述
  11. 用 Code 改变世界 —— 阿里百川 Hackathon 回顾
  12. linux 解压zip文件到指定文件夹,Linux解压文件到指定目录
  13. 软件工程之项目团队分工
  14. PHP 百度图片搜索功能API接口开发
  15. linux gcc strip命令简介
  16. 详细了解JS Map,它和传统对象有什么区别?
  17. 回顾2018年圆齿轮流量计行业发展现状
  18. vue echarts使用教程
  19. java 微信 百度地图_[Java教程]H5微信通过百度地图API实现导航方式二
  20. linux脚本获取经纬度,我想在命令行上获得linux设备的精确经纬度。就像HTML5中的地理定位。我的眉毛没法接触...

热门文章

  1. 2022年茶艺师(中级)上岗证题库及答案
  2. Redis:EVAL执行Lua脚本
  3. 自动动锁螺丝机程序采用显控触摸屏加三菱FX3GA或者FX3U , 用PLC变址寄存器做配方,用D1000-D7999存储数据
  4. 量子计算机和光计算,杂谈|是量子计算,还是光学实验?
  5. 域名一定需要备案吗?什么情况下不用备案?
  6. 关于 .bashrc
  7. 金和C6协同办公中对用户密码的处理
  8. Microsoft Data Access Components (MDAC) 2.8
  9. ROS msg srv
  10. 黑苹果安装EP-DB1608无线网卡驱动