원문
YOLOv4: Optimal Speed and Accuracy of Object Detection
Link : https://arxiv.org/abs/2004.10934v1
YOLOv4: Optimal Speed and Accuracy of Object Detection
There are a huge number of features which are said to improve Convolutional Neural Network (CNN) accuracy. Practical testing of combinations of such features on large datasets, and theoretical justification of the result, is required. Some features operate
arxiv.org
Introduction
정확도와 Real-Time Object Detection을 모두 만족하는 Object Detector가 필요하다. 그렇기 때문에 해당 논문에서는 yolov4
를 이용해 training하는 동안 최신 기법인 Bag-of-Freebies
, Bag-of-Sqecials
기법들이 주는 영향에대해 검증한다.
Related Work
Object detection models
최신의 detector들은 일반적으로 아래와 같이 구성되어 있다.
Bag of freebies
Bag of freebies
기법은 inference 비용을 늘리지 않고 정확도를 향상시키는 방법을 의미한다.
- Data augmentation : input 이미지의 변동성을 증가시켜 model이 다른 환경에서 얻은 이미지에 대하여 더 높은 robustness를 갖도록 한다.
- 광학적 왜곡 : brightness, contrast, hue, saturation, noise of an image
- 기하학적 왜곡 : random scailing, cropping, flipping, rotating
- Random ease, CutOut, hide-and-seek, grid mask
- MixUp, CutMix
- GAN
- Imbalance sampling : 다양한 클래스사이의 data imbalance 문제를 해결
- Focal Loss
- Label smoothing : 모델이 더 높은 robustness를 갖도록 학습시 hard label를 soft label로 변환한다.
- Objective function : 기존의 Mean Square Error(MSE) 대신에 아래 loss function을 사용
- IoU loss : 예측된 bbox와 ground truth bbox의 coverage를 고려
- GIoU loss : converage area와 object shape 및 orientation을 포함
- DIoU loss : 추가적으로 object의 중심 거리를 고려
- CIoU loss : overlapping area, center points 사이의 거리, aspect ratio를 동시에 고려
Bag of specials
Bag of specials
기법은 Bag of freebies
와 달리 inference 비용을 조금 높이면서 정확도를 크게 향상시키는 방법을 말한다.
- Plugin modules : 모델의 특정 속성을 강화 시키는 방법
- Enhancing receptive field : SPP, ASPP, RFB
- Attention module : Squeeze-and-Excitation(SE), Spatial Attention Module(SAM)
- Feature integration : SFAM, ASFF, BiFPN
- Activation funciont : Gradient vanish problem을 해결하기 위해 ReLU 함수가 쓰였고, 이후 LReLU, PReLU, ReLU6, Scaled Exponential Linear Unit(SELU), Swish, hard-Swish, Mish가 제안되었다.
- Post-processing : 모델의 예측 결과를 선별하는 방법
- NMS(Non-Maximum Suppression)
위의 Post-processing 방법은 모두 capture된 image feature를 직접적으로 참고하고 있지 않기 때문에, 이후의 anchor-free 기법의 개발에서는 더 이상 필요하지 않음.
Methodology
Selection of architecture
Input network의 해상도, Convolutional layer의 수, parameter의 수, layer outputs의 수 사이에서 최적의 balance가 되는 architecutre를 선택한다. 해당 선택 조건은 아래와 같다.
- Higher input network size
- More layers
- More paramters
위의 조건을 만족하는 architecutre는 아래와 같다.
- Bachbone : CSPDarkNet53
- Additional module : SPP
- Path-aggregation : PANet
- Head : yolov3
Selection of BoF and BoS
위의 모델의 훈련을 개선하기 위해 우래와 같은 기법들이 선택되었다.
- Bag of freebies
- BBox regression loss : MSE, IoU, GIoU, CIoU, DIoU
- Data augmentation : CutOut, MixUp, CutMix
- Regularization method : DropBlock
- Bag of specials
- Activations : ReLU, leaky-ReLU, Swish, Mish
- Normalization of the network activations by their mean and variance : Batch Normalization(BN), Filter Response Normalization(FRN), Cross-Iteration Batch Normalizatoin(CBN)
- Skip-connections : Residual connections, Weighted resiudal connections, Multi-input weighted residual connections, Cross stage partial connections(CSP)
Additional improvements
아래의 방법들처럼 추가적인 설계 및 개선을 수행해서 yolov4
를 하나의 GPU를 이용한 training 시 보다 적합하게 만들었다.
Bag of freebies
- Mosaic
CutMix
는 단지 2개의 입력 이미지들만 Mix하는데, Mosaic
는 4개의 이미지들을 Mix했다.
이를 통해 normal한 context 외부의 object들도 detection할 수 있다. 또한 BN은 각 layer 상에서 서로 다른 4개의 이미지들에 대한 activation 통계를 셰산 가능하므로 큰 크기의 mini-batch에 대한 필요성을 상당히 줄일 수 있다.
- Self-Adversarial Training(SAT)
2단계의 forward 및 backward 단계로 동작한다.
- 1단계 : neural network는 network의 weight 대신에 원본 이미지를 변경한다.
- 2단계 : neural network은 변경된 이미지에서 정상적인 방식으로 object detetion을 하도록 훈련된다.
Bag of specials
- Cross mini-Batch Normalization(CmBN)
CBN
의 변경된 version으로, 단일 batch 내에서 mini-batch에 대한 통계를 수집한다.
- modified SAM, modified PAN
SAM
을 spatial-wise attention에서 point-wise attention으로 변경했다.
PAN
의 shortcut connetcion을 concatenation으로 교체했다.
YOLOv4
yolov4
의 구성은 아래와 같다.
- Backbone : CSPDarknet53
- Neck : SPP, PAN
- Head : yolov3
yolov4
에서 사용한 기법들은 아래와 같다.
- BoF for backbone : CutMix and Mosaic dataaugmentation, DropBlock regularization, Class label smoothing
- Bos for backbone : Mish activation, Cross-stage partial connections(CSP), Multi-input weighted residual connections(MiWRC)
- Bof for detetor : CIoU-loss, CmBN, DropBlock regularization, Mosaic data augmentation, Self-Adversarial Trining(SAT), Eliminate grid sensitivity, Using multiple anchors for a single ground truth, Cosine annealing scheduler, Optimal hyper-parameters, Random training shapes
- Bos for detector : Mish activation, SPP-block, SAM-block, PAN path-agggregation block, DIoU-NMS