Analyzing a Tennis Serve with the Video Intelligence API




Launch AI Platform Notebook

Copy notebook file

Follow the notebook

Analyzing a Tennis Serve with the Video Intelligence API

1 hour 5 积分


Google Cloud Self-Paced Labs


Already, machine learning plays a role in sports: companies use it to identify players’ unique talents, detect injuries earlier, and broker optimal player trades. Plus, almost every professional sport uses machine learning technology for tracking. The NBA, for example, has deployed a sophisticated vision-based system on courts to track players’ motions, read numbers off their jerseys, analyze how fast they pass the ball, and determin how accurately they shoot under pressure.

In this lab you will learn how to create the core components of a simple vision-based system to analyze a tennis serve using the Video Intelligence API and a pretrained AutoML Vision Object Detection model.

The Video Intelligence API allows developers to use Google video analysis technology as part of their applications. The REST API enables users to annotate videos stored locally or in Cloud Storage with contextual information at the level of the entire video, per segment, per shot, and per frame. Among its many features, the Video Intelligence API offers Person Detection which detects each person in the video and recognizes a large amount of body parts, facial features, and clothing.

Using Person Detection in this lab, you will be able to calculate the position of a tennis player's wrists, knees, elbows, and shoulders over time from a video clip. Then, with an AutoML Vision Object Detection model that's been trained to recognize tennis balls, you will be able to track the position of the ball in the same video and determine its speed. This collective data can then be analyzed to determine many aspects about the tennis serve such as when the serve happened, how powerful the serve was, and what the tennis player's form during the serve was.

This lab is based on the blog post, Can AI Make You a Better Athlete? Using Machine Learning to Analyze Tennis Serves and Penalty Kicks, by Dale Markowitz.

What you'll do

  • Analyze a tennis serve with the Video Intelligence API

  • Use Pose Detection to calculate angle of a person's elbows and arms over time

  • Use a pretrained AutoML Vision Object Detection model to track the speed of the tennis ball


It is recommended, but not required, to have completed the Video Intelligence: Qwik Start lab in order to have a baseline foundation for how the Video Intelligence API is working.

Join Qwiklabs to read the rest of this lab...and more!

  • Get temporary access to the Google Cloud Console.
  • Over 200 labs from beginner to advanced levels.
  • Bite-sized so you can learn at your own pace.
Join to Start This Lab