Skip to content

AndrewFesenko/ai-basketball-analytics

Repository files navigation

🏀 Analyzing UF's Championship Game with Computer Vision

After the University of Florida won the 2025 college basketball championship, Gainesville went wild. Students filled the streets, and my roommates and I couldn't stop rewatching the game. That energy led to this project — a computer vision system that analyzes basketball footage from real games.

This tool detects players and the ball, tracks possession, assigns teams based on jersey color, and even maps everything to a tactical top-down view of the court. It started as a way to study key plays from the UF win and turned into a full analysis pipeline.


🧠 What It Does

  • 🧍 Detects players and the ball using YOLOv5/YOLOv8
  • 🎯 Tracks movement to calculate distance and speed for each player
  • 🧢 Assigns teams using a zero-shot image classifier based on jersey color
  • 🏀 Logs passes and interceptions by detecting possession changes
  • 📍 Detects court keypoints to understand player positioning
  • 📐 Transforms perspective to generate a tactical top-down view
  • 🎥 Outputs an annotated game video showing all tracked events and stats

⚙️ Tech Stack

  • Python
  • YOLOv5 / YOLOv8 – player, ball, and keypoint detection
  • Roboflow – dataset hosting and augmentation
  • OpenCV + NumPy – video frame processing and geometry
  • Hugging Face Transformers – zero-shot team classification
  • Matplotlib – drawing overlays and visualizations
  • Docker (optional) – containerized execution

📁 Models and Datasets

This project uses several pretrained and custom-trained models:

Additional resources:

🎥 Demo Video

Here are a few clips showing the system in action:

output_video_3.mp4
output_video_1.mp4
output_video_2.mp4

About

Computer vision system that analyzes basketball footage with YOLO, tracking, and team classification, built using UF's 2025 championship clips

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages