roi_align¶
dragon.vision.
roi_align
(
inputs,
pooled_h,
pooled_w,
spatial_scale=1.0,
sampling_ratio=- 1,
aligned=False,
**kwargs
)[source]¶Apply the average roi align. [He et.al, 2017].
The input
rois
should be packed with the shape \((N, 5)\), where \(N\) is the number of RoIs, and each column takes \(5\) values for a sequence of \([i_{\text{batch}}, x_{\min}, y_{\min}, x_{\max}, y_{\max}]\).Examples:
x = dragon.range(18, dtype='float32').reshape((1, 2, 3, 3)) rois = dragon.constant([[0., 1., 1., 2.]], dtype='float32') print(dragon.vision.roi_align([x, rois], pooled_h=1, pooled_w=1))
- Parameters:
- inputs (Sequence[dragon.Tensor]) – The tensor
x
androis
. - pooled_h (int, required) – The output height.
- pooled_w (int, required) – The output width.
- spatial_scale (float, optional, default=1.0) – The input scale to the size of
rois
. - sampling_ratio (int, optional, default=-1) – The number of sampling grids for
rois
. - aligned (bool, optional, default=False) – Whether to shift the input coordinates by
-0.5
.
- inputs (Sequence[dragon.Tensor]) – The tensor
- Returns:
dragon.Tensor – The output tensor.