Skip to main content

๐Ÿค– GPU Backend Overview

AI-Powered Video Analysis Engine

:::tip TL;DR

  • Python 3.11.x only (not 3.12+) โ€” CatBoost + MediaPipe wheels
  • Pipeline: Ball โ†’ Court โ†’ Players โ†’ Bounces โ†’ Shots โ†’ Analysis โ†’ Export
  • Runs on the Lambda pull-worker fleet in prod (RunPod removed 2026-08-16), local MPS/CUDA/CPU in dev
  • --dev flag enables a 96%-faster cache for iteration
  • v46 (April 2026): 5-phase accuracy overhaul โ€” real court coords in meters, parabolic trajectory interpolation, fixed shot classifier ONNX path
  • Phase 6: insight engine (src/insights/) emits ranked insights.json, also embedded in the analysis JSON :::

The GPU Backend is the core AI processing engine that transforms tennis videos into structured analysis data using computer vision and pose estimation.

:::info Tennis-only (multi-sport deferred) The shipped product is tennis-only. Both main.py entry points hardcode sport="tennis" and there is no --sport CLI flag. Multi-sport work is deferred; add a new games/<sport>/config.yaml only when real sport-specific models exist. :::


๐ŸŽฏ System Overviewโ€‹

:::info Tech Stack

RepositoryCommitDocker Image
acesense-gpu-backenddaaddb2akshaysarode/acesense:v46
  • Language: Python 3.11.x (required for catboost + mediapipe)
  • Object Detection: YOLO v8 / v11 (Ultralytics)
  • Pose Estimation: MediaPipe
  • Video Processing: OpenCV, FFmpeg
  • Bounce Detection: CatBoost
  • Hosting: Lambda Cloud, autoscaled by lambdaScalerTick (RunPod removed 2026-08-16)
  • GPU: NVIDIA RTX 4090 :::

๐Ÿ—๏ธ Processing Architectureโ€‹


๐ŸŽฏ AI Modelsโ€‹

YOLO v8 Object Detectionโ€‹

ClassPrecisionRecallmAP@0.5
Ball94.2%91.8%93.0%
Player98.5%97.2%97.8%
Court96.1%95.4%95.7%

MediaPipe Pose Estimationโ€‹


๐Ÿ“Š Shot Detection Algorithmโ€‹

Shot Classificationโ€‹

Shot TypeDetection MethodAccuracy
ForehandWrist position + swing direction96.3%
BackhandArm cross + shoulder rotation94.8%
ServeOverhead motion + ball toss98.2%
VolleyNet proximity + punch motion91.5%

๐Ÿ“‹ Output Schema (v1.5.0)โ€‹

The analysis export writes a canonical JSON file (*_analysis.json, schema 1.5.0) plus a standalone insights.json. Spatial coordinates are in meters (ITF court standard), and the analysis JSON embeds an "insights" object.

See the dedicated Output Schema reference for the full, authoritative field-by-field specification โ€” it is the single source of truth and replaces the abbreviated block that used to live here.


๐Ÿ–ฅ๏ธ RunPod Configuration (historical)โ€‹

:::warning Not in use RunPod was removed on 2026-08-16 โ€” it repeatedly sat at 402 Insufficient Balance, which turned a dead Lambda worker into a failed job rather than a slower one. The adapter and this section are kept for the day the account is funded and runpod is named in GPU_PROVIDER_POLICY.enabled. :::

Environment Variablesโ€‹

VariableDescription
FIREBASE_CREDENTIALSService account JSON
STORAGE_BUCKETGCS bucket name
MODEL_PATHYOLO weights path
LOG_LEVELLogging verbosity

โšก Performanceโ€‹

MetricValue
Processing Speed~2x real-time
Frames per Second60 FPS
Memory Usage~18 GB VRAM
Cold Start~15 seconds
Warm Inference~10ms/frame

Optimization Techniquesโ€‹

  • Batch Processing: Process 8 frames at once
  • TensorRT: Optimized YOLO inference
  • Half Precision: FP16 for pose estimation
  • Stream Processing: Decode while processing

๐Ÿ”„ Error Handlingโ€‹


๐ŸŽฏ Next Stepsโ€‹