anchor_generator¶
- paddle.fluid.layers.detection. anchor_generator ( input, anchor_sizes=None, aspect_ratios=None, variance=[0.1, 0.1, 0.2, 0.2], stride=None, offset=0.5, name=None ) [source]
- 
         Anchor generator operator Generate anchors for Faster RCNN algorithm. Each position of the input produce N anchors, N = size(anchor_sizes) * size(aspect_ratios). The order of generated anchors is firstly aspect_ratios loop then anchor_sizes loop. - Parameters
- 
           - input (Variable) – 4-D Tensor with shape [N,C,H,W]. The input feature map. 
- anchor_sizes (float32|list|tuple, optional) – The anchor sizes of generated anchors, given in absolute pixels e.g. [64., 128., 256., 512.]. For instance, the anchor size of 64 means the area of this anchor equals to 64**2. None by default. 
- aspect_ratios (float32|list|tuple, optional) – The height / width ratios of generated anchors, e.g. [0.5, 1.0, 2.0]. None by default. 
- variance (list|tuple, optional) – The variances to be used in box regression deltas. The data type is float32, [0.1, 0.1, 0.2, 0.2] by default. 
- stride (list|tuple, optional) – The anchors stride across width and height. The data type is float32. e.g. [16.0, 16.0]. None by default. 
- offset (float32, optional) – Prior boxes center offset. 0.5 by default. 
- name (str, optional) – For detailed information, please refer to Name. Usually name is no need to set and None by default. 
 
- Returns
- 
           
           Anchors(Variable): The output anchors with a layout of [H, W, num_anchors, 4]. H is the height of input, W is the width of input, num_anchors is the box count of each position. Each anchor is in (xmin, ymin, xmax, ymax) format an unnormalized. Variances(Variable): The expanded variances of anchors with a layout of [H, W, num_priors, 4]. H is the height of input, W is the width of input num_anchors is the box count of each position. Each variance is in (xcenter, ycenter, w, h) format. 
- Return type
- 
           Tuple 
 Examples import paddle.fluid as fluid import paddle paddle.enable_static() conv1 = fluid.data(name='conv1', shape=[None, 48, 16, 16], dtype='float32') anchor, var = fluid.layers.anchor_generator( input=conv1, anchor_sizes=[64, 128, 256, 512], aspect_ratios=[0.5, 1.0, 2.0], variance=[0.1, 0.1, 0.2, 0.2], stride=[16.0, 16.0], offset=0.5) 
