Skip to content

kr1shnasomani/Sportiq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sportiq

Sportiq performs player and ball tracking for tennis. It detects court boundaries, tracks players, and maps ball trajectories using Computer Vision (OpenCV), MediaPipe, and a TrackNet-based model.

Execution Guide:

The project has a FastAPI backend and a Vite React frontend. Use the root runner to start both in dev mode.

  1. Clone the repository and navigate into it:
git clone https://github.com/kr1shnasomani/Sportiq.git
cd Sportiq
  1. Start both servers:
./run_all.sh

What this does:

  • Creates/uses a local Python virtual environment under backend/.venv and installs Python deps from backend/requirements.txt.
  • Starts the FastAPI backend (auto-picks a free port like 8000/8001 and prints it, health at /health).
  • Starts the Vite dev server for the frontend (auto-picks port like 8080/8081 and prints it, proxies /api to the backend).

Open the printed frontend URL in your browser, upload a tennis video, and download the processed result.

Note:

  • The TrackNet weight file lives at backend/model/TrackNet.pth (already included here).
  • Temporary files are handled automatically; you do not need to modify paths in code.

Run Services Individually (Optional):

Backend only:

cd backend
chmod +x run_backend.sh
PORT=8000 ./run_backend.sh

Frontend only:

cd frontend
chmod +x run_frontend.sh
VITE_BACKEND_URL="http://localhost:8000" VITE_DEV_PORT=8080 ./run_frontend.sh

API Usage (Direct):

The backend exposes a single main endpoint to process a video upload.

  • Health check: GET /health
  • Process video: POST /api/process (multipart/form-data, file field: video)

Example curl:

curl -X POST \
  -F "video=@/absolute/path/to/input.mp4" \
  http://localhost:8000/api/process \
  -o output.mp4

Output:

split.mp4

Workflow:

image