Object tracking in video with OpenCV and Deep Learning
Use automatic labeling to create a model from a video, then use the model to annotate a video
This code pattern is part of the Getting started with PowerAI Vision learning path.
|100||Introduction to computer vision||Article|
|101||Introduction to PowerAI Vision||Article|
|201||Build and deploy a PowerAI Vision model and use it in an iOS app||Tutorial|
|202||Locate and count items with object detection||Code pattern|
|203||Object tracking in video with OpenCV and Deep Learning||Code pattern|
|301||Validate computer vision deep learning models||Code pattern|
|302||Develop analytical dashboards for AI projects with PowerAI Vision||Code pattern|
Whether you are counting cars on a road or products on a conveyor belt, there are many use cases for computer vision with video. With video as input, you can use automatic labeling to create a better classifier with less manual effort. This code pattern shows you how to create and use a classifier to identify objects in motion and then track and count the objects as they enter designated regions of interest.
Whether it is car traffic, people traffic, or products on a conveyer belt, there are many applications for keeping track of potential customers, actual customers, products, or other assets. With video cameras everywhere, a business can get useful information from them with some computer vision. Applying this technology to videos is much more practical than older methods (for example, using special hardware or a person counting vehicle traffic).
This code pattern explains how to create a video car counter using the PowerAI Vision Video Data Platform, OpenCV, and a Jupyter Notebook. You’ll use a little manual labeling and a lot of automatic labeling to train an object classifier to recognize cars on a highway. You’ll load another car video into a Jupyter Notebook where you’ll process the individual frames and annotate the video.
You’ll use the deployed model for inference to detect cars on a sample of the frames at a regular interval, and you’ll use OpenCV to track the cars from frame to frame in between inference. In addition to counting the cars as they are detected, you’ll also count them as they cross a “finish line” for each lane and show cars per second.
When you’ve completed this code pattern, you will understand how to:
- Use automatic labeling to create an object detection classifier from a video
- Process frames of a video using a Jupyter Notebook, OpenCV, and PowerAI Vision
- Detect objects in video frames with PowerAI Vision
- Track objects from frame to frame with OpenCV
- Count objects in motion as they enter a region of interest
- Annotate a video with bounding boxes, labels, and statistics
- Upload a video using the PowerAI Vision web UI.
- Use automatic labeling and train a model.
- Deploy the model to create a PowerAI Vision inference API.
- Use a Jupyter Notebook to detect, track, and count cars in a video.
Find the detailed steps for this pattern in the README. The steps will show you how to:
- Create a data set in Video Data Platform.
- Train and deploy the model.
- Automatically label objects.
- Run the notebook.
- Create the annotated video.
This code pattern showed how to create and use a classifier to identify objects in motion and then track and count the objects as they enter designated regions of interest. The code pattern is part of the Getting started with PowerAI Vision learning path. To continue the series and learn about more PowerAI Vision features, look at the next code pattern, Validate deep learning models.