๐Ÿ‘€ Computer Vision

๐Ÿ‘€ Computer Vision

[CV] OpenCV๋กœ Object Detection ๊ตฌํ˜„ํ•˜๊ธฐ (Part.1)

OpenCV DNN ์žฅ๋‹จ์ OpenCV Deep Neural Network์˜ ์žฅ๋‹จ์ ์— ๋ฐํ•˜์—ฌ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.OpenCV ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” Intel์— ์˜ํ•˜์—ฌ ์ตœ์ดˆ ๊ฐœ๋ฐœ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์žฅ๋‹จ์ ์„ ์„ค๋ช…ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.OpenCV DNN ์žฅ์ ๋”ฅ๋Ÿฌ๋‹ ๊ฐœ๋ฐœ ํ”„๋ ˆ์ž„ ์›Œํฌ ์—†์ด ์‰ฝ๊ฒŒ Inference๋ฅผ ๊ตฌํ˜„ ๊ฐ€๋Šฅ ํ•ฉ๋‹ˆ๋‹ค.OpenCV์—์„œ ์ง€์›ํ•˜๋Š” ๋‹ค์–‘ํ•œ Computer Vision ์ฒ˜๋ฆฌ ๋ฐ API์™€ Deep learning์„ ์‰ฝ๊ฒŒ ๊ฒฐํ•ฉํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ํŠน์ง•์ด ์žˆ์Šต๋‹ˆ๋‹ค.OpenCV DNN ๋‹จ์ GPU ์ง€์› ๊ธฐ๋Šฅ์ด ์•ฝํ•ฉ๋‹ˆ๋‹ค.DNN ๋ชจ๋“ˆ์€ ๊ณผ๊ฑฐ์— NVIDIA GPU ์ง€์›์ด ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. 2019๋…„ 10์›”์— Google์—์„œ NVIDIA GPU ์ง€์› ๋ฐœํ‘œํ–ˆ์ง€๋งŒ. ์•„์ง ํ™˜๊ฒฝ ๊ตฌ์„ฑ/์„ค์น˜๊ฐ€ ์–ด๋ ต์Šต๋‹ˆ๋‹ค. ์ ์ฐจ ๊ฐœ์„  ์ž‘์—…์ด ์ง„ํ–‰์ค‘์ž…๋‹ˆ๋‹ค.OpenCV๋Š” ..

๐Ÿ‘€ Computer Vision

[CV] Faster R-CNN (Faster Region-based Convolutional Neural Network)

Faster R-CNNFaster R-CNN์€ R-CNN ๊ณ„์—ด์˜ Object Detection ๋ชจ๋ธ ์ค‘์—์„œ ๊ฐ€์žฅ ์ง„๋ณด๋œ ๋ชจ๋ธ ์ค‘ ํ•˜๋‚˜๋กœ, Object Detection ์—์„œ ๋งค์šฐ ๋†’์€ ์ •ํ™•๋„์™€ ํšจ์œจ์„ฑ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.๋˜ํ•œ Region Proposal Network (RPN)๋ฅผ ๋„์ž…ํ•˜์—ฌ ์ „์ฒด ์‹œ์Šคํ…œ์˜ ์†๋„์™€ ์ •ํ™•๋„๋ฅผ ํฌ๊ฒŒ ํ–ฅ์ƒ์‹œ์ผฐ์Šต๋‹ˆ๋‹ค.Faster R-CNN์€ RPN(Region Proposal Network) + Fast R-CNN์ด ํ•ฉ์ณ์ง„ ๋ชจ๋ธ์ž…๋‹ˆ๋‹ค.๊ธฐ์กด Selective Search๊ฐ€ ์ˆ˜ํ–‰ํ•˜๋˜ Object ์œ„์น˜์— Bounding Box๋ฅผ ๊ทธ๋ ค์„œ ์ถ”์ฒœํ•ฉ๋‹ˆ๋‹ค. (GPU ์‚ฌ์šฉ)๋˜ํ•œ Region Proposal Network๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. (Selective Search ์—ญํ• )๊ทธ๋ฆฌ๊ณ  Network๋กœ๋งŒ ๊ตฌ์„ฑ์ด ๋˜..

๐Ÿ‘€ Computer Vision

[CV] Fast R-CNN (Fast Region-based Convolutional Neural Network)

Fast R-CNN ๊ฐœ์š” FAST R-CNN์€ R-CNN (Region-based Convolutional Neural Network)๊ณผ SPP-Net (Spatial Pyramid Pooling Network)์˜ ๋‹จ์ ์„ ๋ณด์™„ํ•˜๊ณ , ๊ฐ์ฒด ํƒ์ง€์˜ ์†๋„์™€ ์ •ํ™•์„ฑ์„ ํฌ๊ฒŒ ๊ฐœ์„ ํ•œ ๋ชจ๋ธ์ž…๋‹ˆ๋‹ค Fast R-CNN์€ ์ด๋Ÿฌํ•œ ์š”์†Œ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.์ž…๋ ฅ ์ด๋ฏธ์ง€: ์›๋ณธ ์ด๋ฏธ์ง€์™€ Region Proposal์ด ์ž…๋ ฅ๋ฉ๋‹ˆ๋‹ค.๊ณตํ†ต CNN: ์ด๋ฏธ์ง€์—์„œ Feature Map(ํŠน์ง• ๋งต)์„ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค.RoI Pooling Layer: ๊ฐ Region Proposal์„ ๊ณ ์ •๋œ ํฌ๊ธฐ์˜ *Feature Map(ํŠน์ง• ๋งต)์œผ๋กœ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค.์™„์ „ ์—ฐ๊ฒฐ ์ธต: ๊ณ ์ •๋œ ํฌ๊ธฐ์˜ *Feature Map(ํŠน์ง• ๋งต)์„ ์ž…๋ ฅ์œผ๋กœ ๋ฐ›์•„ Classificatio..

๐Ÿ‘€ Computer Vision

[CV] SPPNet - Spatial Pyramid Pooling Net

SPPNet - Spatial Pyramid Pooling Net์ด๋ฒˆ์—๋Š” SPPNet - Spatial Pyramid Pooling Net์— ๋ฐํ•˜์—ฌ ์•Œ์•„๋ณด๊ณ  ์™œ SPPNet์ด ๋“ฑ์žฅํ–ˆ๋Š”์ง€ ํ•œ๋ฒˆ ์•Œ์•„ ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. RCNN ์ฃผ์š” ๋ฌธ์ œ์ ๊ทธ์ „์— RCNN์˜ ์ฃผ์š” ๋ฌธ์ œ์ ์— ๋ฐํ•˜์—ฌ ํ•œ๋ฒˆ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.์ผ๋‹จ, CNN์€ 2,000๊ฐœ์˜ Region ์˜์—ญ ์ด๋ฏธ์ง€๊ฐ€ CNN์œผ๋กœ ์ž…๋ ฅ ๋˜๋ฉด์„œ Object Detection ์ˆ˜ํ–‰์‹œ๊ฐ„์ด ์˜ค๋ž˜ ๊ฑธ๋ฆฝ๋‹ˆ๋‹ค.์ด์œ ๋Š” ์œ„์˜ ๊ทธ๋ฆผ์„ ๋ณด๋ฉด ์•Œ ์ˆ˜ ์žˆ๋“ฏ์ด 2,000๊ฐœ์˜ Region ์˜์—ญ์ด Proposal ๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.๊ทธ๋Ÿฌ๋ฉด Feature Map์ด 2,000๊ฐœ๊ฐ€ ๋งŒ๋“ค์–ด ์ €์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด๋กœ ์ธํ•ด์„œ ๋จพ์€ ์—ฐ์‚ฐ์ด ํ•„์š”ํ•˜๋ฉฐ ์ฒ˜๋ฆฌ ์‹œ๊ฐ„์ด ๊ธธ์–ด์ง‘๋‹ˆ๋‹ค.๋˜ํ•œ Region ์˜์—ญ ์ด๋ฏธ์ง€๊ฐ€ ๊ณ ์ •๋œ ํฌ๊ธฐ๋กœ Crop / W..

๐Ÿ‘€ Computer Vision

[CV] Object Detection Network ๊ตฌ์กฐ, R-CNN ๊ฐœ์š”

์ด๋ฒˆ ๊ธ€์—์„œ๋Š” Object Detection Network ๊ตฌ์กฐ ๊ฐœ์š”, FPS, Resolution๊ณผ ์„ฑ๋Šฅ ์ƒ๊ด€ ๊ด€๊ณ„, R-CNN ์— ๋ฐํ•˜์—ฌ ์•Œ์•„ ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. Object Detection Network ๊ฐœ์š”Object Detetction Network ๊ตฌ์กฐ๋Š” ๋‘ ๋ถ€๋ถ„์œผ๋กœ ๋‚˜๋ˆŒ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:ํŠน์ง• ์ถ”์ถœ ๋„คํŠธ์›Œํฌ(Feature Extractor Network)์™€ ๊ฐ์ฒด ํƒ์ง€ ๋„คํŠธ์›Œํฌ(Object Detection Network)์ž…๋‹ˆ๋‹ค.๋‘ ๋„คํŠธ์›Œํฌ๋Š” ์ผ๋ฐ˜์ ์œผ๋กœ ์‚ฌ์ „ ํ•™์Šต๋œ ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•˜์—ฌ ํŠน์ • ์ž‘์—…์— ๋งž๊ฒŒ ๋ฏธ์„ธ ์กฐ์ •๋ฉ๋‹ˆ๋‹ค. Feature Extractor Network (ํŠน์ง• ์ถ”์ถœ ๋„คํŠธ์›Œํฌ)์ž…๋ ฅ ์ด๋ฏธ์ง€์—์„œ ์œ ์šฉํ•œ ํŠน์ง•์„ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค.VGG, ResNet, Inception ๋“ฑ๊ณผ ๊ฐ™์€ ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•˜๋ฉฐ, ๋ณดํ†ต Ima..

๐Ÿ‘€ Computer Vision

[CV] Object Detection & Segmentation์„ ์œ„ํ•œ ํŒจํ‚ค์ง€ & CUDA ์†Œ๊ฐœ

Object Detection & Segmentation์„ ์œ„ํ•œ ๋‹ค์–‘ํ•œ ํŒจํ‚ค์ง€๋“คObject Detection & Segmentation์„ ์œ„ํ•œ ๋‹ค์–‘ํ•œ ํŒจํ‚ค์ง€๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค.Keras์™€ Tensorflow ๊ธฐ๋ฐ˜์˜ ๋‹ค์–‘ํ•œ ์˜คํ”ˆ์†Œ์Šค ํŒจํ‚ค์ง€๋“ค์‰ฌ์šด ํ™œ์šฉ๊ณผ Customization ๊ฐ€๋Šฅํ•œ ์žฅ์ ์ด ์žˆ์Šต๋‹ˆ๋‹ค.๋‹ค๋งŒ Object Detection ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ณ„๋กœ ์„œ๋กœ ๋‹ค๋ฅธ ํŒจํ‚ค์ง€๋“ค์„ ์ ์šฉํ•ด์•ผ ํ•˜๋Š” ๋‹จ์ ์ด ์žˆ์Šต๋‹ˆ๋‹ค.OpenCV ์˜ DNN(Deep Neural Network) ๋ชจ๋“ˆ๊ฐ„ํŽธํ•˜๊ฒŒ Object Detection Inference๊ฐ€ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.๋‹ค๋งŒ ํ•™์Šต์ด ๋ถˆ๊ฐ€๋Šฅํ•˜๋ฉฐ ์ฃผ๋กœ CPU ์œ„์ฃผ๋กœ GPU ํ™œ์šฉ์ด ์–ด๋ ต๋‹ค๋Š” ์ ์ด ์žˆ์Šต๋‹ˆ๋‹ค.Tensorflow Object Detection API๊ฐ€์žฅ ๋งŽ์€ Detection ์•Œ๊ณ ๋ฆฌ์ฆ˜์— ์ ์šฉ์ด ..

๐Ÿ‘€ Computer Vision

[CV] OpenCV ์˜์ƒ์ฒ˜๋ฆฌ ๊ฐœ์š”

OpenCV ์˜์ƒ ์ฒ˜๋ฆฌ ๊ฐœ์š”ํ•œ๋ฒˆ OpenCV์˜ ์˜์ƒ์ฒ˜๋ฆฌ ๋ฐฉ๋ฒ•์— ๋ฐํ•˜์—ฌ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.OpenCV์˜ VideoCaptureํด๋ž˜์Šค๋Š” ๋™์˜์ƒ์„ ๊ฐœ๋ณ„ Frame์œผ๋กœ ํ•˜๋‚˜์”ฉ ์ฝ์–ด(Read)๋“ค์ด๋Š” ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.VideoWriter๋Š” VideoCapture๋กœ ์ฝ์–ด๋“ค์ธ ๊ฐœ๋ณ„ Frame์„ ๋™์˜์ƒ ํŒŒ์ผ๋กœ Write๋ฅผ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.VideoCapture.read() - ์˜์ƒ์˜ ๋‹ค์Œ Frame์„ ์ฝ์Šต๋‹ˆ๋‹ค.VideoWriter.write() - ์˜์ƒ์˜ Frame์„ write ํ•ฉ๋‹ˆ๋‹ค.cap = cv2.VideoCapture(video_input_path)…………vid_writer = cv2.VideoWriter(video_output_path, …..)while True:hasFrame, img_frame = cap.read..

๐Ÿ‘€ Computer Vision

[CV] OpenCV ๊ฐœ์š”

Python ๊ธฐ๋ฐ˜ ์ฃผ์š” ์ด๋ฏธ์ง€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌํฌ๊ฒŒ 3๊ฐ€์ง€๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.PIL (Python Image Library)์ฃผ๋กœ ์ด๋ฏธ์ง€ ์ฒ˜๋ฆฌ๋งŒ์„ ์œ„ํ•ด ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.์ฒ˜๋ฆฌ ์„ฑ๋Šฅ์ด ์ƒ๋Œ€์ ์œผ๋กœ ๋Š๋ฆฌ๋‹ค๋Š” ๋‹จ์ ์ด ์žˆ์Šต๋‹ˆ๋‹ค.Scikit-ImageํŒŒ์ด์ฌ ๊ธฐ๋ฐ˜์˜ ์ „๋ฐ˜์ ์ธ ์ปดํ“จํ„ฐ ๋น„์ „ ๊ธฐ๋Šฅ ์ž…๋‹ˆ๋‹ค.์‚ฌ์ดํŒŒ์ด(Scipy)์— ๊ธฐ๋ฐ˜ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.OpenCV์˜คํ”ˆ์†Œ์Šค ๊ธฐ๋ฐ˜์˜ ์ตœ๊ณ  ์ธ๊ธฐ ์ปดํ“จํ„ฐ ๋น„์ „ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ž…๋‹ˆ๋‹ค.์ปดํ“จํ„ฐ ๋น„์ „ ๊ธฐ๋Šฅ ์ผ๋ฐ˜ํ™”์— ํฌ๊ฒŒ ๊ธฐ์—ฌ ํ–ˆ๋‹ค๋Š” ํŠน์ง•์ด ์žˆ์Šต๋‹ˆ๋‹ค.(์–ด๋ ค์šด ๊ธฐ๋Šฅ๋„ API ๋ช‡์ค„๋กœ ๊ฐ„๋‹จํ•˜๊ฒŒ ๊ตฌํ˜„์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.)C++ ๊ธฐ๋ฐ˜์ด๋‚˜ Python๋„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. (Java, C# ๋“ฑ ๋‹ค์–‘ํ•œ ์–ธ์–ด ์ง€์›) OpenCV ํŠน์ง•OpenCV (Open Source Computer Vision Library)๋Š” ์ปดํ“จํ„ฐ ๋น„์ „๊ณผ ๋จธ์‹  ๋Ÿฌ๋‹์„ ์œ„ํ•œ ์˜คํ”ˆ..

๐Ÿ‘€ Computer Vision

[CV] Object Detection & Segmentation์„ ์œ„ํ•œ ์ฃผ์š” Dataset

์ฃผ์š” Dataset๋งŽ์€ Detection & Segmentation DL ํŒจํ‚ค์ง€๊ฐ€ ์•„๋ž˜์˜ Dataset๋“ค์„ ๊ธฐ๋ฐ˜์œผ๋กœ Pretrained ๋˜์–ด ๋ฐฐํฌ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.PASCAL VOC: XML Format, 20๊ฐœ์˜ Object CategoryBounding Box ์–‘์‹์œผ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค(XML), ๊ทธ๋ฆฌ๊ณ  ํ•˜๋‚˜์˜ Image์— ๋ฐํ•˜์—ฌ Annotation ํ•ฉ๋‹ˆ๋‹ค. MS COCO: json Form, 80๊ฐœ์˜ ์˜ค๋ธŒ์ ํŠธ ์นดํ…Œ๊ณ ๋ฆฌGoogle Open Images: csv Format, 600๊ฐœ์˜ ์˜ค๋ธŒ์ ํŠธ ์นดํ…Œ๊ณ ๋ฆฌ  PASCAL VOC 2012PASCAL VOC(Pattern Analysis, Statistical Modelling and Computational Learning Visual Object Classes)..

๐Ÿ‘€ Computer Vision

[CV] Precision(์ •๋ฐ€๋„) & Recall(์žฌํ˜„์œจ)

Precision(์ •๋ฐ€๋„) & Recall(์žฌํ˜„์œจ)์ •๋ฐ€๋„(Precision)๊ณผ ์žฌํ˜„์œจ(Recall)์€ ์ฃผ๋กœ Binary Classification(์ด์ง„ ๋ถ„๋ฅ˜)์—์„œ ์‚ฌ์šฉ๋˜๋Š” ์„ฑ๋Šฅ์ง€ํ‘œ ์ž…๋‹ˆ๋‹ค.์ •๋ฐ€๋„(Precision)๋Š” ์˜ˆ์ธก์„ Positive๋กœ ํ•œ ๋Œ€์ƒ ์ค‘์— ์˜ˆ์ธก๊ณผ ์‹ค์ œ ๊ฐ’์ด Positive๋กœ ์ผ์น˜ํ•œ ๋ฐ์ดํ„ฐ์˜ ๋น„์œจ์„ ๋œปํ•ฉ๋‹ˆ๋‹ค.Object Detection์—์„œ๋Š” ๊ฒ€์ถœ ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ๊ฒ€์ถœ ์˜ˆ์ธกํ•œ ๊ฒฐ๊ณผ๊ฐ€ ์‹ค์ œ Object๋“ค๊ณผ ์–ผ๋งˆ๋‚˜ ์ผ์น˜ํ•˜๋Š”์ง€๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์ง€ํ‘œ์ž…๋‹ˆ๋‹ค.์žฌํ˜„์œจ(Recall)์€ ์‹ค์ œ ๊ฐ’์ด Positive์ธ ๋Œ€์ƒ ์ค‘์— ์˜ˆ์ธก๊ณผ ์‹ค์ œ ๊ฐ’์ด Positive๋กœ ์ผ์น˜ํ•œ ๋ฐ์ดํ„ฐ์˜ ๋น„์œจ์„ ๋œปํ•ฉ๋‹ˆ๋‹ค. ObjectDetection์—์„œ๋Š” ๊ฒ€์ถœ ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ์‹ค์ œ Object๋“ค์„ ๋น ๋œจ๋ฆฌ์ง€ ์•Š๊ณ  ์–ผ๋งˆ๋‚˜ ์ •ํ™•ํžˆ ๊ฒ€์ถœ ์˜ˆ์ธกํ•˜๋Š”์ง€๋ฅผ ๋‚˜ํƒ€๋‚ด..

Bigbread1129
'๐Ÿ‘€ Computer Vision' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (2 Page)