Event Server Object Detection not working
Posted: Fri Nov 05, 2021 4:54 pm
Facial recognition is working but object detection isn't.
Ubuntu 20.04
Zoneminder v1.37.1
Followed the article here on setup https://zmeventnotification.readthedocs ... hooks.html
Using OpenCV with YOLOv4 with NVIDIA GPU support
I found a similar issue here but does not seem to apply to me because I can't find the code they are referring to.
viewtopic.php?f=43&t=31129&p=123238&hil ... le#p123238
Any help or suggestions would be greatly appreciated as I am stumped.
Thanks!
Ubuntu 20.04
Zoneminder v1.37.1
Followed the article here on setup https://zmeventnotification.readthedocs ... hooks.html
Using OpenCV with YOLOv4 with NVIDIA GPU support
Code: Select all
root@NVR:/etc/zm# sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini --debug --eventid 27 --monitorid 3 --eventpath=/tmp
INF [zmesdetect_m3] [Setting up signal handler for logs]
INF [zmesdetect_m3] [Switching global logger to ZMLog]
INF [zmesdetect_m3] [---------| app:6.1.28, pyzm:0.3.56, ES:6.1.28
, OpenCV:4.5.4-dev|------------]
INF [zmesdetect_m3] [Reading config from: /etc/zm/objectconfig.ini]
INF [zmesdetect_m3] [Reading secrets from: /etc/zm/secrets.ini]
DBG2 [zmesdetect_m3] [Secret token found in config: !ML_USER]
DBG2 [zmesdetect_m3] [Secret token found in config: !ML_PASSWORD]
DBG2 [zmesdetect_m3] [Secret token found in config: !PLATEREC_ALPR_KEY]
DBG1 [zmesdetect_m3] [allowing self-signed certs to work...]
DBG2 [zmesdetect_m3] [Now checking for monitor overrides]
DBG3 [zmesdetect_m3] [Finally, doing parameter substitution]
INF [zmesdetect_m3] [Importing local classes for Object/Face]
INF [zmesdetect_m3] [Connecting with ZM APIs]
DBG2 [zmesdetect_m3] [API SSL certificate check has been disbled]
DBG1 [zmesdetect_m3] [using username/password for login]
DBG2 [zmesdetect_m3] [Using new token API]
DBG1 [zmesdetect_m3] [Access token expires on:2021-11-05 14:34:38.601172 [7200s]]
DBG1 [zmesdetect_m3] [Refresh token expires on:2021-11-06 12:34:38.601827 [86400s]]
DBG2 [zmesdetect_m3] [using ml_sequence]
DBG2 [zmesdetect_m3] [using stream_sequence]
DBG1 [zmesdetect_m3] [Resetting models, will be loaded on next run]
DBG3 [zmesdetect_m3] [Using automatic locking as we are switching between models]
DBG2 [zmesdetect_m3] [Media get SSL certificate check has been disbled]
DBG2 [zmesdetect_m3] [Using URL 27 for stream]
DBG2 [zmesdetect_m3] [We will only process frames: ['snapshot', 'alarm']]
DBG2 [zmesdetect_m3] [No need to start streams, we are picking images from https://example.com/zm/index.php?view=image&eid=27]
DBG3 [zmesdetect_m3] [Reading https://example.com/zm/index.php?view=image&eid=27&fid=snapshot]
DBG3 [zmesdetect_m3] [No need to relogin as access token still has 119.9992968 minutes remaining]
DBG3 [zmesdetect_m3] [make_request called with url=https://example.com/zm/index.php?view=image&eid=27&fid=snapshot payload={} type=get query={'token': 'removed'}]
DBG1 [zmesdetect_m3] [perf: Starting for frame:snapshot]
DBG1 [zmesdetect_m3] [Sequence of detection types to execute: ['object', 'face', 'alpr']]
DBG1 [zmesdetect_m3] [============ Frame: snapshot Running object detection type in sequence ==================]
DBG2 [zmesdetect_m3] [Skipping TPU object detection as it is disabled]
DBG2 [zmesdetect_m3] [Loading sequence: YoloV4 GPU/CPU]
DBG2 [zmesdetect_m3] [Initializing model type:object with options:{'name': 'YoloV4 GPU/CPU', 'enabled': 'yes', 'object_config': '/var/lib/zmeventnotification/models/yolov4/yolov4.cfg', 'object_weights': '/var/lib/zmeventnotification/models/yolov4/yolov4.weights', 'object_labels': '/var/lib/zmeventnotification/models/yolov4/coco.names', 'object_min_confidence': 0.3, 'object_framework': 'opencv', 'object_processor': 'gpu', 'gpu_max_processes': 1, 'gpu_max_lock_wait': 100, 'cpu_max_processes': 3, 'cpu_max_lock_wait': 100, 'max_detection_size': '90%', 'disable_locks': 'no'}]
DBG2 [zmesdetect_m3] [portalock: max:1, name:pyzm_uid33_gpu_lock, timeout:100]
DBG3 [zmesdetect_m3] [object has a same_model_sequence strategy of first]
DBG1 [zmesdetect_m3] [--------- Frame:snapshot Running variation: #1 -------------]
DBG2 [zmesdetect_m3] [detect extracted image dimensions as: 800wx450h]
DBG2 [zmesdetect_m3] [Waiting for pyzm_uid33_gpu_lock portalock...]
DBG2 [zmesdetect_m3] [Got pyzm_uid33_gpu_lock portalock]
DBG1 [zmesdetect_m3] [|--------- Loading "YoloV4 GPU/CPU" model from disk -------------|]
DBG1 [zmesdetect_m3] [perf: processor:gpu Yolo initialization (loading /var/lib/zmeventnotification/models/yolov4/yolov4.weights model from disk) took: 159.07 ms]
DBG2 [zmesdetect_m3] [Setting CUDA backend for OpenCV]
DBG3 [zmesdetect_m3] [If you did not set your CUDA_ARCH_BIN correctly during OpenCV compilation, you will get errors during detection related to invalid device/make_policy]
DBG1 [zmesdetect_m3] [|---------- YOLO (input image: 800w*450h, model resize dimensions: 416w*416h) ----------|]
DBG2 [zmesdetect_m3] [Released pyzm_uid33_gpu_lock portalock]
[b]11/05/21 12:34:38 zmesdetect_m3[8215] ERR detect_sequence.py:713 [Error running model: invalid index to scalar variable.]
DBG2 [zmesdetect_m3] [Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pyzm/ml/detect_sequence.py", line 710, in detect_stream
_b,_l,_c,_m = m.detect(image=frame)
File "/usr/local/lib/python3.8/dist-packages/pyzm/ml/object.py", line 65, in detect
b,l,c,_model_names = self.model.detect(image)
File "/usr/local/lib/python3.8/dist-packages/pyzm/ml/yolo.py", line 168, in detect
ln = self.get_output_layers()
File "/usr/local/lib/python3.8/dist-packages/pyzm/ml/yolo.py", line 129, in get_output_layers
output_layers = [
File "/usr/local/lib/python3.8/dist-packages/pyzm/ml/yolo.py", line 130, in <listcomp>
layer_names[i[0] - 1] for i in self.net.getUnconnectedOutLayers()
IndexError: invalid index to scalar variable.
][/b]
DBG2 [zmesdetect_m3] [We did not find any object matches in frame: snapshot]
DBG1 [zmesdetect_m3] [============ Frame: snapshot Running face detection type in sequence ==================]
DBG2 [zmesdetect_m3] [Skipping TPU face detection as it is disabled]
DBG1 [zmesdetect_m3] [perf: processor:cpu Face Recognition library load time took: 0.00 ms ]
DBG1 [zmesdetect_m3] [Initializing face recognition with model:cnn upsample:1, jitters:0]
DBG2 [zmesdetect_m3] [portalock: max:3, name:pyzm_uid33_cpu_lock, timeout:100]
DBG1 [zmesdetect_m3] [pre-trained faces found, using that. If you want to add new images, remove: /var/lib/zmeventnotification/known_faces/faces.dat]
DBG3 [zmesdetect_m3] [face has a same_model_sequence strategy of union]
DBG1 [zmesdetect_m3] [--------- Frame:snapshot Running variation: #1 -------------]
DBG1 [zmesdetect_m3] [|---------- Dlib Face recognition (input image: 800w*450h) ----------|]
DBG3 [zmesdetect_m3] [Face options={'name': 'DLIB based face recognition', 'enabled': 'yes', 'save_unknown_faces': 'yes', 'save_unknown_faces_leeway_pixels': 100, 'face_detection_framework': 'dlib', 'known_images_path': '/var/lib/zmeventnotification/known_faces', 'unknown_images_path': '/var/lib/zmeventnotification/unknown_faces', 'face_model': 'cnn', 'face_train_model': 'cnn', 'face_recog_dist_threshold': '0.6', 'face_num_jitters': '1', 'face_upsample_times': '1', 'gpu_max_processes': 1, 'gpu_max_lock_wait': 100, 'cpu_max_processes': 3, 'cpu_max_lock_wait': 100, 'max_size': 800, 'disable_locks': 'no'}]
DBG2 [zmesdetect_m3] [Waiting for pyzm_uid33_cpu_lock portalock...]
DBG2 [zmesdetect_m3] [Got pyzm_uid33_cpu_lock lock...]
DBG1 [zmesdetect_m3] [perf: processor:cpu Finding faces took 5684.75 ms]
DBG1 [zmesdetect_m3] [Released pyzm_uid33_cpu_lock portalock]
DBG1 [zmesdetect_m3] [perf: processor:cpu Computing face recognition distances took 0.88 ms]
DBG2 [zmesdetect_m3] [This model iteration inside face found: labels: [],conf:[]]
DBG2 [zmesdetect_m3] [Max object size found to be: 90%]
DBG2 [zmesdetect_m3] [Converted 90% to 324000.0]
DBG2 [zmesdetect_m3] [No polygons, adding full image polygon: {'name': 'full_image', 'value': [(0, 0), (2304, 0), (2304, 1296), (0, 1296)], 'pattern': None}]
DBG3 [zmesdetect_m3] [resized polygons x=0.3472222222222222/y=0.3472222222222222: [{'name': 'full_image', 'value': [(0, 0), (800, 0), (800, 450), (0, 450)], 'pattern': None}]]
DBG2 [zmesdetect_m3] [We did not find any face matches in frame: snapshot]
DBG1 [zmesdetect_m3] [============ Frame: snapshot Running alpr detection type in sequence ==================]
DBG2 [zmesdetect_m3] [Making sure we have matched one of ['car', 'motorbike', 'bus', 'truck', 'boat'] in [] before we proceed]
DBG1 [zmesdetect_m3] [Did not find pre existing labels, not running detection type]
DBG3 [zmesdetect_m3] [Reading https://example.com/zm/index.php?view=image&eid=27&fid=alarm]
DBG3 [zmesdetect_m3] [No need to relogin as access token still has 119.85817178333333 minutes remaining]
DBG3 [zmesdetect_m3] [make_request called with url=https://example.com/zm/index.php?view=image&eid=27&fid=alarm payload={} type=get query={'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjM2MTMwMDc4LCJleHAiOjE2MzYxMzcyNzgsInVzZXIiOiJhZG1pbiIsInR5cGUiOiJhY2Nlc3MifQ.vtGnZD7Hlfmwuh5KNsYY2nfaH4MdFbcbv_7Sndmp5T4'}]
DBG1 [zmesdetect_m3] [perf: Starting for frame:alarm]
DBG1 [zmesdetect_m3] [Sequence of detection types to execute: ['object', 'face', 'alpr']]
DBG1 [zmesdetect_m3] [============ Frame: alarm Running object detection type in sequence ==================]
DBG3 [zmesdetect_m3] [object has a same_model_sequence strategy of first]
DBG1 [zmesdetect_m3] [--------- Frame:alarm Running variation: #1 -------------]
DBG2 [zmesdetect_m3] [detect extracted image dimensions as: 800wx450h]
DBG2 [zmesdetect_m3] [Waiting for pyzm_uid33_gpu_lock portalock...]
DBG2 [zmesdetect_m3] [Got pyzm_uid33_gpu_lock portalock]
DBG1 [zmesdetect_m3] [|---------- YOLO (input image: 800w*450h, model resize dimensions: 416w*416h) ----------|]
DBG2 [zmesdetect_m3] [Released pyzm_uid33_gpu_lock portalock]
[b]11/05/21 12:34:47 zmesdetect_m3[8215] ERR detect_sequence.py:713 [Error running model: invalid index to scalar variable.]
DBG2 [zmesdetect_m3] [Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pyzm/ml/detect_sequence.py", line 710, in detect_stream
_b,_l,_c,_m = m.detect(image=frame)
File "/usr/local/lib/python3.8/dist-packages/pyzm/ml/object.py", line 65, in detect
b,l,c,_model_names = self.model.detect(image)
File "/usr/local/lib/python3.8/dist-packages/pyzm/ml/yolo.py", line 168, in detect
ln = self.get_output_layers()
File "/usr/local/lib/python3.8/dist-packages/pyzm/ml/yolo.py", line 129, in get_output_layers
output_layers = [
File "/usr/local/lib/python3.8/dist-packages/pyzm/ml/yolo.py", line 130, in <listcomp>
layer_names[i[0] - 1] for i in self.net.getUnconnectedOutLayers()
IndexError: invalid index to scalar variable.
][/b]
DBG2 [zmesdetect_m3] [We did not find any object matches in frame: alarm]
DBG1 [zmesdetect_m3] [============ Frame: alarm Running face detection type in sequence ==================]
DBG3 [zmesdetect_m3] [face has a same_model_sequence strategy of union]
DBG1 [zmesdetect_m3] [--------- Frame:alarm Running variation: #1 -------------]
DBG1 [zmesdetect_m3] [|---------- Dlib Face recognition (input image: 800w*450h) ----------|]
DBG3 [zmesdetect_m3] [Face options={'name': 'DLIB based face recognition', 'enabled': 'yes', 'save_unknown_faces': 'yes', 'save_unknown_faces_leeway_pixels': 100, 'face_detection_framework': 'dlib', 'known_images_path': '/var/lib/zmeventnotification/known_faces', 'unknown_images_path': '/var/lib/zmeventnotification/unknown_faces', 'face_model': 'cnn', 'face_train_model': 'cnn', 'face_recog_dist_threshold': '0.6', 'face_num_jitters': '1', 'face_upsample_times': '1', 'gpu_max_processes': 1, 'gpu_max_lock_wait': 100, 'cpu_max_processes': 3, 'cpu_max_lock_wait': 100, 'max_size': 800, 'disable_locks': 'no'}]
DBG2 [zmesdetect_m3] [Waiting for pyzm_uid33_cpu_lock portalock...]
DBG2 [zmesdetect_m3] [Got pyzm_uid33_cpu_lock lock...]
DBG1 [zmesdetect_m3] [perf: processor:cpu Finding faces took 5687.92 ms]
DBG1 [zmesdetect_m3] [Released pyzm_uid33_cpu_lock portalock]
DBG1 [zmesdetect_m3] [perf: processor:cpu Computing face recognition distances took 0.79 ms]
DBG2 [zmesdetect_m3] [This model iteration inside face found: labels: [],conf:[]]
DBG2 [zmesdetect_m3] [Max object size found to be: 90%]
DBG2 [zmesdetect_m3] [Converted 90% to 324000.0]
DBG2 [zmesdetect_m3] [We did not find any face matches in frame: alarm]
DBG1 [zmesdetect_m3] [============ Frame: alarm Running alpr detection type in sequence ==================]
DBG2 [zmesdetect_m3] [Making sure we have matched one of ['car', 'motorbike', 'bus', 'truck', 'boat'] in [] before we proceed]
DBG1 [zmesdetect_m3] [Did not find pre existing labels, not running detection type]
DBG1 [zmesdetect_m3] [perf: TOTAL detection sequence (with image loads) took: 14289.41 ms to process 27]
DBG1 [zmesdetect_m3] [Closing logs]
viewtopic.php?f=43&t=31129&p=123238&hil ... le#p123238
Any help or suggestions would be greatly appreciated as I am stumped.
Thanks!