YOLOv4 is a real-time object detection model introduced in 2020 by Alexey Bochkovskiy, Chien-Yao Wang, and Hong-Yuan Mark Liao in the paper YOLOv4: Optimal Speed and Accuracy of Object Detection. The model was designed to improve both detection accuracy and inference speed while remaining practical to train and run on conventional GPU hardware.
YOLOv4 builds on the single-stage detection philosophy of earlier YOLO models while combining a large collection of architectural and training improvements.
Its major ideas include:
- CSP-based feature extraction
- Mish activation
- Mosaic data augmentation
- Self-Adversarial Training
- Cross mini-Batch Normalization
- DropBlock regularization
- CIoU loss
- Multi-scale object detection
- Efficient real-time inference
What Is YOLOv4?
YOLOv4 is a single-stage object detector.
It analyzes an entire image through one neural network and predicts:
- Bounding boxes
- Objectness scores
- Object classes
- Detection confidence
The goal of YOLOv4 was not simply to increase model size. Instead, the authors evaluated many existing deep-learning techniques and selected combinations that improved detection performance without making training or inference unnecessarily expensive.
YOLOv4 and Darknet
YOLOv4 was implemented using the Darknet neural network framework.
Darknet is an open-source framework written primarily in C and CUDA and supports both CPU and GPU computation.
The repository you provided describes itself as:
YOLOv4 – Neural Networks for Object Detection (Windows and Linux version of Darknet).
It includes YOLOv4-related configuration files, Darknet source code, training functionality, and object detection resources.
YOLOv4 Architecture
YOLOv4 combines several major components.
A simplified architecture can be described as:
Input Image → Backbone → Neck → Detection Head
The most commonly described YOLOv4 architecture uses:
- CSPDarknet53 as the backbone
- SPP and PANet-style feature aggregation in the neck
- YOLO-style detection heads at multiple scales
This architecture allows the model to capture both strong semantic information and fine spatial detail for objects of different sizes.
CSPDarknet53 Backbone
YOLOv4 uses CSPDarknet53 as its feature extraction backbone.
CSP stands for:
Cross Stage Partial
The CSP approach splits and merges feature information across stages of the network.
This helps improve:
- Gradient flow
- Feature reuse
- Computational efficiency
- Training stability
CSP-based connections are one of the important architectural components discussed in the YOLOv4 paper.
Mish Activation
YOLOv4 incorporates the Mish activation function in its architecture.
Activation functions help neural networks learn nonlinear relationships.
Mish is designed to provide smooth nonlinear behavior and was one of the techniques selected by the YOLOv4 authors to improve model accuracy.
Spatial Pyramid Pooling
YOLOv4 uses Spatial Pyramid Pooling, commonly abbreviated as SPP.
SPP helps expand the effective receptive field without significantly increasing computational cost.
This allows the model to capture information from different spatial scales before features are passed deeper into the detection pipeline.
SPP is useful for improving context understanding, especially when objects vary significantly in size.
PANet Feature Aggregation
YOLOv4 uses a PANet-style path aggregation approach in the neck.
The goal is to combine deep semantic information with lower-level spatial information.
This helps the network detect:
- Large objects
- Medium objects
- Small objects
The YOLOv4 network performs prediction at multiple feature-map resolutions rather than relying on only one output scale.
Three Detection Scales
YOLOv4 performs object detection at three different scales.
For a typical 608-pixel configuration, different feature maps are responsible for detecting objects of different sizes.
Conceptually:
- Coarse feature maps help detect large objects
- Medium-resolution maps help detect medium objects
- Fine-resolution maps help detect small objects
This multi-scale strategy improves detection across diverse scenes.
Anchor-Based Detection
YOLOv4 uses anchor boxes.
Anchor boxes are predefined bounding box shapes that act as starting points for object predictions.
The model adjusts these anchors to fit detected objects.
Each prediction includes information such as:
- Bounding box center
- Width
- Height
- Objectness
- Class confidence
Anchor-based detection helps the model handle objects with different shapes and aspect ratios.
Bounding Box Prediction
YOLOv4 predicts bounding boxes around detected objects.
Each bounding box represents:
- X position
- Y position
- Width
- Height
- Confidence
- Class prediction
The model learns to adjust its predictions so that the boxes align closely with ground-truth objects.
CIoU Loss
YOLOv4 uses Complete Intersection over Union, commonly called CIoU, as part of bounding box regression.
CIoU considers multiple geometric factors when evaluating bounding boxes, including:
- Box overlap
- Center-point distance
- Aspect ratio
This provides a richer localization objective than simple overlap measurements alone.
Mosaic Data Augmentation
One of the most recognizable YOLOv4 training techniques is Mosaic augmentation.
Mosaic combines multiple training images into a single composite image.
This exposes the model to:
- More objects per training sample
- Different object scales
- Different visual contexts
- More varied spatial arrangements
The YOLOv4 paper lists Mosaic among the important techniques contributing to its performance.
Self-Adversarial Training
YOLOv4 includes Self-Adversarial Training, or SAT.
SAT alters training images in ways that force the network to improve its understanding of important visual features.
The model effectively challenges itself during training and then learns from the modified examples.
SAT is one of the training techniques explicitly highlighted by the YOLOv4 authors.
Cross mini-Batch Normalization
YOLOv4 uses Cross mini-Batch Normalization, abbreviated as CmBN.
Batch normalization helps stabilize neural network training.
CmBN modifies this process by sharing normalization information more effectively across mini-batches.
It was included among the techniques selected to improve YOLOv4 training performance.
DropBlock Regularization
YOLOv4 uses DropBlock regularization.
Traditional dropout randomly disables individual activations.
DropBlock instead removes contiguous regions of feature maps.
This can make the network less dependent on specific local features and improve generalization.
The YOLOv4 paper identifies DropBlock as one of its useful regularization techniques.
Bag of Freebies
The YOLOv4 paper categorizes many improvements as Bag of Freebies.
Bag-of-Freebies techniques improve model accuracy primarily during training without significantly increasing inference cost.
Examples associated with YOLOv4 include:
- Mosaic augmentation
- Self-Adversarial Training
- Label smoothing
- CIoU-based bounding box regression
- Advanced data augmentation
These methods help increase final detection quality without making the deployed model substantially slower.
Bag of Specials
YOLOv4 also uses what the authors call Bag of Specials.
These techniques can increase inference cost slightly but provide meaningful improvements in accuracy.
Examples include architectural components and feature-processing methods designed to improve detection performance.
The YOLOv4 design balances both Bag-of-Freebies and Bag-of-Specials techniques.
YOLOv4 Input Resolution
YOLOv4 can operate at different input resolutions depending on its configuration.
Common configurations include resolutions such as:
- 416 × 416
- 512 × 512
- 608 × 608
- 640 × 640
Changing the input size affects the tradeoff between:
- Detection accuracy
- Speed
- GPU memory
- FLOPs
Higher-resolution inputs can provide more detail for small objects, while smaller inputs generally increase inference speed.
YOLOv4 Performance
The original YOLOv4 paper reported:
- 43.5% AP
- 65.7% AP50
- Approximately 65 FPS
on the MS COCO dataset using an NVIDIA Tesla V100 GPU under the authors’ benchmark setup.
These results demonstrated a strong speed-to-accuracy balance for a real-time object detector at the time.
YOLOv4 vs YOLOv3
YOLOv4 introduced substantial improvements over YOLOv3.
The original paper reports that YOLOv4 improved YOLOv3’s AP and FPS by approximately:
- 10% AP
- 12% FPS
under the authors’ evaluation setup.
Important YOLOv4 improvements include:
| Feature | YOLOv3 | YOLOv4 |
|---|---|---|
| Backbone | Darknet-53 | CSPDarknet53 |
| Mish activation | No | Yes |
| Mosaic augmentation | No | Yes |
| SAT | No | Yes |
| CIoU loss | No | Yes |
| DropBlock | No | Yes |
| Cross mini-Batch Normalization | No | Yes |
| Multi-scale detection | Yes | Improved |
| SPP | Limited | Integrated |
YOLOv4 vs EfficientDet
The YOLOv4 paper reports that YOLOv4 runs approximately twice as fast as EfficientDet while providing comparable performance in the authors’ comparison.
This reinforced YOLOv4’s focus on achieving a strong combination of speed and accuracy.
YOLOv4 Tiny
A lightweight version called YOLOv4-Tiny is also commonly used.
YOLOv4-Tiny reduces network complexity to improve inference speed.
It is useful for:
- Edge devices
- Lower-end GPUs
- Embedded systems
- Real-time video applications
- Resource-constrained environments
The tradeoff is lower detection accuracy compared with the full YOLOv4 model.
YOLOv4 and COCO
YOLOv4 was evaluated extensively using the MS COCO object detection dataset.
COCO contains many everyday object categories and challenging image scenes.
The YOLOv4 paper reports its standard AP and AP50 metrics on COCO.
The repository also contains a coco.names file defining COCO object classes.
YOLOv4 Training
YOLOv4 training involves optimizing:
- Bounding box localization
- Objectness prediction
- Class prediction
The Darknet framework provides the training system used for YOLOv4.
Training can incorporate techniques such as:
- Mosaic augmentation
- SAT
- CIoU loss
- Batch normalization
- Data augmentation
- Multi-scale training
These components work together to improve robustness and generalization.
Custom Dataset Training
YOLOv4 can be trained on custom object detection datasets.
A custom dataset typically requires:
- Training images
- Validation images
- Bounding box annotations
- Class names
- Dataset configuration
- YOLO configuration file
This allows YOLOv4 to detect specialized objects beyond standard COCO categories.
Example applications include:
- Vehicle detection
- Person detection
- Industrial defects
- Wildlife detection
- Agriculture
- Manufacturing
- Traffic analysis
YOLOv4 Inference
YOLOv4 inference follows a typical single-stage detection process:
- Load an image.
- Resize the image.
- Process it through CSPDarknet53.
- Aggregate multi-scale features.
- Generate anchor-based predictions.
- Predict bounding boxes.
- Predict objectness.
- Predict classes.
- Filter low-confidence predictions.
- Apply Non-Maximum Suppression.
- Return final detections.
Non-Maximum Suppression
YOLOv4 can generate multiple overlapping detections around the same object.
Non-Maximum Suppression, or NMS, removes duplicate predictions.
The general process:
- Sort predictions by confidence.
- Keep the highest-confidence box.
- Compare overlapping boxes.
- Suppress weaker duplicates.
This produces cleaner final detections.
YOLOv4 GPU Support
Darknet supports CUDA-based GPU acceleration.
Using a compatible NVIDIA GPU can significantly improve:
- Training speed
- Inference speed
- Batch processing performance
GPU acceleration is especially important when processing real-time video.
YOLOv4 CPU Support
Darknet can also run on CPU hardware.
This makes YOLOv4 usable on systems without CUDA-compatible GPUs, although inference is generally much slower.
YOLOv4 Use Cases
YOLOv4 can be applied to many computer vision tasks, including:
- Person detection
- Vehicle detection
- Traffic monitoring
- Security cameras
- Industrial inspection
- Robotics
- Wildlife monitoring
- Agriculture
- Manufacturing
- Video analytics
- Drone vision
- Object tracking pipelines
Its speed and accuracy made it particularly attractive for real-time applications.
YOLOv4 Advantages
Strong Real-Time Performance
YOLOv4 was designed specifically to balance detection accuracy and inference speed.
Improved Accuracy Over YOLOv3
The paper reports meaningful AP improvements compared with YOLOv3.
Strong Backbone
CSPDarknet53 provides efficient feature extraction.
Multi-Scale Detection
The model predicts objects across multiple feature-map resolutions.
Advanced Training Techniques
Mosaic, SAT, CmBN, DropBlock, and CIoU improve model learning.
Practical GPU Requirements
The authors specifically designed YOLOv4 to be trainable and usable on conventional GPU hardware rather than requiring extremely specialized infrastructure.
YOLOv4 Limitations
Larger Than YOLOv3
The full YOLOv4 architecture introduces additional complexity compared with earlier YOLO generations.
Higher Hardware Requirements Than Tiny Models
The full model benefits significantly from GPU acceleration.
Anchor Dependency
YOLOv4 relies on predefined anchor boxes.
NMS Post-Processing
Standard YOLOv4 detection uses post-processing to remove duplicate bounding boxes.
Older Framework
Darknet is less integrated with modern Python-first deep learning ecosystems than frameworks such as PyTorch.
YOLOv4 Paper
The original research paper is titled:
YOLOv4: Optimal Speed and Accuracy of Object Detection
Authors:
- Alexey Bochkovskiy
- Chien-Yao Wang
- Hong-Yuan Mark Liao
The paper was submitted in April 2020.
YOLOv4 Repository Note
The repository you provided is:
kiyoshiiriemon/yolov4_darknet
It contains YOLOv4 Darknet resources and describes itself as a Windows and Linux Darknet implementation.
However, the original YOLOv4 paper itself points to AlexeyAB/darknet as the source-code repository.
So if you are documenting YOLOv4 historically, the AlexeyAB Darknet repository is the stronger canonical source.
Why YOLOv4 Is Important
YOLOv4 is important because it demonstrated that significant improvements in object detection could come from intelligently combining existing techniques rather than relying only on completely new architectures.
Its major contributions include:
- CSP-based architecture
- Mish activation
- Mosaic augmentation
- Self-Adversarial Training
- Cross mini-Batch Normalization
- DropBlock
- CIoU
- Improved multi-scale detection
- Strong real-time performance
YOLOv4 helped establish many training and augmentation techniques that became influential in later real-time object detection systems.
Frequently Asked Questions
What is YOLOv4?
YOLOv4 is a real-time single-stage object detector introduced in 2020.
Who created YOLOv4?
YOLOv4 was introduced by:
- Alexey Bochkovskiy
- Chien-Yao Wang
- Hong-Yuan Mark Liao.
What is the YOLOv4 paper called?
The paper is titled:
YOLOv4: Optimal Speed and Accuracy of Object Detection
When was YOLOv4 introduced?
The paper was submitted in April 2020.
What backbone does YOLOv4 use?
YOLOv4 is commonly built around CSPDarknet53.
Does YOLOv4 use anchor boxes?
Yes. YOLOv4 uses anchor-based bounding box prediction.
Does YOLOv4 use Mosaic augmentation?
Yes. Mosaic augmentation is one of the important training techniques highlighted by the authors.
What is SAT in YOLOv4?
SAT stands for Self-Adversarial Training.
It is a training technique used to improve model robustness.
What is CIoU in YOLOv4?
CIoU stands for Complete Intersection over Union and is used to improve bounding box regression.
What dataset was YOLOv4 evaluated on?
YOLOv4 was evaluated on the MS COCO object detection dataset.
How accurate is YOLOv4?
The original paper reports 43.5% AP and 65.7% AP50 on COCO under its benchmark setup.
How fast is YOLOv4?
The original authors report approximately 65 FPS on a Tesla V100 for the primary benchmark configuration.
Does YOLOv4 support custom datasets?
Yes. Darknet supports training YOLO models on custom object detection datasets.
Does YOLOv4 support GPU acceleration?
Yes. Darknet supports CUDA-compatible GPU acceleration.
Can YOLOv4 run on CPU?
Yes. Darknet supports CPU computation, although inference is generally slower than GPU processing.
What is YOLOv4-Tiny?
YOLOv4-Tiny is a lightweight YOLOv4 variant designed for faster inference and reduced computational requirements.
Is the provided repository the original YOLOv4 repository?
The provided repository contains YOLOv4 Darknet resources, but the original YOLOv4 paper points to AlexeyAB/darknet as the source-code repository.
Is YOLOv4 still useful?
Yes. YOLOv4 remains useful for education, legacy Darknet deployments, custom object detection systems, research comparisons, and understanding the evolution of real-time YOLO architectures.
Conclusion
YOLOv4 is an important milestone in real-time object detection.
It combines CSP-based feature extraction, Mish activation, Mosaic augmentation, Self-Adversarial Training, Cross mini-Batch Normalization, DropBlock regularization, and CIoU loss to improve both detection accuracy and training effectiveness.
The original paper reports 43.5% AP, 65.7% AP50, and approximately 65 FPS on a Tesla V100, demonstrating a strong balance between speed and accuracy for its time.
YOLOv4 remains especially important for understanding how architectural improvements and carefully selected training techniques helped advance the YOLO family beyond YOLOv3.