Skip to content

Commit 0f10fc3

Browse files
authored
Deprecate NDR, DSA, and some filters. Remove deprecation from tiling. (#1780)
<!-- Contributing guide: https://github.com/open-edge-platform/datumaro/blob/develop/CONTRIBUTING.md --> ### Summary This PR deprecates NDR, DSA (data shift analysis), model transform, xpath filters. It also remove the deprecation of tiling as it is used by OTX. <!-- Resolves #111 and #222. Depends on #1000 (for series of dependent commits). This PR introduces this capability to make the project better in this and that. - Added this feature - Removed that feature - Fixed the problem #1234 --> ### How to test <!-- Describe the testing procedure for reviewers, if changes are not fully covered by unit tests or manual testing can be complicated. --> ### Checklist <!-- Put an 'x' in all the boxes that apply --> - [ ] I have added unit tests to cover my changes.​ - [ ] I have added integration tests to cover my changes.​ - [ ] I have added the description of my changes into [CHANGELOG](https://github.com/open-edge-platform/datumaro/blob/develop/CHANGELOG.md).​ - [ ] I have updated the [documentation](https://github.com/open-edge-platform/datumaro/tree/develop/docs) accordingly ### License - [ ] I submit _my code changes_ under the same [MIT License](https://github.com/open-edge-platform/datumaro/blob/develop/LICENSE) that covers the project. Feel free to contact the maintainers if that's a concern. - [ ] I have updated the license header for each file (see an example below). ```python # Copyright (C) 2025 Intel Corporation # # SPDX-License-Identifier: MIT ```
2 parents 2a61efd + 093413b commit 0f10fc3

File tree

14 files changed

+43
-12
lines changed

14 files changed

+43
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3131

3232
### Deprecations
3333
- Added deprecation notices to the following features that will soon be removed:
34+
- Inference
35+
- Model-based transformations
3436
- Crypter
35-
- Advanced dataset comparison based on similarity search with OpenVINO
3637
- Synthetic dataset generation
3738
- Data exploration
3839
- BBox to mask using SAM
39-
- Tiling
40-
- Dataset versioning with DVCS
4140
- Telemetry
4241
- Anchor generation
4342
- Missing annotation detection
4443
- Model inference explanation
4544
- Near-duplicate removal
4645
- Pruning
4746
- Pseudo-labels
48-
(<https://github.com/open-edge-platform/datumaro/pull/1776>)
47+
(<https://github.com/open-edge-platform/datumaro/pull/1776>, <https://github.com/open-edge-platform/datumaro/pull/1780>)
4948

5049
## Q1 2025 Release 1.10.0
5150

src/datumaro/components/abstracts/model_interpreter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from datumaro.components.annotation import Annotation
1111
from datumaro.components.dataset_base import DatasetItem
12+
from datumaro.util.deprecation import deprecated
1213

1314
__all__ = ["IModelInterpreter", "PrepInfo", "ModelPred", "LauncherInputType"]
1415

@@ -17,6 +18,7 @@
1718
LauncherInputType = Union[np.ndarray, Dict[str, np.ndarray]]
1819

1920

21+
@deprecated(deprecated_version="1.11", removed_version="1.12")
2022
class IModelInterpreter(ABC):
2123
@abstractmethod
2224
def preprocess(self, inp: DatasetItem) -> Tuple[LauncherInputType, PrepInfo]:

src/datumaro/components/algorithms/hash_key_inference/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from typing import TYPE_CHECKING, Sequence
66

77
from datumaro.components.dataset import Dataset
8+
from datumaro.util.deprecation import deprecated
89

910
if TYPE_CHECKING:
1011
import datumaro.plugins.explorer as explorer
@@ -14,6 +15,7 @@
1415
explorer = lazy_import("datumaro.plugins.explorer")
1516

1617

18+
@deprecated(deprecated_version="1.11", removed_version="1.12")
1719
class HashInference:
1820
def __init__(self, *datasets: Sequence[Dataset]) -> None:
1921
pass

src/datumaro/components/algorithms/hash_key_inference/prune.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def base(
8181
raise NotImplementedError
8282

8383

84+
@deprecated(deprecated_version="1.11", removed_version="1.12")
8485
class RandomSelect(PruneBase):
8586
"""
8687
Select items randomly from the dataset.
@@ -95,6 +96,7 @@ def base(self, ratio, num_centers, labels, database_keys, item_list, source):
9596
return selected_items, None
9697

9798

99+
@deprecated(deprecated_version="1.11", removed_version="1.12")
98100
class Centroid(PruneBase):
99101
"""
100102
Select items through clustering with centers targeting the desired number.
@@ -127,6 +129,7 @@ def base(self, ratio, num_centers, labels, database_keys, item_list, source):
127129
return selected_items, dist_tuples
128130

129131

132+
@deprecated(deprecated_version="1.11", removed_version="1.12")
130133
class ClusteredRandom(PruneBase):
131134
"""
132135
Select items through clustering and choose randomly within each cluster.
@@ -153,6 +156,7 @@ def base(self, ratio, num_centers, labels, database_keys, item_list, source):
153156
return selected_items, None
154157

155158

159+
@deprecated(deprecated_version="1.11", removed_version="1.12")
156160
class QueryClust(PruneBase):
157161
"""
158162
Select items through clustering with inits that imply each label.
@@ -206,6 +210,7 @@ def base(self, ratio, num_centers, labels, database_keys, item_list, source):
206210
return selected_items, dist_tuples
207211

208212

213+
@deprecated(deprecated_version="1.11", removed_version="1.12")
209214
class Entropy(PruneBase):
210215
"""
211216
Select items through clustering and choose them based on label entropy in each cluster.

src/datumaro/components/annotation.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
from datumaro.components.media import Image
3535
from datumaro.util.attrs_util import default_if_none, not_empty
36+
from datumaro.util.deprecation import deprecated
3637
from datumaro.util.points_util import normalize_points
3738

3839

@@ -257,6 +258,7 @@ class Label(Annotation):
257258
label: int = field(converter=int)
258259

259260

261+
@deprecated(deprecated_version="1.11", removed_version="1.12")
260262
@attrs(slots=True, eq=False, order=False)
261263
class HashKey(Annotation):
262264
_type = AnnotationType.hash_key
@@ -276,6 +278,7 @@ def __eq__(self, other):
276278
return np.array_equal(self.hash_key, other.hash_key)
277279

278280

281+
@deprecated(deprecated_version="1.11", removed_version="1.12")
279282
@attrs(eq=False, order=False)
280283
class FeatureVector(Annotation):
281284
_type = AnnotationType.feature_vector

src/datumaro/components/filter.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
)
2525
from datumaro.components.media import Image
2626
from datumaro.components.transformer import ItemTransform
27+
from datumaro.util.deprecation import deprecated
2728

2829
if TYPE_CHECKING:
2930
from datumaro.components.dataset_base import CategoriesInfo, DatasetItem, IDataset
@@ -36,6 +37,7 @@
3637
]
3738

3839

40+
@deprecated(deprecated_version="1.11", removed_version="1.12")
3941
class DatasetItemEncoder:
4042
@classmethod
4143
def encode(
@@ -268,6 +270,7 @@ def to_string(encoded_item: ET.ElementBase) -> str:
268270
return ET.tostring(encoded_item, encoding="unicode", pretty_print=True)
269271

270272

273+
@deprecated(deprecated_version="1.11", removed_version="1.12")
271274
class XPathDatasetFilter(ItemTransform):
272275
def __init__(self, extractor: IDataset, xpath: str) -> None:
273276
super().__init__(extractor)
@@ -289,6 +292,7 @@ def transform_item(self, item: DatasetItem) -> Optional[DatasetItem]:
289292
return item
290293

291294

295+
@deprecated(deprecated_version="1.11", removed_version="1.12")
292296
class XPathAnnotationsFilter(ItemTransform):
293297
def __init__(self, extractor: IDataset, xpath: str, remove_empty: bool = False) -> None:
294298
super().__init__(extractor)

src/datumaro/components/hl_ops/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from datumaro.components.transformer import ModelTransform, Transform
2727
from datumaro.components.validator import TaskType, Validator
2828
from datumaro.util import parse_str_enum_value
29+
from datumaro.util.deprecation import deprecated
2930
from datumaro.util.scope import on_error_do, scoped
3031

3132
if TYPE_CHECKING:
@@ -296,6 +297,7 @@ def merge(
296297
return Dataset(source=merged, env=env)
297298

298299
@staticmethod
300+
@deprecated(deprecated_version="1.11", removed_version="1.12")
299301
def run_model(
300302
dataset: IDataset,
301303
model: Union[Launcher, Type[ModelTransform]],

src/datumaro/components/shift_analyzer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from datumaro.components.dataset import IDataset
1414
from datumaro.components.launcher import LauncherWithModelInterpreter
1515
from datumaro.util import take_by
16+
from datumaro.util.deprecation import deprecated
1617

1718
if TYPE_CHECKING:
1819
from scipy import linalg, stats
@@ -26,6 +27,7 @@
2627
shift_launcher = lazy_import("datumaro.plugins.openvino_plugin.shift_launcher")
2728

2829

30+
@deprecated(deprecated_version="1.11", removed_version="1.12")
2931
class RunningStats1D:
3032
def __init__(self):
3133
self.running_mean = None
@@ -67,6 +69,7 @@ def cov(self) -> np.ndarray:
6769
return self.running_sq_mean - np.matmul(mean, mean.transpose())
6870

6971

72+
@deprecated(deprecated_version="1.11", removed_version="1.12")
7073
class FeatureAccumulator:
7174
def __init__(self, model: LauncherWithModelInterpreter):
7275
self.model = model
@@ -83,6 +86,7 @@ def get_activation_stats(self, dataset: IDataset) -> RunningStats1D:
8386
return running_stats
8487

8588

89+
@deprecated(deprecated_version="1.11", removed_version="1.12")
8690
class FeatureAccumulatorByLabel(FeatureAccumulator):
8791
def __init__(self, model):
8892
super().__init__(model)
@@ -106,6 +110,7 @@ def get_activation_stats(self, dataset: IDataset) -> Dict[int, RunningStats1D]:
106110
return running_stats
107111

108112

113+
@deprecated(deprecated_version="1.11", removed_version="1.12")
109114
class ShiftAnalyzer:
110115
def __init__(self) -> None:
111116
"""

src/datumaro/components/transformer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from datumaro.components.dataset_base import DatasetBase, DatasetItem, IDataset
1212
from datumaro.components.launcher import Launcher
1313
from datumaro.util import is_method_redefined, take_by
14+
from datumaro.util.deprecation import deprecated
1415
from datumaro.util.multi_procs_util import consumer_generator
1516

1617

@@ -146,6 +147,7 @@ def _process_batch(
146147
return results
147148

148149

150+
@deprecated(deprecated_version="1.11", removed_version="1.12")
149151
class ModelTransform(Transform):
150152
"""A transformation class for applying a model's inference to dataset items.
151153

src/datumaro/plugins/ndr.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from datumaro.components.dataset_base import DEFAULT_SUBSET_NAME
1414
from datumaro.components.transformer import Transform
1515
from datumaro.util import parse_str_enum_value
16+
from datumaro.util.deprecation import deprecated
1617

1718

1819
class Algorithm(Enum):
@@ -30,6 +31,7 @@ class UnderSamplingMethod(Enum):
3031
inverse = auto()
3132

3233

34+
@deprecated(deprecated_version="1.11", removed_version="1.12")
3335
class NDR(Transform, CliPlugin):
3436
"""
3537
Removes near-duplicated images in subset|n

0 commit comments

Comments
 (0)