짧은하루

coco dataset 기본 형식, bounding box 정보 본문

Study/Dataset

coco dataset 기본 형식, bounding box 정보

짧은하루 2020. 11. 12. 15:09

이미지 데이터를 다루다보니 coco dataset을 자주 보게 되어 간단하게 포스팅해봅니다.

 

COCO Dataset이란?

coco 데이터셋은 object detection, segmentation, and keypoint detection 분야의 연구나 대회에서 자주 사용되는 데이터 셋입니다. 이미지 파일과 annotation 파일을 제공하며 큰 규모의 데이터를 가지고 있습니다.

 

coco image example

 

데이터 형식

coco dataset의 annotation 파일은 기본 구조분야별 형식을 더한 형태로 구성되어 있습니다.

object detection, segmentation, and keypoint detection 등 분야에 따라 정해진 형식을 사용하고 있으며 이렇게 표준화된 형식은 코드의 호환성 부분에서 큰 이점을 제공합니다. 아래는 분야에 상관없이 항상 가지고 있는 기본 구조입니다.

{
"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 dection 분야라면 기본 구조에 아래의 형식을 추가적으로 가진다고 보면 됩니다.

(참고:  bbox의 원점은 좌상단입니다)

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,
}]

 


 

모델을 학습시키기 위해서 각 데이터 셋의 annotation파일이 어떻게 구성되어있는지 아는 것은 중요한 일입니다.

coco dataset의 keypoint detection 등 다른 분야의 형식이 궁금하다면 https://cocodataset.org/#format-data 페이지를 참고해주세요.

 

coco dataset을 더 공부하고 싶다면 Create COCO Annotations From Scratch(https://www.immersivelimit.com/tutorials/create-coco-annotations-from-scratch/#previewing-coco-annotations)도 추천 드립니다.

 

반응형
Comments