roi_pool

dragon.vision.roi_pool(
  inputs,
  pooled_h,
  pooled_w,
  spatial_scale=1.0,
  **kwargs
)[source]

Apply the max roi pooling. [Girshick, 2015].

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_pool([x, rois], pooled_h=1, pooled_w=1))
Parameters:
  • inputs (Sequence[dragon.Tensor]) – The tensor x and rois.
  • 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.
Returns:

dragon.Tensor – The output tensor.