This repository is a simple project to demonstrate how to implement a pipeline for object detection and tracking using NVidia DeepStream. It also contains a simple implementation of a custom DeepStream plugin using python.
- DeepStream SDK = 6.0
- Python >= 3.6
- Python-Gst >= 1.14.0
- pyDS
This system is designed to do object detection and tracking on video stream/files and send results to a web API using post request.
System design illustrated below:
Before starting to install I highly recommend using Docker
To build
docker build --gpus all -t deepstream_tracking_sample:0.1 .
To run
docker run --gpus all --network host -i deepstream_tracking_sample:0.1
There are three steps to install dependencies
First you need to install DeepStream SDK, I assume you've already installed DeepStream SDK
The following dependencies need to be met:
Ubunutu - 18.04 [using python-3.6]:
apt install -y git python-dev python3 python3-pip python3.6-dev python3.8-dev cmake g++ build-essential\
libglib2.0-dev libglib2.0-dev-bin python-gi-dev libtool m4 autoconf automake
Ubuntu - 20.04 [using python-3.8]:
apt install python3-gi python3-dev python3-gst-1.0 python-gi-dev git python-dev \
python3 python3-pip python3.8-dev cmake g++ build-essential libglib2.0-dev \
libglib2.0-dev-bin python-gi-dev libtool m4 autoconf automake
Gst-python:
git clone https://github.com/GStreamer/gst-python.git
cd gst-python
./autogen.sh
make
make install
After building and installing gst-python you need to set GST_PLUGIN_PATH variable to point to plugins, for this project plugins are located at the plugins folder
export GST_PLUGIN_PATH=$GST_PLUGIN_PATH:<project-path>/plugins
Pybind11:
git clone https://github.com/pybind/pybind11.git
cd pybind11
python3 setup.py install
PyDS:
git clone https://github.com/NVIDIA-AI-IOT/deepstream_python_apps/
cd deepstream_python_apps/bindings/
mkdir build && cd build
Ubuntu - 18.04 [using python-3.6]:
cmake ..
make
pip3 install pyds-1.1.0-py3-none-linux_x86_64.whl
Ubuntu - 20.04 [using python-3.8]:
cmake .. -DPYTHON_MAJOR_VERSION=3 -DPYTHON_MINOR_VERSION=8
make
pip3 install pyds-1.1.0-py3-none-linux_x86_64.whl
Python requirements:
pip3 install -r requirements.txt
For the configuration there are some config files that are located in configs folder
In this config file you need to provide project's main configs such as video stream uris, object detector's config, object tracker's config.
Example: main_config.yml
Config file for nvinfer plugin
Example: pgie_config.txt
Config file for nvtracker plugin
Example: tracker_config.txt
To run the project after installing all the requirements just simply run:
python3 pipeline configs/main_config.yml
After running the command above, the pipeline starts to build and play, by detecting any object sendersink would send a post request to API, for testing results there is a simple Flask Rest-API that receives post request from sendersink.
To run the test API run the following commands:
pip3 install flask, flask-cors
python3 test/receiver_app.py