Object Detection 논문 리뷰. You Only Look Once:Unified, Real-Time Object Detection

2022. 12. 25. 00:13개발

 앞서 정리한 Object Detection의 기법이 상당히 반영되어 있는 YOLOv1의 논문을 리뷰해보고 성능을 더 끌어올린 기법이 무엇인지를 알아보자. 또, 다음에 이어 그대로 구현도 해볼 예정이다.

참조

Abstract (초록)

Object Detection을 바운딩 박스와 그 클래스 확률을 공간적으로 분리하여 푸는 회귀 문제로 짰다.

하나의 신경망으로 이미지에서 바운딩 박스와 클래스 예측을 한번에 수행한다.

YOLO는 Localization Error가 더 많지만, 배경을 오브젝트로 예측하는 False Positive는 적습니다.

YOLO는 오브젝트의 General Representation을 잘 학습합니다. (오브젝트에 대한 일반화 성능이 좋다는 뜻.)

Instead, we frame object detection as a regression problem to spatially separated bounding boxes and associated class probabilities.
A single neural network predicts bounding boxes and class probabilities directly from full images in one evaluation.
YOLO makes more localization errors but is less likely to predict false positives on background.
YOLO learns very general representations of objects.

1. Introduction (서론)

오브젝트를 빨리 인식하지만, 몇몇 오브젝트(특히, 작은 오브젝트)의 위치를 찾는데 어려워 합니다.

While it can quickly identify objects in images it struggles to precisely localize some objects, especially small ones.

2. Unified Detection (통합 탐지)

신뢰도(Confidence)는 오브젝트가 있을 확률 * 실제와 예측간 IoU로 정의합니다. 

또한, 각 그리드는 클래스별 조건부 확률을 예측합니다.

PASCAL VOC 데이터셋에 대해 YOLO는 그리드는 가로세로 각 7(S=7), 박스는 2개, 클래스는 20개로 최종적으로 7x7x30 tensor를 예측합니다.

Formally we define confidence as Pr(Object) ∗ IOUtruth pred. 
Each grid cell also predicts C conditional class probabilities, Pr(Classi |Object).
For evaluating YOLO on PASCAL VOC, we use S = 7, B = 2. PASCAL VOC has 20 labelled classes so C = 20. Our final prediction is a 7 × 7 × 30 tensor.

2.1. Network Design (망 설계)

Figure 3: 구조.

2.2. Training (훈련)

Convolutional 레이어는 ImageNet 데이터셋으로 사전 학습(pretrain)합니다.

Detection은 종종 세밀한 시각 정보가 필요하므로, Input 해상도를 224에서 448로 증가시킵니다.

이미지와 바운딩 박스의 너비 및 높이는 0과 1사이 값으로 정규화(normalize)합니다.

바운딩 박스내 x,y 좌표는 각 그리드 셀에 오프셋으로 0과 1사이 값으로 파라미터화(parametrize)합니다.

마지막 레이어에서 linear 활성함수를 쓰고, 나머지 레이어에서 leaky ReLU 활성함수를 씁니다.

쉬운 최적화 (학습)을 위해서 SSE(sum-squared error)를 쓰지만, AP(average precision) 최대화라는 우리 목표에 완벽히 들어맞지는 않습니다.

Localization 에러와 Classification 에러에 똑같이 가중치를 두는 것은 알맞지 않습니다. 또한, 이미지 내 많은 그리드들에는 오브젝트가 없습니다. 이것은 신뢰도 점수를 0으로 예측하게 만드는데, 오브젝트가 있는 경우에도 0으로 예측하게 합니다.

이것을 해결하기 위해 좌표가중치(λcoord = 5)로 바운딩 박스 예측의 로스를 증가시키고, No-오브젝트가중치(λnoobj = 0.5)로 오브젝트가 없는 경우의 신뢰도 예측의 로스를 감소시킵니다.

또한, SSE는 큰 박스와 작은 박스의 에러에 똑같이 가중치를 둡니다. 오차 측정(Error Metric)에서 큰 박스에서 편차를 작게 반영해야 하기 때문에, 바운딩 박스의 너비 및 높이를 그대로 사용하지 않고 스퀘어 루트를 사용합니다.

YOLO는 각 그리드에서 복수의(multiple) 바운딩 박스를 예측합니다. 

훈련에서는 각 오브젝트를 책임질 하나의 바운딩 박스 예측기만 필요합니다.

실제(Ground Truth)와 가장 높은 IoU를 가지는가를 기준으로 예측을 책임을 갖는 예측기(predictor)를 할당합니다.

각 예측기는 특정 사이즈, 종횡비, 또는 클래스를 예측하는 데에 더 좋아지고, 전체적인 recall을 개선합니다.

오버피팅을 피하기 위해서 dropout(첫 FC레이어에 0.5)과 augmentation(이미지 사이즈 20% 범위 내 랜덤 스케일링 및 translation, 1.5 HSV 범위 내 이미지 노출 및 채도 조정)을 씁니다.

We pretrain our convolutional layers on the ImageNet 1000-class competition dataset.
Detection often requires fine-grained visual information so we increase the input resolution of the network from 224 × 224 to 448 × 448.
We normalize the bounding box width and height by the image width and height so that they fall between 0 and 1.
We parametrize the bounding box x and y coordinates to be offsets of a particular grid cell location so they are also bounded between 0 and 1.
We use a linear activation function for the final layer and all other layers use the following leaky rectified linear activation.
We use sum-squared error because it is easy to optimize, however it does not perfectly align with our goal of maximizing average precision.
It weights localization error equally with classification error which may not be ideal. Also, in every image many grid cells do not contain any object. This pushes the “confidence” scores of those cells towards zero, often overpowering the gradient from cells that do contain objects.
To remedy this, we increase the loss from bounding box coordinate predictions and decrease the loss from confidence predictions for boxes that don’t contain objects. We use two parameters, λcoord and λnoobj to accomplish this. We set λcoord = 5 and λnoobj = .5.
Sum-squared error also equally weights errors in large boxes and small boxes. Our error metric should reflect that small deviations in large boxes matter less than in small boxes. To partially address this we predict the square root of the bounding box width and height instead of the width and height directly.
YOLO predicts multiple bounding boxes per grid cell.
At training time we only want one bounding box predictor to be responsible for each object.
We assign one predictor to be “responsible” for predicting an object based on which prediction has the highest current IOU with the ground truth.
Each predictor gets better at predicting certain sizes, aspect ratios, or classes of object, improving overall recall.
To avoid overfitting we use dropout and extensive data augmentation.

2.3. Inference (추론)

PASCAL VOC 데이터셋에 대해서 우리 모델은 이미지당 98개의 바운딩 박스와 각 박스의 클래스 확률을 예측합니다.

큰 오브젝트나 그리드 경계에 위치한 오브젝트의 경우 여러 셀에서 동 오브젝트를 예측합니다. 이러한 중복 감지는 NMS로 정정합니다.

On PASCAL VOC the network predicts 98 bounding boxes per image and class probabilities for each box.
Some large objects or objects near the border of multiple cells can be well localized by multiple cells.
Non-maximal suppression can be used to fix these multiple detections.

2.4. Limitations of YOLO (한계)

각 그리드셀에서 박스 2개를 예측하고 클래스 1개를 가질 수 있으므로, YOLO는 강한 공간적 제약을 가한다.

우리 모델은 양떼나 새떼같은 그룹의 형태로 나타나는 작은 오브젝트를 예측하기는 어렵습니다.

큰 박스에 대해 작은 에러를 적용하는 것은 잘 작용하지만, 작은 박스에 대한 작은 에러가 IoU에 훨씬 더 큰 작용을 합니다. 우리 모델의 대부분의 에러가 부정확한 Localization이었습니다. 

YOLO imposes strong spatial constraints on bounding box predictions since each grid cell only predicts two boxes and can only have one class.
Our model struggles with small objects that appear in groups, such as flocks of birds.
A small error in a large box is generally benign but a small error in a small box has a much greater effect on IOU.
Our main source of error is incorrect localizations.

후략.. (성능 비교 및 결과)

리뷰 (총평)

앞서 포스트한 Object Detection 정리 대부분의 내용이 이 논문에 녹아있다. 특히, 그리드 방식의 접근이 이 논문의 가장 큰 기여가 아닐까싶다. 공감하는 성능 향상 기법은 아래와 같고,

  • 가중치(λcoord, λnoobj) 사용
  • 너비 및 높이에 스퀘어 루트 적용
  • Augmentation 사용

의구심이 있어, 실험해볼 것은 아래와 같다.

  • Confidence에 IoU컨셉을 곱한 것이 어떤 성능 향상을 보일까
  • 마지막 FC 레이어 2개 층을 구성한 점에서 어떤 성능 차이를 보일까
  • B=2로 예측기의 수를 두는 것에서 어떤 성능 차이를 보일까
728x90
반응형