datumaro.plugins.data_formats.arrow.mapper.media#

Classes

ImageMapper()

MediaElementMapper()

MediaMapper()

PointCloudMapper()

class datumaro.plugins.data_formats.arrow.mapper.media.MediaMapper[source]#

Bases: Mapper

classmethod forward(obj: MediaElement | None, **options) Dict[str, Any][source]#

Convert an object to bytes.

classmethod backward(media_struct: StructScalar, idx: int, table: Table, table_path: str) MediaElement | None[source]#

Build an object from bytes.

class datumaro.plugins.data_formats.arrow.mapper.media.MediaElementMapper[source]#

Bases: Mapper

MAGIC_PATH = '/NOT/A/REAL/PATH'#
MEDIA_TYPE = 1#
classmethod forward(obj: MediaElement) Dict[str, Any][source]#

Convert an object to bytes.

classmethod backward(media_dict: Dict[str, Any], idx: int, table: Table, table_path: str) MediaElement[source]#

Build an object from bytes.

class datumaro.plugins.data_formats.arrow.mapper.media.ImageMapper[source]#

Bases: MediaElementMapper

MEDIA_TYPE = 2#
AVAILABLE_SCHEMES = ('AS-IS', 'PNG', 'TIFF', 'JPEG/95', 'JPEG/75', 'NONE')#
classmethod encode(obj: Image, scheme: str = 'PNG') bytes | None[source]#
classmethod decode(path: str | None = None, data: bytes | None = None) ndarray | None[source]#
classmethod forward(obj: Image, encoder: str | Callable[[Image], bytes] = 'PNG') Dict[str, Any][source]#

Convert an object to bytes.

classmethod backward(media_struct: StructScalar, idx: int, table: Table, table_path: str) Image[source]#

Build an object from bytes.

classmethod backward_extra_image(image_struct: StructScalar, idx: int, table: Table, extra_image_idx: int) Image[source]#
class datumaro.plugins.data_formats.arrow.mapper.media.PointCloudMapper[source]#

Bases: MediaElementMapper

MEDIA_TYPE = 6#
B64_PREFIX = '//B64_ENCODED//'#
classmethod forward(obj: PointCloud, encoder: str | Callable[[PointCloud], bytes] = 'PNG') Dict[str, Any][source]#

Convert an object to bytes.

classmethod backward(media_struct: StructScalar, idx: int, table: Table, table_path: str) PointCloud[source]#

Build an object from bytes.