PolygonMaskConverter
- class cocohelper.utils.segmentation.PolygonMaskConverter[source]
Bases:
MaskConverter
Method List
decode
(code, **kwargs)Creates and returns a mask from polygon in COCO format. :param code: polygon coordinates. :param **kwargs: extra parameters such as: - width and height to indicate the shape of the output mask. - value to indicate the value of the zero-valued pixels in the output mask. - dtype to indicate the type of the output mask.
encode
(mask, **kwargs)Converts segmentation mask to a list of polygons.
Attributes List
Methods Details
- decode(code, **kwargs)[source]
Creates and returns a mask from polygon in COCO format. :param code: polygon coordinates. :param **kwargs: extra parameters such as:
width and height to indicate the shape of the output mask.
value to indicate the value of the zero-valued pixels in the output mask.
dtype to indicate the type of the output mask.
- Returns:
The polygon mask as a numpy array.
- Parameters:
code (Any) –
- Return type:
ndarray
- encode(mask, **kwargs)[source]
Converts segmentation mask to a list of polygons. :param mask: numpy array containing multiple segmentation masks. Each mask must :param **kwargs: extra parameters are ignored.
- Returns:
List of polygons segmentation masks.
- Parameters:
mask (ndarray) –
- Return type:
Any
Attribute Details
- _abc_impl = <_abc._abc_data object>