avg_pool2d_valid#

rlemasklib.RLEMask.avg_pool2d_valid(kernel_size, stride=(1, 1), threshold=-1)[source]#

Perform a 2D average pooling with the given kernel size and threshold the result.

This function does not perform any padding and only returns the “valid” part of the pooling, similar to “valid” padding mode in deep learning frameworks as opposed to “same” or “full” padding.

Parameters:
  • kernel_size (Sequence[int]) – the size of the pooling kernel as two integers

  • stride (Sequence[int]) – the stride of the pooling as two integers

  • threshold (int) – the result is set to 1 if the pooled result is greater than this value

Returns:

A new RLEMask object representing the pooled and thresholded mask.

Return type:

RLEMask

Examples

3x3 kernel with stride 2 pools down to smaller size:

.avg_pool2d_valid((3, 3), stride=(2, 2)) ==

See also

avg_pool2x2()