1.分析COCO标注数据
使用pycocotools读取文件
COCO
cocoapi/PythonAPI/pycocotools/coco.py /
from pycocotools.coco import COCO
import pandas as pd
ann_file = './xxx.json'
annotation = COCO(annotation_file=ann_file)
annotation.dataset #所有数据
annotation.anns#标注
annotation.cats#类别
annotation.imgs#图片
2.分析DataFrame数据
转换为dataframe,使用head()查看示例数据,默认值为5,可指定显示数量
ann_label = pd.DataFrame(annotation.anns.values())
ann_label.head()
ann_label.head(1)