Is a specific anchor box related to a specific class?

I disagree. In my experience you want to find the shapes of bounding boxes that best represent the shapes of the objects in your training data, not the classes. Anchor shape is primarily about good localization, not classification. If you have a lot of nearby cars and a lot of far away cars in your data, you likely need at least 2 anchor box shapes to localize them…not one for all cars. Further, if the objects in your training data don’t represent the objects you want to predict, you have another, different, problem.

The YOLO designers used K-means to derive good anchor box shapes. There is a thread about it in this forum here: Deriving YOLO anchor boxes

1 Like