A multithreaded program that calculate and detect number of persons in a room from an arbitrary amount of cameras with Tensorflow object detection.
The demo below visualize how the program looks from two ip cameras and one realsense depth camera. The fourth camera demonstrates what happens if a camera-source can't be captured by openCV. NOTE: lighting and the usage of identical cameras are crucial for detection performance!
The demo below visualize the usage of a vast amount of cameras. NOTE: Close program windows by pressing "Q" button.
This part describe the installation and running process.
Here we describe how to install the implementation on your local computer.
-
Install python
-
Install required packages
pip3 install -r requirements.txt
- Done!
- Change variables in "main.py".
- Run main.py:
python3 main.py
Here we describe what this implementation actually does!
This implementation uses multithreading for async tasks such as receiving and handling Camera streams. OpenCV is used to collect and visualize the streams.
This implementation also contains a auto screen splitter. Letting you add an arbitary amount of cameras in the source_list. The camera streams will be evenly shared among all screens connected to the computer.
A simple tensorflow object detection is used. It is a faster-rcnn trained on the COCO-dataset. All models needed to run the implementation is in this repo, all used models is provided by Google developer team.
To decide if a person has already been detected we use an image template probability match method to detect image differences. This method is mainly used to make sure that a person is not calculated several times when seen from several cameras at once.
The code for object detection assume from: https://github.com/jamesloyys/Real-Time-Object-Detection.git