pixano_inference.pydantic.tasks.image.utils
Pydantic models for image tasks.
CompressedRLE
Bases: BaseModel
Compressed RLE mask type.
Attributes:
| Name | Type | Description |
|---|---|---|
size |
list[int]
|
Mask size. |
counts |
bytes
|
Mask RLE encoding. |
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_inference/pydantic/tasks/image/utils.py
to_mask()
Convert the compressed RLE mask to a NumPy array.
Returns:
| Type | Description |
|---|---|
ndarray
|
The mask as a NumPy array. |