当前位置:网站首页>Anchor point and anchor frame of target detection

Anchor point and anchor frame of target detection

2022-07-24 03:36:00 Shaoji Bay

 Insert picture description here
Reading guide : The target detection model uses the anchor box to predict the position box of the object , It is of key significance for the task of target detection . Understanding and carefully tuning the anchor frame of the model is very important to improve the detection performance , Especially when the data set has irregular objects .

Anchor frame and target detection task

object detection , Different from the image classification task . Usually there are many objects of the same or different categories in a picture , Target detection task , Need to accurately identify and locate all items .
 Insert picture description here
This figure shows the result of a target being detected , Both need to be given object class The degree of confidence , You also need to give the coordinates of the location frame (x1,x2,y1,y1, Four numbers are used here to describe the location box ). The target detection model handles this task by dividing the prediction into two parts : Predict the bounding box through regression ; Predict class labels by classification .

What is an anchor frame ?

In order to predict and locate multiple targets in a picture , Most leading detection models such as EfficientDet and YOLO Take the anchor frame as a priori , And then start adjusting . Generally speaking , Use the bounding box in the following order :

  • Thousands of candidate anchor boxes are formed in the image ;
  • For each anchor frame , Predict some amount of this box , And as a candidate box ;
  • Bounding box based on real dimension , Calculate the loss function ;
  • Calculate the probability that the given offset box overlaps the real object ;
  • If the probability is greater than 0.5, Incorporate this forecast into the loss function ;
  • Through the gradual reward and punishment prediction box , Push the model in the right direction .

If you are only a light training model , You will see the prediction box appear everywhere . As shown in the figure below :
 Insert picture description here

If you train on your own dataset YOLO, You may need to customize these anchor boxes . but YOLOv5 It can automatically learn the anchor box distribution based on the training set , Every time you train , Adaptively calculate the best anchor frame value in different training sets .
Of course , If you think the calculated anchor frame effect is not very good , You can also turn off the automatic calculation anchor box function in the code .
Described in the code as :

parser.add_argument('--noautoanchor', action='store_true', help='disable autoanchor check')

Turn off the automatic calculation anchor box function , namely train.py This line of code in , Set to False, Every time you train , Does not automatically calculate .

原网站

版权声明
本文为[Shaoji Bay]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/204/202207222146499123.html