From 08688b0c3e3e280a0f9a4973aab48a36589de399 Mon Sep 17 00:00:00 2001 From: zhiltsov-max Date: Wed, 18 Mar 2020 14:57:51 +0300 Subject: [PATCH] [Datumaro] Fix occluded and z_order attributes export (#1271) * Fix occluded and z_order attributes export * Add line to changelog Co-authored-by: Nikita Manovich <40690625+nmanovic@users.noreply.github.com> --- CHANGELOG.md | 1 + cvat/apps/dataset_manager/bindings.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03542b302605..0da60518f6b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - ### Fixed +- `occluded` and `z_order` annotation attributes are now correctly passed to Datumaro ([#1271](https://github.com/opencv/cvat/pull/1271)) - Annotation-less tasks now can be exported as empty datasets in COCO ([#1277](https://github.com/opencv/cvat/issues/1277)) - Frame name matching for video annotations import - allowed `frame_XXXXXX[.ext]` format ([#1274](https://github.com/opencv/cvat/pull/1274)) diff --git a/cvat/apps/dataset_manager/bindings.py b/cvat/apps/dataset_manager/bindings.py index 6b531545c384..d1d98af279aa 100644 --- a/cvat/apps/dataset_manager/bindings.py +++ b/cvat/apps/dataset_manager/bindings.py @@ -91,7 +91,9 @@ def categories(self): @staticmethod def _load_categories(cvat_anno): categories = {} - label_categories = datumaro.LabelCategories() + + label_categories = datumaro.LabelCategories( + attributes=['occluded', 'z_order']) for _, label in cvat_anno.meta['task']['labels']: label_categories.add(label['name']) @@ -144,6 +146,8 @@ def convert_attrs(label, cvat_attrs): anno_group = shape_obj.group anno_label = map_label(shape_obj.label) anno_attr = convert_attrs(shape_obj.label, shape_obj.attributes) + anno_attr['occluded'] = shape_obj.occluded + anno_attr['z_order'] = shape_obj.z_order anno_points = shape_obj.points if shape_obj.type == ShapeType.POINTS: @@ -238,7 +242,7 @@ def import_dm_annotations(dm_dataset, cvat_task_anno): frame=frame_number, label=label_cat.items[ann.label].name, points=ann.points, - occluded=False, + occluded=ann.attributes.get('occluded') == True, group=group_map.get(ann.group, 0), attributes=[cvat_task_anno.Attribute(name=n, value=str(v)) for n, v in ann.attributes.items()],