mask_to_compressed_rle

cocohelper.utils.segmentation.mask_to_compressed_rle(mask, **kwargs)[source]

Converts a binary mask to compressed RLE format.

Parameters:
  • mask (ndarray) – a binary mask to encode.

  • **kwargs – extra parameters are ignored.

Returns:

A string encoding the mask as compressed RLE.

Return type:

str