CompressedRLEMaskConverter
- class cocohelper.utils.segmentation.CompressedRLEMaskConverter[source]
Bases:
MaskConverter
Method List
decode
(code, **kwargs)Converts a compressed RLE to a binary mask with the given output dtype. :param code: RLE encoding of the semantic mask. :param **kwargs: extra parameters such as: - height and width to indicate the shape of the output mask. - dtype to indicate the type of the output mask.
encode
(mask, **kwargs)Converts a binary mask to compressed RLE format.
Attributes List
Methods Details
- decode(code, **kwargs)[source]
Converts a compressed RLE to a binary mask with the given output dtype. :param code: RLE encoding of the semantic mask. :param **kwargs: extra parameters such as:
height and width to indicate the shape of the output mask.
dtype to indicate the type of the output mask.
- Returns:
The compressed RLE mask as a numpy array.
- Parameters:
code (Any) –
- Return type:
ndarray
- encode(mask, **kwargs)[source]
Converts a binary mask to compressed RLE format. :param mask: a binary mask to encode. :param **kwargs: extra parameters are ignored.
- Returns:
A string encoding the mask as compressed RLE.
- Parameters:
mask (ndarray) –
- Return type:
Any
Attribute Details
- _abc_impl = <_abc._abc_data object>