joydeepmedhi/Anchor-Boxes-with-KMeans

How to use these clustering results in Faster RCNN to initialize Anchors?

Closed this issue · 6 comments

I am sorry to bother you. I would like to ask how these clustering results can be used in Faster-RCNN. I see a lot of output in your .ipynb. Can I replace the corresponding parameters in Faster-RCNN config file with the clustering results such as Aspect Ratios and Scales? I have just come into contact with this research direction. I look forward to your reply, thank you!

@AllanHLL : yes, these scales and aspect ratios can be used to improve detection. just keep in mind the base size. These are calculated using base size 256 which might not be same as yours. Also, unlike in the original caffe Faster-RCNN implementation, you need not multiply all scales to all aspect ratios to get final anchors, if you want to speed up training. You can just use the ones returned by this codebase.

@ravikantb Wow! Thank you very much for your reply. I get it now. Thank you again.

@ravikantb I have a question about the model.. I wonder if this analysis is also fit for model ssd_mobilenet_v2? As it will generate the anchors boxes as well..
Here is an example of configuration file:
anchor_generator {
ssd_anchor_generator {
num_layers: 6
min_scale: 0.2
max_scale: 0.95
aspect_ratios: 1.0
aspect_ratios: 2.0
aspect_ratios: 0.5
aspect_ratios: 3.0
aspect_ratios: 0.3333
}
}

Thanks a lot for your reply!

Hi @chenyuZha ,
Yes, this technique should also work for other similar methods with initial anchor boxes.
You can think this technique as a good initialization for anchor boxes for bounding box predictions. It is similar to how we initialize weights of a Neural Net (using Xavier or Kaiming Initialization etc.) for faster convergence, here only we try to apply same for the case of anchor boxes. If you have ideas to improve this, we can discuss!

@joydeepmedhi Thanks a lot for your reply! Yes I would like to test this for model ssd_mobilenet_v2 and I'll do some comparisons with model without anchor boxes analysis..
Just one question before start: I saw you define the size of anchor boxes=256x256, but in the configuration file of ssd_mobilnet_v2, I didn't see this option (height=' ' ,width= ' ')..

I have the same problem like chenyuZha, just for ssd_resnet50...