datumaro.components.media#
Classes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
An enumeration. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table data with multiple rows and columns. |
|
Read a '.csv' file and compose a Table instance. |
|
Read a pandas DataFrame and compose a Table instance. |
|
Read a list of table row data and compose a Table instance. |
|
TableRow media refers to a Table instance and its row index. |
|
TableRow media refers to a Table instance and its row index. |
|
|
|
- class datumaro.components.media.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.components.media.MediaElement(crypter: ~datumaro.components.crypter.Crypter = <datumaro.components.crypter.NullCrypter object>, *args, **kwargs)[source]#
Bases:
Generic
[AnyData
]
- class datumaro.components.media.FromDataMixin(data: Callable[[], AnyData] | AnyData, *args, **kwargs)[source]#
Bases:
Generic
[AnyData
]
- class datumaro.components.media.Image(size: Tuple[int, int] | None = None, ext: str | None = None, *args, **kwargs)[source]#
Bases:
MediaElement
[ndarray
]
- class datumaro.components.media.ImageFromFile(path: str, *args, **kwargs)[source]#
Bases:
FromFileMixin
,Image
- class datumaro.components.media.ImageFromData(data: Callable[[], AnyData] | AnyData, *args, **kwargs)[source]#
Bases:
FromDataMixin
,Image
- class datumaro.components.media.ImageFromNumpy(data: Callable[[], bytes] | bytes, *args, **kwargs)[source]#
Bases:
ImageFromData
- class datumaro.components.media.ImageFromBytes(data: Callable[[], bytes] | bytes, *args, **kwargs)[source]#
Bases:
ImageFromData
- class datumaro.components.media.VideoFrame(video: Video, index: int)[source]#
Bases:
ImageFromNumpy
- class datumaro.components.media.Video(path: str, step: int = 1, start_frame: int = 0, end_frame: int | None = None, *args, **kwargs)[source]#
Bases:
MediaElement
,Iterable
[VideoFrame
]- get_frame_data(idx: int) VideoFrame [source]#
- property length: int | None#
Returns frame count of the closed interval [start_frame, end_frame], if video provides such information.
Note that not all videos provide length / duration metainfo, so the result may be undefined.
Also note, that information may be inaccurate because of variable FPS in video or incorrect metainfo. The count is only guaranteed to be valid after video is completely read once.
The count is affected by the frame filtering options of the object, i.e. start frame, end frame and frame step.
- class datumaro.components.media.PointCloud(extra_images: List[Image] | Callable[[], List[Image]] | None = None, *args, **kwargs)[source]#
Bases:
MediaElement
[bytes
]
- class datumaro.components.media.PointCloudFromFile(path: str, *args, **kwargs)[source]#
Bases:
FromFileMixin
,PointCloud
- class datumaro.components.media.PointCloudFromData(data: Callable[[], AnyData] | AnyData, *args, **kwargs)[source]#
Bases:
FromDataMixin
,PointCloud
- class datumaro.components.media.PointCloudFromBytes(data: Callable[[], AnyData] | AnyData, *args, **kwargs)[source]#
Bases:
PointCloudFromData
- class datumaro.components.media.MultiframeImage(images: Iterable[str | Image | ndarray | Callable[[str], ndarray]] | None, *, path: str | None = None)[source]#
Bases:
MediaElement
- class datumaro.components.media.RoIImage(roi: Tuple[int, int, int, int], *args, **kwargs)[source]#
Bases:
Image
- class datumaro.components.media.RoIImageFromFile(path: str, roi: Tuple[int, int, int, int], *args, **kwargs)[source]#
Bases:
FromFileMixin
,RoIImage
- class datumaro.components.media.RoIImageFromData(data: Callable[[], AnyData] | AnyData, *args, **kwargs)[source]#
Bases:
FromDataMixin
,RoIImage
- class datumaro.components.media.RoIImageFromBytes(data: bytes | Callable[[], bytes], roi: Tuple[int, int, int, int], *args, **kwargs)[source]#
Bases:
RoIImageFromData
- class datumaro.components.media.RoIImageFromNumpy(data: ndarray | Callable[[], ndarray], roi: Tuple[int, int, int, int], *args, **kwargs)[source]#
Bases:
RoIImageFromData
- class datumaro.components.media.MosaicImage(*args, **kwargs)[source]#
Bases:
Image
- class datumaro.components.media.MosaicImageFromData(data: Callable[[], AnyData] | AnyData, *args, **kwargs)[source]#
Bases:
FromDataMixin
,MosaicImage
- class datumaro.components.media.MosaicImageFromImageRoIPairs(data: List[Tuple[Image, Tuple[int, int, int, int]]], size: Tuple[int, int])[source]#
Bases:
MosaicImageFromData
- class datumaro.components.media.Table[source]#
Bases:
object
Table data with multiple rows and columns. This provides random access to the table row.
Initialization must be done in the child class.
- classmethod from_csv(path: str, *args, **kwargs) Type[Table] [source]#
Returns Table instance creating from a csv file.
- Parameters:
path (str) – Path to csv file.
- classmethod from_dataframe(data: DataFrame | Callable[[], DataFrame], *args, **kwargs) Type[Table] [source]#
Returns Table instance creating from a pandas DataFrame.
- Parameters:
data (DataFrame) – Data in pandas DataFrame format.
- classmethod from_list(data: List[Dict[str, TableDtype]], *args, **kwargs) Type[Table] [source]#
Returns Table instance creating from a list of dicts.
- class datumaro.components.media.TableFromCSV(path: str, dtype: Dict | None = None, sep: str | None = None, encoding: str | None = None, *args, **kwargs)[source]#
Bases:
FromFileMixin
,Table
Read a ‘.csv’ file and compose a Table instance.
- Parameters:
- class datumaro.components.media.TableFromDataFrame(data: Callable[[], DataFrame] | DataFrame, *args, **kwargs)[source]#
Bases:
FromDataMixin
,Table
Read a pandas DataFrame and compose a Table instance.
- Parameters:
data (DataFrame) – Data in pandas DataFrame format.
- class datumaro.components.media.TableFromListOfDict(data: List[Dict[str, TableDtype]], *args, **kwargs)[source]#
Bases:
TableFromDataFrame
Read a list of table row data and compose a Table instance. The table row data is in dictionary format.
- class datumaro.components.media.TableRow(table: Table, index: int)[source]#
Bases:
MediaElement
TableRow media refers to a Table instance and its row index.
- class datumaro.components.media.TableRowFromData(data: Dict, *args, **kwargs)[source]#
Bases:
FromDataMixin
,TableRow
TableRow media refers to a Table instance and its row index.