[CV] About RPN(Region Proposal Network)

๊ฐ•๋™์—ฐยท2022๋…„ 2์›” 7์ผ
0

[Paper review]

๋ชฉ๋ก ๋ณด๊ธฐ
10/17

๐Ÿ‘จโ€๐Ÿซ ์˜ค๋Š˜์€ Faster R-CNN ๋…ผ๋ฌธ์—์„œ ๋‚˜์˜จ RPN(Region Proposal Network)์— ๋Œ€ํ•ด์„œ ๋‹ค์‹œ ์•Œ์•„๋ณผ๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ์‚ฌ์‹ค ์ „์— Faster R-CNN ๋…ผ๋ฌธ ๋ฆฌ๋ทฐ๋ฅผ ํ–ˆ์ง€๋งŒ, RPN์— ๋Œ€ํ•ด ๋‹ค์‹œ ๊ธ€์„ ์“ฐ๋Š” ์ด์œ ๋Š” ๋งŽ์€ ๋‹ค๋ฅธ ๋…ผ๋ฌธ๋“ค์—์„œ RPN์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งค์šฐ ์ž์ฃผ ์žˆ๊ธฐ์— ๋‹ค์‹œ ํ•œ ๋ฒˆ ์ •๋ฆฌํ•ด๋ณผ๋ ค๊ณ  ํ•œ๋‹ค.(ํ•ญ์ƒ RPN์— ๋Œ€ํ•ด ์ƒ๊ฐํ•  ๋•Œ๋งˆ๋‹ค ๋ฐ”๋กœ๋ฐ”๋กœ ๋– ์˜ค๋ฅด์ง€ ์•Š๊ธฐ์— ๋‹ค์‹œ ํ•œ ๋ฒˆ ์ •๋ฆฌํ•œ๋‹ค...ใ… )

๐ŸŽˆ RPN์˜ ์ˆ˜ํ–‰ ๊ณผ์ •๊ณผ RPN์˜ ์•ฝ๊ฐ„์˜ anchor box์˜ detail์— ๋Œ€ํ•ด์„œ ์‚ดํŽด๋ณผ ๊ฒƒ์ด๋‹ค!

RPN Steps

Step 1

โœ” ๊ฐ€์žฅ ๋จผ์ € Input ์ด๋ฏธ์ง€๋ฅผ Convolutional Neural Network์— ํ•™์Šต์‹œํ‚ค๊ณ  ๋งˆ์ง€๋ง‰ ๋ ˆ์ด์–ด์—์„œ features map์„ output์œผ๋กœ ๋ฐ›๋Š”๋‹ค.

Step 2

โœ” CNN์—์„œ ๋ฐ›์€ feature map์—์„œ ํŠน์ • ์‚ฌ์ด์ฆˆ์˜ ์œˆ๋„์šฐ๋กœ(nxn), sliding window๋ฅผ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ ์ค‘์š”ํ•œ ์ ์€ Anchor boxes๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค๋Š” ์  ์ž…๋‹ˆ๋‹ค. sliding window๋ฅผ ํ•˜๋ฉด์„œ ๊ฐ๊ฐ์˜ features ๊ฐ’๋“ค์— ๋Œ€ํ•ด 9๊ฐœ์˜ Anchor boxes๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.(3๊ฐœ์˜ ๋‹ค๋ฅธ aspect ratios(1:1, 1:2, 2:1) ๊ทธ๋ฆฌ๊ณ  3๊ฐœ์˜ ๋‹ค๋ฅธ scale(128, 256, 512)) ๊ฒฐ๊ณผ์ ์œผ๋กœ W H(feature map size) K(anchor boxes)์˜ ๋ฐ•์Šค๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Step 3

โœ” ๊ฐ๊ฐ์˜ anchor boxes๋“ค์ด ๋ฌด์—‡์„ ์˜๋ฏธํ•˜๋Š”์ง€ ์•Œ์•„๋ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ ์ฐพ์•„์•ผ ํ•˜๋Š”๊ฑด ๊ฐ anchor boxes๋“ค์ด ๊ฐœ์ฒด๋ฅผ ์˜๋ฏธํ•˜๋Š”์ง€ ์•ˆํ•˜๋Š”์ง€, ๊ทธ๋ฆฌ๊ณ  bbox์˜ offset ์ž…๋‹ˆ๋‹ค. ์ฆ‰, ๊ฐ anchor box๊ฐ€ foreground์ธ์ง€ background์ธ์ง€ ํŒ๋‹จํ•˜๊ณ , bbox regression์„ ํ†ตํ•ด ์ขŒํ‘œ์˜ ์œ„์น˜๋ฅผ ์กฐ์ •ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.

Step 4

โœ” bbox Classifier๋Š” GT์™€์˜ IoU๊ฐ’์„ ๊ณ„์‚ฐํ•ด foreground์ธ์ง€ background์ธ์ง€ ํŒ๋‹จํ•ฉ๋‹ˆ๋‹ค. ์ผ๋ฐ˜์ ์œผ๋กœ ๊ทธ ํ™•๋ฅ ์„ objectness score๋ผ๊ณ  ๋ถˆ๋ฆฝ๋‹ˆ๋‹ค.

โœ” bbox Regressor layer์€ foreground๋กœ ๋ถ„๋ฅ˜๋œ anchor box์˜ GT์— ๋Œ€ํ•œ offset์„ ํ•™์Šตํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ‘จโ€๐Ÿซ ๊ฐ„๋‹จํ•˜๊ฒŒ RPN์˜ Step์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ดค์Šต๋‹ˆ๋‹ค. ๋””ํ…Œ์ผํ•œ ๋ถ€๋ถ„๋“ค์ด ๋น ์ ธ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๊ธ€์„ ์“ฐ๋Š” ๋ชฉ์  ์ž์ฒด๊ฐ€ RPN์— ๋Œ€ํ•ด ์ƒ๊ฐํ–ˆ์„ ๋•Œ ๊ณผ์ •์ด ๋ฐ”๋กœ ์ƒ๊ฐ๋‚˜๋Š” ๊ฒƒ์„ ์›ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ตœ๋Œ€ํ•œ ํ•ต์‹ฌ์ ์ธ ๋ถ€๋ถ„๋งŒ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค. ์ฆ‰ RPN์— ๋Œ€ํ•ด ์ฒ˜์Œ ๋ณด์‹ ๋‹ค๋ฉด R-CNN ๊ณ„์—ด์˜ ๋…ผ๋ฌธ๋“ค์„ ์ฝ์–ด๋ณด์‹œ๊ธธ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค.(ํ•˜ํ•˜ ๊ทธ๋ฆฌ๊ณ  ๋””ํ…Œ์ผํ•œ ๋ถ€๋ถ„์„ ๋ช…ํ™•ํ•˜๊ฒŒ ์„ค๋ช…ํ•  ์ž์‹ ์ด ์—†์Šต๋‹ˆ๋‹ค.)

About anchor boxes

โœ” ์œ„์˜ ๊ณผ์ • ์ค‘ ํ˜น์€ RPN์— ๋Œ€ํ•ด ๊ณต๋ถ€ํ•˜๋‹ค๋ณด๋ฉด ํ•œ ๊ฐ€์ง€ ์˜๋ฌธ์ด ๋“œ๋Š” ์ ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์œ„์˜ ๊ณผ์ •์—์„œ๋Š” CNN์—์„œ ๋‚˜์˜จ ๊ฐ๊ฐ์˜ feature ๊ฐ’๋“ค์— ๋Œ€ํ•ด anchor boxes๋ฅผ ์ œ์‹œํ•ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ด boxes๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„  ์›๋ณธ ์ด๋ฏธ์ง€๋ฅผ ํ•„์š”๋กœ ํ•ฉ๋‹ˆ๋‹ค.

โœ” ์˜ˆ๋ฅผ ๋“ค์–ด vgg16์—์„œ๋Š”, 16๋ฐฐ ์ค„์ธ feature map๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ ‡๋‹ค๋ฉด ์œ„์˜ ์‚ฌ์ง„ ์ฒ˜๋Ÿผ 16์˜ stride๋ฅผ ๊ฐ€์ง„ feature ์ ์„ ์ด๋ฏธ์ง€์— ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ์ด์ œ ๊ฐ๊ฐ์˜ ์œ„์น˜์—์„œ 9๊ฐœ์˜ anchor boxes๋ฅผ ์ฐพ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


Reference

profile
Maybe I will be an AI Engineer?

0๊ฐœ์˜ ๋Œ“๊ธ€