Custom video analytics: object detection and tracking

About a year ago we’ve published a Python library called “vnxpy”; it is available at https://github.com/viinex/vnxpy. The purpose of this small library was to provide the Python interface to the vnxvideo DLL, which makes it possible for Python code to retrieve decoded video frames from Viinex. There is also an additional Python class Analytics1, — a skeleton for a video analytics module for Viinex can easily be implemented in Python.

Back then, the use of this “vnxpy” library was limited; we published a couple of samples of how it can be used – a QR code reader, and a motion estimator based on a classical Horn-Schunck algorithm.

Today we’ve added to “vnxpy” a support for server-side rendering on top of video, — means that a Python code, besides doing some image processing, can also draw something on top of a video frame, and give that frame back to Viinex. A modified (annotated) video can be further re-streamed to clients. Given that this functionality was requested previously by some of our customers, we thought the whole vnxpy thing is worth mentioning in our news.

As a proof of concept to the functionality described above, we took an open-source implementation of object detector, and integrated that detector with an open-source of implementation of object tracker. Note that we’re not advertising these algorithms. Our point here is to  provide an example of how the custom real-world video analytics can be easily integrated with Viinex.

The object detector and tracking algorithm integration is available in source code at https://github.com/viinex/tracker. Specifically, see files “vnx_vino_inference.py“, which is the source code for video analytics, and the sample Viinex configuration files “tracker.conf” and “vnx_vino_config.json“.

In addition, the distribution of a Python environment containing this integration may be downloaded. This is a tarball captured from a working venv and containing all necessary Python packages installed, and also the object detector & tracker implementation itself, along with a trained neural network for the detector. An installed OpenVINO is required for this integration (it’s not included with provided environment). This venv was tested on Ubuntu 20.04 and OpenVINO 2021.4. The integration was also tested on Windows, however we don’t provide respective Python environment, — contact us if you need help with that.

A demo for this detector and tracker is available on our demo site connected over WAMP: navigate your browser to http://demo.viinex.com:8080/, use WAMP realm “lwo”, login name “guest” and an empty password to log in. There’s a video source named “Inner yard – tracking”, identifier “cam2-res”, — that’s an annotated video stream containing rectangles, object track IDs and object class labels rendered by the algorithm. Of course the tracker process sends events reporting finalized object tracks, and the events may be caught by the client app in real time, stored to the database, processed by Viinex builtin scripts, and so on.