(img_shape, fea_shape)
return anchors
Set anchors.

  Args:
    img_shape: 1-D list with shape `[2]`.
    fea_shape: 1-D list with shape `[2]`.

  Returns:
    anchors: 4-D tensor with shape `[fea_h, fea_w, num_anchors, 4]`
Set anchors.
Set anchors .
def set_anchors(img_shape, fea_shape):
  """Set anchors.

  Args:
    img_shape: 1-D list with shape `[2]`.
    fea_shape: 1-D list with shape `[2]`.

  Returns:
    anchors: 4-D tensor with shape `[fea_h, fea_w, num_anchors, 4]`

  """
  H = fea_shape[0]
  W = fea_shape[1]
  B = config.NUM_ANCHORS

  anchor_shape = tf.constant(config.ANCHOR_SHAPE, dtype=tf.float32)
  anchor_shapes = tf.reshape(
    tf.concat(
      [anchor_shape for i in range(W * H)],
      0
    ),
    [H, W, B, 2]
  )

  center_x = tf.truediv(
    tf.range(1, W + 1, 1, dtype=tf.float32),  # * img_w,
    float(W + 1)
  )
  center_x = tf.concat(
    [center_x for i in range(H * B)], 0
  )
  center_x = tf.reshape(center_x, [B, H, W])
  center_x = tf.transpose(center_x, (1, 2, 0))
  center_x = tf.reshape(center_x, [H, W, B, 1])

  center_y = tf.truediv(
    tf.range(1, H + 1, 1, dtype=tf.float32),  # * img_h,
    float(H + 1)
  )
  center_y = tf.concat(
    [center_y for i in range(W * B)], 0
  )
  center_y = tf.reshape(center_y, [B, W, H])
  center_y = tf.transpose(center_y, (2, 1, 0))
  center_y = tf.reshape(center_y, [H, W, B, 1])

  anchors = tf.concat([center_x, center_y, anchor_shapes], 3)

  return anchors
def set_anchors ( img_shape , fea_shape ) : H = fea_shape [ 0 ] W = fea_shape [ 1 ] B = config . NUM_ANCHORS anchor_shape = tf . constant ( config . ANCHOR_SHAPE , dtype = tf . float32 ) anchor_shapes = tf . reshape ( tf . concat ( [ anchor_shape for i in range ( W * H ) ] , 0 ) , [ H , W , B , 2 ] ) center_x = tf . truediv ( tf . range ( 1 , W + 1 , 1 , dtype = tf . float32 ) , # * img_w, float ( W + 1 ) ) center_x = tf . concat ( [ center_x for i in range ( H * B ) ] , 0 ) center_x = tf . reshape ( center_x , [ B , H , W ] ) center_x = tf . transpose ( center_x , ( 1 , 2 , 0 ) ) center_x = tf . reshape ( center_x , [ H , W , B , 1 ] ) center_y = tf . truediv ( tf . range ( 1 , H + 1 , 1 , dtype = tf . float32 ) , # * img_h, float ( H + 1 ) ) center_y = tf . concat ( [ center_y for i in range ( W * B ) ] , 0 ) center_y = tf . reshape ( center_y , [ B , W , H ] ) center_y = tf . transpose ( center_y , ( 2 , 1 , 0 ) ) center_y = tf . reshape ( center_y , [ H , W , B , 1 ] ) anchors = tf . concat ( [ center_x , center_y , anchor_shapes ] , 3 ) return anchors