์ถ์ฒ: ๐บ๋๋น๋ ์ ํ๋ธ
(R-CNN ๊ณ์ด ์ค๋ช
์ ์์ฃผ ์์ฃผ ์ ํด์ฃผ์ ๋ค !)
R-CNN์
1. CPU ๊ธฐ๋ฐ์ selective search ์งํ์ผ๋ก ๋ง์ ์๊ฐ์ด ์์๋๊ณ ,
2. ์ ์ฒด ์ํคํ
์ฒ์์ SVM, Regressor ๋ชจ๋์ด CNN๊ณผ ๋ถ๋ฆฌ ๋์ด ์์ด End-to-End ๋ฐฉ์์ผ๋ก ํ์ตํ ์ ์์ผ๋ฉฐ
3. ๋ชจ๋ Roi๋ฅผ CNN์ ๋ฃ์ด์ผํ๊ธฐ ๋๋ฌธ์ ๋ง์ CNN ์ฐ์ฐ์ด ํ์ํ๋ค
๋ ๋จ์ ์ด ์๋ค.
R-CNN์ ๋จ์ ์ ๋ณด์ํ์ฌ ๋์จ ๊ฒ์ด Fast R-CNN์ธ๋ฐ
Fast R-CNN์ End-to-End ๋ฐฉ์์ผ๋ก ํ์ต์ด ๊ฐ๋ฅํ๊ฒ ๋์์ง๋ง
์ฌ์ ํ Region Proposal์ CPU์์ ์ํ๋๊ธฐ ๋๋ฌธ์ ์๋๊ฐ ๋๋ฆฌ๋ค.
๋ฐ๋ผ์ Faster R-CNN์์๋
RPN(Region Proposal Network)๋ฅผ ์ ์ํ์ฌ feature map์ ๋ณด๊ณ ์ด๋ ๊ณณ์ ๋ฌผ์ฒด๊ฐ ์์ ๋ฒํ์ง ์์ธกํ ์ ์๋๋ก
๋ง๋ค์๋ค.
YOLO์ key point 3๊ฐ์ง
YOLO๊ฐ ์งํ๋๋ ๋จ๊ณ๋ฅผ 3๊ฐ์ step์ผ๋ก ๋๋ ๋ณด์๋ค.
Step 1. input image๋ฅผ S x S grid๋ก ๋๋๋ค.
Step 2. B๊ฐ์ bounding box ์ขํ(x, y, w, h)์ confidence score๋ฅผ ๊ตฌํ๋ค.
(bounding box score ๊ณ์ฐ)
๋ณธ ๋
ผ๋ฌธ์์๋ S๋ฅผ 7๋ก ์ค์ ํ์ฌ 7 x 7 grid๋ก ๋๋์๋ค. ๊ทธ๋ฆฌ๊ณ ๊ฐ bounding box์ ์ขํ(x, y, w, h) ์ confidence score๋ฅผ ๊ตฌํ๋ค. confidence score๋ฅผ ๊ตฌํ๋ ๋ฐฉ๋ฒ์ object์ ์ /๋ฌด(1/0)๊ณผ IoU score๋ฅผ ๊ณฑํ๋ค. ์ ๊ทธ๋ฆผ์ฒ๋ผ grid cell์ object๊ฐ ์๋ค๋ฉด 0์ด ๋์ค๊ฒ ๋๊ณ , grid cell์ object๊ฐ ์๋ค๋ฉด 1๊ณผ IoU ๊ฐ์ด ๊ณฑํด์ ธ ์ต์ข
์ ์ผ๋ก IoU score์ ๋์ผํ ๊ฐ์ด ๋์ค๊ฒ ๋๋ค.
(train์์๋ B๊ฐ์ bounding box ์ฌ์ฉ, test์์๋ 2๊ฐ์ bounding box ๋ผ๊ณ ๋
ผ๋ฌธ์ ๋์์๋๋ฐ train์์๋ B=2 ์ธ ๊ฒ ๊ฐ๋ค.)
Step3. Class probability๋ฅผ ๊ตฌํ๋ค.
conditional class probability์ box confidence score๋ฅผ ๊ณฑํ์ฌ ์ต์ข
์ ์ผ๋ก class confidence score๋ฅผ ๊ตฌํ๊ฒ ๋๋ค.
(๋
ผ๋ฌธ์์๋ test ์์ conditional class probability์ box confidence predict๋ฅผ ๊ณฑํ๋ค๊ณ ๋์ด์๋๋ฐ, train์์๋ ๋์ผํ๊ฑด์ง ์๋ฌธ)
network๋ฅผ ๋ณด๋ฉด imageNet data๋ก pretrain ๋ GoogLeNet์ ๊ฐ์ ธ์ค๊ณ , ๋ค์ 4๊ฐ์ convolution layer์ 2๊ฐ์ fully connected layers ๊ฐ ๋ถ๋๋ฐ 4๊ฐ์ conv ์ 2๊ฐ์ fc๋ train ๋๋ค. ๋ํ GoogleNet์ inception modules ๋์ 1x1 reduction layer ์ 3x3 conv layer๋ฅผ ์ฌ์ฉํ๋ค.
pretrain๋ GoogLeNet์ ์ด๋ฏธ์ง ๋ถ๋ฅ์ ์ฌ์ฉํ๋ network์ธ๋ฐ, input image์ ๋ํ spatial information ์ถ์ถ์ด ๊ฐ๋ฅํ๋ค๋ ํน์ฑ ๋๋ฌธ์ object detection์์ ์ฌ์ฉ๋ ์ ์๋ค๊ณ ํ๋ค.
train network๋ฅผ ๊ฑฐ์น ํ output tensor shape์ 7x7x30์ด ๋๋ค.
<< ์ค์ ๊ฐ >>
์: S x S x (B * 5 + C)
- S x S (: grid cell) = 7
- B (: bounding box ๊ฐ์) = 2
- C (: class ๊ฐ์) = 20
S x S (7x7)๋ก ๋๋ grid cell์ ์ดํด๋ณด๋ฉด, ๊ฐ grid cell ๋น B๊ฐ(B=2)์ bounding box ๊ฐ ์กด์ฌํ๊ณ ๊ฐ bounding box ๋น ์ขํ๊ฐ(x, y, w, h) ๊ณผ confidence score ์ฆ, ์ด 5๊ฐ์ง์ ์ ๋ณด๊ฐ ๋์ค๊ฒ ๋๋ค. ๋ณธ ๋ ผ๋ฌธ์์๋ PASCAL VOC dataset์ ์ฌ์ฉํ๋ฏ๋ก class ๊ฐ์ C๋ 20์ด ๋๋ค. ๋ฐ๋ผ์ ์์ ๋ฐ๋ผ ์ ์ด๋ณด๋ฉด 7 x 7 x (2 * 5 + 20) = 7x7x30 ์ด๋ผ๋ ๊ฒฐ๊ณผ๋ฅผ ์ป์ ์ ์๋ค.
(bounding box)
๋ณธ ๋
ผ๋ฌธ์์๋ 448x448 size์ ์ด๋ฏธ์ง๋ฅผ ์ฌ์ฉํ์ฌ 7x7x30์ feature map์ ์ถ์ถํ๋ค. 7x7์ ๊ฐ grid ํ๋ ํ๋๋ 5๊ฐ์ bounding box ์ ๋ณด (x, y, w, h, confidence score)๋ฅผ ๋ด๊ณ ์๋ค. 30 ์ฐจ์์ด ์ด๋ป๊ฒ ์ด๋ฃจ์ด์ง๋์ง ์ดํด๋ณด๋ฉด 1 - 5 ์ฐจ์์ ๋ ๊ฐ์ bounding box ์ค ์ฒซ๋ฒ์งธ bounding box ์ ๋ณด๊ฐ ๋ด๊ธด๋ค. 6 - 10 ์ฐจ์์ ๋๋ฒ์งธ bounding box์ ์ ๋ณด๊ฐ ๋ด๊ธด๋ค. 11 - 30 ์ฐจ์์ ์ฒซ๋ฒ์งธ bounding box์์ ํ์ง๋ object์ 20๊ฐ์ class์ ๋ํ ํ๋ฅ ๊ฐ์ด ๋ด๊ธฐ๊ฒ ๋๋ค (PASCAL VOC dataset์ class๊ฐ 20๊ฐ ์ด๊ธฐ ๋๋ฌธ).
(class confidence score)
์ด๋ ๊ฒ ๋์จ bounding box์ confidence socre์ class probability๋ฅผ ๊ณฑํ์ฌ bounding box๋ค์ confidence score๋ฅผ ๊ตฌํ๋ค. ๋ณธ ๋
ผ๋ฌธ์์ 7x7 grid ๋น 2๊ฐ์ bounding box๋ก ๊ตฌ์ฑํ์์ผ๋ฏ๋ก 7x7x2=98๊ฐ์ bounding box์ ๋ํ ์ ๋ณด๋ฅผ ์ป์ ์ ์๋ค.
(NMS(Non-max suppression))
์ ๊ณผ์ ์ ๊ฑฐ์ณ ๋์จ 98๊ฐ์ ์ ๋ณด๋ค์ ๋ํด์ NMS๋ฅผ ์ํํ๋ค. NMS๋ฅผ ์ํํ์ฌ detect๋ object์ ์์ธก๊ฐ์ ์ป๊ฒ ๋๋ค.
๐กNon maximum suppresion(NMS)
: ์ ์ผ ํฐ IoU๋ฅผ ๊ฐ์ง bounding box๋ฅผ ์ ์ธํ๊ณ ๋๋จธ์ง๋ ์์ถ์ํจ๋ค.
(IoU๊ฐ ํน์ threshold ์ด์์ธ ์ค๋ณต box ์ ๊ฑฐ)
์ ์ฒด loss๋ ์ ๊ทธ๋ฆผ๊ณผ ๊ฐ๊ณ , ๊ฒ์์ ํตํด ๊ณต๋ถํ ๊ฒ์ ํ ๋๋ก loss ํจ์๋ฅผ 3๊ฐ๋ก ๋๋์ด ๋ณผ ์ ์๋ค

๊ทธ๋ฆผ์์
- ์ด๋ก์ ๋๊ทธ๋ผ๋ฏธ ๋ถ๋ถ: i๋ฒ์งธ grid cell์์ j๋ฒ์งธ bounding box๊ฐ object๋ฅผ ์์ธกํ๋๋ก
responsible for (ํ ๋น) ๋ฐ์์ ๋ 1, ๊ทธ๋ ์ง ์์ผ๋ฉด 0์ด ๋๋ค.
- ํ๋์ ๋๊ทธ๋ผ๋ฏธ ๋ถ๋ถ: object๋ฅผ ํฌํจํ์ง ์๋ grid cell์ confidence score๊ฐ 0์ด ๋์ด
gradient์ ์ํฅ์ ์ฃผ๋ ๊ฒ์ ๋ฐฉ์งํ์ฌ ๊ฐ์ฒด๋ฅผ ํฌํจํ๋ grid cell์
๊ฐ์ค์น๋ฅผ ์ฃผ๊ฒ ๋๋ค. (๋ณธ ๋
ผ๋ฌธ setting = 5)
ํฐ bounding box์ ์์ ์ค๋ฅ๊ฐ ์์ bounding box์ ์ค๋ฅ๋ณด๋ค ๋ ์ค์ํ๊ธฐ ๋๋ฌธ์, ์ด๋ฅผ ๋ฐ์ํ๊ธฐ ์ํด w, h์ ๋ฃจํธ๋ฅผ ์์์ค๋ค.

๊ทธ๋ฆผ์์
- ์ด๋ก์ ๋๊ทธ๋ผ๋ฏธ ๋ถ๋ถ: object๊ฐ ์กด์ฌํ์ง ์๋ grid cell์ ๊ฐ์ค์น 0.5๋ฅผ ๊ณฑํ์ฌ loss์ ์ํฅ์ด ๋ ๊ฐ๋๋ก ํ๋ค.

Comparison to Other Real-Time Systems

Error Analysis

Generalizability: Person Detection in Artwork
