Shortcuts

BorderAlign

class mmcv.ops.BorderAlign(pool_size: int)[source]

Border align pooling layer.

Applies border_align over the input feature based on predicted bboxes. The details were described in the paper BorderDet: Border Feature for Dense Object Detection.

For each border line (e.g. top, left, bottom or right) of each box, border_align does the following:

  1. uniformly samples pool_size +1 positions on this line, involving the start and end points.

  2. the corresponding features on these points are computed by bilinear interpolation.

  3. max pooling over all the pool_size +1 positions are used for computing pooled feature.

Parameters

pool_size (int) – number of positions sampled over the boxes’ borders (e.g. top, bottom, left, right).

forward(input: torch.Tensor, boxes: torch.Tensor)torch.Tensor[source]
Parameters
  • input – Features with shape [N,4C,H,W]. Channels ranged in [0,C), [C,2C), [2C,3C), [3C,4C) represent the top, left, bottom, right features respectively.

  • boxes – Boxes with shape [N,H*W,4]. Coordinate format (x1,y1,x2,y2).

Returns

Pooled features with shape [N,C,H*W,4]. The order is (top,left,bottom,right) for the last dimension.

Return type

torch.Tensor