Anchor和RPN的浅薄理解(三)-mmdetection中Anchor生成源码分析

在 MMDetection 中,RPN 网络使用 AnchorGenerator 类生成 Anchor,在config文件中 AnchorGenerator 的默认设置如下:

anchor_generator=dict(
    type='AnchorGenerator',
    scales=[8],
    ratios=[0.5,1.0,2.0], 
    strides=[4,8,16,32,64]),

接下来直接撸 AnchorGenerator 这个类,其实现源码目录为:mmdet\core\anchor\anchor_generator.py

在这个类中,有以下几个比较重要的方法,现有一个初步的认识:

  • 参数及demo调用:参数如果不懂可以在心里留个印象,下面具体分析。Demo直接复制官方:
    Args:
        strides (list[int] | list[tuple[int, int]]): 各尺度 feature map 相对于原图的缩放因子,也可以叫做anchor移动的步长
        ratios (list[float]): anchor 的高宽比列表
        scales (list[int] | None): anchor 的缩放比率,不能与 `octave_base_scale` 和 `scales_per_octave	

猜你喜欢

转载自blog.csdn.net/qq_42308217/article/details/122791815