๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
TIL/Boostcamp AI tech

[Segmentation] COCO Dataset format & EDA & Metric

by seowit 2021. 10. 19.

๐Ÿ“Œ์žฌํ™œ์šฉ ์“ฐ๋ ˆ๊ธฐ ๊ด€๋ จ ์ด๋ฏธ์ง€ ์ถœ์ฒ˜ : CC BY 2.0

 

Creative Commons — ์ €์ž‘์žํ‘œ์‹œ 2.0 ๋Œ€ํ•œ๋ฏผ๊ตญ — CC BY 2.0 KR

This content is freely available under simple legal terms because of Creative Commons, a non-profit that survives on donations. If you love this content, and love that it's free for everyone, please consider a donation to support our work. When you share,

creativecommons.org


1. COCO Dataset

COCO format

COCO Dataset์˜ ๊ฐ๊ฐ์˜ image ์˜ annotation ๊ฐ’์€ train json ํŒŒ์ผ์— ์กด์žฌ

train.json

  • “info”์—๋Š” dataset ์— ๋Œ€ํ•œ high level ์˜ ์ •๋ณด๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์Œ
  • “licenses”์—๋Š” image ์˜ license ๋ชฉ๋ก์ด ํฌํ•จ๋˜์–ด ์žˆ์Œ
  • “images”์— dataset ์˜ image ๋ชฉ๋ก ๋ฐ ๊ฐ๊ฐ์˜ width, heigh, file_name, id(image_id) ๋“ฑ์„ ํฌํ•จ
  • “categories”์—๋Š” class ์— ํ•ด๋‹นํ•˜๋Š” id, name ๋ฐ supercategory ๊ฐ€ ํฌํ•จ๋ผ ์žˆ์Œ
  • “segmentation" ์—๋Š” ๊ฐ class ์— ํ•ด๋‹น๋˜๋Š” pixel ์˜ x, y ์ขŒํ‘œ๋“ค์ด ํฌํ•จ๋˜์–ด ์žˆ์Œ
    • ์ด๋ฏธ์ง€ ์ถœ์ฒ˜ : CC BY 2.0

 

Dataloader

โœ” Shape

  • Shape of images : (batch, 3, height, width)
  • Shape of targets : (batch, height, width)

โœ” CustomDataloader

  • data_dir : dataset path(e.g. train.json)
  • mode : dataset์˜ ์šฉ๋„๊ฐ€ train์ธ์ง€ test์ธ์ง€ ๋ถ„๊ธฐ
    • mode = train : (images, masks, image_infos)
    • mode = test : (images, image_infos) 
  • transform : image size ์กฐ์ ˆ ๋ฐ data format ๋ณ€ํ™˜ ๋“ฑ์˜ ์ „์ฒ˜๋ฆฌ ์ž‘์—…
    • albumentation ์˜ ToTensorV2() : numpy ์˜ HWC ์ˆœ์„œ๋ฅผ CHW ์ˆœ์„œ๋กœ ๋ณ€ํ™˜  

 

2. EDA

Image ๋ถ„์„

์›๋ณธ๊ณผ segmentation overlay๋œ ์ด๋ฏธ์ง€ ๋ฏธ๋ฆฌ๋ณด๊ธฐ

plastic bag

Class ๋ถ„์„

์ด๋ฏธ์ง€ ํ•˜๋‚˜์— ๋“ฑ์žฅํ•˜๋Š” object ๊ฐœ์ˆ˜ : ์ฃผ๋กœ 1๊ฐœ์—์„œ 9๊ฐœ๊นŒ์ง€ ๋ถ„ํฌ

 

๊ฐ€์„ค ๊ฒ€์ •

  • Plastic๊ณผ Plastic bag๋Š” ๋”ฐ๋กœ ๋ผ๋ฒจ๋ง ๋˜์–ด ์žˆ์„๊นŒ? → NO
  • Plastic bag ๋‚ด๋ถ€์˜ ์žฌํ™œ์šฉ๋„ ๋ผ๋ฒจ๋ง ๋˜์–ด ์žˆ์„๊นŒ? → NO
  • ๋ฐฐ๊ฒฝ์ด Paper bag ์ธ๊ฑด ์–ด๋–ป๊ฒŒ ์•Œ ์ˆ˜ ์žˆ์„๊นŒ?
  • ๋งค์šฐ ์ž‘์€ ํฌ๊ธฐ์˜ Object์— ๋Œ€ํ•ด์„œ๋„ ๋ ˆ์ด๋ธ”๋ง ๋œ ๊ฒฝ์šฐ
  • ์žฌํ™œ์šฉ ์“ฐ๋ ˆ๊ธฐ๊ฐ€ ์•„๋‹Œ ๋ถ€๋ถ„์ด ๊ฒน์ณ์„œ ํ•˜๋‚˜๋กœ ๋ ˆ์ด๋ธ”๋ง ๋œ ๊ฒฝ์šฐ

3. ํ‰๊ฐ€ Metric

miou

 

๋Œ“๊ธ€