YOLO V4
Speed and accuracy are both improved
The Yolov4 released by Alexey Bochkovskiy and 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 on certain models exclusively and for certain problems exclusively, or only for small-scale datasets; while some features, such as batch-normalization and residual-connections, are applicable to the majority of models, tasks, and datasets.
Paper Yolo v4: https://arxiv.org/abs/2004.10934
New Features:
- Weighted-Residual-Connections (WRC)
- Cross-Stage-Partial-connections (CSP)
- Cross mini-Batch Normalization (CmBN)
- Self-adversarial-training (SAT)
- Mish activation
- Mosaic data augmentation
- DropBlock regularization
- CIoU loss
Results of the new features are FPS, Accuracy with V100 GPU and the results shown in below. They are tested with multiple GPUs and the results here.
Compared with YOLOv3, the new version of AP (accuracy) and FPS (frame rate per second) are improved by 10% and 12%, respectively.
Added more Convolutional Neural Network (CNN) layer in YOLOv4.
Object Detector:
The object detector is composed of several parts. The parts are
The difference of yolov4 from yolov3 is only the backbone. Because the yolov3 has Darknet53 backbone. But the yolov4 has CSPDarknet53.
All other thinks are same compare with yolov3.
The Yolov4 heads is same as yolov3. The Heads is prediction part and it has two types. One is Dense Prediction(One-stage detector) and another one is Sparse Prediction(Two stage detector).
YOLO v4 uses:
- Bag of Freebies (BoF) for backbone: CutMix and Mosaic data augmentation, DropBlock regularization, Class label smoothing
- Bag of Specials (BoS) for backbone: Mish activation, Cross-stage partial connections (CSP), Multiinput weighted residual connections (MiWRC).
- Bag of Freebies (BoF) for detector: CIoU-loss, CmBN, DropBlock regularization, Mosaic data augmentation, Self-Adversarial Training, Eliminate grid sensitivity, Using multiple anchors for a single ground truth, Cosine annealing scheduler [52], Optimal hyperparameters, Random training shapes.
- Bag of Specials (BoS) for detector: Mish activation, SPP-block, SAM-block, PAN path-aggregation block, DIoU-NMS.
Install YoloV4(Ubuntu):
git clone https://github.com/AlexeyAB/darknet.git
cd darknet
make
We have to change come value in Makefile inside the darknet folder before run make command. Open the Makefile and change these values
GPU=1
CUDNN=1
CUDNN_HALF=1
OPENCV=1
if you installed GPU, cuda, cudnn, and OpenCV.
If you have any doubt to change the Makefile, please comment the questions below.
Prediction Command:
Download the pretrained weights for yolov4
./darknet detect cfg/yolov4.cfg yolov4.weights data/dog.jpg
Please check the link and see the descriptions to how to run the darknet command.
Yolov4 and Yolov3 prediction comparision:
Train Custom Objects in YOLOV4:
The yolov4 custom object training is same as yolov3. Only the difference is backbone of the yolo. Yolov3 has darknet53 and yolov4 has CSPDarknet53.
The filters equation is same as yolov3. If you don’t train with yolov3, please follow the training link.