Spaces:
Running on T4
Running on T4
|
Download AI-coach-agent/docs/POSE_DATA_SPEC.md from modventures/baseball-engine: direct link, hf CLI and curl.
- Browser
- Download file 25.5 kB
-
https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/AI-coach-agent/docs/POSE_DATA_SPEC.md
- Command line
-
hf download hf://spaces/modventures/baseball-engine/AI-coach-agent/docs/POSE_DATA_SPEC.md
-
curl -L -o POSE_DATA_SPEC.md https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/AI-coach-agent/docs/POSE_DATA_SPEC.md
25.5 kB
| # Pose data specification: what the pose pipeline must send | |
| **For:** the ML / pose-pipeline engineer. **From:** the downstream side (measurements and the AI coach). | |
| **Start with `ML_PIPELINE_RESPONSE.md` (the one-page response structure).** | |
| **Reminder:** your stage never decides what is wrong with the player or what to improve; that is the AI coach agent's job. You provide points, events and measurements. | |
| **Status:** a contract written from what the product needs, **independent of how your code is structured today**. Adapt your output to | |
| it, or tell us what you cannot provide (section 12). Nothing here depends on any current module names. | |
| How this fits with the other documents: | |
| ``` | |
| video --> [ this document: pose data ] --> events + reps --> measurements --> [AGENT_INPUT_SPEC.md] --> AI coach agent | |
| points, boxes, timestamps (section 7) (numbers only) (v2: numbers only) decides what is wrong / right / | |
| what to improve and which drill | |
| ``` | |
| Files that go with this document (all in `AI-coach-agent/`): | |
| `docs/pose_track.schema.json` (machine-readable schema), `docs/examples/pose_track_example.json` (a valid example file) and | |
| `tools/check_pose_json.py` (checker, section 11). | |
| --- | |
| ## 1. One-screen summary | |
| | Send | Details | | |
| |---|---| | |
| | **2D body keypoints, every frame** | 17 COCO points (section 3), pixel coordinates in the **upright** image, with a **confidence per point** | | |
| | **Real timestamps** | seconds of **real capture time** per frame, never playback time (section 6) | | |
| | **One athlete box + people count per frame** | to detect "two people in view" and track identity | | |
| | **Quality per frame** | blur (0 sharp to 1 blurry) and brightness (0 to 255) | | |
| | **Video facts** | width/height after rotation, capture fps, playback fps, rotation applied, how time was obtained | | |
| | **Events per rep** (if you own that stage) | frame indices with confidence, only the events you actually found (section 7) | | |
| | Recommended | Details | | |
| |---|---| | |
| | 6 foot points | heel, big toe and small toe of each foot: makes foot plant and stride more accurate | | |
| | `track_id` per frame | makes athlete identity switches visible | | |
| | Optional (accepted, **not used in v1**) | Details | | |
| |---|---| | |
| | 3D points | `kp3d` in meters. We do not need it for v1 (section 2) | | |
| | Bat and ball | per-frame bat knob/barrel and ball centre (section 4) | | |
| | Do NOT send | Why | | |
| |---|---| | |
| | video, frames, thumbnails | privacy and size; we never need pixels | | |
| | names, ids, faces | the athlete is anonymous to this stage | | |
| | the 133-point whole-body set, face and finger points, heatmaps | not used; just bigger files | | |
| | smoothed, interpolated or guessed points | we smooth and fill short gaps ourselves; send what the model saw (section 9) | | |
| | `(0, 0)` or "last known" positions for missing joints | send `null` with confidence `0` | | |
| ## 2. 2D or 3D? | |
| **Send 2D. It is required.** **3D is recommended only if you have validated it** (updated after we checked our metrics on real lab data; | |
| this replaces the earlier "3D is ignored" answer). Full explanation, with the evidence, is in `ML_PIPELINE_RESPONSE.md` section 2. In short: | |
| * Every metric the agent judges today works from 2D geometry (checked on 100 pitchers and 98 hitters of public lab data, projected to an ideal side-view or | |
| face-on camera). | |
| * Four coaching-relevant quantities do **not** survive in 2D: hip-shoulder separation (r = 0.38 hitting, -0.08 pitching with the true value), the face-on | |
| hitting front-knee angle (reads about 28 degrees too straight, r = 0.01), face-on hitting trunk tilt, and side-view arm slot / trunk side lean (move 8 to 20 degrees | |
| with a 10 to 20 degree camera error). A **validated** monocular 3D estimate would let the agent judge them. | |
| * If you send 3D, use the optional `kp3d` block: the same 17 joints, in meters, with the frame of reference declared and a confidence per joint, plus the model name | |
| and how you validated it (`ML_PIPELINE_RESPONSE.md` section 8 gives a ready-made lab-truth test). Until validated, it is experimental: shown to the coach, | |
| never the player's priority fix. | |
| ## 3. Which points | |
| ### 3.1 Required: COCO-17, in this exact order | |
| "left" and "right" are the **athlete's own** left and right, not the image side (a face-on hitter's left side appears on the image's right). | |
| | # | Name | Needed for | Accuracy matters | | |
| |---|---|---|---| | |
| | 0 | `nose` | head movement / head stability, body-height normalisation, which way the athlete faces | high | | |
| | 1 | `left_eye` | facing direction (face-on vs side check) | medium | | |
| | 2 | `right_eye` | facing direction | medium | | |
| | 3 | `left_ear` | head orientation (optional use) | low | | |
| | 4 | `right_ear` | head orientation (optional use) | low | | |
| | 5 | `left_shoulder` | shoulder line (trunk tilt, hip-shoulder separation), arm slot origin, body height | high | | |
| | 6 | `right_shoulder` | same | high | | |
| | 7 | `left_elbow` | arm extension at contact (hitting contact estimate), arm slot refinement | medium | | |
| | 8 | `right_elbow` | same | medium | | |
| | 9 | `left_wrist` | hand path (load, swing start), pitching release (peak wrist speed), arm slot | high, but motion blur is expected | | |
| | 10 | `right_wrist` | same | high, blur expected | | |
| | 11 | `left_hip` | pelvis line, centre-of-mass drift, trunk tilt, knee angle, body height | high | | |
| | 12 | `right_hip` | same | high | | |
| | 13 | `left_knee` | knee angle / flexion (lead leg), leg lift (pitching) | high | | |
| | 14 | `right_knee` | same | high | | |
| | 15 | `left_ankle` | **stride length, foot lift, foot plant, stance** | **highest** | | |
| | 16 | `right_ankle` | same | **highest** | | |
| Required for the metrics to exist at all: nose, shoulders, hips, knees, ankles, wrists. Eyes and elbows are strongly wanted; ears are optional. | |
| ### 3.2 Recommended: 6 foot points (optional block `kp_extra`, order below) | |
| `left_big_toe, left_small_toe, left_heel, right_big_toe, right_small_toe, right_heel`. They are not needed for any v1 metric, but heel and toe | |
| make "foot has landed" much more reliable than an ankle point alone. Send them as `frames.kp_extra` / `frames.conf_extra` together with | |
| `extra_keypoint_order`. | |
| ### 3.3 Not needed | |
| Hands and fingers, face landmarks, hair, torso surface points, a pelvis or neck point (we derive mid-hip and mid-shoulder ourselves). | |
| ### 3.4 Conventions (please follow exactly) | |
| * **Coordinates:** pixels in the **upright** image (rotation already applied), origin top-left, x to the right, y downward, at the video's full | |
| resolution. One decimal is enough. Declare `video.width/height` (after rotation) and `rotation_degrees_applied`. | |
| * **Missing point:** `null` in `kp` **and** `0` in `conf`. Never `(0,0)`, never NaN (invalid JSON), never the previous position. | |
| * **Confidence:** 0 to 1, comparable across joints, and it must reflect real uncertainty (section 9). A constant confidence is a defect. | |
| * **Every frame:** do not skip or down-sample frames; the array length must equal `video.frame_count`. | |
| ### 3.5 Mapping from common models (if you change models) | |
| | Ours (COCO-17) | Apple Vision (19) | MediaPipe Pose (33) | RTMW / COCO-WholeBody (133) | | |
| |---|---|---|---| | |
| | nose, left/right eye, left/right ear | `nose`, `leftEye`, `rightEye`, `leftEar`, `rightEar` | 0, 2, 5, 7, 8 | 0 to 4 | | |
| | shoulders, elbows, wrists | `leftShoulder`... `rightWrist` | 11/12, 13/14, 15/16 | 5 to 10 | | |
| | hips, knees, ankles | `leftHip`... `rightAnkle` | 23/24, 25/26, 27/28 | 11 to 16 | | |
| | foot points | not provided | heel 29/30, foot index 31/32 (no small toe: send the 4 you have as `null` for the missing ones) | 17 to 22 | | |
| | (dropped) | `neck`, `root` | all others | 23 to 132 | | |
| Apple Vision returns **normalised** coordinates with the origin at the **bottom-left**: convert with `x_px = x * width`, `y_px = (1 - y) * height`. | |
| Check MediaPipe's visibility score is turned into `conf`, and that its coordinates are scaled to pixels (they are 0 to 1 by default). | |
| ## 4. Which objects | |
| | Object | Required? | What to send | | |
| |---|---|---| | |
| | **The athlete (person)** | **Yes** | per frame: box `[x1, y1, x2, y2]` in pixels (or `null`), `people_count`, and ideally `track_id` | | |
| | Other people | counted only | `people_count` = persons with detection score >= 0.5 and box height >= 15% of the frame height (state your rule in `model.people_rule`); used to block a recording with 2+ people | | |
| | **Bat** | no (v1) | optional `objects.bat[i] = {knob:[x,y]|null, barrel:[x,y]|null, conf}` | | |
| | **Ball** | no (v1) | optional `objects.ball[i] = {center:[x,y], radius_px, conf}` or `null` | | |
| | Ground line, plate, rubber | no | comes from the app (a one-time tap), not from you | | |
| Why bat and ball are not required: the v1 product is pose-only. Bat speed, exit velocity, pitch velocity and ball flight are explicit non-goals, | |
| because a single phone cannot measure them credibly. Contact is therefore an **estimate** from lead-arm extension and hand position. If you | |
| already detect the ball, say so: it could make the contact estimate better later. | |
| One athlete only: if more than one person is detected, choose one athlete, keep the same `track_id` for them, and let `people_count` show the rest. | |
| ## 5. The file: full structure | |
| One JSON file per clip (the schema also describes the same arrays if you prefer binary; keep the same names). Arrays under `frames` are | |
| **columnar** (one array per field, one entry per frame, all the same length). | |
| ```json | |
| { | |
| "schema_version": "1.0", | |
| "discipline": "hitting", | |
| "view": "face_on", | |
| "video": { | |
| "width": 1080, | |
| "height": 1920, | |
| "frame_count": 120, | |
| "capture_fps": 120.0, | |
| "playback_fps": 30.0, | |
| "rotation_degrees_applied": 90, | |
| "time_source": "slowmo_rescaled" | |
| }, | |
| "model": { | |
| "name": "illustrative-example", | |
| "version": "0", | |
| "processing": [], | |
| "people_rule": "score>=0.5 and box height>=15% of frame height", | |
| "blur_definition": "1 - clip(log10(laplacian_var(person_crop_256px)/20)/log10(500/20), 0, 1)" | |
| }, | |
| "keypoint_order": ["nose", "left_eye", "right_eye", "left_ear", "right_ear", "left_shoulder", "right_shoulder", "left_elbow", "right_elbow", "left_wrist", "right_wrist", "left_hip", "right_hip", "left_knee", "right_knee", "left_ankle", "right_ankle"], | |
| "frames": { | |
| "t_s": [0.0, 0.00833, 0.01667, "... one entry per frame ..."], | |
| "kp": [ | |
| [[540, 760], [555, 745], [525, 745], [575, 755], [505, 755], [610, 880], [470, 880], [640, 1010], [440, 1010], [610, 1130], [470, 1130], [590, 1140], [490, 1140], [600, 1380], [480, 1380], [605, 1620], [475, 1620]], | |
| [[545, 760], [560, 745], [530, 745], [580, 755], [510, 755], [615, 880], [475, 880], [645, 1010], [445, 1010], null, [475, 1130], [595, 1140], [495, 1140], [605, 1380], [485, 1380], [626, 1620], [480, 1620]], | |
| "... one row of 17 points per frame ..." | |
| ], | |
| "conf": [ | |
| [0.93, 0.93, 0.93, 0.93, 0.93, 0.93, 0.93, 0.93, 0.93, 0.86, 0.93, 0.93, 0.93, 0.93, 0.93, 0.9, 0.9], | |
| [0.93, 0.93, 0.93, 0.93, 0.93, 0.93, 0.93, 0.93, 0.93, 0.0, 0.93, 0.93, 0.93, 0.93, 0.93, 0.9, 0.9], | |
| "..." | |
| ], | |
| "box": [[380.0, 700.0, 740.0, 1700.0], "..."], | |
| "track_id": [1, 1, 1, "..."], | |
| "people_count": [1, 1, 1, "..."], | |
| "blur": [0.05, 0.05, 0.05, "..."], | |
| "brightness": [128.0, 128.0, 128.0, "..."] | |
| }, | |
| "reps": [ | |
| { | |
| "rep": 1, | |
| "start_frame": 0, | |
| "end_frame": 119, | |
| "events": { | |
| "stance_set": { | |
| "frame": 6, | |
| "t_s": 0.05, | |
| "confidence": 0.8, | |
| "estimated": false, | |
| "method": "body speed below threshold for 100 ms" | |
| }, | |
| "load_start": { | |
| "frame": 26, | |
| "t_s": 0.21667, | |
| "confidence": 0.6, | |
| "estimated": false, | |
| "method": "hands move backward after stance" | |
| }, | |
| "stride": { | |
| "frame": 36, | |
| "t_s": 0.3, | |
| "confidence": 0.7, | |
| "estimated": false, | |
| "method": "lead ankle starts moving toward the pitcher" | |
| }, | |
| "foot_plant": { | |
| "frame": 66, | |
| "t_s": 0.55, | |
| "confidence": 0.75, | |
| "estimated": false, | |
| "method": "lead ankle velocity returns to ~0 after the stride" | |
| }, | |
| "swing_start": { | |
| "frame": 78, | |
| "t_s": 0.65, | |
| "confidence": 0.6, | |
| "estimated": false, | |
| "method": "sustained forward hand acceleration" | |
| }, | |
| "contact": { | |
| "frame": 90, | |
| "t_s": 0.75, | |
| "confidence": 0.5, | |
| "estimated": true, | |
| "method": "max lead-arm extension, hands in front" | |
| }, | |
| "finish": { | |
| "frame": 112, | |
| "t_s": 0.93333, | |
| "confidence": 0.6, | |
| "estimated": false, | |
| "method": "hands settled after follow-through" | |
| } | |
| }, | |
| "missing_events": {} | |
| } | |
| ] | |
| } | |
| ``` | |
| In the excerpt the two `kp`/`conf` rows shown are frame 0 and frame 41. In frame 41 the left wrist is briefly occluded, so it is `null` with | |
| confidence `0`: this is how every unknown point must look. | |
| Optional blocks (`extra_keypoint_order` + `frames.kp_extra/conf_extra`, `kp3d`, `objects`) are in `docs/pose_track.schema.json`. | |
| ### 5.1 Top level | |
| | Field | Type | Meaning | | |
| |---|---|---| | |
| | `schema_version` | `"1.0"` | contract version | | |
| | `discipline` | `hitting` or `pitching` | | | |
| | `view` | `face_on` or `open_side` | the camera setup the user was asked for; hitting is face-on, pitching is open-side | | |
| | `video` | object | section 5.2 | | |
| | `model` | object | `name`, `version`, `processing` (list, empty when raw), `people_rule`, `blur_definition` | | |
| | `keypoint_order` | list of 17 names | must equal the table in 3.1 | | |
| | `frames` | object | section 5.3 | | |
| | `reps` | list, optional | section 7 | | |
| | `kp3d`, `objects` | optional | not used in v1 | | |
| ### 5.2 `video` | |
| | Field | Meaning | | |
| |---|---| | |
| | `width`, `height` | upright image size in pixels (after rotation) | | |
| | `frame_count` | number of frames; every per-frame array has exactly this length | | |
| | `capture_fps` | **real** frames per second at capture (240 for iPhone slow motion) | | |
| | `playback_fps` | frames per second in the file's own timeline (often 30 for a slow-motion export) | | |
| | `rotation_degrees_applied` | 0, 90, 180 or 270 clockwise that you applied so the athlete is upright | | |
| | `time_source` | `pts` (read from the file), `slowmo_rescaled` (file timeline converted to real time) or `assumed_constant` (avoid) | | |
| | `sha256` | optional hash of the source video, to tie results to a file | | |
| ### 5.3 `frames` (one entry per frame) | |
| | Array | Item | Notes | | |
| |---|---|---| | |
| | `t_s` | number | real capture time in seconds from the first frame, strictly increasing | | |
| | `kp` | 17 x `[x, y]` or `null` | section 3 | | |
| | `conf` | 17 x number 0..1 | `0` exactly when the point is `null` | | |
| | `box` | `[x1,y1,x2,y2]` or `null` | the athlete's box | | |
| | `track_id` | integer or `null` | stable id of the athlete; changes only on a real identity switch | | |
| | `people_count` | integer | people in view (rule in `model.people_rule`) | | |
| | `blur` | 0..1 | 0 sharp, 1 very blurry; define it in `model.blur_definition` and keep the direction | | |
| | `brightness` | 0..255 | mean luma of the frame | | |
| | `kp_extra`, `conf_extra` | 6 x ... | optional foot points | | |
| ## 6. Time: send real capture time (the slow-motion trap) | |
| All timing metrics (foot plant to contact, load tempo, leg lift to foot plant, foot plant to release) are computed from `t_s`. | |
| * An iPhone 240 fps slow-motion clip is often exported with a **30 fps playback timeline**. Reading presentation timestamps then gives | |
| frames 33 ms apart, but the real gap was 4.2 ms: **every timing would be 8x too long**. Send `t_s` in real capture time (here 1/240 s steps) | |
| and set `time_source: "slowmo_rescaled"`, `capture_fps: 240`, `playback_fps: 30`. | |
| * If a file has variable frame timing, send the actual time of each frame; do not assume constant fps. | |
| * The checker flags the common mistake (step matches playback fps but capture fps is much higher) as an error. | |
| * Timing needs frame rate: **120 fps or more** for timing metrics, 60 to 119 downgraded, under 60 not shown. Your `capture_fps` decides this, so it must be true. | |
| ## 7. Events and reps (needed if you own that stage; see section 8) | |
| A **rep** is one swing or one pitch. Send `start_frame` and `end_frame` (inclusive) for each, with a little padding before the first event and | |
| after the finish. Reps are separated by at least 1.5 s; up to 25 per clip. Non-swing frames (walking, talking) are not reps. | |
| Each event: `frame` (integer index into `frames`), optional `t_s` (sub-frame time), `confidence` (0..1), `estimated` (true when it is an estimate), | |
| and `method` (one line). **Send only events you actually found.** Do not invent a missing one; list it in `missing_events` with a reason instead. | |
| Events must be in the order below and lie inside the rep. | |
| ### Hitting (face-on): 8 events (`foot_contact` is optional) | |
| | Event | Definition (what we need it to mean) | | |
| |---|---| | |
| | `stance_set` | first frame the athlete is set in the stance: body speed stays below a small threshold for about 100 ms before the load | | |
| | `load_start` | first frame of the load: hands (or weight) start moving back before the stride | | |
| | `stride` | first frame the lead foot leaves the ground or starts moving toward the pitcher | | |
| | `foot_contact` | **first** frame the lead foot touches the ground after the stride (optional but strongly wanted) | | |
| | `foot_plant` | first frame the lead foot is **fully planted** after the stride: its weight is on the ground and the ankle has stopped moving (the lab's "100% of body weight", typically about 50 ms after `foot_contact` when hitting) | | |
| | `swing_start` | first frame of sustained forward hand acceleration toward the pitcher | | |
| | `contact` | **estimated**: frame of maximum lead-arm extension with the hands in front of the body. Always `estimated: true` unless a ball or sensor really supports it | | |
| | `finish` | first frame after contact where the hands have decelerated and the athlete has settled (follow-through) | | |
| The lead side comes from the player profile (a right-handed hitter's lead leg is the left leg). | |
| ### Pitching (open side): 7 events (`foot_contact` is optional) | |
| | Event | Definition | | |
| |---|---| | |
| | `first_move` | first frame of movement from the set position or windup start | | |
| | `leg_lift` | frame of peak lead-knee height | | |
| | `hand_break` | frame the hands separate | | |
| | `foot_contact` | **first** frame the lead foot touches the ground (optional but strongly wanted) | | |
| | `foot_plant` | first frame the lead foot is **fully planted**: its weight is on the ground and the ankle has stopped moving (the lab's "100% of body weight", typically about 19 ms after `foot_contact` when pitching) | | |
| | `release` | frame of the throwing wrist's peak forward speed (ball release proxy) | | |
| | `finish` | follow-through settled | | |
| The throwing arm comes from the player profile. At release the arm moves so fast (about 7,500 degrees per second, around 31 degrees per frame | |
| even at 240 fps) that the wrist and elbow are blurred: lower their confidence there instead of reporting a confident position. | |
| ## 8. Who computes what (please confirm which level you deliver) | |
| | Level | Content | Needed from you | | |
| |---|---|---| | |
| | **1. Pose** | sections 3 to 6 | **always** | | |
| | **2. Events and reps** | section 7 | if you already detect them, send them; otherwise we compute them from level 1 using our own definitions | | |
| | **3. Measurements** | numbers only, as in `AGENT_INPUT_SPEC.md` (stride, angles, timings, each with a confidence) | only if your stage computes them; otherwise we do. **Never** faults, a priority fix or a drill: the AI coach agent decides those | | |
| If you change definitions (an event, a metric formula, a joint convention), tell us in writing so every consumer changes together. We would | |
| rather have a documented difference than a silent one. | |
| ## 9. Accuracy and quality requirements | |
| These are **our proposed targets for discussion**. We have no validated real data yet, so none of them has been measured. They are set from | |
| geometry: an error of `e` (as a percentage of the athlete's body height) in a point moves each metric by roughly this much. | |
| | Metric (what it uses) | Rule of thumb | Proposed target | | |
| |---|---|---| | |
| | Stride length, % of height (ankles) | ankle error of 1% of height changes the stride by about 1 percentage point; the typical band is about 8 points wide | ankle error <= 1% of height | | |
| | Head movement, % of height (nose path) | the path length **adds up jitter**: noisy points inflate head movement; band is 0 to about 5% | nose jitter <= 0.7% of height | | |
| | Knee angle (hip, knee, ankle) | angle error is about error / segment length; a thigh or shin is about 0.25 of height, so 1% of height is about 2.3 degrees | each joint <= 1.5% of height (about +-5 degrees) | | |
| | Trunk tilt, separation (shoulders, hips) | shoulder line is about 0.2 of height, so 1% of height is about 3 degrees | shoulders and hips <= 1% of height | | |
| | Timing (events) | one frame is 4.2 ms at 240 fps, 8.3 ms at 120, 33 ms at 30; the typical timing band is about +-25 ms | foot plant and release within +-2 frames of a hand label for >= 90% of events; `contact` is estimated, report its error | | |
| Quality rules: | |
| 1. **Raw points.** Send what the model produced. We apply a One-Euro smoother and fill gaps of up to 3 frames. If you already smooth or | |
| interpolate, list it in `model.processing` so we do not do it twice (the checker warns). | |
| 2. **Honest confidence.** Of points with `conf >= 0.5`, at least 90% should be within about 3% of body height of a hand label. Confidence must drop | |
| under motion blur and occlusion. A confidence that is always 0.9 tells us nothing, and the checker flags it. | |
| 3. **Missing means missing.** `null` and `0`. Never invent a position for an occluded joint. Briefly occluded points are fine; the downstream | |
| code interpolates up to 3 frames and treats longer gaps as unknown. | |
| 4. **No frozen frames.** Repeated identical detections (for example a detector that only runs every few frames and copies the result) must be | |
| re-estimated, not copied. The checker warns when more than 20% of frames repeat exactly. | |
| 5. **Coverage.** Each required joint should be confident (`conf >= 0.3`) in at least 60% of frames of a clean clip. | |
| 6. **One consistent athlete.** The same person in every frame; report switches through `track_id`. | |
| 7. **Blur and brightness are measured on the real frame**, and keep their direction (blur 1 is worst). | |
| ## 10. Capture assumptions we make | |
| These come from the product spec (the client's document, which we treat as scope only, not technical truth). Tell us if your model cannot | |
| meet them. | |
| * **Hitting:** camera face-on to the hitter's chest, about 4 to 5 m away, lens at hip height, 1080p, **240 fps**, athlete at least one third of the frame height, whole body in view (feet included). | |
| * **Pitching:** camera on the open (chest) side, about 5 to 6 m away, hip height, 240 fps, rubber to landing foot and the full arm path in view. | |
| * One athlete in view. Good light. Phone on a stand. | |
| * A clip may contain several reps (up to 25). | |
| Known hard cases (from our own tests): clips at 30 fps, a low camera that cuts off the feet, long clothing, netting or fences in front of the athlete, | |
| and motion blur on the arm at release. | |
| ## 11. Check your file before sending it | |
| ```bash | |
| cd AI-coach-agent && source .venv/bin/activate | |
| python tools/check_pose_json.py path/to/pose_track.json # errors = unusable, warnings = weaker results | |
| python tools/check_pose_json.py path/to/pose_track.json --strict # warnings also fail | |
| ``` | |
| The checker validates `docs/pose_track.schema.json` and the rules a schema cannot express: equal array lengths, `t_s` strictly increasing and in | |
| **capture** time, `null` points with confidence 0, points inside the image, no `(0,0)` placeholders, no frozen frames, a non-constant confidence, | |
| per-joint coverage, athlete size, people count, track switches, and event order and range. `docs/examples/pose_track_example.json` is a valid | |
| (synthetic, illustrative) file to compare against. Your file should produce **0 errors**. | |
| ## 12. Questions we need answered | |
| 1. Which keypoint model(s) do you use now, and which of the 17 (plus foot points) does it really provide? | |
| 2. Do you produce 3D? If yes: which model, and has it been validated against anything (marker data, a second camera)? | |
| 3. Which level (section 8) will you deliver: 1 only, 1+2, or 1+2+3? For pitching too? | |
| 4. What frame rate and resolution do your test clips have, and how do you obtain **capture** time for slow-motion files? | |
| 5. Are the points raw, or smoothed or interpolated (and how)? | |
| 6. How do you pick the athlete and keep identity? Is `people_count` available? | |
| 7. How is confidence computed, and has it been checked against hand labels? | |
| 8. Where do your event definitions differ from section 7? | |
| 9. Do you detect the bat or ball? If yes, how reliable is it (even roughly)? | |
| ## 13. Changing this contract | |
| `schema_version` is `1.0`. Adding an optional field is safe. Renaming, removing or re-defining a field, or changing a unit or an event | |
| definition, needs a version bump and a note to everyone who consumes the file. `tests/test_pose_spec.py` fails if the schema or the example | |
| drift from `tools/build_pose_spec.py` (regenerate with `python tools/build_pose_spec.py`). | |