feat: identify the court camera from the video instead of the filename - #91
Merged
Merged
Conversation
Courts 2, 4, and 6 are recognized by normalized correlation of a 96x54 grayscale thumbnail against each calibration frame (gates 0.75 absolute, 0.12 margin), with the court-line detector's own keypoints on those frames as a recorded cross-check. Fallback order: explicit config.camera_id, auto-identify, filename hint, detected homography. The decision is stored on matches.camera_id / camera_match (migration included; a missing column only logs) and returned by the recording API. Validated with the real model on CPU: the three calibration frames identify themselves at 1.00, the St Mary's court-2 clip scores 0.93 vs 0.65, test2.mov resolves to court 2 at 0.84, and off-court footage is rejected at 0.42.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the
Court2filename convention with automatic camera identification. Implemented by Codex (xhigh) fromdocs/superpowers/plans/2026-09-14-court-auto-detect.md, revised after real-model validation, reviewed by Claude.backend/calibration_frames/camera_fingerprints.json(courts 2, 4, 6). Gates: best ≥ 0.75 and margin over the runner-up ≥ 0.12, both inPipelineConfig.keypoint_agrees, never overrides the decision. (Hand-marked calibration keypoints turned out unusable as fingerprints: the detector sits ~110 px from them with the same ranking on every input.)config.camera_id→ auto-identify → filename hint → detected homography. Nothing is worse than today on unknown footage.matches.camera_id,matches.camera_match(migration20260914_add_camera_id.sql; a missing column only logs) and returned ascameraId/cameraMatchbyGET /api/recordings/[id].python3 -m backend.tools.identify_camera <video|image>...prints both signal tables.backend/README.mddocuments the gates and how to register a new court.Validation (real model, CPU)
Test plan
supabase/migrations/20260914_add_camera_id.sqlin the SQL editor (optional; code tolerates its absence)modal deploy backend/app.pyfrom a checkout that hasbackend/weights/, then reprocess one recording and check the[Camera] identified=log line