AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.65k stars 7.96k forks source link

Question on Anchor Boxes #6574

Open ashleyai opened 4 years ago

ashleyai commented 4 years ago

A quick question for experts in this group.

Q: How YOLO generates the predefined Anchor boxes for a new data set? We do not define anything for Anchor boxes and the framework generates itself. How the framework knows where to put the anchor for the ground truth dataset.?

Q2: Is it a best practice to generate our own Anchor boxes for our datasets?

stephanecharette commented 4 years ago

I cannot answer #1 as I really don't know.

But for #2, I can definitely say that it is not a requirement. I have several commercial neural networks I've delivered that work great at client sites, and I've never had to mess with custom anchor boxes. All my networks are YOLOv3-Tiny, YOLOv4-Tiny, or YOLOv4-Tiny-3L.

WongKinYiu commented 4 years ago

use calc_anchors and it will apply k-means to find the anchors of provided ground truth.

LukeAI commented 4 years ago

I've tried using anchors generated from my (smallish) datasets and only ever seen worse results. Maybe for large or very unusual datasets you would see an improvement. it's easy enough to try though - give it a go!

LukeAI commented 4 years ago

the predefined anchors in the config files are derived from coco, I believe.