3. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
1
• Regression Problem
• Single Network
• Fast
• Less false positives on background
• General representations + New Domain
Abstract
YOLO란?
4. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
2
Introduction
Object Detection
여러 물체에 대해 어떤 물체인지, 어디에 위치해 있는지를 알아내는 작업
Classification + Localization
5. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
2
Introduction
Object Detection : DPM, R-CNN
문제점
1. 느리다
2. 최적화하기가 어렵다.
+ Refine
+ Eliminate
+ Rescore
6. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
2
Introduction
Object Detection : YOLO
사람처럼 어디에 무엇이 있는 지 한 번에 판단하자!
Single regression problem
- Single convolutional network
- Bounding box 좌표 & class 확률 계산
• 빠르다.
- Base : 45 fps , Fast : 150fps
• 전체적인 이미지를 보고 추론
- 배경을 객체로 인식하는 오류 ↓
• 일반화된 표현 학습
- 새로운 도메인에 적용 용이
7. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
3
Unified Detection
Overall
B : 각 grid마다 box 2개
Box의 중심 x, y 좌표 + box의 높이h , 너비w + confidence score
C : 각 grid마다 class 확률 계산
가장 높은 확률의 class로 정해짐
8. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
3
Unified Detection
Overall
1. 이미지를 S x S grid로 나눠 줌
- Grid cell 내 중심을 가지는 bounding boxes 존재
2. Grid cell은
B : Bounding box + Confidence Score 예측
- Bounding box : 중심의 x, y 좌표 , box의 w, h
- Confidence Score
: 객체가 존재한다면 IOU , 존재하지 않는다면 0
3. C : conditional class probabilities
- Box들과 별도로 Grid cell 각각에 대해서 class 확률 계산
- 확률이 가장 높은 class = grid cell의 class
( x, y, h, w, confidence score ) * Box의 개수
+
Class probabilities C개
S x S개의 grid cell X
본 논문에서는 S = 7 , B = 2 , C =20 로 7 x 7 x 30 tensor
9. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
3
Unified Detection
Network Design
• GoogLeNet 기반
- Inception Module❌ → 1x1 reduction layer ⭕
1x1 layers
10. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
3
Unified Detection
Network Design
Convolutional layer 24개 Fc layer 2개
11. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
3
Unified Detection
Training
• Conv layer 20개는 1000-class ImageNet 으로 pretrain
• Conv layer 4개 + Fc layer 2개 추가
- 가중치 random 초기화
• 해상도를 위해 input size 변경 224 → 448
• 마지막 layer를 제외한 모든 layer : leaky ReLU 사용
1470
reshape
Feature Extract Object Detect
12. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
3
Unified Detection
Training
𝑥𝐵1 𝑦𝐵1 ℎ𝐵1 𝑤𝐵1 𝑠𝐵1 𝑥𝐵2 𝑦𝐵2 ℎ𝐵2 𝑤𝐵2 𝑠𝐵2
Dog
0.7
cat
0.1 ………
Box1의
x,y,h,w,c-score
Box2의
x,y,h,w,c-score
해당 그리드
Class 20개의 확률
Box의 정규화 된 x, y, h, w 사용
- Box의 높이, 너비 : 전체 image에 대해 정규화
- Box의 중심좌표 x, y : grid에 대해 정규화
예시 ]
이미지의 높이 = 448, 너비 = 448
그리드의 높이 , 너비 = 64
노란색 상자의 높이 = 150
너비 = 120
중심의 좌표 x = 70 , y = 140
정규화된 box
높이 =
150
448
너비 =
120
448
x좌표 =
70 −64
64
Y좌표 =
140 −128
64
13. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
3
Unified Detection
Loss function
Bounding box coordinate regession
• 1𝑖,𝑗
𝑜𝑏𝑗
: i번째 그리드 , j번째 box가 물체가 있는 경우
• λ𝑐𝑜𝑜𝑟𝑑 : classification 보다 localization에 가중치를
주기 위한 loss term
• Box의 크기에 따른 error의 영향을 줄이기 위해
높이,너비에 대해 루트 값 사용
예시 )
29번째 그리드 내
0번째 box
Bounding box
Coordinate
regression
Confidence
score
prediction
Class
score
prediction
- SSE 사용 + 보완
14. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
3
Unified Detection
Loss function
Bounding box confidence score
prediction
• Object의 유뮤에 따라 confidence score 값 다름
• 1𝑖,𝑗
𝑜𝑏𝑗
: i번째 그리드 , j번째 box 내 물체가 있는 경우
• 1𝑖,𝑗
𝑛𝑜𝑜𝑏𝑗
: i번째 그리드 , j번째 box 내 물체가 없는 경우
• λ𝑛𝑜𝑜𝑏𝑗 = 0.5 :
- 객체가 없는 no object box가 더 많이 존재
- noobj와 obj의 균형을 맞춰 주기 위함
Bounding box
Coordinate
regression
Confidence
score
prediction
Class
score
prediction
- SSE 사용 + 보완
15. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
3
Unified Detection
Loss function
Class score prediction
• 1𝑖
𝑜𝑏𝑗
: i번째 그리드 내 물체가 있는 경우
• 물체가 없는 경우 (background로 간주)
Bounding box
Coordinate
regression
Confidence
score
prediction
Class
score
prediction
- SSE 사용 + 보완
16. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
3
Unified Detection
Hyperparameter
• epochs = 135
• batch_size = 64
• momentum = 0.9
• decay = 0.0005
• Learning rate = [0.001 , 0.01, 0.01, 0.001]
- 1epochs : 0.001 → 0.01
- 75epoch 까지 0.01 유지
- 30epoch 동안 0.001 유지
- 30epoj동안 0.0001 유지
• Avoid Overfitting → dropout , augmentation
• dropout rate = 0.5
• Data augmention
- 원본의 20% scaling , translation
- 랜덤으로 HSV 공간에서 exposure , saturation 1.5배
* HSV : 색조,채도,명도
17. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
3
Unified Detection
Test
𝑠𝐵1 𝑠𝐵2 𝑐1 ………
Box Box2 Class 20개의
확률
Class-specific confidence score 사용
- bounding box에 class가 나타날 확률과 얼마나 잘 위치해 있는지(fit) 𝑐0𝑠𝑏1
𝑐1𝑠𝑏1
𝑐2𝑠𝑏1
𝑐3𝑠𝑏1
.
.
.
.
.
𝑐18𝑠𝑏1
𝑐19𝑠𝑏1
Box별 confidence score
X
Grid 내 class의 확률
Bbox1
20x1
𝑐0𝑠𝑏2
𝑐1𝑠𝑏2
𝑐2𝑠𝑏2
𝑐3𝑠𝑏2
.
.
.
.
.
𝑐18𝑠𝑏2
𝑐19𝑠𝑏2
Bbox2
20x1
𝑐0𝑠𝑏98
𝑐1𝑠𝑏98
𝑐2𝑠𝑏98
𝑐3𝑠𝑏98
.
.
.
.
.
𝑐18𝑠𝑏98
𝑐19𝑠𝑏98
20x1
……
Bbox98
7x7개의 그리드에 대해서
box 2개씩 => 총 98개
18. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
3
Unified Detection
Test
Class prob> 0.2면,
0으로 치환 후 정렬
NMS
Class 1
Dog
bbox0 bbox1 bbox97
. . .
bbox2
0.4 0.3 0.08 0
Class 1
Dog
bbox0 bbox1 bbox97
. . .
bbox44
0.4 0.3 0.21 0 0.4 0.3 0.21 0.01 0
0 1 44 2 1
기준
IOU
기준 BOX와 선택 BOX의
IOU > 0.5 :
선택 BOX의 P = 0
20개의 class 에 대해
동일하게 반복 진행
20. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
3
Unified Detection
Limitation
1. 각 grid cell은 하나의 클래스만 예측
→ 물체가 겹쳐져 있다면 제대로 예측하지 못함
→ 크기가 작은 물체들은 제대로 인식되지 않음
2. Bounding box의 형태가 새롭거나 독특하면 잘 예측하지 못한다.
3. Bounding box의 크기와 상관없이 똑같이 error를 처리한다.
→ error가 작다면 large bbox는 큰 영향 x , 하지만 small bbox는 IOU에 큰 영향
21. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
4
Experiments
Comparision
DPM vs YOLO
- 45fps로 기존 DPM보다 빠르면서 mAP는 3배 높음
Faster R-CNN vs YOLO
- 10 mAP 낮지만 FPS가 6배 이상 높음
GoogLeNet vs VGG-16
- 같은 YOLO 모델에 convnet을 vgg16으로 교체
- 3 mAP 증가 , FPS는 2배 차이
22. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
4
Experiments
Error Analysis
FAST RCNN: Background Error 가 Error의 절반 가량
YOLO :Background Error가 Fast RCNN의
1
3
배
→ YOLO의 error의 대부분은 Localization으로 ,
Background error의 비율은 상당히 낮음
[ 기준 ]
Correct : class가 정확하며 IOU > 0.5 인 경우
Localization : class가 정확하고, 0.1 < IOU < 0.5 인 경우
Similar : class가 유사하고 IOU > 0.1 인 경우
Other : class는 틀렸으나, IOU > 0.1 인 경우
Background : 어떤 Object라도 IOU < 0.1 인 경우
23. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
4
Experiments
Fast RCNN + YOLO
FAST RCNN의 장점 : localization error ↓
+
YOLO 의 장점 : background error ↓
⇓
앙상블 사용시 mAP가 3.2% 증가
24. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
4
Experiments
Generalizability
- 피카소의 그림 같은 예술작품에 대해서도 person Detection이 뛰어나다.
25. Copyrightⓒ. Saebyeol Yu. All Rights Reserved.
• https://89douner.tistory.com/92
• https://taeu.github.io/paper/deeplearning-paper-yolo1-03/
• https://www.slideshare.net/TaegyunJeon1/pr12-you-only-look-
once-yolo-unified-realtime-object-detection