Skip to content

KeypointDetectionAnnotation

Represents keypoint detection for a single instance: an annotation id, keypoint coordinates, optional per-keypoint scores, and optional feature descriptors. This datatype is used for pose and keypoint detection inputs and outputs within the Telekinesis ecosystem.

Field

Required

FieldTypeDescription
idintAnnotation identifier (int).

Optional

FieldTypeDescription
scoresArrayLikePer-keypoint response strengths; 1D array, dtype float32.
keypointsArrayLikeKeypoint coordinates; shape (N, 2) or flat length 2N, dtype float32.
num_keypointsintNumber of keypoints (int); inferred from keypoints if omitted.
descriptorsArrayLikeFlattened feature descriptors (array).

Methods

MethodDescription
to_dict()Returns a dictionary with keys: id (int), and optionally keypoints, scores, num_keypoints, descriptors (as stored).

Example

python
import numpy as np
from datatypes import datatypes

keypoints = np.array([[10.0, 20.0], [30.0, 40.0], [50.0, 60.0]], dtype=np.float32)
scores = np.array([0.9, 0.8, 0.7], dtype=np.float32)
ann = datatypes.KeypointDetectionAnnotation(
    id=1,
    keypoints=keypoints,
    scores=scores,
    num_keypoints=3,
)

# Accessing keypoint data for pose or visualization.
# to_dict() returns id and optionally keypoints, scores, num_keypoints, descriptors; or use attributes directly.
d = ann.to_dict()
print("KeypointDetectionAnnotation id:", d["id"])
print("KeypointDetectionAnnotation keypoints shape:", getattr(ann.keypoints, "shape", None), "(N, 2)")
print("KeypointDetectionAnnotation scores shape:", getattr(ann.scores, "shape", None))
print("KeypointDetectionAnnotation num_keypoints:", ann.num_keypoints)