ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
48.85k stars 15.96k forks source link

Add Guided Anchoring. #872

Closed learncrazy closed 3 years ago

learncrazy commented 3 years ago

🚀 Feature

Recently I saw a blog and wrote that there is a way to predict the shape and position of Anchor directly through Guided Anchoring without clustering Anchor based on data, and it can already be applied to yolov3 to improve mAP. So I think yolov5 can try to add this.

https://arxiv.org/pdf/1901.03278.pdf

Motivation

Pitch

Alternatives

Additional context

glenn-jocher commented 3 years ago

@learncrazy I don't have time myself to experiment with this, but if you can obtain improved results with this method we can help you work on a PR.

I skimmed the paper very quickly, and the premise seems to be to exploit a priori information about correlations in the 4d (xywh) box space, though they seem to mainly discuss applicability to 2-stage detectors.

We already harvest and illustrate some of this information to present to the user in labels.png. For example the VOC dataset: labels

glenn-jocher commented 3 years ago

I created a correlogram of the 4 box dimensions using seaborn. The existing plots in labels.png are circled below. There are definitely constraints that exist in the 4d space. I believe these are already being enforced however, by clipping out of bounds boxes in test.py and detect.py.

A more sophisticated solution may employ a 4d density estimate to apply a bayesian prior onto the network output. This might reduce confidences in low density areas for example. This could even be done by class for high statistics datasets like COCO.

labels_correlogram

glenn-jocher commented 3 years ago

Added automatic correlogram plotting if user has seaborn and pandas installed 987c2268490a6220ac14a1325e76774c60ea4f47

learncrazy commented 3 years ago

Of course, I think your work is excellent. If I can, I will try it and see if mAP can be improved. Thanks for your answer.

buimanhlinh96 commented 3 years ago

@learncrazy Did you have any experiment with this idea and how about the result?

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.