diff --git a/packages/jabs-core/src/jabs/core/abstract/pose_est.py b/packages/jabs-core/src/jabs/core/abstract/pose_est.py index 10a8adb7..f918548c 100644 --- a/packages/jabs-core/src/jabs/core/abstract/pose_est.py +++ b/packages/jabs-core/src/jabs/core/abstract/pose_est.py @@ -54,7 +54,8 @@ class PoseEstimation(ABC): hash (str): Hash of the pose file. static_objects (dict): Static objects in the pose file. num_lixit_keypoints (int): Number of lixit keypoints (default 0). - external_identities (list[int] | None): Mapping to external identities. + external_identities (list[str] | None): External identity names, indexed by + JABS identity index. None when the pose file has no external identities. """ class KeypointIndex(enum.IntEnum): diff --git a/src/jabs/project/timeline_annotations.py b/src/jabs/project/timeline_annotations.py index dfab0e11..cf7b6eb4 100644 --- a/src/jabs/project/timeline_annotations.py +++ b/src/jabs/project/timeline_annotations.py @@ -128,6 +128,19 @@ def load( def serialize(self) -> list[dict]: """Convert the internal IntervalTree to a JSON-serializable list of dictionaries. + Each annotation is serialized with the following fields, which are also the + fields :meth:`load` reads back: + + - ``start``: first frame of the annotation (inclusive). + - ``end``: last frame of the annotation (inclusive). + - ``tag``: annotation tag. + - ``color``: color used to render the annotation. + - ``description``: optional description, omitted when unset. + - ``identity``: optional internal JABS identity index the annotation + applies to, omitted when the annotation is not tied to an identity. + The derived ``display_identity`` is not serialized: :meth:`load` + recomputes it from this index. + Returns: list[dict]: A list containing a dictionary representation for each timeline annotation, suitable for JSON serialization. diff --git a/src/jabs/project/video_labels.py b/src/jabs/project/video_labels.py index 14fea406..ee6c3b57 100644 --- a/src/jabs/project/video_labels.py +++ b/src/jabs/project/video_labels.py @@ -160,62 +160,75 @@ def as_dict( project_metadata: dict | None = None, video_metadata: dict | None = None, ) -> dict: - """return dict representation of video labels + """Return a dict representation of the video labels. - useful for JSON serialization and saving to disk + This is the on-disk format of a project's ``jabs/annotations/