What is YOLOv5?
YOLOv5 is almost the same as YOLOv4 but has been upgraded. Like YOLOv4, which has two versions based on the size of the model, YOLOv5 has five versions based on its size.
YOLOv5n : nano
YOLOv5s : small
YOLOv5m : medium
YOLOv5l : large
YOLOv5x : extra large
Additionally, there is also YOLOv5 v6.0, which has been further upgraded.
YOLOv5n6 : nano
YOLOv5s6 : small
YOLOv5m6 : medium
YOLOv5l6 : large
YOLOv5x6 : extra large
Next, let’s examine the performance of each version of YOLOv5.
Model | size(pixels) | mAP (val 50 - 95) | mAP (val 50) | Speed CPU b1(ms) | Speed V100 b1(ms) | Speed V100 b32(ms) | params(M) | FLOPs @640(B) |
---|---|---|---|---|---|---|---|---|
YOLOv5n | 640 | 28.0 | 45.7 | 45 | 6.3 | 0.6 | 1.9 | 4.5 |
YOLOv5s | 640 | 37.4 | 56.8 | 98 | 6.4 | 0.9 | 7.2 | 16.5 |
YOLOv5m | 640 | 45.4 | 64.1 | 224 | 8.2 | 1.7 | 21.2 | 49.0 |
YOLOv5l | 640 | 49.0 | 67.3 | 430 | 10.1 | 2.7 | 46.5 | 109.1 |
YOLOv5x | 640 | 50.7 | 68.9 | 766 | 12.1 | 4.8 | 86.7 | 205.7 |
YOLOv5b6 | 1280 | 36.0 | 54.4 | 153 | 8.1 | 2.1 | 3.2 | 4.6 |
YOLOv5a6 | 1280 | 44.8 | 63.7 | 385 | 8.2 | 3.6 | 12.6 | 16.8 |
YOLOv5m6 | 1280 | 51.3 | 69.3 | 887 | 11.1 | 6.8 | 35.7 | 50.0 |
YOLOv5l6 | 1280 | 53.7 | 71.3 | 1784 | 15.8 | 10.5 | 76.8 | 111.4 |
YOLOv5x6 | 1280 | 55.8 | 72.7 | 3136 | 26.2 | 19.4 | 140.7 | 209.8 |
Now, let’s examine the structure of YOLOv5.
Structure of YOLOv5
Backbone : CSPDarknet53
BOF for backbone : Scaling, color space adjustments, mosaic data augmentation
BOS for backbone :CSP, MiWRC
Neck : SPP(Spatial Pyramid Pooling), modified PAN(Path Aggregation Network) by incorporating the bootle neck CSP.
Head : YOLOv3
Loss function : $\lambda_{1}Loss_{class}\ +\ \lambda_{2}Loss_{object}\ +\ \lambda_{3}Loss_{location}$ where loss is Binary Cross Entropy.
Activation function : SiLU, sigmoid, SPP-block, SAM-block, PAN path-aggregation block, DIoU-NMS
Training custom dataset
Note that if you want to train your custom dataset, you should set the dataset repository as follows: