COCO Dataset Format
COCO에는 object detection, keypoint detection, stuff segmentation, panoptic segmentation, densepose, image captioning 과 같은 여러 주석 유형이 있습니다.
주석은 JSON 을 사용하여 저장됩니다.
Basic data structure
모든 Annotation은 아래의 기본 데이터 구조를 공유합니다.
{
"info": info,
"images": [image],
"annotations": [annotation],
"licenses": [license]
}
info {
"year": int,
"version": str,
"description": str,
"contributor": str,
"url": str,
"date_created": datetime,
}
image {
"id": int,
"width": int,
"height": int,
"file_name": str,
"license": int,
"flickr_url": str,
"coco_url": str,
"date_captured": datetime,
}
license {
"id": int,
"name": str,
"url": str,
}
Object Detection
각 "Object Instance Annotation"은 객체의 "Category ID"및 "Segmentation Mask"를 포함한 일련의 필드가 포함됩니다.
"Segmentation Format"은 인스턴스가
- 단일 개체 (폴리곤이 사용되는 경우
iscrowd=0
) 또는 - 개체 모음 (#RLE가 사용되는 경우
iscrowd=1
)
을 나타내는지 여부에 따라 다릅니다.
- 단일 개체(
iscrowd=0
)는 예를 들어 가려진 경우 여러 다각형이 필요할 수 있습니다. - 군중 주석(
iscrowd=1
)은 대규모 개체 그룹(예: 군중)에 레이블을 지정하는 데 사용됩니다.
또한 각 객체에 대해 둘러싸는 경계 상자가 제공됩니다(상자 좌표계는 이미지의 왼쪽 상단 모서리에서 측정되며 0으로 측정됩니다).
마지막으로 주석 구조의 범주 필드는 범주 및 상위 범주(Supercategory) 이름에 대한 "Category ID"의 매핑을 저장합니다.
annotation {
"id" : int,
"image_id" : int,
"category_id" : int,
"segmentation" : RLE or [polygon],
"area" : float,
"bbox" : [x,y,width,height],
"iscrowd" : 0 or 1,
}
categories [
{
"id" : int,
"name" : str,
"supercategory" : str,
}
]
Sample
{
"images": [
{
"height": 1088,
"width": 1920,
"id": 1,
"file_name": "scene00706.png"
}
],
"annotations": [
{
"iscrowd": 0,
"image_id": 1,
"bbox": [
1524,
812,
60,
41
],
"segmentation": [
[
1564,
815,
1559,
824,
1548,
831,
1538,
832,
1525,
834,
1524,
843,
1532,
848,
1550,
852,
1565,
850,
1583,
839,
1584,
828,
1580,
817,
1575,
811
]
],
"category_id": 0,
"id": 1,
"area": 1378
}
],
"categories": [
{
"id": 0,
"name": "smoke",
"supercategory": "smoke"
}
]
}
area
It means Segmentation Area.
You can use mask.area function to compute it.
Projects
- labelme2coco
- labelme 포맷을 coco dataset format으로 변환하기 위한 경량 패키지입니다.
- https://github.com/fcakyon/labelme2coco
From labelme
- https://github.com/fcakyon/labelme2coco/blob/master/labelme2coco/labelme2coco.py
- https://github.com/wkentaro/labelme/blob/1d6ea6951c025a7db0540c7eac77577bc1507efa/labelme/utils/image.py
- https://github.com/wkentaro/labelme/blob/1d6ea6951c025a7db0540c7eac77577bc1507efa/labelme/cli/draw_json.py