|
7 | 7 | import itertools
|
8 | 8 | from abc import ABCMeta, abstractmethod
|
9 | 9 | from collections.abc import Collection
|
10 |
| -from typing import Iterable, Optional, Sequence |
| 10 | +from typing import Iterable, Sequence |
11 | 11 |
|
12 | 12 | import attrs
|
13 | 13 |
|
|
17 | 17 | import datumaro.components.merge.intersect_merge
|
18 | 18 | import numpy as np
|
19 | 19 | from datumaro.components.errors import FailedLabelVotingError
|
20 |
| -from datumaro.util.annotation_util import find_instances, max_bbox, mean_bbox |
| 20 | +from datumaro.util.annotation_util import mean_bbox |
21 | 21 | from datumaro.util.attrs_util import ensure_cls
|
22 | 22 |
|
23 | 23 | from cvat.apps.engine.models import Label
|
@@ -121,27 +121,8 @@ def _for_type(t: dm.AnnotationType, **kwargs) -> AnnotationMatcher:
|
121 | 121 | else:
|
122 | 122 | raise AssertionError(f"Annotation type {t} is not supported")
|
123 | 123 |
|
124 |
| - instance_map = {} |
125 |
| - for s in sources: |
126 |
| - s_instances = find_instances(s) |
127 |
| - for inst in s_instances: |
128 |
| - inst_bbox = max_bbox( |
129 |
| - [ |
130 |
| - a |
131 |
| - for a in inst |
132 |
| - if a.type |
133 |
| - in { |
134 |
| - dm.AnnotationType.polygon, |
135 |
| - dm.AnnotationType.mask, |
136 |
| - dm.AnnotationType.bbox, |
137 |
| - } |
138 |
| - ] |
139 |
| - ) |
140 |
| - for ann in inst: |
141 |
| - instance_map[id(ann)] = [inst, inst_bbox] |
142 |
| - |
143 | 124 | self._mergers = {
|
144 |
| - t: _for_type(t, instance_map=instance_map, categories=self._categories) |
| 125 | + t: _for_type(t, categories=self._categories) |
145 | 126 | for t in self.conf.included_annotation_types
|
146 | 127 | }
|
147 | 128 |
|
@@ -357,17 +338,13 @@ class MaskMatcher(PolygonMatcher):
|
357 | 338 |
|
358 | 339 | @attrs.define(kw_only=True, slots=False)
|
359 | 340 | class PointsMatcher(ShapeMatcher):
|
360 |
| - sigma: Optional[list] = attrs.field(default=None) |
361 |
| - |
362 | 341 | def match_annotations_between_two_items(self, item_a, item_b):
|
363 | 342 | matches, _, _, _, distances = self._comparator.match_points(item_a, item_b)
|
364 | 343 | return matches, distances
|
365 | 344 |
|
366 | 345 |
|
367 | 346 | @attrs.define(kw_only=True, slots=False)
|
368 | 347 | class SkeletonMatcher(ShapeMatcher):
|
369 |
| - sigma: float = 0.1 |
370 |
| - |
371 | 348 | def match_annotations_between_two_items(self, item_a, item_b):
|
372 | 349 | matches, _, _, _, distances = self._comparator.match_skeletons(item_a, item_b)
|
373 | 350 | return matches, distances
|
|
0 commit comments