pixano.features.schemas.annotations.compressed_rle
CompressedRLE(created_at=None, updated_at=None, **data)
Bases: Annotation
Compressed RLE mask type.
Attributes:
Name | Type | Description |
---|---|---|
size |
list[int]
|
Mask size. |
counts |
bytes
|
Mask RLE encoding. |
Source code in pixano/features/schemas/base_schema.py
encode(mask, height, width, **kwargs)
staticmethod
Create a compressed RLE mask from polygons / uncompressed RLE / compressed RLE.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mask
|
list[list] | dict[str, list[int]]
|
Mask as polygons / uncompressed RLE / compressed RLE. |
required |
height
|
int
|
Image height. |
required |
width
|
int
|
Image width. |
required |
kwargs
|
Any
|
Additional arguments. |
{}
|
Returns:
Type | Description |
---|---|
CompressedRLE
|
The compressed RLE mask. |
Source code in pixano/features/schemas/annotations/compressed_rle.py
from_mask(mask, **kwargs)
staticmethod
Create a compressed RLE mask from a NumPy array.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mask
|
Image | ndarray
|
The mask as a NumPy array. |
required |
kwargs
|
Any
|
Additional arguments. |
{}
|
Returns:
Type | Description |
---|---|
CompressedRLE
|
The compressed RLE mask. |
Source code in pixano/features/schemas/annotations/compressed_rle.py
from_polygons(polygons, height, width, **kwargs)
staticmethod
Create a compressed RLE mask from polygons.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
polygons
|
list[list]
|
The mask as polygons. |
required |
height
|
int
|
Image height. |
required |
width
|
int
|
Image width. |
required |
kwargs
|
Any
|
Additional arguments. |
{}
|
Returns:
Type | Description |
---|---|
CompressedRLE
|
The compressed RLE mask. |
Source code in pixano/features/schemas/annotations/compressed_rle.py
from_urle(urle, **kwargs)
staticmethod
Create a compressed RLE mask from an uncompressed RLE.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
urle
|
dict[str, list[int]]
|
The mask as an uncompressed RLE. |
required |
kwargs
|
Any
|
Additional arguments. |
{}
|
Returns:
Type | Description |
---|---|
CompressedRLE
|
The compressed RLE mask. |
Source code in pixano/features/schemas/annotations/compressed_rle.py
none()
classmethod
Utility function to get a None
equivalent.
Should be removed as soon as Lance manages None
value.
Returns:
Type | Description |
---|---|
Self
|
"None" |
Source code in pixano/features/schemas/annotations/compressed_rle.py
to_mask()
Convert the compressed RLE mask to a NumPy array.
Returns:
Type | Description |
---|---|
ndarray
|
The mask as a NumPy array. |
to_polygons()
create_compressed_rle(size, counts, id='', item_ref=ItemRef.none(), view_ref=ViewRef.none(), entity_ref=EntityRef.none(), source_ref=SourceRef.none())
Create a CompressedRLE
instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
size
|
list[int]
|
Mask size. |
required |
counts
|
bytes
|
Mask RLE encoding. |
required |
id
|
str
|
|
''
|
item_ref
|
ItemRef
|
Item reference. |
none()
|
view_ref
|
ViewRef
|
View reference. |
none()
|
entity_ref
|
EntityRef
|
Entity reference. |
none()
|
source_ref
|
SourceRef
|
Source reference. |
none()
|
Returns:
Type | Description |
---|---|
CompressedRLE
|
The compressed RLE instance. |
Source code in pixano/features/schemas/annotations/compressed_rle.py
is_compressed_rle(cls, strict=False)
Check if the given class is a subclass of CompressedRLE
.