import base64 import json from pathlib import Path import numpy as np from pose_tracking_exp.joints import BODY20_INDEX_BY_NAME from pose_tracking_exp.normalization import normalize_rtmpose_body20 from pose_tracking_exp.parajumping import PROTOCOL_HEADER, convert_payload_record, decode_pose_payload from pose_tracking_exp.replay import load_replay_file, load_scene_file from pose_tracking_exp.sync import synchronize_frames def _encode_payload( *, frame_index: int, reference_size: tuple[int, int], boxes: np.ndarray, box_scores: np.ndarray, keypoints_xy: np.ndarray, keypoint_scores: np.ndarray, timestamp_unix_ns: int, ) -> bytes: return ( PROTOCOL_HEADER + int(frame_index).to_bytes(4, "little") + np.asarray(reference_size, dtype="