datumaro.components.annotations.matcher#
Functions
|
Match segments and return sets of the matched segments which can be more than two |
|
Match segments and return pairs of the two matched segments |
Classes
|
Method generated by attrs for class AnnotationMatcher. |
|
Method generated by attrs for class BboxMatcher. |
|
Method generated by attrs for class CaptionsMatcher. |
|
Method generated by attrs for class Cuboid2DMatcher. |
|
Method generated by attrs for class Cuboid3dMatcher. |
|
Method generated by attrs for class FeatureVectorMatcher. |
|
Method generated by attrs for class HashKeyMatcher. |
|
Method generated by attrs for class ImageAnnotationMatcher. |
|
Method generated by attrs for class LabelMatcher. |
|
Method generated by attrs for class LineMatcher. |
|
Method generated by attrs for class MaskMatcher. |
|
Method generated by attrs for class PointsMatcher. |
|
Method generated by attrs for class PolygonMatcher. |
|
Method generated by attrs for class RotatedBboxMatcher. |
|
Method generated by attrs for class ShapeMatcher. |
|
Method generated by attrs for class TabularMatcher. |
- datumaro.components.annotations.matcher.match_segments_pair(a_segms, b_segms, distance=<function segment_iou>, dist_thresh=1.0, label_matcher=<function <lambda>>)[source]#
Match segments and return pairs of the two matched segments
- datumaro.components.annotations.matcher.match_segments_more_than_pair(a_segms, b_segms, distance=<function segment_iou>, dist_thresh=1.0, label_matcher=<function <lambda>>)[source]#
Match segments and return sets of the matched segments which can be more than two
- class datumaro.components.annotations.matcher.AnnotationMatcher(*, context: IMatcherContext | IMergerContext | None = None)[source]#
Bases:
object
Method generated by attrs for class AnnotationMatcher.
- class datumaro.components.annotations.matcher.LabelMatcher(*, context: IMatcherContext | IMergerContext | None = None)[source]#
Bases:
AnnotationMatcher
Method generated by attrs for class LabelMatcher.
- class datumaro.components.annotations.matcher.ShapeMatcher(*, context: ~datumaro.components.abstracts.merger.IMatcherContext | ~datumaro.components.abstracts.merger.IMergerContext | None = None, pairwise_dist=0.9, cluster_dist=-1.0, match_segments=<function match_segments_pair>)[source]#
Bases:
AnnotationMatcher
Method generated by attrs for class ShapeMatcher.
- match_annotations(sources: List[List[Annotation]]) List[List[Annotation]] [source]#
- class datumaro.components.annotations.matcher.BboxMatcher(*, context: ~datumaro.components.abstracts.merger.IMatcherContext | ~datumaro.components.abstracts.merger.IMergerContext | None = None, pairwise_dist=0.9, cluster_dist=-1.0, match_segments=<function match_segments_pair>)[source]#
Bases:
ShapeMatcher
Method generated by attrs for class BboxMatcher.
- class datumaro.components.annotations.matcher.PolygonMatcher(*, context: ~datumaro.components.abstracts.merger.IMatcherContext | ~datumaro.components.abstracts.merger.IMergerContext | None = None, pairwise_dist=0.9, cluster_dist=-1.0, match_segments=<function match_segments_pair>)[source]#
Bases:
ShapeMatcher
Method generated by attrs for class PolygonMatcher.
- class datumaro.components.annotations.matcher.MaskMatcher(*, context: ~datumaro.components.abstracts.merger.IMatcherContext | ~datumaro.components.abstracts.merger.IMergerContext | None = None, pairwise_dist=0.9, cluster_dist=-1.0, match_segments=<function match_segments_pair>)[source]#
Bases:
ShapeMatcher
Method generated by attrs for class MaskMatcher.
- class datumaro.components.annotations.matcher.PointsMatcher(*, context: ~datumaro.components.abstracts.merger.IMatcherContext | ~datumaro.components.abstracts.merger.IMergerContext | None = None, pairwise_dist=0.9, cluster_dist=-1.0, match_segments=<function match_segments_pair>, sigma: list | None = None, instance_map)[source]#
Bases:
ShapeMatcher
Method generated by attrs for class PointsMatcher.
- class datumaro.components.annotations.matcher.LineMatcher(*, context: ~datumaro.components.abstracts.merger.IMatcherContext | ~datumaro.components.abstracts.merger.IMergerContext | None = None, pairwise_dist=0.9, cluster_dist=-1.0, match_segments=<function match_segments_pair>)[source]#
Bases:
ShapeMatcher
Method generated by attrs for class LineMatcher.
- class datumaro.components.annotations.matcher.CaptionsMatcher(*, context: IMatcherContext | IMergerContext | None = None)[source]#
Bases:
AnnotationMatcher
Method generated by attrs for class CaptionsMatcher.
- class datumaro.components.annotations.matcher.Cuboid3dMatcher(*, context: ~datumaro.components.abstracts.merger.IMatcherContext | ~datumaro.components.abstracts.merger.IMergerContext | None = None, pairwise_dist=0.9, cluster_dist=-1.0, match_segments=<function match_segments_pair>)[source]#
Bases:
ShapeMatcher
Method generated by attrs for class Cuboid3dMatcher.
- class datumaro.components.annotations.matcher.ImageAnnotationMatcher(*, context: IMatcherContext | IMergerContext | None = None)[source]#
Bases:
AnnotationMatcher
Method generated by attrs for class ImageAnnotationMatcher.
- class datumaro.components.annotations.matcher.HashKeyMatcher(*, context: IMatcherContext | IMergerContext | None = None)[source]#
Bases:
AnnotationMatcher
Method generated by attrs for class HashKeyMatcher.
- class datumaro.components.annotations.matcher.FeatureVectorMatcher(*, context: IMatcherContext | IMergerContext | None = None)[source]#
Bases:
AnnotationMatcher
Method generated by attrs for class FeatureVectorMatcher.
- class datumaro.components.annotations.matcher.Cuboid2DMatcher(*, context: ~datumaro.components.abstracts.merger.IMatcherContext | ~datumaro.components.abstracts.merger.IMergerContext | None = None, pairwise_dist=0.9, cluster_dist=-1.0, match_segments=<function match_segments_pair>)[source]#
Bases:
ShapeMatcher
Method generated by attrs for class Cuboid2DMatcher.
- class datumaro.components.annotations.matcher.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.annotations.matcher.IMatcherContext[source]#
Bases:
ABC
- abstract get_any_label_name(ann: Annotation, label_id: int) str [source]#
- class datumaro.components.annotations.matcher.IMergerContext[source]#
Bases:
IMatcherContext
- abstract merge(sources: Sequence[IDataset]) DatasetItemStorage [source]#
- datumaro.components.annotations.matcher.OKS(a, b, sigma=None, bbox=None, scale=None)[source]#
Object Keypoint Similarity metric. https://cocodataset.org/#keypoints-eval
- class datumaro.components.annotations.matcher.Points(points, visibility: List[IntEnum] | None = None, *, id: int = 0, attributes: Dict[str, Any] = _Nothing.NOTHING, group: int = 0, object_id: int = -1, label=None, z_order: int = 0)[source]#
Bases:
Shape
Represents an ordered set of points.
- _type#
The type of annotation, set to AnnotationType.points.
- Type:
- Nested Class:
- Visibility (IntEnum): Enum representing the visibility state of points. It has three states:
absent: Point is absent (0).
hidden: Point is hidden (1).
visible: Point is visible (2).
Method generated by attrs for class Points.
- class Visibility(value)[source]#
Bases:
IntEnum
Enum representing the visibility state of points.
Point is hidden (1).
- Type:
- absent = 0#
- hidden = 1#
- visible = 2#
- class datumaro.components.annotations.matcher.RotatedBboxMatcher(sigma: list | None = None, *, context: ~datumaro.components.abstracts.merger.IMatcherContext | ~datumaro.components.abstracts.merger.IMergerContext | None = None, pairwise_dist=0.9, cluster_dist=-1.0, match_segments=<function match_segments_pair>)[source]#
Bases:
ShapeMatcher
Method generated by attrs for class RotatedBboxMatcher.
- class datumaro.components.annotations.matcher.TabularMatcher(*, context: IMatcherContext | IMergerContext | None = None)[source]#
Bases:
AnnotationMatcher
Method generated by attrs for class TabularMatcher.
- datumaro.components.annotations.matcher.approximate_line(points: Sequence[float], segments: int) ndarray [source]#
Approximates a 2d line to the required number of segments. The new points are distributed uniformly across the input line.
- Parameters:
points (Sequence) – an array of line point coordinates. The size is [points * 2], the layout is [x0, y0, x1, y1, …].
segments (int) – the required numebr of segments in the resulting line.
- Returns:
an array of new line point coordinates.
- Return type:
new_points (numpy.ndarray)
- Returns:
The size is [(segments + 1) * 2], the layout is [x0, y0, x1, y1, …].
- datumaro.components.annotations.matcher.attrib(default=_Nothing.NOTHING, validator=None, repr=True, cmp=None, hash=None, init=True, metadata=None, type=None, converter=None, factory=None, kw_only=False, eq=None, order=None, on_setattr=None, alias=None)[source]#
Create a new field / attribute on a class.
Identical to attrs.field, except it’s not keyword-only.
Consider using attrs.field in new code (
attr.ib
will never go away, though).Warning
Does nothing unless the class is also decorated with attr.s (or similar)!
New in version 15.2.0: convert
New in version 16.3.0: metadata
Changed in version 17.1.0: validator can be a
list
now.Changed in version 17.1.0: hash is None and therefore mirrors eq by default.
New in version 17.3.0: type
Deprecated since version 17.4.0: convert
New in version 17.4.0: converter as a replacement for the deprecated convert to achieve consistency with other noun-based arguments.
New in version 18.1.0:
factory=f
is syntactic sugar fordefault=attr.Factory(f)
.New in version 18.2.0: kw_only
Changed in version 19.2.0: convert keyword argument removed.
Changed in version 19.2.0: repr also accepts a custom callable.
Deprecated since version 19.2.0: cmp Removal on or after 2021-06-01.
New in version 19.2.0: eq and order
New in version 20.1.0: on_setattr
Changed in version 20.3.0: kw_only backported to Python 2
Changed in version 21.1.0: eq, order, and cmp also accept a custom callable
Changed in version 21.1.0: cmp undeprecated
New in version 22.2.0: alias
- datumaro.components.annotations.matcher.attrs(maybe_cls=None, these=None, repr_ns=None, repr=None, cmp=None, hash=None, init=None, slots=False, frozen=False, weakref_slot=True, str=False, auto_attribs=False, kw_only=False, cache_hash=False, auto_exc=False, eq=None, order=None, auto_detect=False, collect_by_mro=False, getstate_setstate=None, on_setattr=None, field_transformer=None, match_args=True, unsafe_hash=None)[source]#
A class decorator that adds dunder methods according to the specified attributes using attr.ib or the these argument.
Consider using attrs.define / attrs.frozen in new code (
attr.s
will never go away, though).- Parameters:
repr_ns (str) – When using nested classes, there was no way in Python 2 to automatically detect that. This argument allows to set a custom name for a more meaningful
repr
output. This argument is pointless in Python 3 and is therefore deprecated.
Caution
Refer to attrs.define for the rest of the parameters, but note that they can have different defaults.
Notably, leaving on_setattr as None will not add any hooks.
New in version 16.0.0: slots
New in version 16.1.0: frozen
New in version 16.3.0: str
New in version 16.3.0: Support for
__attrs_post_init__
.Changed in version 17.1.0: hash supports None as value which is also the default now.
New in version 17.3.0: auto_attribs
Changed in version 18.1.0: If these is passed, no attributes are deleted from the class body.
Changed in version 18.1.0: If these is ordered, the order is retained.
New in version 18.2.0: weakref_slot
Deprecated since version 18.2.0:
__lt__
,__le__
,__gt__
, and__ge__
now raise a DeprecationWarning if the classes compared are subclasses of each other.__eq
and__ne__
never tried to compared subclasses to each other.Changed in version 19.2.0:
__lt__
,__le__
,__gt__
, and__ge__
now do not consider subclasses comparable anymore.New in version 18.2.0: kw_only
New in version 18.2.0: cache_hash
New in version 19.1.0: auto_exc
Deprecated since version 19.2.0: cmp Removal on or after 2021-06-01.
New in version 19.2.0: eq and order
New in version 20.1.0: auto_detect
New in version 20.1.0: collect_by_mro
New in version 20.1.0: getstate_setstate
New in version 20.1.0: on_setattr
New in version 20.3.0: field_transformer
Changed in version 21.1.0:
init=False
injects__attrs_init__
Changed in version 21.1.0: Support for
__attrs_pre_init__
Changed in version 21.1.0: cmp undeprecated
New in version 21.3.0: match_args
New in version 22.2.0: unsafe_hash as an alias for hash (for PEP 681 compliance).
Deprecated since version 24.1.0: repr_ns
Changed in version 24.1.0: Instances are not compared as tuples of attributes anymore, but using a big
and
condition. This is faster and has more correct behavior for uncomparable values like math.nan.New in version 24.1.0: If a class has an inherited classmethod called
__attrs_init_subclass__
, it is executed after the class is created.Deprecated since version 24.1.0: hash is deprecated in favor of unsafe_hash.
- datumaro.components.annotations.matcher.bbox_iou(a, b) Literal[-1] | float [source]#
IoU computations for simple cases with bounding boxes
- datumaro.components.annotations.matcher.max_bbox(annotations: Iterable[Tuple[float, float, float, float] | _Shape | Mask]) Tuple[float, float, float, float] [source]#
Computes the maximum bbox for the set of spatial annotations and boxes.
- Returns:
(x, y, w, h)
- Return type:
bbox (tuple)