rle_to_mask

cocohelper.utils.segmentation.rle_to_mask(rle_code, dtype=<class 'bool'>, **kwargs)[source]

Converts an RLE to a binary mask with the given output dtype.

Parameters:
  • rle_code

  • dtype (Union[dtype[Any], None, Type[Any], _SupportsDType[dtype[Any]], str, Tuple[Any, int], Tuple[Any, Union[SupportsIndex, Sequence[SupportsIndex]]], List[Any], _DTypeDict, Tuple[Any, Any]]) – an output dtype for the converted mask.

  • **kwargs – extra parameters are ignored.

Returns:

The RLE mask as a numpy array.