datumaro.components.merge.exact_merge#
Classes
|
Merges several datasets using the "simple" algorithm: |
- class datumaro.components.merge.exact_merge.ExactMerge(**options)[source]#
Bases:
Merger
- Merges several datasets using the “simple” algorithm:
All datasets should have the same categories
items are matched by (id, subset) pairs
- matching items share the media info available:
nothing + nothing = nothing
nothing + something = something
something A + something B = conflict
annotations are matched by value and shared
in case of conflicts, throws an error
- classmethod merge(sources: Sequence[IDataset]) DatasetItemStorage [source]#
- classmethod merge_items(existing_item: DatasetItem, current_item: DatasetItem) DatasetItem [source]#
- class datumaro.components.merge.exact_merge.Annotation(*, id: int = 0, attributes: Dict[str, Any] = _Nothing.NOTHING, group: int = 0, object_id: int = -1)[source]#
Bases:
object
A base annotation class.
Derived classes must define the ‘_type’ class variable with a value from the AnnotationType enum.
Method generated by attrs for class Annotation.
- property type: AnnotationType#
- class datumaro.components.merge.exact_merge.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.components.merge.exact_merge.DatasetItemStorage[source]#
Bases:
object
- put(item: DatasetItem) bool [source]#
- get(id: str | DatasetItem, subset: str | None = None, dummy: Any | None = None) DatasetItem | None [source]#
- exception datumaro.components.merge.exact_merge.DatasetMergeError(msg=None, *, sources=None)[source]#
Bases:
DatasetError
- sources#
- class datumaro.components.merge.exact_merge.IDataset[source]#
Bases:
object
- subsets() Dict[str, IDataset] [source]#
Enumerates subsets in the dataset. Each subset can be a dataset itself.
- categories() Dict[AnnotationType, Categories] [source]#
Returns metainfo about dataset labels.
- get(id: str, subset: str | None = None) DatasetItem | None [source]#
Provides random access to dataset items.
- media_type() Type[MediaElement] [source]#
Returns media type of the dataset items.
All the items are supposed to have the same media type. Supposed to be constant and known immediately after the object construction (i.e. doesn’t require dataset iteration).
- ann_types() List[AnnotationType] [source]#
Returns available task type from dataset annotation types.
- class datumaro.components.merge.exact_merge.Image(size: Tuple[int, int] | None = None, ext: str | None = None, *args, **kwargs)[source]#
Bases:
MediaElement
[ndarray
]
- class datumaro.components.merge.exact_merge.MediaElement(crypter: ~datumaro.components.crypter.Crypter = <datumaro.components.crypter.NullCrypter object>, *args, **kwargs)[source]#
Bases:
Generic
[AnyData
]
- class datumaro.components.merge.exact_merge.Merger(**options)[source]#
Bases:
IMergerContext
,CliPlugin
Merge multiple datasets into one dataset
- static merge_categories(sources: Sequence[Dict[AnnotationType, Categories]]) Dict [source]#
- exception datumaro.components.merge.exact_merge.MismatchingAttributesError(item_id: Tuple[str, str], key: str, a: Any, b: Any, *, sources=_Nothing.NOTHING)[source]#
Bases:
DatasetMergeError
Method generated by attrs for class MismatchingAttributesError.
- exception datumaro.components.merge.exact_merge.MismatchingImageInfoError(item_id: Tuple[str, str], a: Tuple[int, int], b: Tuple[int, int], *, sources=_Nothing.NOTHING)[source]#
Bases:
DatasetMergeError
Method generated by attrs for class MismatchingImageInfoError.
- exception datumaro.components.merge.exact_merge.MismatchingMediaError(item_id: Tuple[str, str], a: Any, b: Any, *, sources=_Nothing.NOTHING)[source]#
Bases:
DatasetMergeError
Method generated by attrs for class MismatchingMediaError.
- exception datumaro.components.merge.exact_merge.MismatchingMediaPathError(item_id: Tuple[str, str], a: str, b: str, *, sources=_Nothing.NOTHING)[source]#
Bases:
DatasetMergeError
Method generated by attrs for class MismatchingMediaPathError.
- class datumaro.components.merge.exact_merge.MultiframeImage(images: Iterable[str | Image | ndarray | Callable[[str], ndarray]] | None, *, path: str | None = None)[source]#
Bases:
MediaElement
- class datumaro.components.merge.exact_merge.PointCloud(extra_images: List[Image] | Callable[[], List[Image]] | None = None, *args, **kwargs)[source]#
Bases:
MediaElement
[bytes
]
- class datumaro.components.merge.exact_merge.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.
- exception datumaro.components.merge.exact_merge.VideoMergeError(item_id, *, sources=_Nothing.NOTHING)[source]#
Bases:
DatasetMergeError
Method generated by attrs for class VideoMergeError.
- item_id#