Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync with upstream #79

Merged
merged 25 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e4375af
sync components/annotation.py
Eldies Jan 15, 2025
7ae972d
sync components/shift_analyzer.py
Eldies Jan 15, 2025
3b2bd56
sync components/dataset_base.py
Eldies Jan 15, 2025
f0c3d7a
sync components/annotations (extracting from components/operations.py)
Eldies Jan 15, 2025
481767c
sync plugins/openvino_plugin
Eldies Jan 15, 2025
f5db58d
sync components/comparator.py (extracting from components/operations.py)
Eldies Jan 15, 2025
4e223a6
sync components/dataset_item_storage.py
Eldies Jan 15, 2025
7cb7a65
sync components/filter.py
Eldies Jan 15, 2025
67490bd
sync components/dataset_storage.py
Eldies Jan 15, 2025
ddb46b6
sync components/merge (extracting from components/operations.py)
Eldies Jan 15, 2025
68767ec
some typing fixes
Eldies Jan 16, 2025
2eb7b05
removing debug artifacts
Eldies Jan 16, 2025
08ba03f
fixing tests (partially syncing components/extractor_tfds.py)
Eldies Jan 16, 2025
c246d3c
linters fix
Eldies Jan 16, 2025
d16d8a3
correctly process missing openvino
Eldies Jan 17, 2025
53d8c2c
typing for some things
Eldies Jan 17, 2025
662be83
typing and import fixes
Eldies Jan 21, 2025
0edb281
Update src/datumaro/components/comparator.py
Eldies Jan 27, 2025
64d0020
handling of malformed transforms
Eldies Jan 27, 2025
dbe2918
Make transform policy kw-only
zhiltsov-max Jan 28, 2025
829245a
Update src/datumaro/components/dataset_storage.py
zhiltsov-max Jan 28, 2025
662345b
Fix formatting
zhiltsov-max Jan 28, 2025
d5e4e73
synced util/mask_tools.py::make_index_mask
Eldies Jan 28, 2025
4c7a12d
fixed some sonarcloud issues
Eldies Jan 28, 2025
d0cede5
linters fix
Eldies Jan 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 4 additions & 20 deletions src/datumaro/cli/commands/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import os.path as osp
from enum import Enum, auto

from datumaro.components.comparator import DistanceComparator, EqualityComparator
from datumaro.components.errors import ProjectNotFoundError
from datumaro.components.operations import DistanceComparator, ExactComparator
from datumaro.util import dump_json_file
from datumaro.util.os_util import rmtree
from datumaro.util.scope import on_error_do, scope_add, scoped
Expand Down Expand Up @@ -221,37 +221,21 @@ def diff_command(args):
if args.method is ComparisonMethod.equality:
if args.ignore_field:
args.ignore_field = eq_default_if
comparator = ExactComparator(
comparator = EqualityComparator(
match_images=args.match_images,
ignored_fields=args.ignore_field,
ignored_attrs=args.ignore_attr,
ignored_item_attrs=args.ignore_item_attr,
all=args.all,
)
matches, mismatches, a_extra, b_extra, errors = comparator.compare_datasets(
first_dataset, second_dataset
)

output = {
"mismatches": mismatches,
"a_extra_items": sorted(a_extra),
"b_extra_items": sorted(b_extra),
"errors": errors,
}
if args.all:
output["matches"] = matches
output = comparator.compare_datasets(first_dataset, second_dataset)

output_file = osp.join(
dst_dir, generate_next_file_name("diff", ext=".json", basedir=dst_dir)
)
log.info("Saving diff to '%s'" % output_file)
dump_json_file(output_file, output, indent=True)

print("Found:")
print("The first project has %s unmatched items" % len(a_extra))
print("The second project has %s unmatched items" % len(b_extra))
print("%s item conflicts" % len(errors))
print("%s matching annotations" % len(matches))
print("%s mismatching annotations" % len(mismatches))
elif args.method is ComparisonMethod.distance:
comparator = DistanceComparator(iou_threshold=args.iou_thresh)

Expand Down
6 changes: 3 additions & 3 deletions src/datumaro/cli/commands/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import os.path as osp
from collections import OrderedDict

from datumaro.components.dataset import DEFAULT_FORMAT
from datumaro.components.dataset import DEFAULT_FORMAT, Dataset
from datumaro.components.environment import Environment
from datumaro.components.errors import DatasetMergeError, DatasetQualityError, ProjectNotFoundError
from datumaro.components.operations import IntersectMerge
from datumaro.components.merge.intersect_merge import IntersectMerge
from datumaro.components.project import ProjectBuildTargets
from datumaro.util import dump_json_file
from datumaro.util.scope import scope_add, scoped
Expand Down Expand Up @@ -230,7 +230,7 @@ def merge_command(args):
quorum=args.quorum,
)
)
merged_dataset = merger(source_datasets)
merged_dataset = Dataset(source=merger(*source_datasets))

merged_dataset.export(save_dir=dst_dir, format=converter, **export_args)

Expand Down
8 changes: 5 additions & 3 deletions src/datumaro/components/abstracts/merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Dict, Optional, Sequence, Type

from datumaro.components.annotation import Annotation
from datumaro.components.dataset_base import IDataset
from datumaro.components.dataset_base import DatasetInfo, IDataset
from datumaro.components.dataset_item_storage import (
DatasetItemStorage,
DatasetItemStorageDatasetView,
Expand All @@ -23,16 +23,18 @@ def get_any_label_name(self, ann: Annotation, label_id: int) -> str:


class IMergerContext(IMatcherContext):
@staticmethod
@abstractmethod
def merge_infos(self, sources: Sequence[IDataset]) -> Dict:
def merge_infos(sources: Sequence[DatasetInfo]) -> Dict:
raise NotImplementedError

@abstractmethod
def merge_categories(self, sources: Sequence[IDataset]) -> Dict:
raise NotImplementedError

@staticmethod
@abstractmethod
def merge_media_types(self, sources: Sequence[IDataset]) -> Optional[Type[MediaElement]]:
def merge_media_types(sources: Sequence[IDataset]) -> Optional[Type[MediaElement]]:
raise NotImplementedError

@abstractmethod
Expand Down
Loading
Loading