yolov5 and yolov4 Very similar
Mosaic Data enhancement
1, Read four pictures at a time .
2, Flip the four pictures separately , zoom , Gamut change, etc , And set it in four directions .
3, The combination of pictures and boxes
For small target detection effect is very good
Adaptive anchor frame calculation
stay Yolo In the algorithm , For different data sets , There will be anchor frames with initial length and width .
In network training , The network outputs the prediction frame based on the initial anchor frame , And then the real box groundtruth Compare , Calculate the difference between the two , Reverse update again , Iterative network parameters .
Therefore, the initial anchor frame is also an important part , such as Yolov5 stay Coco The initial anchor box on the dataset ：
3） Adaptive image scaling
In the common target detection algorithm , Different pictures are different in length and width , Therefore, the common way is to scale the original image to a standard size , And then into the detection network .
such as Yolo Commonly used in algorithms 416*416,608*608 Equal size , For example, below 800*600 Zoom in and out of the image .
Yolov5 In the code of datasets.py Of letterbox Function , Adding least black edges adaptively to the original image .
Yolov5 current Neck and Yolov4 It's the same in China , All adopted FPN+PAN The structure of , But in Yolov5 When I first came out , Only used FPN structure , It was added later PAN structure , In addition, other parts of the network have also been adjusted .
therefore , Dabai is here Yolov5 When it was first proposed , A lot of structural drawings , They have all been readjusted .
YOLO The series loss calculation is based on objectness score, class probability score, and bounding box
YOLO V5 use GIOU Loss As bounding box The loss of .
YOLO V5 Using binary cross entropy and Logits The loss function calculates the loss of class probability and target score . We can also use fl _ gamma Parameter to activate Focal
loss Calculating the loss function .
YOLO V4 use CIOU Loss As bounding box The loss of , Compared with other methods mentioned above ,CIOU It brings faster convergence and better performance .