Recent Posts
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Today
Total
관리 메뉴

코드민수

[MS COCO] COCO annotation 포맷 본문

[기타]

[MS COCO] COCO annotation 포맷

코드민수 2023. 5. 12. 14:05
BIG
{
    "images": [image],
    "annotations": [annotation],
    "categories": [category]
}

image = {
    "id": int,
    "width": int,
    "height": int,
    "file_name": str,
}

annotation = {
    "id": int,
    "image_id": int,
    "category_id": int,
    "segmentation": RLE or [polygon],
    "area": float,
    "bbox": [x,y,width,height], # (x, y) are the coordinates of the upper left corner of the bbox
    "iscrowd": 0 or 1,
}

categories = [{
    "id": int,
    "name": str,
    "supercategory": str,
}]

Object Detection 관련 모델은 대부분 COCO 데이터셋 포맷을 지원하기 때문에

 

Custom Dataset 사용 시 바운딩 박스 레이블을 COCO 포맷으로 변경해줄 필요가 있습니다.

 

처음 포맷을 찾아볼 때 bbox의 x, y를 x center, y center 좌표로 설명한 블로그 글을 보고

 

시행착오를 겪으면서 시간 낭비를 했어서 따로 정리해둡니다.

 

https://mmdetection.readthedocs.io/en/latest/user_guides/train.html#train-with-customized-datasets

 

Train predefined models on standard datasets — MMDetection 3.0.0 documentation

Train predefined models on standard datasets MMDetection also provides out-of-the-box tools for training detection models. This section will show how to train predefined models (under configs) on standard datasets i.e. COCO. Prepare datasets Training requi

mmdetection.readthedocs.io

위 json 스크립트는 mmdetection의 가이드 문서에서 발췌하였습니다.

LIST