标准COCO格式json文件内容

本文所描述的coco格式为标准coco数据集里的object instances格式,coco格式的基本信息描述如下:

{
    
    
    "info": info,                   #描述数据集的相关信息,内部由字典组成
    "licenses": [license],          #列表形式,内部由字典组成
    "images": [image],              #描述图片信息,列表形式,内部由字典组成,字典数量为图片数量
    "annotations": [annotation],    #描述bounding box信息列表形式,内部由字典组成,字典数量为bounding box数量
     "categories": [category]       # 描述图片类别信息,列表形式 ,内部由字典组成,字典数量为类别个数
}

coco标注文件的格式为.json文件,且所有图片的标注信息在一个.json文件里,该json文件由上面描述的字典组成,该字典有五个key,其中coco的坐标信息为(xmin,ymin,w,h),(xmin,ymin)表示标注框的左上角坐标,这四个值都是绝对值,下面将描述每个key对应value的详细信息:

info{
    
    
    "year": int,               #年份
    "version": str,            #数据集版本
    "description": str,        #数据集描述
    "contributor": str,        #数据集的提供者
    "url": str,                #数据集的下载地址
    "date_created": datetime,  #数据集的创建日期
}
license{
    
                         
    "id": int,
    "name": str,
    "url": str,
} 
image{
    
    
    "id": int,                    #图片标识,相当于图片的身份证
    "width": int,                 #图片宽度
    "height": int,                #图片高度
    "file_name": str,             #图片名称,注意不是图片的路径,仅仅是名称
    "license": int,
    "flickr_url": str,            #flicker网络地址
    "coco_url": str,              #网络地址路径
    "date_captured": datetime,    #图片获取日期 
}
annotation{
    
     
    "id": int,                                #bounding box标识,相当于bounding box身份证
    "image_id": int,                          #图片标识,和image中的"id"对应
    "category_id": int,                       #类别id
    "segmentation": RLE or [polygon],         #描述分割信息,iscrowd=0,则segmentation是polygon格式;iscrowd=1,则segmentation就是RLE格式
    "area": float,                            #标注框面积
    "bbox": [x,y,width,height],               #标注框坐标信息,前文有描述
    "iscrowd": 0 or 1,                        #是否有遮挡,无遮挡为0,有遮挡为1
}
category{
    
    
    "id": int,                                #类别id,注意从1开始,而不是从0开始
    "name": str,                              #类别名称
    "supercategory": str,                     #该类别的超类
}

猜你喜欢

转载自blog.csdn.net/qq_34972053/article/details/130622204
今日推荐