[Datumaro] Fix duplicating keypoints in COCO export (#1435)

main
zhiltsov-max 6 years ago committed by GitHub
parent 9344b067b1
commit c78db45d9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
-

@ -352,8 +352,7 @@ class _KeypointsConverter(_InstancesConverter):
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 @@ class _KeypointsConverter(_InstancesConverter):
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

@ -556,7 +556,7 @@ class CocoConverterTest(TestCase):
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),

Loading…
Cancel
Save