saimj7 / People-Counting-in-Real-Time

People Counting in Real-Time with an IP camera.
MIT License
528 stars 263 forks source link

Multi Threading #36

Closed dbaler closed 2 years ago

dbaler commented 2 years ago

Hello! First I want to thank you for this awesome program, however, I am having issues with setting thread to True in config.py

If I set to True. The program will not run. False runs "fine" it struggles to pick up people in real time, hence the need to set to True.

My Setup: Raspberry Pi4B (Overclocked to 2Ghz) Camera (Pi Camera plugged into the camera slot)

Command I am running.

> python3 run.py --prototxt mobilenet_ssd/MobileNetSSD_deploy.prototxt --model mobilenet_ssd/MobileNetSSD_deploy.caffemodel
> [INFO] Starting the live stream..
> ^CTraceback (most recent call last):
>   File "run.py", line 353, in <module>
>     run()
>   File "run.py", line 89, in run
>     frame = vs.read()
>   File "/home/pi/Desktop/PPL Count/mylib/thread.py", line 28, in read
>     return self.q.get() # fetch frames from the queue one by one
>   File "/usr/lib/python3.7/queue.py", line 170, in get
>     self.not_empty.wait()
>   File "/usr/lib/python3.7/threading.py", line 296, in wait
>     waiter.acquire()
> KeyboardInterrupt

My config.py

> #===============================================================================
""" Optional features config. """
#===============================================================================
# Enter mail below to receive real-time email alerts
# e.g., 'email@gmail.com'
MAIL = ''
# Enter the ip camera url (e.g., url = 'http://191.138.0.100:8040/video')
url = '0'

# ON/OFF for mail feature. Enter True to turn on the email alert feature.
ALERT = False
# Set max. people inside limit. Optimise number below: 10, 50, 100, etc.
Threshold = 30
# Threading ON/OFF
Thread = True
# Simple log to log the counting data
Log = False
# Auto run/Schedule the software to run at your desired time
Scheduler = False
# Auto stop the software after certain a time/hours
Timer = False
#===============================================================================
#===============================================================================
saimj7 commented 2 years ago

Hi! Can you try with url = 0 (not url = '0')?