Skip to content

Commit 3e74b6b

Browse files
Fix keypoint label extraction to check for attribute presence (#1904)
<!-- Contributing guide: https://github.com/open-edge-platform/datumaro/blob/develop/CONTRIBUTING.md --> <!-- Please add a summary of changes. You may use Copilot to auto-generate the PR description but please consider including any other relevant facts which Copilot may be unaware of (such as design choices and testing procedure). Add references to the relevant issues and pull requests if any like so: Resolves #111 and #222. Depends on #1000 (for series of dependent commits). --> ### Checklist <!-- Put an 'x' in all the boxes that apply --> - [ ] I have added tests to cover my changes or documented any manual tests. - [ ] I have updated the [documentation](https://github.com/open-edge-platform/datumaro/tree/develop/docs) accordingly Signed-off-by: Albert van Houten <[email protected]>
1 parent d6e9b9b commit 3e74b6b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/datumaro/experimental/legacy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,10 @@ def convert_annotations(
619619
result = {}
620620
if len(keypoints) > 0:
621621
result["keypoints"] = keypoints[0] # Pass the Points object directly
622-
if self.keypoints_labels_attribute is not None:
622+
if (
623+
self.keypoints_labels_attribute is not None
624+
and "keypoint_label_ids" in keypoints[0].attributes
625+
):
623626
result["labels"] = keypoints[0].attributes["keypoint_label_ids"]
624627
else:
625628
result["labels"] = None

0 commit comments

Comments
 (0)