mask_to_rle

cocohelper.utils.segmentation.mask_to_rle(binary_mask, **kwargs)[source]

Converts a binary mask to RLE encoding.

Parameters:
  • binary_mask (ndarray) – a binary mask as a numpy array.

  • **kwargs – extra parameters are ignored.

Returns:

The RLE encoding of the binary mask.

Return type:

Dict[str, list]