-
SSD: Single-Shot Multibox DetectorAI\ML\DL/๋ ผ๋ฌธ ๋ฆฌ๋ทฐ 2023. 8. 24. 23:30๋ฐ์ํ
๏นก
<Motivation>
R-CNN ๊ณ์ด์ 2-stage detector๋ region proposal ๊ณผ ๊ฐ์ ๋ค์ํ view๋ฅผ ๋ชจ๋ธ์ ์ ๊ณตํ์ฌ ๋์ ์ ํ๋๋ฅผ ๋ณด์ฌ์ฃผ์๋ค.
ํ์ง๋ง region proposal์ ์ถ์ถํ๊ณ ์ด๋ฅผ ์ฒ๋ฆฌํ๋ ๊ณผ์ ์์ ๋ง์ ์๊ฐ์ด ๊ฑธ๋ ค detection ์๋๊ฐ ๋๋ฆฌ๋ค๋ ๋จ์ ์ด ์๋ค.
YOLO v1 ์ ์๋ณธ ์ด๋ฏธ์ง ์ ์ฒด๋ฅผ ํตํฉ๋ ๋คํธ์ํฌ๋ก ์ฒ๋ฆฌํ๊ธฐ ๋๋ฌธ์ detection ์๋๊ฐ ๋งค์ฐ ๋น ๋ฅด๋ค. ํ์ง๋ง grid cell ๋ณ๋ก 2๊ฐ์ bounding box ๋ง์ ์ ํํ์ฌ ์๋์ ์ผ๋ก ์ ์ view ๋ฅผ ๋ชจ๋ธ์ ์ ๊ณตํ์ฌ ์ ํ๋๊ฐ ๋จ์ด์ง๋ค.
์ด๋ฌํ ์ ํ๋์ detection ์๋์ trade-off ๊ด๊ณ๋ฅผ ์ํํ ๋ชจ๋ธ์ด SSD ์ด๋ค.
SSD ๋ ๋ค์ํ view๋ฅผ ํ์ฉํ๋ฉด์ ํตํฉ๋ single deep neural network ๊ตฌ์กฐ๋ฅผ ๊ฐ์ง 1-stage detector๋ก์ ๋์ ์ ํ๋์ ๋น ๋ฅธ ์๋๋ฅผ ๊ฐ์ง๋ค.
Abstract
SSD discretizes the output space of bounding boxes into a set of default boxes over different aspect ratios and scales per feature map location(multiple feature map).
SSD ์๊ณ ๋ฆฌ์ฆ์ ํ ๋ฌธ์ฅ์ผ๋ก ์ ๋ฆฌํ๋ฉด ์์ ๊ฐ๋ค.
- SSD๋ ์ฌ๋ฌ ๊ฐ์ feature map ์ ํตํด default bounding box๋ฅผ ์ถ๋ ฅํ๋ค.
(default box ๋ YOLO์ Anchor box์ ๋น์ทํ ๊ฐ๋ )
- ๊ฐ Feature map์ ์๋ก ๋ค๋ฅธ ๋น์จ๊ณผ ํฌ๊ธฐ๋ฅผ ๊ฐ์ง Default box๋ฅผ ์์ฑํ๊ณ , ์ด๋ฅผ ํ์ฉํ์ฌ ๋ชจ๋ธ์ bounding box์ ์์น์ ํด๋์ค๋ฅผ ์์ธกํ๋ค. ์ด๋ฅผ ํตํด ๋ค์ํ ํฌ๊ธฐ์ ๋น์จ์ ๊ฐ์ง ๊ฐ์ฒด๋ค์ ํจ๊ณผ์ ์ผ๋ก ๊ฒ์ถํ ์ ์๊ฒ ๋๋ค.
feature map ๋ง๋ค ์์ฑ๋๋ ์๋ก ๋ค๋ฅธ ํฌ๊ธฐ์ ratio (์ข ํก๋น)์ default bounding box ๋ค. ํ์ต ๊ณผ์ ์์ default boxes ๋ฅผ ground truth boxes ์ ๋งค์นญ์ํจ๋ค. ๋น๊ต์ ์ผ๋ก ํฐ ๊ฐ์์ง๋ ๋ค์ ์๋ ์์ feature map ์์ ๋ฝ๊ณ , ๋น๊ต์ ์ผ๋ก ์์ ํฌ๊ธฐ์ ๊ณ ์์ด๋ ์์ชฝ์ ์๋ ํฐ feature map ์์ ๋ฝ๋๋ค. Yolo v1 ์ ๊ฐ์ ๊ฒฝ์ฐ ์ต์ข output์ผ๋ก ํ๋์ feature map ์ ์ถ๋ ฅํ๊ณ , feature map์ ๊ฐ grid cell ๋น 2๊ฐ์ bounding box๋ฅผ ์์ธกํ๋๋ฐ ๋นํด, SSD ๋ output ์ผ๋ก ์ฌ๋ฌ๊ฐ์ง์ feature map์ ์ถ๋ ฅํ๊ณ , ๊ฐ grid cell ๋น 6๊ฐ ํน์ 4๊ฐ์ ์ bounding box๋ฅผ ์์ธกํ๋ค.
์คํ ๊ฒฐ๊ณผ๋ ๊ฑธ๋ฆฐ ์๊ฐ๊ณผ ์ ํ๋์ ๋ํ ๋ถ์์ ํ์ ๋, PASCAL VOC, COCO, ILSVRC ๋ฐ์ดํฐ์ ์ผ๋ก Faster R-CNN, YOLO ๋๋น ์ ์ผ ์ฑ๋ฅ์ด ์ข์๋ค.
Model
๋ ผ๋ฌธ์ ๋์์๋ ๋ชจ๋ธ ๊ตฌ์กฐ๋ ๋ค์์ผ๋ก ๊ตฌ์ฑ๋๋ค.
1. Base convolution network
2. Auxiliary convolution network
์ ์ฒด ๋คํธ์ํฌ๋ pretrained ๋ VGG16์ base network๋ก ์ฌ์ฉํ๊ณ , ์ดํ ๋ณด์กฐ(auxiliary) network ๋ฅผ ์ถ๊ฐํ ๊ตฌ์กฐ๋ฅผ ๊ฐ์ง๊ณ ์๋ค.
Base Convolution Network
SSD๋ Base network ๋ก์ ImageNet ๋ฐ์ดํฐ์ ์ ์ฌ์ ํ์ต๋ VGG-16 ๋คํธ์ํฌ๋ฅผ ์ฌ์ฉํ๋ค.
์ดํ์ ๋์ค๋ auxiliary convolution network์ ์ฐ๊ฒฐํ ๋๋ VGG16 ํ๋ฐ๋ถ์ ๋ฑ์ฅํ๋ fc layer (FC6, FC7) ๋ฅผ conv layer๋ก ๋ฐ๊ฟ์ค๋ค. ์ด ๊ณผ์ ์์ fc layer ๊ฐ ์ ๊ฑฐ๋๋ฉด์ detection ์๋๊ฐ ํฅ์๋๋ ์ด์ ์ด ์๋ค.
Auxiliary Convolution Network
์ถ๊ฐ์ ์ธ convolution layer๋ฅผ ์ ์ฉ์์ผ์ฃผ๋ ๋ณด์กฐ ๋คํธ์ํฌ์์๋ ๊ณ์ pooling๊ณผ ํํฐ๋ฅผ ๊ฑฐ์น๋ฉด์ ์ฑ๋ ์๋ฅผ ์ ๋ฐ์ผ๋ก ์ค์ฌ๋๊ฐ๋ค.
์ด์ ๋์์ ์ค๊ฐ ์ค๊ฐ์ feature map ์์ ๊ณ์ bounding box ๋ฅผ ๋ฝ์๋ด๋๋ฐ, ์ด๊ฒ์ด SSD ์ ์ค์ํ ํน์ง ์ค ํ๋์ด๋ค.
๋ฐ๋ก ๋ค์ํ ํฌ๊ธฐ์ Feature map๋ค ์์ ์๋ก ๋ค๋ฅธ ๋น์จ(ratio) ์ ํฌ๊ธฐ(scale)์ ๊ฐ์ง bounding box๋ฅผ ์ฌ๋ฌ ๊ฐ ์์ฑํด ๋ธ๋ค๋ ์ ์ด๋ค.
์ด ๋ชจ๋ bounding box ์ ํ๋ณด๋ค์ 'default boxes'๋ผ๊ณ ๋ ํ๋ค.
์ต์ข ์ ์ผ๋ก ๋์ค๋ bounding box์ ๊ฐ์๋ 300x300 ์ ๋ ฅ ์ด๋ฏธ์ง ๊ธฐ์ค์ผ๋ก 8732 ๊ฐ๋ผ๊ณ ๋์์๋ค. (์์ ๋ชจ๋ธ ๊ทธ๋ฆผ ์ฐธ์กฐ)
BBox ๋ฅผ ์์ฑํ๋ Feature map ์ 6๊ฐ๊ฐ ์๋๋ฐ, 38x38, 19x19, 10x10, 5x5, 3x3, 1x1 ์ด ์๋ค.
๊ฐ feature map ์ผ๋ก๋ถํฐ conv ์ฐ์ฐ์ ํ์ฌ ์ฐ๋ฆฌ๊ฐ ์์ธกํ๊ณ ์ ํ๋ bounding box ์ class ์ ์๋ค๊ณผ, offset ์ ์ป๊ฒ ๋๋ค.
- class score: default box ๋ด์ ๊ฐ class ๊ฐ ์กด์ฌํ๋ ํ๋ฅ
- offset: default box์ x, y, w, h (์ด 4๊ฐ)
์ด๋ ์ปจ๋ณผ๋ฃจ์ kernel_size๋ 3x3 ์ด๊ณ , ํํฐ ์ฑ๋์ ํฌ๊ธฐ๋ ์์ฑํ BBox์ ๊ฐ์ $\times$ (class ๊ฐ์ + offset ๊ฐ์) ์ด๋ค.
๋ฐ๋ผ์ ๊ฐ feature map์ ์ปจ๋ณผ๋ฃจ์ ์ฐ์ฐ์ ํ ํํฐ ํฌ๊ธฐ๋ฅผ ์ ๋ฆฌํ๋ฉด ์๋์ ๊ฐ๋ค.
$$ 3\times 3\times (\textrm{the number of bounding box}\times (\textrm{class score}+\textrm{offset}))$$
๊ฐ feature map (=location) ์์๋ $k$ ๊ฐ์ bounding box ๋ฅผ ์์ฑํ๊ณ ,
๊ฐ bounding box๋ $c$๊ฐ์ class ์ ๋ํ softmax ํ๋ฅ ๊ฐ๊ณผ, default bounding box ์์ ์กฐ์ ํ ์์น๊ฐ์ธ offset (x, y, width, height) ๊ฐ 4๊ฐ๋ฅผ ์์ธกํ ์ ์๊ฒ ๋๋ค.
Q. ๊ทธ๋ ๋ค๋ฉด 19x19x1024 feature map ์ผ๋ก๋ถํฐ ์์ฑ๋๋ bounding box ์ ๊ฐ์๋ ์ด ๋ช ๊ฐ์ผ๊น?
19x19์ ํ์ด ํฌ๊ธฐ๋ฅผ ๊ฐ์ง๋ feature map ์์๋ grid cell๋ง๋ค 6๊ฐ์ bounding box ๊ฐ ์์ฑ๋๋ฏ๋ก,
19x19x1024 feature map ์ผ๋ก๋ถํฐ 19x19x6(=2166) ๊ฐ์ default box๊ฐ ์๊ธธ ๊ฒ์ด๋ค.
(ํ๋์ bounding box ๋ง๋ค 21(VOC2007 ๊ธฐ์ค)+4=25 ๊ฐ์ ๊ฐ์ด ์์ธก๋๋ค๊ณ ํ์ผ๋, 25 ์์ฒด๋ ํ๋์ bounding box๊ฐ ํฌํจํ๊ณ ์๋ํ๋ผ๋ฏธํฐ ๊ฐ์๋ก, ์์ฑ๋๋ bounding box ๊ฐ์์๋ ๊ด๋ จ์ด ์๋ค.)
๋ฐ๋ผ์ 38x38, 19x19, 10x10, 5x5, 3x3, 1x1 ์ด 6๊ฐ์ feature map ๊ฐ๊ฐ์์ ์์ธก๋ ๋ฐ์ด๋ฉ๋ฐ์ค์ ์ด ํฉ์ 8732๊ฐ ๋๋ ๊ฒ์ด๋ค.
์ด์ ๋ ์์ ์ด๋ฐ์ abstract ์์ ์ค๋ช ํ๋ Multiple feature map (location) ์์ ์๋ก ๋ค๋ฅธ ratio ์ scale์ ๊ฐ์ง๋ default bounding box ๋ฅผ ์์ฑํ๋ค๋ ๊ฒ์ ์๋ฏธ๋ฅผ ์ดํดํ ์ ์์ ๊ฒ์ด๋ค.
NMS (Non-Maximum suppression)
์ฌ๋ฌ feature map ์์ ์์ฑ๋ default box์ ๋ํด NMS๋ฅผ ์ํํ์ฌ ์ต์ข ๊ฒฐ๊ณผ๋ฅผ ๋์ถํ๋ค.
Matching strategy
During training we need to determine which default boxes correspond to a ground truth detection and train the network accordingly. We begin by matching each ground truth box to the default box with the best jaccard overlap (=IoU). Unlike MultiBox, We then match default boxes to any ground truth with jaccard overlap higher than a thereshold (0.5).
- Ground truth ์ 'default box'๋ฅผ ๋งค์นญ ์ํด
- ๋ ์์ญ์ IoU๊ฐ 0.5 ์ด์์ธ ๊ฒ๋ค๋ง ๋งค์นญ ์ํด
Training objective
SSD์ loss ํจ์๋ classification์ ์ํ loss ์ธ confidence loss (conf) ์, BBox์ ์์น๋ฅผ regression ์ํค๋ localization loss (loc) ์ ํฉ์ผ๋ก ๊ตฌ์ฑ๋๋ค.
$$L(x,c,l,g)=\frac{1}{n}(L_{conf}(x,c)+\alpha L_{loc}(x,l,g))$$
(โ ์์ฑ์ค)
'AI\ML\DL > ๋ ผ๋ฌธ ๋ฆฌ๋ทฐ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Inception Net (2014.09) (0) 2023.09.17 VGG Net (2014.09) (0) 2023.09.16 cyclic ordinal regression ํ์ต๋ฒ (0) 2023.07.28 Super resolution (SR) technique (1) 2023.06.17 - SSD๋ ์ฌ๋ฌ ๊ฐ์ feature map ์ ํตํด default bounding box๋ฅผ ์ถ๋ ฅํ๋ค.