HoopBuddy
Turning high school basketball game film into data: player positions mapped onto a 2D court, and made baskets detected.

- Role
- Solo: research, training and implementation
- Stack
- PythonJupyterYOLOv8YOLO11Pose estimationHomographyComputer vision
HoopBuddy annotates basketball game film to turn it into meaningful data. High school programmes rarely have the staff to chart their own games, so the statistics that drive decisions at higher levels simply don't exist for them. The goal was to produce those statistics quickly and accurately from footage teams already have.
It is a research prototype rather than a finished product, and this case study is scoped to what was actually built: the tracking layer underneath. The current version detects players and maps their positions onto a 2D court, tracks the basketball, and detects when a basket has been made.
Player location is the part I'm happiest with. Deriving a bird's-eye position from a side-on camera angle requires homography, which needs at least four reference points. I use eight, detected as the “pose” of the key. A player's coordinate comes from the average position of their two ankles on screen, then transforms onto the court plane. The image above is a validation frame from that model: the key detected and boxed, with the pose points marked along it. Those points are the reference the homography solves from.
It runs on twelve custom YOLO models across ball, hoop, rim, key, lane lines, players, pose and scoring. I trained them on hand-labelled YouTube footage of high school, college and NBA games, deliberately mixing court designs so the models would adapt to whatever gym they were pointed at. Each typically saw 20+ hand-labelled examples, augmented during training to stop small sets from overfitting.
- 01Player positions mapped onto a 2D court through homography from eight detected key points.
- 02Ball tracked through play, with made baskets detected.
- 03Twelve custom YOLO models across ball, hoop, rim, key, lane lines, players, pose and scoring.
- 04Footage hand-labelled across HS, college and NBA games so models generalise across court designs.
- 05Augmentation during training to stop small (20+ example) sets from overfitting.