You Only Look Once : Unified, Real-Time Object...
Transcript of You Only Look Once : Unified, Real-Time Object...
You Only Look Once :Unified, Real-Time Object Detection
Byeong-Sun Hong
2018. 07. 12
Computer Graphics @ Korea University
Copyright of figures and other materials in the paper belongs to original authors.
Joseph Redmon et al.(University of Washington)CVPR 2015
Byeong-sun Hong | 2018. 07. 12 | # 2Computer Graphics @ Korea University
Index
• Introduction
• Unified Detection
• Comparison to Other Detection Systems
• Experiments
• Real-Time Detection In The Wild
• Conclusion
Introduction
Byeong-sun Hong | 2018. 07. 12 | # 4Computer Graphics @ Korea University
1.Introduction
• Object Detection
▪ 입력 영상이 주어졌을 때, 영상 내에 존재하는 N개의 Object에대해서 classification과 localization을 하는 것
• 사용되는 분야
▪ 자율주행, 얼굴탐지 etc…
Byeong-sun Hong | 2018. 07. 12 | # 5Computer Graphics @ Korea University
1.Introduction
• Object Detection 방식
▪ Sliding Window
• Window를 image 좌상단 부터 우하단까지 sliding 시키며detection을 진행
▪ Region proposals
• 물체가 있을 법한 영역을 미리 추천 받아서 그 영역에 대해서만detection 진행
Byeong-sun Hong | 2018. 07. 12 | # 6Computer Graphics @ Korea University
1.Introduction
• 어떤 사물이 있고(classification) 어디에 있는지(Localization) 예측하기위해 이미지를 오직 한번만 보면 된다.(You Only Look Once)
▪ Sliding window 방식과 region proposal 방식과는 다름
• YOLO의 장점
▪ 빠르다 – Titan X GPU에서 45fps, fast version : 150fps
▪ 학습과 test시에 image 전체를 본다 - Fast RCNN같은 경우는region에 대해서만 detection을 하므로 큰 이미지를 못 보게 되어background error가 많이 발생한다.
▪ 사물의 일반화된 representation을 학습한다. 그림에서도 높은 mAP를나타냄
Figure 1
Byeong-sun Hong | 2018. 07. 12 | # 7Computer Graphics @ Korea University
1.IntroductionRelated Work
• [Object Detection with Discriminatively Trained Part Based Models]▪ P. F. Felzenszwalb et al. (IEEE Trans 2010)
• DPM(Deformable Part Model)
▪ HOG feature를 사용
▪ root filter와 part filter로 구성
▪ SVM을 이용하여 분류
Byeong-sun Hong | 2018. 07. 12 | # 8Computer Graphics @ Korea University
1.IntroductionRelated Work
• HOG(Histogram of Oriented Gradients)
▪ Image에서 Gradient를 계산하고 그 값을 이용하여 Local histogram 생성한다.
▪ Gradient 계산
• image에 kernel을 씌워 edge를 구한다.
• x축 edge와 y축 edge를 계산하여 두 값을 가지고 arctan를 이용해orientation을 계산
Byeong-sun Hong | 2018. 07. 12 | # 9Computer Graphics @ Korea University
1.IntroductionRelated Work
• root filter와 part filter로 구성
▪ Root filter(전체)와 Part filter(부분별)를 동시에 사용하기 때문에 일부분이보이지 않거나 약간의 변형이 있더라도 잘 검출할 수 있다.
Byeong-sun Hong | 2018. 07. 12 | # 10Computer Graphics @ Korea University
1.IntroductionRelated Work
• SVM(Support Vector Machine)을 이용하여 classification
▪ 두 class 사이의 Margin(Gap)을 최대화 시키는 선을 찾아 분류한다
Byeong-sun Hong | 2018. 07. 12 | # 11Computer Graphics @ Korea University
1.IntroductionRelated Work
• [Overfeat: Integrated recognition, localization and detection using convolutional networks]
▪ P. Sermanet et al. (CVPR 2013)
• Overfeat
▪ Class 별로 Bbox 및 socre를 출력하는 Network를 따로 학습하여 class 개수 만큼의 Network가 이미지를 여러 scale로 sliding 하며 얻은 모든결과를 취합
Byeong-sun Hong | 2018. 07. 12 | # 12Computer Graphics @ Korea University
1.IntroductionRelated Work
• [Scalable object detection using deep neural networks]
▪ D Erhan et al. (CVPR 2014)
• Deep MultiBox
▪ Localization만 가능 Classification 불가
▪ N개의 Bounding box를 생성하여 ground truth와 match하여 최고를찾음
Byeong-sun Hong | 2018. 07. 12 | # 13Computer Graphics @ Korea University
1.IntroductionRelated Work
• [Rich feature hierarchies for accurate object detection and semantic segmentation]
▪ P. F. Felzenszwalb et al. (IEEE Trans 2010)
• R-CNN▪ 3부분으로 나뉘어짐
• 1. region proposals(selective search 사용)
• 2. 각 region에 대해 Warp 후 CNN
• 3. Classify region
Byeong-sun Hong | 2018. 07. 12 | # 14Computer Graphics @ Korea University
1.IntroductionRelated Work
• Region proposals
▪ Selective Search(SS)• Sub-segmentation
• Region 통합
• 후보영역 생성
Byeong-sun Hong | 2018. 07. 12 | # 15Computer Graphics @ Korea University
1.IntroductionRelated Work
• Convolutional Neural Network
▪ Convolution연산
• 이미지 위에서 filter가 슬라이딩 방식으로 움직이면서 dot product 연산을 한다.
Byeong-sun Hong | 2018. 07. 12 | # 16Computer Graphics @ Korea University
1.IntroductionRelated Work
• Convolutional Neural Network
▪ Layer가 깊어질 수록 복잡한 feature를 확인 할 수 있다.
Byeong-sun Hong | 2018. 07. 12 | # 17Computer Graphics @ Korea University
1.IntroductionRelated Work
• [Fast R-CNN]
▪ Ross Girshick (ICCV 2015)
• Fast R-CNN
▪ R-CNN에서 각 region에 대하여 CNN을 진행하는 방식을 1번으로바꿈(약 2000번의 CNN vs 1번의 CNN)
Byeong-sun Hong | 2018. 07. 12 | # 18Computer Graphics @ Korea University
1.IntroductionRelated Work
• Roi Pooling Layer
▪ image 전체에 대하여 CNN을 진행한 뒤 구해놓은 region proposal을conv feature에 projection 시켜서 detection 진행
Byeong-sun Hong | 2018. 07. 12 | # 19Computer Graphics @ Korea University
1.IntroductionRelated Work
• Fast R-CNN의 한계
▪ Selective Search에 걸리는 시간
Byeong-sun Hong | 2018. 07. 12 | # 20Computer Graphics @ Korea University
1.IntroductionRelated Work
• [Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks]
▪ Shaoqing Ren et al. (NIPS 2015)
• Faster R-CNN
▪ Fast R-CNN에서 region proposal 부분의 bottleneck을 해결하기 위해region proposal network를 개발
Byeong-sun Hong | 2018. 07. 12 | # 21Computer Graphics @ Korea University
1.IntroductionRelated Work
• RPN(Region Proposal Network)
▪ sliding window 방식
▪ 종횡비와 크기가 다른 anchor들을 사용
Byeong-sun Hong | 2018. 07. 12 | # 22Computer Graphics @ Korea University
1.IntroductionRelated Work
• Result
Byeong-sun Hong | 2018. 07. 12 | # 23Computer Graphics @ Korea University
1.IntroductionRelated Work
• [Real-time grasp detection using convolutional neural networks]
▪ J. Redmon and A. Angelova (ICRA 2015)
• Multi-Grasp
▪ image를 NxN grid로 나누어서 한 grid마다 grasp이 잘 될확률(heatmap)과 coordinate 값 출력 (x,y,w,h,𝜃)
Unified Detection
Byeong-sun Hong | 2018. 07. 12 | # 25Computer Graphics @ Korea University
2. Unified Detection
• 지금까지의 Object Detection에서는 Classification과 Localization이나누어져 있었지만 YOLO는 두 가지 과정을 한번에 해결
Figure 2
Byeong-sun Hong | 2018. 07. 12 | # 26Computer Graphics @ Korea University
2. Unified Detection
• S x S grid로 나눔
Byeong-sun Hong | 2018. 07. 12 | # 27Computer Graphics @ Korea University
2. Unified Detection
• 각 grid의 Bounding Box 및 Confidence 값 예측
▪ Grid 당 2개의 Bounding box 예측
• Bounding Box
▪ (x, y, w, h, confidence)
• Confidence
▪
Byeong-sun Hong | 2018. 07. 12 | # 28Computer Graphics @ Korea University
2. Unified Detection
• IOU(Intersection Over Union)
▪ 예측한 Bounding box와 실제 Bounding box가 얼마나 겹쳤는지 계산
Byeong-sun Hong | 2018. 07. 12 | # 29Computer Graphics @ Korea University
2. Unified Detection
• 각 grid의 class가 어떤 것인지 예측
(1)
Byeong-sun Hong | 2018. 07. 12 | # 30Computer Graphics @ Korea University
2. Unified Detection
• NMS(Non-maximum suppression)를 통해 겹치는 부분을 없앤다.
• PASCAL VOC에 대해서 평가
▪ S = 7, B = 2, C = 20
▪ S x S x ((B x 5) + C) / 총 7x7x30개의 값이 한 image에 대해 나온다.
Byeong-sun Hong | 2018. 07. 12 | # 31Computer Graphics @ Korea University
2. Unified Detection2.1 Network Design
• Yolo Network 구조
▪ 24개의 Convolution layer, 2개의 Fully Connected layer
• Fast Yolo
▪ 9개의 Convolution layer를 사용한 것과 필터 개수만 다르다.
Figure 3
Byeong-sun Hong | 2018. 07. 12 | # 32Computer Graphics @ Korea University
2. Unified Detection2.2 Training
• Pre-train
▪ ImageNet 1000-class dataset에 대해 20개의 conv layer를 1주일 간학습시켜 얻은 weight로 초기화
• Pre-train된 Network에 Convolution layer와 Fully connected layer를추가하여 성능을 향상시킴(random weight)
▪ [Object Detection Networks on Convolutional Feature Map]
• Shaoqing Ren et al. (CVPR 2015)
Byeong-sun Hong | 2018. 07. 12 | # 33Computer Graphics @ Korea University
2. Unified Detection2.2 Training
• Detection에서 좀 더 세밀한 정보를 볼 수 있게 input size를224x224에서 448x448로 증가시킴
• Bbox의 w, h를 이미지의 폭과 높이에 맞춰 0~1로 정규화하고
x, y좌표는 grid셀을 기준으로 0~1사이 값을 가짐
• Activation function은 마지막 layer에서만 linear activation function을사용하고 나머지는 모두 leaky ReLU function 사용
(2)
Byeong-sun Hong | 2018. 07. 12 | # 34Computer Graphics @ Korea University
2. Unified Detection2.2 Training
• MSE 보다 쉽게 최적화 할 수 있는 SSE 사용
• 대부분의 grid에서 object를 포함하고 있지 않으므로 confidence 값이0으로 수렴하고 그 영향으로 모델이 불안정해 질 수 있다.
▪ Object가 있는 bounding box 좌표의 loss는 증가시키고 object가없는 bounding box confidence의 loss는 감소시킨다.
▪ 위의 작업을 위해 두 parameter를 사용한다
• = 5 = 0.5
Byeong-sun Hong | 2018. 07. 12 | # 35Computer Graphics @ Korea University
2. Unified Detection2.2 Training
• Training시에 사용되는 loss function
(3)
Byeong-sun Hong | 2018. 07. 12 | # 36Computer Graphics @ Korea University
2. Unified Detection2.2 Training
• Training시에 사용되는 loss function
▪ Bounding box coordinate 부분
: Object가 존재하는 𝑖번째 Grid cell의 𝑗번째 bounding box
: x,y,w,h에 대한 loss와 다른 loss들과의 균형을 위한 parameter = 5
𝑥𝑖, 𝑦𝑖 , 𝑤𝑖, ℎ𝑖 : 𝑖번째의 coordinate 값
Byeong-sun Hong | 2018. 07. 12 | # 37Computer Graphics @ Korea University
2. Unified Detection2.2 Training
• Training시에 사용되는 loss function
▪ Confidence 부분
: Object가 존재하는 𝑖번째 Grid cell의 𝑗번째 bounding box
: Object가 존재하지 않는 𝑖번째 Grid cell의 𝑗번째 bounding box
𝐶𝑖 : 𝑖번째 grid의 confidence 값 ( object가 있으면 1, 없으면 0 )
: Object가 있는 box와 없는 box간의 균형을 위한 parameter = 0.5
Byeong-sun Hong | 2018. 07. 12 | # 38Computer Graphics @ Korea University
2. Unified Detection2.2 Training
• Training시에 사용되는 loss function
▪ Class 예측 부분
: Object가 존재하는 𝑖번째 Grid cell
𝑝𝑖 : 𝑖번째의 conditional class probability (맞는 class는 1, 다른 값은 0)
Byeong-sun Hong | 2018. 07. 12 | # 39Computer Graphics @ Korea University
2. Unified Detection2.2 Training
• PASCAL VOC2007 2012 dataset에 대해 135번 학습
• batch_size = 64
• Learning_rate
▪ loss가 작아지는 쪽으로 최적화 될 때 한번에 움직이는 step 크기
• learning rate값 변화
▪ 첫 학습 0.001 -> 0.01
▪ 75번까지 0.01
▪ 105번까지 0.001
▪ 135번까지 0.0001
Byeong-sun Hong | 2018. 07. 12 | # 40Computer Graphics @ Korea University
2. Unified Detection2.2 Training
• Overfitting
▪ training data에만 최적화 된 상태
• Overfitting을 피하기 위해 두 가지 방법 사용
▪ 첫 번째 FC 다음에 Dropout = 0.5로 진행(50%는 버림)
▪ Data증가 = 원본 이미지를 random scaling and translation
Byeong-sun Hong | 2018. 07. 12 | # 41Computer Graphics @ Korea University
2. Unified Detection2.3 Inference
• Test시에도 똑같은 Network 사용
▪ 이미지당 98개의 bounding box와 각 grid당 class확률 예측
▪ NMS(Non-Maximum Suppression)를 이용해 최종 Bbox를 결정한다.
• 중복되는 부분을 제거하기 위해 사용
• 동일한 class에 대하여 confidence 순으로 정렬한다.
• 가장 confidence가 높은 bounding box와 IOU가 일정 이상인bounding box는 동일한 물체라고 판단하여 지운다.(보통 0.5)
Byeong-sun Hong | 2018. 07. 12 | # 42Computer Graphics @ Korea University
2. Unified Detection2.4 Limitations of YOLO
• 각 grid 셀이 2개의 박스만 예측하고 하나의 클래스만 가질 수있으므로 bbox 예측에 공간적 제약이 있음
▪ 무리 지어 있는 작은 사물은 detection하기 어려움
• 데이터로부터 bbox를 예측하므로 새롭거나 특이한 가로 세로비는 잘못 찾을 수 있다.
• 크기에 상관없이 bbox의 error를 동일하게 처리하므로 잘못된localization이 발생할 수 있다.(IOU에 영향을 미침)
Comparison to Other Detection Systems
Byeong-sun Hong | 2018. 07. 12 | # 44Computer Graphics @ Korea University
3. Comparison to Other Detection Systems
• Deformable parts models(DPM)
▪ Feature 추출, region 분류, bbox예측을 하기 위해 분리된pipeline사용하지만 YOLO는 이 모든 과정을 하나의 Network로 대체
▪ GPU사용과 알고리즘 변화로 속도 증가를 시켰지만 성능이 YOLO보다낮음
• R-CNN
▪ Region proposal 사용, SS가 bbox생성, conv Network가 feature추출SVM으로 classification 등등 복잡한 pipeline을 가짐 속도로 1장당40초로 느리다.
▪ RCNN은 1장당 2000개의 Bbox를 제안하지만 YOLO는 98개만 제안
• Fast/Faster RCNN
▪ 속도 개선에 중점을 두었지만 실시간에는 무리
Byeong-sun Hong | 2018. 07. 12 | # 45Computer Graphics @ Korea University
3. Comparison to Other Detection Systems
• Deep MultiBox
▪ 어떤 사물이 있는지 구분은 못함 (Object가 있는지 없는지만 판단)
• Overfeat
▪ Localization와 Classification 두 부분으로 나눠져 있음
• Multi Grasp
▪ Bbox 예측을 위한 grid방식은 YOLO와 비슷
▪ Multi Grasp은 하나의 물체만 있는 이미지에 대해 잡을 수 있는 단일region만 예측
▪ yolo는 비슷한 방법으로 여러 class의 여러 object에 대한 bbox와confidence를 예측한다.
Experiments
Byeong-sun Hong | 2018. 07. 12 | # 47Computer Graphics @ Korea University
4. Experiments4.1 Comparison to Other Real-Time Systems
• Real-Time에 근접한 다른 알고리즘과 비교
▪ mAP와 FPS를 둘 다 봤을 때 YOLO가 우수하다.
Table 1
Byeong-sun Hong | 2018. 07. 12 | # 48Computer Graphics @ Korea University
4. Experiments4.1 Comparison to Other Real-Time Systems
• mAP(mean Average Precision)
▪ AP – Recall 값에 대응하는 Precision 값들의 Average
▪ Precision – 참 값 이라고 예측한 것 중에서 맞게 예측한 비율
• True Positive / ( False Positive + True Positive)
▪ Recall – 실제 참 값 중에 정확히 참 값을 예측한 비율
• True Positive / ( False Negative + True Positive)
▪ 따라서 mAP는 각각의 object당 AP값을 구해 평균을 구함
Byeong-sun Hong | 2018. 07. 12 | # 49Computer Graphics @ Korea University
4. Experiments4.2 VOC 2007 Error Analysis
• Fast R-CNN은 YOLO에 비해 더 많은 Background 즉 false positive를찾는다.
Figure 4
Byeong-sun Hong | 2018. 07. 12 | # 50Computer Graphics @ Korea University
4. Experiments4.3 Combining Fast R-CNN and YOLO
• Fast R-CNN 과 YOLO를 결합했더니 더 좋은 결과가 나왔다.
▪ YOLO는 Fast R-CNN과 비교했을 때 background를 더 적게 찾음
▪ Fast R-CNN과 YOLO 둘 다 예측한 곳은 Fast R-CNN으로classification
▪ mAP는 올라가는 것을 확인 할 수 있었지만 YOLO R-CNN을 둘 다돌려야 하므로 YOLO의 빠른 시간에 따른 이점은 없다.
Table 2
Byeong-sun Hong | 2018. 07. 12 | # 51Computer Graphics @ Korea University
4. Experiments4.4 VOC 2012 Results
Table 3
Byeong-sun Hong | 2018. 07. 12 | # 52Computer Graphics @ Korea University
4. Experiments4.5 Generalizability: Person Detection in Artwork
• Artwork에 대한 detection 능력 비교▪ YOLO는 artwork에서도 강한
모습을 보임
Figure 5
Figure 6
Real-Time Detection In The Wild
Byeong-sun Hong | 2018. 07. 12 | # 54Computer Graphics @ Korea University
5. Real-Time Detection In The Wild
Conclusion
Byeong-sun Hong | 2018. 07. 12 | # 56Computer Graphics @ Korea University
6. Conclusion
• Classification과 localization을 통합시킨 model
• 전체 Image에서 한번에 학습하는 simple한 구조
• Fast YOLO는 제일 빠름
• 일반적인 사물 detection이 뛰어남
Byeong-sun Hong | 2018. 07. 12 | # 57Computer Graphics @ Korea University
Appendix
• Fast RCNN 구조
Byeong-sun Hong | 2018. 07. 12 | # 58Computer Graphics @ Korea University
Appendix
• Backpropagation
Byeong-sun Hong | 2018. 07. 12 | # 59Computer Graphics @ Korea University
Appendix
• Backpropagation
Byeong-sun Hong | 2018. 07. 12 | # 60Computer Graphics @ Korea University
Appendix
• Vanishing Gradient Problem
▪ Sigmoid tanh같은 경우에는 양쪽 끝으로 가게 되면 gradient가 매우작아져서 weight 를 계속 곱해가다 보면 gradient가 0에 수렴하게되어 초기 layer의 weight들이 의미가 없어지는 현상이 생긴다.
Byeong-sun Hong | 2018. 07. 12 | # 61Computer Graphics @ Korea University
Appendix
• linear 함수일 때 불가능한 것
Byeong-sun Hong | 2018. 07. 12 | # 62Computer Graphics @ Korea University
Appendix
• Max pooling
▪ Mask를 씌웠을 때 가장 큰 숫자만 선택
▪ Feature 값 중에서 큰 값이 가장 효과적일 수 있기 때문에
max pooling 사용 실제로 결과가 좋음
Byeong-sun Hong | 2018. 07. 12 | # 63Computer Graphics @ Korea University
Appendix
• DropOut
▪ Random하게 unit들을 제외하여 overfitting 문제를 개선
Byeong-sun Hong | 2018. 07. 12 | # 64Computer Graphics @ Korea University
Appendix
• Zero padding
Byeong-sun Hong | 2018. 07. 12 | # 65Computer Graphics @ Korea University
Appendix
• CIFAR-10 demo
Byeong-sun Hong | 2018. 07. 12 | # 66Computer Graphics @ Korea University
Appendix
• Fully-connected layer