RLEMaskConverter

class cocohelper.utils.segmentation.RLEMaskConverter[source]

Bases: MaskConverter

Method List

decode(code, **kwargs)

Converts an RLE to a binary mask with the given output dtype. :param code: RLE encoding of the semantic mask. :param **kwargs: extra parameters such as: - dtype to indicate the type of the output mask.

encode(mask, **kwargs)

Converts a binary mask to RLE encoding.

Attributes List

_abc_impl

Methods Details

decode(code, **kwargs)[source]

Converts an RLE to a binary mask with the given output dtype. :param code: RLE encoding of the semantic mask. :param **kwargs: extra parameters such as:

  • dtype to indicate the type of the output mask.

Returns:

The RLE mask as a numpy array.

Parameters:

code (Any) –

Return type:

ndarray

encode(mask, **kwargs)[source]

Converts a binary mask to RLE encoding. :param mask: a binary mask as a numpy array. :param **kwargs: extra parameters are ignored.

Returns:

The RLE encoding of the binary mask.

Parameters:

mask (ndarray) –

Return type:

Any

Attribute Details

_abc_impl = <_abc._abc_data object>