datumaro.plugins.data_formats.arrow.mapper#
- class datumaro.plugins.data_formats.arrow.mapper.DatasetItemMapper[source]#
Bases:
Mapper
- static backward(idx: int, table: Table, table_path: str) DatasetItem [source]#
Build an object from bytes.
- class datumaro.plugins.data_formats.arrow.mapper.MediaMapper[source]#
Bases:
Mapper
- class datumaro.plugins.data_formats.arrow.mapper.AnnotationListMapper[source]#
Bases:
Mapper
- backward_map = {AnnotationType.label: <bound method LabelMapper.backward of <class 'datumaro.plugins.data_formats.datumaro_binary.mapper.annotation.LabelMapper'>>, AnnotationType.mask: <bound method MaskMapper.backward of <class 'datumaro.plugins.data_formats.datumaro_binary.mapper.annotation.MaskMapper'>>, AnnotationType.points: <bound method PointsMapper.backward of <class 'datumaro.plugins.data_formats.datumaro_binary.mapper.annotation.PointsMapper'>>, AnnotationType.polygon: <bound method PolygonMapper.backward of <class 'datumaro.plugins.data_formats.datumaro_binary.mapper.annotation.PolygonMapper'>>, AnnotationType.polyline: <bound method PolyLineMapper.backward of <class 'datumaro.plugins.data_formats.datumaro_binary.mapper.annotation.PolyLineMapper'>>, AnnotationType.bbox: <bound method BboxMapper.backward of <class 'datumaro.plugins.data_formats.datumaro_binary.mapper.annotation.BboxMapper'>>, AnnotationType.caption: <bound method CaptionMapper.backward of <class 'datumaro.plugins.data_formats.datumaro_binary.mapper.annotation.CaptionMapper'>>, AnnotationType.cuboid_3d: <bound method Cuboid3dMapper.backward of <class 'datumaro.plugins.data_formats.datumaro_binary.mapper.annotation.Cuboid3dMapper'>>, AnnotationType.ellipse: <bound method EllipseMapper.backward of <class 'datumaro.plugins.data_formats.datumaro_binary.mapper.annotation.EllipseMapper'>>, AnnotationType.cuboid_2d: <bound method Cuboid2DMapper.backward of <class 'datumaro.plugins.data_formats.datumaro_binary.mapper.annotation.Cuboid2DMapper'>>}#
- classmethod forward(anns: List[Annotation]) bytes [source]#
Convert an object to bytes.
- class datumaro.plugins.data_formats.arrow.mapper.DatasetItem(id: str, *, subset: str | None = None, media: str | MediaElement | None = None, annotations: List[Annotation] | None = None, attributes: Dict[str, Any] | None = None)[source]#
Bases:
object
- media: MediaElement | None#
- annotations: Annotations#
- class datumaro.plugins.data_formats.arrow.mapper.Image(size: Tuple[int, int] | None = None, ext: str | None = None, *args, **kwargs)[source]#
Bases:
MediaElement
[ndarray
]
- class datumaro.plugins.data_formats.arrow.mapper.ImageMapper[source]#
Bases:
MediaElementMapper
- MEDIA_TYPE = 2#
- AVAILABLE_SCHEMES = ('AS-IS', 'PNG', 'TIFF', 'JPEG/95', 'JPEG/75', 'NONE')#
- classmethod forward(obj: Image, encoder: str | Callable[[Image], bytes] = 'PNG') Dict[str, Any] [source]#
Convert an object to bytes.
- class datumaro.plugins.data_formats.arrow.mapper.MediaElement(crypter: ~datumaro.components.crypter.Crypter = <datumaro.components.crypter.NullCrypter object>, *args, **kwargs)[source]#
Bases:
Generic
[AnyData
]
- class datumaro.plugins.data_formats.arrow.mapper.MediaElementMapper[source]#
Bases:
Mapper
- MAGIC_PATH = '/NOT/A/REAL/PATH'#
- MEDIA_TYPE = 1#
- class datumaro.plugins.data_formats.arrow.mapper.MediaType(value)[source]#
Bases:
IntEnum
An enumeration.
- NONE = 0#
- MEDIA_ELEMENT = 1#
- IMAGE = 2#
- BYTE_IMAGE = 3#
- VIDEO_FRAME = 4#
- VIDEO = 5#
- POINT_CLOUD = 6#
- MULTIFRAME_IMAGE = 7#
- ROI_IMAGE = 8#
- MOSAIC_IMAGE = 9#
- TABLE_ROW = 10#
- property media: Type[MediaElement] | None#
- class datumaro.plugins.data_formats.arrow.mapper.PointCloud(extra_images: List[Image] | Callable[[], List[Image]] | None = None, *args, **kwargs)[source]#
Bases:
MediaElement
[bytes
]
- class datumaro.plugins.data_formats.arrow.mapper.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.
- datumaro.plugins.data_formats.arrow.mapper.decode_image(image_bytes: bytes, dtype: ~numpy.dtype = <class 'numpy.uint8'>) ndarray [source]#
- datumaro.plugins.data_formats.arrow.mapper.encode_image(image: np.ndarray, ext: str, dtype: DTypeLike = <class 'numpy.uint8'>, **kwargs) bytes [source]#
- datumaro.plugins.data_formats.arrow.mapper.load_image(path: str, dtype: DTypeLike = <class 'numpy.uint8'>, crypter: Crypter = <datumaro.components.crypter.NullCrypter object>)[source]#
Reads an image in the HWC Grayscale/BGR(A) [0; 255] format (default dtype is uint8).
Modules