People Counting in Real-Time using live video stream/IP camera in OpenCV.
This is an improvement/modification to https://www.pyimagesearch.com/2018/08/13/opencv-people-counter/
Refer to added Features. Also, added support for an IP camera.
Live demo
SSD detector:
Centroid tracker:
pip install -r requirements.txt
The requirements will be updated timely, but note that there can always be version conflicts between the dependencies themselves and other factors like OS, hardware etc.
python run.py --prototxt mobilenet_ssd/MobileNetSSD_deploy.prototxt --model mobilenet_ssd/MobileNetSSD_deploy.caffemodel --input videos/example_01.mp4
# Enter the ip camera url (e.g., url = 'http://191.138.0.100:8040/video')
url = ''
python run.py --prototxt mobilenet_ssd/MobileNetSSD_deploy.prototxt --model mobilenet_ssd/MobileNetSSD_deploy.caffemodel
Set url = 0 for webcam.
The following is an example of the added features. Note: You can easily on/off them in the config. options (mylib/config.py):
1. Real-Time alert:
Threshold = 10
).2. Threading:
set Thread = True in config.
3. Scheduler:
##Runs at every day (9:00 am). You can change it.
schedule.every().day.at("9:00").do(run)
4. Timer:
if Timer:
# Automatic timer to stop the live stream. Set to 8 hours (28800s).
t1 = time.time()
num_seconds=(t1-t0)
if num_seconds > 28800:
break
5. Simple log:
Main:
Optional:
To get started/contribute quickly (optional) ...
Option 1
Option 2
$ git clone https://github.com/saimj7/People-Counting-in-Real-Time.git
Roll it!
saimj7/ 19-08-2020 © Sai_Mj.