본문 바로가기
공부이야기/인공지능

SSD 학습 데이터 준비

by Kim-D 2020. 4. 21.

. COCO dataset

이미지파일, 이미지에 대한 설명 텍스트/이미지에 있는 Object들의 category,box,mask/사람 자세 데이터 json 파일로 구성

. instances json 파일(Object들의 category, box, mask)

info, licenses, images, annotations, categories 로 구성.

"info": {
   "description": "COCO 2017 Dataset",
   "url": "http://cocodataset.org",
   "version": "1.0",
   "year": 2017,
   "contributor": "COCO Consortium",
   "date_created": "2017/09/01"
}
"licenses": [
   {
      "url": "http://creativecommons.org/licenses/by-nc-sa/2.0/",
      "id": 1,
      "name": "Attribution-NonCommercial-ShareAlike License"
    }

images 에 있는 이미지 id 를 key 값으로 annotations 에서 image_id 값과 같은 항목 수가 해당 이미지의 Detection 된 Object 수 임.

"images": [
   {
     "license": 4,
     "file_name": "000000397133.jpg",
     "coco_url": "http://images.cocodataset.org/val2017/000000397133.jpg",
     "height": 427,
     "width": 640,
     "date_captured": "2013-11-14 17:02:52",
     "flickr_url": "http://farm7.staticflickr.com/6116/6255196340_da26cf2c9e_z.jpg",
     "id": 397133
   }
    ...  
]
"annotations": [
   {  //Object 에 대한 mask 정보
      "segmentation": [
        [
          510.66,
          423.01,
          511.72,
          420.03,
          510.45,
          416,
          510.34,
          413.02,
          510.77,
          410.26,
          510.77,
          407.5,
          510.34,
          405.16,
          511.51,
          402.83,
          511.41,
          400.49,
          510.24,
          398.16,
          509.39,
          397.31,
          504.61,
          399.22,
          502.17,
          399.64,
          500.89,
          401.66,
          500.47,
          402.08,
          499.09,
          401.87,
          495.79,
          401.98,
          490.59,
          401.77,
          488.79,
          401.77,
          485.39,
          398.58,
          483.9,
          397.31,
          481.56,
          396.35,
          478.48,
          395.93,
          476.68,
          396.03,
          475.4,
          396.77,
          473.92,
          398.79,
          473.28,
          399.96,
          473.49,
          401.87,
          474.56,
          403.47,
          473.07,
          405.59,
          473.39,
          407.71,
          476.68,
          409.41,
          479.23,
          409.73,
          481.56,
          410.69,
          480.4,
          411.85,
          481.35,
          414.93,
          479.86,
          418.65,
          477.32,
          420.03,
          476.04,
          422.58,
          479.02,
          422.58,
          480.29,
          423.01,
          483.79,
          419.93,
          486.66,
          416.21,
          490.06,
          415.57,
          492.18,
          416.85,
          491.65,
          420.24,
          492.82,
          422.9,
          493.56,
          424.39,
          496.43,
          424.6,
          498.02,
          423.01,
          498.13,
          421.31,
          497.07,
          420.03,
          497.07,
          415.15,
          496.33,
          414.51,
          501.1,
          411.96,
          502.06,
          411.32,
          503.02,
          415.04,
          503.33,
          418.12,
          501.1,
          420.24,
          498.98,
          421.63,
          500.47,
          424.39,
          505.03,
          423.32,
          506.2,
          421.31,
          507.69,
          419.5,
          506.31,
          423.32,
          510.03,
          423.01,
          510.45,
          423.01
        ]
      ],
      "area": 702.1057499999998,
      "iscrowd": 0,
      "image_id": 289343, //images 에 있는 id 값과 동일
      "bbox": [ //object가 포함 된 사각형 정보
        473.07,
        395.93,
        38.65,
        28.67
      ],
      "category_id": 18,  // categories 의 id
      "id": 1768
   }
   ...
]

annotations 의 category_id 를 key 값으로 categories 에서 같은 id 를 찾아 name(category name) 을 표시.

"categories": [
    {
      "supercategory": "person",
      "id": 1,
      "name": "person"
    }
    ...
]

. SSD 이미지 Object Detection 결과(ssd_keras)

Predicted boxes:
  class conf  xmin    ymin    xmax     ymax
[[ 1.     0.76 252.87 44.39  301.98  304.61]
 [ 1.     0.75 105.88 153.96 168.86  299.62]
 [ 1.     0.72 164.92  61.64  248.29  289.15]
 [ 1.     0.71   40.1    145.49  102.82 298.17]
 [ 1.     0.63 83.93   30.45   135.25  207.3 ]
 [ 1.     0.52 136.48  32.48  163.87   90.7 ]]

. SSD 학습 시 사용하는 COCO Dataset ??