Skip to content

Commit

Permalink
Fix label comparison in voc format (#1382)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiltsov-max authored Apr 13, 2020
1 parent 13b8cfa commit 819b81d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- 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)
- VOC format exports Upper case labels correctly in lower case (https://github.com/opencv/cvat/pull/1379)
- Fixed polygon exporting bug in COCO dataset (https://github.com/opencv/cvat/issues/1387)
- Task creation from remote files (https://github.com/opencv/cvat/pull/1392)

Expand Down
10 changes: 5 additions & 5 deletions datumaro/datumaro/plugins/voc_format/converter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2019 Intel Corporation
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -426,7 +426,7 @@ 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]:
# generate colormap for union of VOC and input dataset labels
Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion datumaro/tests/test_voc_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 819b81d

Please sign in to comment.