open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.5k stars 9.45k forks source link

Documentation resource on Anchor Generation Faster Rcnn parameters #7734

Open abhi-kumar opened 2 years ago

abhi-kumar commented 2 years ago

Hi,

Where can i find resources on understanding the anchor generator arguments and the output in faster rcnn config. The original paper talks simply about sizes and ratios. Here there is scale, strides, ratios, base_size and I am finding it very difficult to understand how its generating anchors. I have spent some 8-10 hours reading the documentation and playing around with the code below, still didn't get it.

from mmdet.core import AnchorGenerator
self = AnchorGenerator([1],   #stride
                       [1.0, 0.5], #ratio
                       [8])  #scales
all_anchors = self.grid_anchors([(256, 256)], device='cpu')
print(all_anchors) 

Please point me to the right resource to understand how the anchors are calculated in mmdetection and what these parameters are.

BIGWangYuDong commented 2 years ago

https://github.com/open-mmlab/mmdetection/blob/master/mmdet/core/anchor/anchor_generator.py here is the code to generate anchors, you can have a look. Also, please note that the faster-rcnn-r50-fpn is the code as FPN, if you want to read the original code, it is suggested to have a look at faster-rcnn-r50-c4.