目录
一.Coco标注数据介绍
1. Json detection标签文件解读
coco数据集的所有标注信息包含在一个json文件中,json文件中以字典格式保存信息. 总的json文件中有五类信息: info. licenses. images. annotations. categories .
我们主要关注后三类信息, 即图片的基本信息(name, height,width) ,每张图片的标注bbox和bbox的类别(category_id),以及总的类别id对应名称.
{ #image:图片信息 annotations:标注数据,categories:类别信息
#---------------------------------------------------
"info":info,
"licenses": [licenses],
"images":["file_name": "000000037777.jpg",
"height": 230,"width": 352,
"id": 37777]
"annotations":["image_id":289343,
#[xmin,ymin,width,height]
"bbox": [473.07,395.93,38.65,28.67],
"category_id": 18,"id": 1768],
"categories":[{"person","id": 1},
{"id": 17,"name": "cat"},
{"id": 18,"name": "dog"}]
}
2.代码读取json文件:
import json
annotate_path = "/home/wtj/Data/Coco2017/annotations/instances_trai