diff --git a/CHANGELOG.md b/CHANGELOG.md index e297fc1feb3b..ffb4ca4928a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Auto annotation, TF annotation and Auto segmentation apps (https://github.com/opencv/cvat/pull/1409) - Import works with truncated images now: "OSError:broken data stream" on corrupt images (https://github.com/opencv/cvat/pull/1430) +- Duplicating keypoints in COCO export (https://github.com/opencv/cvat/pull/1435) ### Security - diff --git a/datumaro/datumaro/plugins/coco_format/converter.py b/datumaro/datumaro/plugins/coco_format/converter.py index 2fe0ee388466..1ba42e0e919c 100644 --- a/datumaro/datumaro/plugins/coco_format/converter.py +++ b/datumaro/datumaro/plugins/coco_format/converter.py @@ -352,8 +352,7 @@ def save_annotations(self, item): instance = [points, [], None, points.get_bbox()] elem = super().convert_instance(instance, item) elem.update(self.convert_points_object(points)) - if elem: - self.annotations.append(elem) + self.annotations.append(elem) # Create annotations for complete instance + keypoints annotations super().save_annotations(item) @@ -390,7 +389,8 @@ def convert_points_object(ann): def convert_instance(self, instance, item): points_ann = find(item.annotations, lambda x: \ - x.type == AnnotationType.points and x.group == instance[0].group) + x.type == AnnotationType.points and \ + instance[0].group and x.group == instance[0].group) if not points_ann: return None diff --git a/datumaro/tests/test_coco_format.py b/datumaro/tests/test_coco_format.py index a0339abc7389..d1727128d23a 100644 --- a/datumaro/tests/test_coco_format.py +++ b/datumaro/tests/test_coco_format.py @@ -556,7 +556,7 @@ def __iter__(self): Points([1, 2, 3, 4, 2, 3], group=2, id=2), Bbox(1, 2, 2, 2, group=2, id=2), ]), - DatasetItem(id=2, subset='train', + DatasetItem(id=2, subset='train', image=np.zeros((5, 4, 3)), annotations=[ # Solitary keypoints Points([1, 2, 0, 2, 4, 1], label=5, id=3),