AI-powered basketball shooting form analyzer. Record your three-point shot via webcam or upload a video, and get instant feedback comparing your form to pro players like Steph Curry and Klay Thompson.
- Record your shot using a webcam (live analysis) or upload a video file
- Detect shots automatically using YOLOv8 ball tracking + MediaPipe pose estimation
- Compare your form against pro reference shots across 4 phases (gather, set point, release, follow-through)
- Score with Gemini AI vision analysis blended with pose metrics
- Coach with TTS voice feedback and personalized tips
Frontend
- Next.js 16 (React 19) with TypeScript
- Tailwind CSS 4, shadcn/ui components
- Three.js / React Three Fiber (3D basketball model)
- Framer Motion, GSAP, Anime.js (animations)
Computer Vision Pipeline
- MediaPipe (33-point pose landmark detection)
- YOLOv8 / Ultralytics (basketball detection with custom
basketball.ptmodel) - OpenCV (video capture and frame processing)
AI Coaching
- Gemini Pro (per-shot video analysis)
- Gemini Flash (structured scoring distillation)
- Gemini TTS (voice coaching audio)
- Node.js 18+
- Python 3.8+
- ngrok (tunnels the backend so your phone can connect)
brew install ngrok ngrok config add-authtoken YOUR_TOKEN
git clone https://github.com/nathsmith-cs/JNKS.git
cd JNKS
npm installpython3 -m venv venv
source venv/bin/activate
pip install -r pipeline/requirements.txtCreate a .env file in the project root:
GEMINI_API_KEY=your_gemini_api_key
./start.shThis will:
- Start an ngrok tunnel on port 8000
- Build the frontend with the ngrok URL baked in
- Start the FastAPI backend (serves both the API and the static frontend)
- Print the URL to open on your phone
Access:
- Phone/remote: the ngrok URL printed by the script
- Local:
http://localhost:8000
Press Ctrl+C to stop everything.
If you only need local access:
source venv/bin/activate
npm run build
python3 -m pipeline.serverThen open http://localhost:8000.
src/
app/ # Next.js pages (landing, analyze, results)
components/
3d/ # Three.js basketball scene
analyze/ # Webcam feed, video upload, analyze button
landing/ # Hero, features, how-it-works sections
results/ # Score display, breakdown, tips
layout/ # Navbar, theme, animated background
ui/ # Reusable UI (buttons, cards, progress, etc.)
lib/ # Utilities, API helpers, workout storage
types/ # TypeScript interfaces
pipeline/ # Python CV + AI pipeline
server.py # FastAPI server (REST + WebSocket)
detector.py # YOLOv8 ball detection
tracker.py # MediaPipe pose estimation (real-time)
pose_extract.py # MediaPipe pose extraction (batch/video mode)
phases.py # Shot phase detection (gather, set point, release, follow-through)
compare.py # Shot comparison against pro references
angles.py # Joint angle computation
scoring.py # Hybrid scoring (MediaPipe metrics + Gemini vision)
gemini_vision.py # Gemini video analysis per clip
llm.py # Gemini text generation, TTS
voice.py # Gemini Live voice coaching session
video.py # Video conversion and splitting (ffmpeg)
models/ # Pre-trained weights (basketball.pt, pose_landmarker_lite.task)
reference/ # Pro player reference shots (JSON pose data)
start.sh # One-command startup (ngrok + build + backend)
| Category | Description |
|---|---|
| Elbow Angle | Shooting arm alignment at the set point |
| Follow-Through | Wrist extension and snap after release |
| Release Point | Height and timing of the ball release |
| Stance | Foot positioning, knee bend, and balance |
Each category is scored 0-100. The overall score is a weighted average with Gemini AI coaching tailored to your weakest area.
The webcam streams 1.5-second video chunks over WebSocket. The server processes each chunk with OpenCV, detects shots via ball tracking + pose estimation, and after every 5 shots:
- Sends per-shot video to Gemini Pro for visual coaching
- Distills all observations into structured scores via Gemini Flash
- Generates TTS audio of the coaching advice
- Sends results back to the client