Attention, Please!!!

[Object Detection] Slide Window & Selective Search ๊ฐœ๋… ๋ณธ๋ฌธ

Computer Vision

[Object Detection] Slide Window & Selective Search ๊ฐœ๋…

G3LU 2024. 3. 16. 00:55

๐Ÿ’ก Sliding Window & Regional Proposal

Object Detection์€ ์—ฌ๋Ÿฌ ๊ฐ์ฒด์— ๋Œ€ํ•œ ์œ„์น˜์™€ ํด๋ž˜์Šค๋ฅผ ๋ถ„๋ฅ˜ํ•˜๋Š”๋ฐ, ๋ณต์žกํ•œ Feature Map์ด ๋„์ถœ๋˜๊ธฐ์— ๊ฐ์ฒด๋ฅผ ๋ถ„๋ฅ˜ํ•˜๋Š”๋ฐ ์–ด๋ ค์›€์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿผ Feature Map๋ฅผ ๊ฐ„๋‹จํ•˜๊ฒŒ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด์„œ๋Š” ์–ด๋–ป๊ฒŒ ํ•ด์•ผํ• ๊นŒ์š”? ์ƒ๊ฐ๋ณด๋‹ค ๋‹จ์ˆœํ•ฉ๋‹ˆ๋‹ค. ์ž…๋ ฅ ๋ฐ์ดํ„ฐ๋ฅผ ์ผ์ •ํ•œ ํฌ๊ธฐ์˜ ๊ฐ„๊ฒฉ์œผ๋กœ ๋‚˜๋ˆ„๊ณ , ๊ฐ๊ฐ์˜ ๋‚˜๋ˆˆ ์˜์—ญ์—์„œ ๊ฐ์ฒด๋ฅผ ์ฐพ๋Š”๋‹ค๋ฉด ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ๋ฐฉ์‹์„ Sliding Window๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค.  

 

์ฆ‰, Sliding Window๋Š” ์ผ์ • ํฌ๊ธฐ์˜ Window(๋…ธ๋ž€์ƒ‰ ์ƒ์ž)๋ฅผ ์™ผ์ชฝ์—์„œ ์˜ค๋ฅธ์ชฝ์œผ๋กœ ์›€์ง์ด๋ฉด์„œ, ๊ฐ๊ฐ์˜ Window ๋‚ด์˜ Feature Map๋ฅผ ๋„์ถœํ•˜์—ฌ ๊ฐ์ฒด๋ฅผ ์ธ์‹ํ•˜๋Š” ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค.

 

๊ทธ๋ ‡๋‹ค๋ฉด ๋งŒ์•ฝ ์ผ์ • ํฌ๊ธฐ์˜ Window๊ฐ€ ๊ฐ์ฒด์˜ ํฌ๊ธฐ ๋ณด๋‹ค ํ›จ์”ฌ ํฌ๋‹ค๋ฉด, ๊ฐ์ฒด๋ฅผ ์ธ์‹ํ•˜์ง€ ๋ชปํ•  ๊ฒƒ ์ž…๋‹ˆ๋‹ค. ์•„๋ž˜์˜ ์‚ฌ์ง„๊ณผ ๊ฐ™์ด ๊ธฐ๋ฆฐ์ด๋ผ๋Š” ๊ฐ์ฒด๋Š” ์„ธ๋กœ๋กœ ๊ธธ์ญ‰ํ•œ๋ฐ, ์ •์‚ฌ๊ฐํ˜• ๋ชจ์–‘์˜ Window๋กœ ์ฐพ๊ธฐ๋ž€ ํฐ ์–ด๋ ค์›€์ด ์žˆ์Šต๋‹ˆ๋‹ค. 

 

์ด๋Ÿฌํ•œ ๋ฌธ์ œ์ ์„ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š”, ์•„๋ž˜์˜ GIF์™€ ๊ฐ™์ด Window ํฌ๊ธฐ๋ฅผ ๊ณ ์ •ํ•˜๋˜ ์ž…๋ ฅ ์ด๋ฏธ์ง€์˜ ํฌ๊ธฐ๋ฅผ ๋ณ€๊ฒฝํ•˜๋Š” ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. 

 

 "๋‚จ์ž"๋ผ๋Š” ๊ฐ์ฒด๋ฅผ ์ฐพ๊ธฐ ์œ„ํ•ด Sliding Window๊ฐ€ ์ง€์†์ ์œผ๋กœ ์ขŒ์šฐ๋กœ ์›€์ง์ด๋ฉฐ, ์ „์ฒด์ ์œผ๋กœ ํ›‘๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์—ฌ๊ธฐ์—์„œ ๋ฌธ์ œ์ ์€ ๋ฐ”๋‹ท๊ฐ€/๋Œ/๊ฑด์ถ•๋ฌผ ๋“ฑ ๋‹ค์–‘ํ•œ ๋‹ค์ค‘๊ฐ์ฒด์— ๋Œ€ํ•ด ํƒ์ƒ‰ํ•˜๊ณ  ์žˆ์œผ๋ฉฐ, ๊ณ„์‚ฐ๋Ÿ‰์ด ์ƒ๋‹นํžˆ ๋งŽ์•„์ง€๋Š” ๊ฒƒ์„ ์•Œ์•„์ฑŒ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋งŒ์•ฝ ์ด๋Ÿฌํ•œ Sliding Window์˜ ๋ฌธ์ œ์ ์„ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด, ์ถ”์ •ํ•ด๋ณด๋ฉด ์–ด๋–จ๊นŒ์š”?? 

 

์ฆ‰, ์ผ์ผ์ด ์ด๋ฏธ์ง€๋ฅผ ์ „์ฒด์ ์œผ๋กœ ํ›‘๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ, ์ž…๋ ฅ ์ด๋ฏธ์ง€์˜ ์œ ์‚ฌํ•œ ํŠน์„ฑ์„ ๊ฐ€์ง€๊ณ  ์žˆ๋Š”๊ณณ์— ๊ฐ์ฒด๊ฐ€ ์žˆ์„๊ฑฐ ๊ฐ™๋‹ค ๋ผ๋Š” ์ถ”์ •์„ ํ•˜๋Š” ๊ฒƒ์ด Regional Proposal ์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. Regional Proposal ๋ฐฉ์‹์€ Sliding Window์— ๋น„ํ•ด ๋น ๋ฅด๋‹ค๋Š” ์žฅ์ ์ด ์žˆ์œผ๋ฏ€๋กœ, Sliding Window๋Š” ๊ฑฐ์˜ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. Regional Proposal ๋ฐฉ์‹์„ ํ™œ์šฉํ•˜๋Š” ๋Œ€ํ‘œ์ ์ธ ๋ชจ๋ธ์ธ Selective Search์ด๋ฉฐ, ์ด์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. 


๐Ÿ’ก Selective Search(์„ ํƒ์  ํƒ์ƒ‰)

 

Selection Search๊ฐ€ ์กด์žฌํ•˜๊ธฐ์ „์—๋Š” ํ›„๋ณด๊ฐ€ ๋  ๋งŒํ•œ ๋Œ€์ƒ์˜ ํฌ๊ธฐ ๋ฐ ๋น„์œจ์ด ๋ชจ๋‘ ๋‹ค๋ฅธ ์ƒํ™ฉ์„ ๊ณ ๋ คํ•˜์—ฌ ํ›„๋ณด ์˜์—ญ์„ ์ฐพ๋Š” ๊ธฐ๋ฒ•์ธ ์™„์ „ํƒ์ƒ‰(Exhaustive Search) ๋ฐฉ๋ฒ•์ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ๋ฐฉ์‹์—์„œ Segmentation(ํ”ฝ์…€๋‹จ์œ„ ํƒ์ง€)์„ ๊ฒฐํ•ฉํ•˜์—ฌ ๊ฐœ์„ ํ•œ ๊ฒƒ์ด Selection Search์ž…๋‹ˆ๋‹ค. ์„ ํƒ์  ํƒ์ƒ‰์€ ์•„๋ž˜์™€ ๊ฐ™์€ ๋ฐฉ์‹์œผ๋กœ ์ง„ํ–‰๋ฉ๋‹ˆ๋‹ค.

 

1. ์ดˆ๊ธฐ ์˜์—ญ ์ƒ์„ฑ : ์ž…๋ ฅ๋œ ์ด๋ฏธ์ง€์— ์กด์žฌํ•˜๋Š” ๊ฐ๊ฐ์˜ ๊ฐ์ฒด(ํ‹ฐ๋น„/์‚ฌ๋žŒ ๋“ฑ)๊ฐ€ ์˜์—ญ ํ•œ ๊ฐœ์— ํ• ๋‹น๋  ์ˆ˜ ์žˆ๋„๋ก Segmentation์„ ์ง„ํ–‰ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ์ด๋ฏธ์ง€์˜ ๊ฐ ๋ถ€๋ถ„์ด ์–ด๋–ป๊ฒŒ ์„œ๋กœ ์—ฐ๊ด€๋˜์–ด ์žˆ๋Š”์ง€ ํŒŒ์•…ํ•˜๋Š”๋ฐ ๋„์›€์„ ์ค๋‹ˆ๋‹ค. 

 

2. ์˜์—ญ๋“ค์˜ ํ†ตํ•ฉ : ์„œ๋กœ ์—ฐ๊ด€๋˜์–ด ์žˆ๋Š” ์กฐ๊ทธ๋งŒํ•œ ๊ทธ๋ฃนํ™”ํ•˜์—ฌ ๋” ํฐ ์˜์—ญ์„ ํ˜•์„ฑํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์ด๋•Œ ํƒ์š•(Greedy) ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์‚ฌ์šฉํ•˜์—ฌ ๋” ํฐ์˜์—ญ์ด ๋ ๋•Œ ๊นŒ์ง€ ๋ฐ˜๋ณต์„ ํ•˜๋Š”๋ฐ, ์ด๋Š” ๊ฐ์ฒด์˜ ์ž ์žฌ์ ์ธ ์œ„์น˜๋ฅผ ํ‘œํ˜„ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

 

3. ์œ ์‚ฌ์„ฑ ๊ณ„์‚ฐ : ์œ ์‚ฌ์„ฑ์„ ๊ธฐ๋ฐ˜์œผ๋กœ 2๋‹จ๊ณ„์—์„œ ์ง„ํ–‰ํ•˜์˜€๋˜ ๊ฒƒ ์ฒ˜๋Ÿผ, ์œ ์‚ฌํ•œ ์˜์—ญ๋“ค์„ ๋ณ‘ํ•ฉํ•˜์—ฌ ์กฐ๊ธˆ ๋” ํฐ ์˜์—ญ์„ ํ˜•์„ฑํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์ดํ›„, ํ›„๋ณด์˜์—ญ(๋ฐ”์šด๋”ฉ ๋ฐ•์Šค)์„ ์ถ”์ถœํ•˜์—ฌ, ๊ฐ์ฒด๋ฅผ ํƒ์ง€ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.