From e1717927a21ca5f99469b128397bf72823ca2b54 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Thu, 9 Apr 2020 00:08:34 +0300 Subject: [PATCH 1/5] Fix label comparison in voc format --- datumaro/datumaro/plugins/voc_format/converter.py | 4 ++-- datumaro/tests/test_voc_format.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/datumaro/datumaro/plugins/voc_format/converter.py b/datumaro/datumaro/plugins/voc_format/converter.py index 729383d5d889..01aa1148fcb3 100644 --- a/datumaro/datumaro/plugins/voc_format/converter.py +++ b/datumaro/datumaro/plugins/voc_format/converter.py @@ -426,9 +426,9 @@ def _load_categories(self, label_map_source=None): label_map = OrderedDict() label_map['background'] = [None, [], []] for item in labels.items: - label_map[item.name] = [None, [], []] + label_map[self._strip_label(item.name)] = [None, [], []] - elif label_map_source in [LabelmapType.guess.name, None]: + elif label_map_source in {LabelmapType.guess.name, None}: # generate colormap for union of VOC and input dataset labels label_map = make_voc_label_map() diff --git a/datumaro/tests/test_voc_format.py b/datumaro/tests/test_voc_format.py index 7abff4cc8515..5d24dd90051c 100644 --- a/datumaro/tests/test_voc_format.py +++ b/datumaro/tests/test_voc_format.py @@ -649,7 +649,7 @@ def __iter__(self): def categories(self): label_cat = LabelCategories() - label_cat.add('label_1') + label_cat.add('Label_1') label_cat.add('label_2') return { AnnotationType.label: label_cat, From daecaad17d81b9d76f601d2bdf300ba85b1aec6e Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Thu, 9 Apr 2020 10:24:25 +0300 Subject: [PATCH 2/5] revert good changes --- datumaro/datumaro/plugins/voc_format/converter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datumaro/datumaro/plugins/voc_format/converter.py b/datumaro/datumaro/plugins/voc_format/converter.py index 01aa1148fcb3..2dc4292ae21a 100644 --- a/datumaro/datumaro/plugins/voc_format/converter.py +++ b/datumaro/datumaro/plugins/voc_format/converter.py @@ -428,7 +428,7 @@ def _load_categories(self, label_map_source=None): for item in labels.items: label_map[self._strip_label(item.name)] = [None, [], []] - elif label_map_source in {LabelmapType.guess.name, None}: + elif label_map_source in [LabelmapType.guess.name, None]: # generate colormap for union of VOC and input dataset labels label_map = make_voc_label_map() From 2703d62225e0f5720038e89851e2803cd33d8ec9 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Thu, 9 Apr 2020 10:36:29 +0300 Subject: [PATCH 3/5] fix --- datumaro/datumaro/plugins/voc_format/converter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/datumaro/datumaro/plugins/voc_format/converter.py b/datumaro/datumaro/plugins/voc_format/converter.py index 2dc4292ae21a..ab79836250a0 100644 --- a/datumaro/datumaro/plugins/voc_format/converter.py +++ b/datumaro/datumaro/plugins/voc_format/converter.py @@ -110,8 +110,8 @@ def init_dirs(self): self._images_dir = images_dir def get_label(self, label_id): - return self._extractor.categories()[AnnotationType.label] \ - .items[label_id].name + return self._strip_label(self._extractor. \ + categories()[AnnotationType.label].items[label_id].name) def save_subsets(self): subsets = self._extractor.subsets() @@ -489,7 +489,7 @@ def _get_actions(self, label): def _make_label_id_map(self): source_labels = { - id: label.name for id, label in + id: self._strip_label(label.name) for id, label in enumerate(self._extractor.categories().get( AnnotationType.label, LabelCategories()).items) } From b840abfd1e699a8b4cecc0f86f26cd80cb7f2a36 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Thu, 9 Apr 2020 10:50:47 +0300 Subject: [PATCH 4/5] important fixes --- CHANGELOG.md | 3 ++- datumaro/datumaro/plugins/voc_format/converter.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40b823f093db..6698e45c7634 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Hidden points (or outsided) are visible after changing a frame - Merge is allowed for points, but clicks on points conflict with frame dragging logic - Removed objects are visible for search -- Add missed task_id and job_id fields into exception logs for the new UI (https://github.com/opencv/cvat/pull/1372) +- Add missed task_id and job_id fields into exception logs for the new UI (https://github.com/opencv/cvat/pull/1372) +- VOC format exports Upper case labels correctly in lower case (https://github.com/opencv/cvat/pull/1379) ### Security - diff --git a/datumaro/datumaro/plugins/voc_format/converter.py b/datumaro/datumaro/plugins/voc_format/converter.py index ab79836250a0..01394a5d9f53 100644 --- a/datumaro/datumaro/plugins/voc_format/converter.py +++ b/datumaro/datumaro/plugins/voc_format/converter.py @@ -1,5 +1,5 @@ -# Copyright (C) 2019 Intel Corporation +# Copyright (C) 2020 Intel Corporation # # SPDX-License-Identifier: MIT From 3cce4418e9f0776a29b4e48a04367eb7998a4798 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Thu, 9 Apr 2020 10:52:51 +0300 Subject: [PATCH 5/5] add comment --- datumaro/tests/test_voc_format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datumaro/tests/test_voc_format.py b/datumaro/tests/test_voc_format.py index 5d24dd90051c..62f6b31410e5 100644 --- a/datumaro/tests/test_voc_format.py +++ b/datumaro/tests/test_voc_format.py @@ -649,7 +649,7 @@ def __iter__(self): def categories(self): label_cat = LabelCategories() - label_cat.add('Label_1') + label_cat.add('Label_1') # should become lowercase label_cat.add('label_2') return { AnnotationType.label: label_cat,