compressed_rle_to_mask

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

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

Parameters:
  • rle_code (str) – RLE encoding of the semantic mask.

  • width (int) – width of the output image array.

  • height (int) – height of the output image array.

  • 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 compressed RLE mask as a numpy array.

Return type:

ndarray