Skip to content

Commit

Permalink
[Datumaro] Fix occluded and z_order attributes export (#1271)
Browse files Browse the repository at this point in the history
* Fix occluded and z_order attributes export

* Add line to changelog

Co-authored-by: Nikita Manovich <[email protected]>
  • Loading branch information
zhiltsov-max and nmanovic authored Mar 18, 2020
1 parent 9545132 commit 08688b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
8 changes: 6 additions & 2 deletions cvat/apps/dataset_manager/bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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()],
Expand Down

0 comments on commit 08688b0

Please sign in to comment.