Mitul Aggarwal
Completed AWS KIRO Hackathon Winner

AI Golf Launch Monitor

Low-cost ball flight analysis from video using YOLOv8

AI / Computer Vision / Sports Analytics

Python YOLOv8 OpenCV Custom labelled dataset Physics calculations
AI Golf Launch Monitor detection overlay
The launch monitor running on real swing footage, comparing its measured launch data with TrackMan-style reference values.

Project Story

I built this because I was frustrated by how little feedback I had after a shot. I could see the ball slice or hook, but I wanted to know what changed in the first few frames after impact. Since commercial launch monitors are expensive and not always available, I tried to see how far I could get with a normal video, computer vision, and a physics model.

Why I Built It

The hard part is that a golf ball is tiny, fast, and often blurred. Classical OpenCV could find it in some clips, but shadows, grass texture, and motion blur caused false detections. On top of that, a simple projectile model is only an approximation because real ball flight depends on drag, lift, spin, and wind.

What I Built

I built a software-only pipeline: load the swing video, detect the ball, calibrate pixels into metres, fit the first part of the trajectory, and turn that into launch speed, angle, and carry. When classical tracking became unreliable, I labelled my own golf-ball dataset and trained a YOLOv8 model to get cleaner detections.

What I Did

  • Created and labelled a custom golf-ball detection dataset
  • Trained and fine-tuned YOLOv8 for golf swing video
  • Wrote the calibration, trajectory fitting, and carry-estimation code
  • Compared the outputs with TrackMan-style reference data and kept refining the assumptions
  • Built the analysis pipeline and demo presentation for AWS KIRO Hackathon

How I Built It

Build Flow

Video input -> frame extraction -> YOLO detection (ball/club) -> impact frame identification -> trajectory tracking -> physics-based parameter estimation.

How It Works

The system finds the ball frame by frame, focuses on the first part of flight, and converts image movement into real-world speed using a scale factor from the scene. I use least-squares fitting over the early trajectory instead of trusting one noisy frame. From there, the physics model estimates carry, and I used TrackMan comparisons to see where simple projectile assumptions started to break down.

Software

  • Python
  • YOLOv8
  • OpenCV
  • Ultralytics

What Was Hard

  • The ball is only a few pixels wide in many frames and disappears quickly after impact
  • Pixel-to-metre calibration has to be right or every downstream number is wrong
  • Motion blur and shadows made early OpenCV tracking fragile
  • The physics model had to be honest about what it did not know, especially spin and drag
Detection pipeline diagram

Build Reference

Pipeline from video input to detection, tracking, launch-parameter estimation, projectile modelling, and output metrics.

Click to inspect

Demos and Build Notes

Product Demos

Final end-to-end launch monitor demo: video ingestion, slow-motion factor handling, AI ball detection, trajectory tracking, calibrated metres-per-pixel scaling, least-squares launch estimation, and projectile-flight output.
First successful stable ball tracking using a tuned OpenCV pipeline with contour filtering and a launch-zone region of interest.
Classical OpenCV tracking versus AI-assisted tracking. The trained YOLOv8-Nano detector reduced false positives and provided cleaner ball centroids for the physics model.
Code walkthrough of the video-processing, detection, calibration, regression, and projectile-motion pipeline.

Photos and Notes

Project photos

Initial engineering brief: commercial radar systems are expensive, so the project targets ordinary video, ball tracking, pixel-to-metre calibration, and physics-based launch estimates.

Golf launch monitor ideation notes

Golf launch monitor ideation notes
Initial engineering brief: commercial radar systems are expensive, so the project targets ordinary video, ball tracking, pixel-to-metre calibration, and physics-based launch estimates.
Software flow diagram from raw video input through OpenCV tracking, velocity and angle calculation, projectile physics, and final numerical output.

Golf launch monitor flow diagram

Golf launch monitor flow diagram
Software flow diagram from raw video input through OpenCV tracking, velocity and angle calculation, projectile physics, and final numerical output.
Tracking progression from setup localisation to noisy motion contours and then filtered trajectory attempts, motivating the final region-of-interest approach.

Golf ball tracking progression screenshots

Golf ball tracking progression screenshots
Tracking progression from setup localisation to noisy motion contours and then filtered trajectory attempts, motivating the final region-of-interest approach.
Calibration step deriving a pixel-to-metre scaling factor from known objects in the frame, allowing image-space motion to become real-world velocity.

Pixel to metre calibration calculation

Pixel to metre calibration calculation
Calibration step deriving a pixel-to-metre scaling factor from known objects in the frame, allowing image-space motion to become real-world velocity.
Projectile-motion derivation and code implementation for velocity components, flight time, apex height, and carry distance.

Projectile-motion equations and code

Projectile-motion equations and code
Projectile-motion derivation and code implementation for velocity components, flight time, apex height, and carry distance.
Custom dataset preparation in Roboflow, labelling golf-ball frames for YOLOv8-Nano training to replace the less reliable contour-based tracker.

Roboflow golf ball labelling dataset

Roboflow golf ball labelling dataset
Custom dataset preparation in Roboflow, labelling golf-ball frames for YOLOv8-Nano training to replace the less reliable contour-based tracker.
AWS Kiro Hackathon recognition for the launch monitor project and its software-only approach to accessible golf analytics.

AWS Kiro Hackathon win recognition

AWS Kiro Hackathon win recognition
AWS Kiro Hackathon recognition for the launch monitor project and its software-only approach to accessible golf analytics.

Technical Evidence

Screenshots

Velocity and launch-angle calculation using least-squares regression over early trajectory points, scaled by metres per pixel, to reduce frame-to-frame jitter.

Velocity and launch-angle calculation code

Velocity and launch-angle calculation code
Velocity and launch-angle calculation using least-squares regression over early trajectory points, scaled by metres per pixel, to reduce frame-to-frame jitter.
Performance validation against Trackman reference values for professional swings. Launch angle, initial velocity, and carry were typically within +-5%, while apex and flight time showed limitations from unmodelled spin and drag.

Measured golf launch monitor data compared with Trackman reference data

Measured golf launch monitor data compared with Trackman reference data
Performance validation against Trackman reference values for professional swings. Launch angle, initial velocity, and carry were typically within +-5%, while apex and flight time showed limitations from unmodelled spin and drag.
Before AI integration: classical tracking was more vulnerable to shadows, background texture, and motion blur.

Before AI golf tracking results

Before AI golf tracking results
Before AI integration: classical tracking was more vulnerable to shadows, background texture, and motion blur.
After AI integration: YOLO-based ball detection produced cleaner positions for downstream velocity and physics calculations.

After AI golf tracking results

After AI golf tracking results
After AI integration: YOLO-based ball detection produced cleaner positions for downstream velocity and physics calculations.

Results & Impact

  • Winner - AWS KIRO Hackathon 2025
  • Functional prototype estimating key launch parameters from video
  • Custom dataset and trained detection model for golf-specific scenarios
  • In controlled tests, launch angle, velocity, and carry were typically within about 5% of reference values

What I Learned

  • Domain-specific training data dramatically improves detection accuracy
  • Physics modelling bridges the gap when hardware sensors are unavailable, but assumptions about spin and drag must be made explicit
  • Golf video analysis requires careful frame rate and camera positioning

Next Steps

  • Improve calibration with reference markers or dual-camera setup
  • Expand to spin estimation and club path analysis
  • Integrate with Golf Dual View for multi-angle capture