Chrysalis Cloud Object detection cctv live stream

Object detection in live video stream with Chrysalis Cloud

Igor Rendulic


This post is an adaptation of a existing pre-trained object detection API ML model form Googles Colab Tutorial to run in the cloud. As the original Object Detection API Demo walks you step by step through the process of using a pre-trained model to detect objects in an image, here we adapt that concept to run on a remote live video stream. We don’t dive into the details of Tensorflow 2, inference nor any other details of training a custom model but rather demonstrate the ease of adapting an existing ML model to run in the Chrysalis Cloud.

Object Detection
Object Detection

About Tensorflow 2 Object Detection API

The TensorFlow Object Detection API is an open source framework built on top of TensorFlow that makes it easy to construct, train and deploy object detection models. The pre-trained models have been re-implemented using Keras layers and the weights have been saved in the TF2 checkpoint format.

In this post we use ssd_mobilenet_v1_coco_2017_11_17 (Common Object in Context) pre-trained model.

Using Chrysalis cloud to detect objects in real-time video stream

This example is assuming you have a GPU capable graphics card. By default it assumes:

  • cudatoolkit=10.1
  • cudnn=7.6.5

Modify environment.yml to fit to your environment.

If you need some additional information as of what your GPU environment is here are some useful commands for Linux OS:

Check GPU card information:


Check cuda version:

nvcc --version


cat /usr/local/cuda/version.txt

Check cudnn version:

cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2


Creating an endpoint on Chrysalis Cloud

For creating an endpoint you’ll need a developer account on Chrysalis Cloud.

Once logged in create your first RTMP Stream. It should take about a minute or less. Chrysalis cloud gives out a free trial for a month for one camera.

Install OBS Studio

In this example we will use OBS studio for development. You could also develop with OpenCV VideoCapture and later move onto Chrysalis Cloud. You will see from the code example how easy we can transition from local solution to cloud solution utilizing Chrysalis Cloud SDK.

Read this if you need  more information how to stream live video to Chrysalis Cloud from OBS Studio.

Alternative streaming methods:

Install Anaconda

Since Chrysalis Cloud SDK is dealing with somewhat complex dependencies the easiest and recommended way is to use anaconda environment. Anaconda also comes in handy later when we need something even more complicated such as GPU acceleration or different versions of Tensorflow.

Find how to install here

Python Code

Clone the development repository:

git clone

Create and activate conda environment:

cd object-detection
conda env create -f environment.yml
conda activate chrysobject

Tensorflow model setup

After creating and activating conda environment clone the tensorflow models:

git clone --depth 1

Compile the protos for object detection:

cd models/research
protoc object_detection/protos/*.proto --python_out=.
cp object_detection/packages/tf2/ .
python -m pip install .
cd ../..
cp -r models/research/object_detection object_detection


Get Chrysalis Cloud SDK streaming credentials for your connected camera and export to environment variables:

export chrys_port=1111
export chrys_password=mypassword
export chrys_cert=pathtomycertificate.cer



Leave a Reply

More great articles

Chrysalis Cloud Mask detection Covid19

Covid19 Mask Detector on Live Video Stream

TL;DR This post is an adaptation of an article written by Adrian Rosebrock titled COVID-19: Face Mask Detector with OpenCV,…

Read Story
Chrysalis Cloud Face recognition with Python SDK

Face Recognition Using Chrysalis Cloud Python SDK 101

We’re going to show how to do face recognition in the cloud using Chrysalis Cloud. We break it down for…

Read Story
Chrysalis Cloud is the easy solution

New to Chrysalis Cloud? Check out the demo video.

If you're taking advantage of our one month free trial, then take advantage of this 15-min demo video. Click below…

Read Story

Never miss a minute

Get great content to your inbox every week. No spam.

    Only great content, we don’t share your email with third parties.