baseball-engine / docs /EXPERIMENTAL_VIDEO_SCORE.md
github-actions[bot]
Automated Deploy: 08c32afb2197fc9ad9b7c3451f02ed400d479a42
3249fe4
|
Raw History Blame Contribute Delete
6.61 kB

Experimental video score

Read product.visual_review.score from the existing /product endpoint. This is separate from product.coaching.score, the measurement-based Mechanics score. Its accuracy has not been validated.

Gemini rates visible movement against the fixed visual-swing-v1 rubric. It returns a grade and explanation, not a numeric score. The server calculates the points. No new model, SAM, second video or extra model call is required per review.

Fixed rubric

Feature Clear sequence: 2 points Mixed: 1 point Needs practice: 0 points
Preparation and forward movement Preparation precedes continuous forward hand movement Preparation precedes forward movement with a visible interruption A clear reversal/interruption prevents a continuous transition
Visible turning order Hip opening visibly begins before the chest/shoulders turn They visibly start together Chest/shoulders visibly turn before hip opening
Visible bat movement near the ball Continuous visible movement into the visible ball region A visible interruption before that region A clear reversal/stop interrupts that route

These are subjective POC pattern criteria, not universal ideals, normal ranges or proven faults. They do not establish whether a swing was early/late, a real hip/shoulder separation angle, contact quality or player ability.

Unclear movement gets no grade and no points, not zero. Bat/ball grading also requires directly visible interaction; seeing a ball somewhere in the picture is insufficient. Every rated feature must cite at least two retained frames from that same swing. Frame IDs must be chronological and valid.

Calculation and coverage

At least two distinct rateable features from the same swing are required. Do not combine one feature from Swing 1 and another from Swing 2 to produce a score. The formula for an eligible swing is:

swing score = round(100 × total rubric points / (2 × number of rated features))

Example: preparation is Clear (2), turning order is Mixed (1), and bat/ball is unclear. That swing gets 75 / 100, based on two of three features. The unclear feature is excluded. Two Needs practice grades give a legitimate 0 / 100; that is different from an unavailable null value.

The root score.value is the rounded mean of available rep_scores[].value. Unscored swings are excluded from that mean. The current review returns three feature observations for the session, each tied to a rep; it does not grade all three features for every swing. Consequently, many multi-swing recordings may have only one scorable swing, or none. reviewed_reps, scored_reps and rep_scores make that coverage explicit. Clips still cover all detected swings.

A score of 100 means all rated rubric criteria were Clear; it does not mean the player has a perfect swing. This is not a percentile, probability, accuracy confidence or a validated progress measure. Different camera views and sampled frames can change subjective grades; do not rank players or claim improvement from this number alone.

Response fields

Field Meaning
name Always "Experimental video score"; use this label in the app.
rubric_version "visual-swing-v1".
basis "visual_rubric".
scope "scorable_reviewed_swings_only".
status "available" or "unavailable".
value Integer from 0–100, or null if unavailable.
max_value 100. Show / 100, not % confidence.
accuracy_validated, judgment_eligible Both false. Measurement guardrails remain unchanged.
reviewed_reps Reps represented by the sampled images.
scored_reps Reps that met the same-swing minimum.
rep_scores Each reviewed rep's score/status, coverage and feature breakdown.
reason_code Null if available; otherwise a fixed reason such as insufficient_visible_features or review_unavailable.
explanation, notice Plain-language coverage and limitations.

Each rep_scores[] item contains rep, status, value, features_scored, features_total: 3, reason_code, explanation, and breakdown. Each breakdown item contains key, label, status (scored/unavailable), grade, grade_label, points, max_points: 2, reason_code, explanation and evidence_frame_ids. The public feature's optional rating also contains the model's grade and explanation; unsuitable/unclear ratings are cleared.

Mobile display

const score = product.visual_review.score;
if (score?.status === "available" && score.value !== null) {
  // Show "Experimental video score", `${score.value} / 100`,
  // score.explanation and the per-swing feature explanations.
} else {
  // Show the explanation or hide the numeric score. Never show null as zero.
}
const byRep = new Map((score?.rep_scores ?? []).map(r => [r.rep, r]));
// Match byRep.get(swing.rep) to the existing annotated swing clips.

Do not copy this number into coaching.score, call it Mechanics score, or use it to fill missing physical measurements. Keep the three video observations, drill, supported timing and annotated clips visible even if the score abstains.

Older reviews and failure behavior

New poc_video reviews include the score automatically, using the same Gemini request. For an older completed review with retained images, explicitly call POST /v1/analyses/{job_id}/video-review once to apply the rubric. This reruns only the image review and preserves measurements and clip URLs/hashes. It consumes Gemini quota. A completed current-rubric review is returned unchanged on subsequent retries, even if it has insufficient evidence for a score.

No model key, disabled review, quota/provider failure or invalid response gives an unavailable score with value: null. Legacy notes without rating fields remain readable but do not acquire invented grades. Original Mechanics scoring and measurement eligibility rules are unchanged.

If the model describes contact without confirming visible ball interaction, the server removes that statement and marks only bat/contact unclear. Valid body observations remain available, and any priority based on that contact claim is removed. visual_review.guardrail_warnings reports unverified_contact_statement for that feature. Invalid frame references or invented measurements still reject the review.

The authenticated /v1/video-score-schema endpoint and video-score.schema.json publish the full score schema.