SharpAI / DeepCamera

Open-Source AI Camera. Empower any camera/CCTV with state-of-the-art AI, including facial recognition, person recognition(RE-ID) car detection, fall detection and more
https://sharpai.github.io/DeepCamera/
MIT License
1.82k stars 311 forks source link

local variable 'person_count' referenced before assignment #67

Closed roykroy10 closed 2 years ago

roykroy10 commented 2 years ago

variable "person_count" referenced before assignment. launched current nano branch on jetson nano added token for telegram bot. ran: run-on-nano.sh

face_detector | File "/root/detection/detector.py", line 220, in detect face_detector | if person_count == 0: face_detector | UnboundLocalError: local variable 'person_count' referenced before assignment face_detector | [2022-01-16 21:53:49,867: INFO/MainProcess] Received task: upload_api-v2.detect[02779ca3-1f3d-4e21-968b-eda66e6aa7cf] expires:[2022-01-16 21:54:19.000863+00:00] detector_plugin | error detector_plugin | null detector_plugin | add detect_task failed!! face_detector | [2022-01-16 21:53:49,920: ERROR/ForkPoolWorker-1] Task upload_api-v2.detect[02779ca3-1f3d-4e21-968b-eda66e6aa7cf] raised unexpected: UnboundLocalError("local variable 'person_count' referenced before assignment",) face_detector | Traceback (most recent call last): face_detector | File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 374, in trace_task face_detector | R = retval = fun(*args, *kwargs) face_detector | File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 629, in __protected_call__ face_detector | return self.run(args, **kwargs) face_detector | File "worker.py", line 52, in detect face_detector | result = m.detect(image_path,trackerid, ts, cameraId, face_filter=None) face_detector | File "/root/detection/detector.py", line 220, in detect face_detector | if person_count == 0: face_detector | UnboundLocalError: local variable 'person_count' referenced before assignment

solderzzc commented 2 years ago

@roykroy10 thank for reporting this issue, let me follow up. It seems you already connect to a local RTSP camera stream through Shinobi GUI, right?

solderzzc commented 2 years ago

@roykroy10 I am wondering why this bug is still there, but I submitted a quick fix, do you have chance to run code on branch person_count_fix and let me know the test result, if the bug is fixed by this PR, I'll merge.

roykroy10 commented 2 years ago

Hey @solderzzc , Thanks for the quick reply. Yes, that's correct, I was using a RTSP stream from the local network. configured from shinobi GUI. I appreciate the quick fix I'll test it and update soon.

Thanks Roy

roykroy10 commented 2 years ago

Hey, it works now thanks. Is it possible to pass a chat_id that's allowed to receive messages?

solderzzc commented 2 years ago

@roykroy10 nice to know it works. Since you already configured the telegram token, after you boot up your deep camera, you can send a message to your telegram bot, then deep camera will save the chat id which deep camera could send message to. Currently, I'm not sure if we need to configure the chat id manually..