ZoneMinder / zmeventnotification

Machine Learning powered Secure Websocket & MQTT based ZoneMinder event notification server
414 stars 129 forks source link

No face detection or recognition #347

Closed mikevador02 closed 3 years ago

mikevador02 commented 3 years ago

Event Server version V: 6.0.6r

Hooks version (if you are using Object Detection) hooks:6.0.6 pyzm:0.2.8

The version of ZoneMinder you are using: 1.34.22

nature of your issue No face detection or recognition but objects are detected

Details I have installed today from git clone zmeventnotification Folow tutorials and offical documentation

Running on debian V10 on VM machine 8vcpu, 16GB ram, swap 8GB, 90GB SSD storage no GPU in CPU mode

work fine with object detection person are detected , but not face detection or recognition

I put also known faces on /var/lib/zmeventnotification/known_faces/the_name_of_know_person/..jpeg files

Tried on hog, and cnn

i run sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini --eventid 8 --monitorid 1 --debug --eventpath ''

i have good value from yolo for objects detection [a] detected:person:93% --SPLIT--[{"type": "object", "label": "person", "box": [262, 226, 322, 378], "confidence": "93.38%"}]

When i tried only a face on captured video from ZM, the return value is empty

Debug Logs

root@vc1:/var/lib/zmeventnotification/known_faces# sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini  --eventid 16 --monitorid 1 --debug --eventpath ''
12/19/20 20:20:51 zmesdetect_m1[6549] INF zm_detect.py:208 [---------| pyzm version:0.2.8, hook version:6.0.6,  ES version:6.0.6 , OpenCV version:4.4.0|------------]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 utils.py:402 [secret filename: /etc/zm/secrets.ini]

{'log_level_debug':5}
12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 utils.py:375 [Secret token found in config: !ZM_PORTAL]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 utils.py:375 [Secret token found in config: !ZM_API_PORTAL]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 utils.py:375 [Secret token found in config: !ZM_USER]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 utils.py:375 [Secret token found in config: !ZM_PASSWORD]

(255,255,255)
12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 utils.py:372 [Section [ml] missing in config file, using key:ml_sequence default: None]

None
12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 utils.py:372 [Section [ml] missing in config file, using key:stream_sequence default: None]

None
(4,4)
(8,8)
12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 utils.py:375 [Secret token found in config: !PLATEREC_ALPR_KEY]

None
12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 utils.py:424 [allowing self-signed certs to work...]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 utils.py:506 [key [object_config] is '/var/lib/zmeventnotification/models/yolov3/yolov3.cfg' after substitution]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 utils.py:506 [key [object_weights] is '/var/lib/zmeventnotification/models/yolov3/yolov3.weights' after substitution]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 utils.py:506 [key [object_labels] is '/var/lib/zmeventnotification/models/yolov3/coco.names' after substitution]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 utils.py:506 [key [known_images_path] is '/var/lib/zmeventnotification/known_faces' after substitution]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 utils.py:506 [key [unknown_images_path] is '/var/lib/zmeventnotification/unknown_faces' after substitution]

12/19/20 20:20:51 zmesdetect_m1[6549] INF zm_detect.py:234 [Importing local classes for Object/Face]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 utils.py:276 [Trying to download https://192.168.80.57/zm/index.php?view=image&eid=16&fid=alarm&username=admin&password=*****]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 utils.py:295 [Trying to download https://192.168.80.57/zm/index.php?view=image&eid=16&fid=snapshot&username=admin&password=*****]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 zm_detect.py:296 [No polygon area specfied, so adding a full image polygon:[{'name': 'full_image', 'value': [(0, 0), (640, 0), (640, 480), (0, 480)], 'pattern': None}]]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 zm_detect.py:299 [resizing to 1200 before analysis...]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 utils.py:138 [resized polygons x=1.0/y=1.0: [{'name': 'full_image', 'value': [(0, 0), (640, 0), (640, 480), (0, 480)], 'pattern': None}]]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 zm_detect.py:320 [User ALPR if vehicle found: False]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 yolo.py:31 [Semaphore: max:1, name:pyzm_cpu # or gpu_lock, timeout:120]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 zm_detect.py:372 [using g.config['object_detection_pattern']=(person|car|motorbike|bus|truck|boat)]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 zm_detect.py:405 [Using model: object with /var/lib/zmeventnotification/images/16-alarm.jpg]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 yolo.py:40 [Waiting for cpu # or gpu lock...]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 yolo.py:42 [Got cpu # or gpu lock ..]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 yolo.py:69 [|--------- Loading Yolo model from disk ---------|]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 yolo.py:77 [Yolo initialization (loading model from disk) took: 59.517 milliseconds]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 yolo.py:88 [Using CPU for detection]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 yolo.py:119 [|---------- YOLO (input image: 640w*480h, resized to: 416w*416h) ----------|]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 yolo.py:56 [Released lock]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG2 yolo.py:135 [detect lock released]

12/19/20 20:20:51 zmesdetect_m1[6549] DBG1 yolo.py:138 [YOLO detection took: 375.173 milliseconds]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 yolo.py:172 [YOLO NMS filtering took: 0.625 milliseconds]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG3 object.py:55 [core model detection over, got 5 objects. Now filtering]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 object.py:88 [Ignoring bottle [58, 414, 80, 448] as conf. level 0.2601052522659302 is lower than 0.3]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 object.py:90 [Returning filtered list of 4 objects.]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 image_manip.py:294 [intersection: polygon in process=[(33, 416), (419, 416), (419, 478), (33, 478)]]

12/19/20 20:20:52 zmesdetect_m1[6549] INF image_manip.py:315 [discarding "sofa" as it does not match your filters]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG1 image_manip.py:318 [full_image intersects object:sofa[[(33, 416), (419, 416), (419, 478), (33, 478)]] but does NOT match your detect pattern filter]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 image_manip.py:294 [intersection: polygon in process=[(328, 216), (418, 216), (418, 282), (328, 282)]]

12/19/20 20:20:52 zmesdetect_m1[6549] INF image_manip.py:315 [discarding "tvmonitor" as it does not match your filters]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG1 image_manip.py:318 [full_image intersects object:tvmonitor[[(328, 216), (418, 216), (418, 282), (328, 282)]] but does NOT match your detect pattern filter]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 image_manip.py:294 [intersection: polygon in process=[(125, 236), (205, 236), (205, 406), (125, 406)]]

12/19/20 20:20:52 zmesdetect_m1[6549] INF image_manip.py:315 [discarding "pottedplant" as it does not match your filters]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG1 image_manip.py:318 [full_image intersects object:pottedplant[[(125, 236), (205, 236), (205, 406), (125, 406)]] but does NOT match your detect pattern filter]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 image_manip.py:294 [intersection: polygon in process=[(397, 14), (637, 14), (637, 442), (397, 442)]]

12/19/20 20:20:52 zmesdetect_m1[6549] INF image_manip.py:315 [discarding "refrigerator" as it does not match your filters]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG1 image_manip.py:318 [full_image intersects object:refrigerator[[(397, 14), (637, 14), (637, 442), (397, 442)]] but does NOT match your detect pattern filter]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 zm_detect.py:622 [ALPR not in use, no need for look aheads in processing]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG1 zm_detect.py:651 [No match found in /var/lib/zmeventnotification/images/16-alarm.jpg using model:object]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG1 zm_detect.py:405 [Using model: object with /var/lib/zmeventnotification/images/16-snapshot.jpg]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 yolo.py:40 [Waiting for cpu # or gpu lock...]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 yolo.py:42 [Got cpu # or gpu lock ..]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG1 yolo.py:119 [|---------- YOLO (input image: 640w*480h, resized to: 416w*416h) ----------|]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 yolo.py:56 [Released lock]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 yolo.py:135 [detect lock released]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG1 yolo.py:138 [YOLO detection took: 235.667 milliseconds]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 yolo.py:172 [YOLO NMS filtering took: 0.577 milliseconds]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG3 object.py:55 [core model detection over, got 3 objects. Now filtering]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 object.py:90 [Returning filtered list of 3 objects.]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 image_manip.py:294 [intersection: polygon in process=[(326, 216), (418, 216), (418, 280), (326, 280)]]

12/19/20 20:20:52 zmesdetect_m1[6549] INF image_manip.py:315 [discarding "tvmonitor" as it does not match your filters]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG1 image_manip.py:318 [full_image intersects object:tvmonitor[[(326, 216), (418, 216), (418, 280), (326, 280)]] but does NOT match your detect pattern filter]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 image_manip.py:294 [intersection: polygon in process=[(74, 388), (456, 388), (456, 480), (74, 480)]]

12/19/20 20:20:52 zmesdetect_m1[6549] INF image_manip.py:315 [discarding "sofa" as it does not match your filters]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG1 image_manip.py:318 [full_image intersects object:sofa[[(74, 388), (456, 388), (456, 480), (74, 480)]] but does NOT match your detect pattern filter]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 image_manip.py:294 [intersection: polygon in process=[(126, 230), (206, 230), (206, 410), (126, 410)]]

12/19/20 20:20:52 zmesdetect_m1[6549] INF image_manip.py:315 [discarding "pottedplant" as it does not match your filters]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG1 image_manip.py:318 [full_image intersects object:pottedplant[[(126, 230), (206, 230), (206, 410), (126, 410)]] but does NOT match your detect pattern filter]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG2 zm_detect.py:622 [ALPR not in use, no need for look aheads in processing]

12/19/20 20:20:52 zmesdetect_m1[6549] DBG1 zm_detect.py:651 [No match found in /var/lib/zmeventnotification/images/16-snapshot.jpg using model:object]

12/19/20 20:20:53 zmesdetect_m1[6549] DBG1 face.py:35 [Initializing face recognition with model:cnn upsample:1, jitters:1]

12/19/20 20:20:53 zmesdetect_m1[6549] DBG2 face.py:52 [Semaphore: max:3, name:pyzm_cpu_lock, timeout:120]

12/19/20 20:20:53 zmesdetect_m1[6549] DBG1 face.py:74 [pre-trained faces found, using that. If you want to add new images, remove: /var/lib/zmeventnotification/known_faces/faces.dat]

12/19/20 20:20:53 zmesdetect_m1[6549] DBG2 zm_detect.py:372 [using g.config['face_detection_pattern']=.*]

12/19/20 20:20:53 zmesdetect_m1[6549] DBG1 zm_detect.py:405 [Using model: face with /var/lib/zmeventnotification/images/16-alarm.jpg]

12/19/20 20:20:53 zmesdetect_m1[6549] DBG1 face.py:142 [|---------- Face recognition (input image: 640w*480h) ----------|]

12/19/20 20:20:53 zmesdetect_m1[6549] DBG2 face.py:100 [Waiting for cpu lock...]

12/19/20 20:20:53 zmesdetect_m1[6549] DBG2 face.py:102 [Got cpu lock for initialization...]

12/19/20 20:20:53 zmesdetect_m1[6549] DBG2 face.py:105 [cpu lock released]

12/19/20 20:20:55 zmesdetect_m1[6549] DBG1 face.py:163 [Finding faces took 596.056 milliseconds]

12/19/20 20:20:55 zmesdetect_m1[6549] DBG1 face.py:113 [pyzm_cpu_lock Lock already released]

12/19/20 20:20:55 zmesdetect_m1[6549] DBG1 face.py:177 [Computing face recognition distances took 0.263 milliseconds]

12/19/20 20:20:55 zmesdetect_m1[6549] DBG2 zm_detect.py:622 [ALPR not in use, no need for look aheads in processing]

12/19/20 20:20:55 zmesdetect_m1[6549] DBG1 zm_detect.py:651 [No match found in /var/lib/zmeventnotification/images/16-alarm.jpg using model:face]

12/19/20 20:20:55 zmesdetect_m1[6549] DBG1 zm_detect.py:405 [Using model: face with /var/lib/zmeventnotification/images/16-snapshot.jpg]

12/19/20 20:20:55 zmesdetect_m1[6549] DBG1 face.py:142 [|---------- Face recognition (input image: 640w*480h) ----------|]

12/19/20 20:20:55 zmesdetect_m1[6549] DBG2 face.py:100 [Waiting for cpu lock...]

12/19/20 20:20:55 zmesdetect_m1[6549] DBG2 face.py:102 [Got cpu lock for initialization...]

12/19/20 20:20:55 zmesdetect_m1[6549] DBG2 face.py:105 [cpu lock released]

12/19/20 20:20:56 zmesdetect_m1[6549] DBG1 face.py:163 [Finding faces took 551.205 milliseconds]

12/19/20 20:20:56 zmesdetect_m1[6549] DBG1 face.py:113 [pyzm_cpu_lock Lock already released]

12/19/20 20:20:56 zmesdetect_m1[6549] DBG1 face.py:177 [Computing face recognition distances took 0.268 milliseconds]

12/19/20 20:20:56 zmesdetect_m1[6549] DBG2 zm_detect.py:622 [ALPR not in use, no need for look aheads in processing]

12/19/20 20:20:56 zmesdetect_m1[6549] DBG1 zm_detect.py:651 [No match found in /var/lib/zmeventnotification/images/16-snapshot.jpg using model:face]

12/19/20 20:20:56 zmesdetect_m1[6549] INF zm_detect.py:667 [No patterns found using any models in all files]

Thanks for help and this good working solution for objects detection with ZM

pliablepixels commented 3 years ago

Hi, your logs show faces are not detected by the model which means dlib (the library I use) is not finding a face. That would usually mean the image doesn't have a recognizable face. You could try increasing the size of the input image, and some other tricks mentioned in https://github.com/ageitgey/face_recognition/wiki/Face-Recognition-Accuracy-Problems

mikevador02 commented 3 years ago

Hi, your logs show faces are not detected by the model which means dlib (the library I use) is not finding a face. That would usually mean the image doesn't have a recognizable face. You could try increasing the size of the input image, and some other tricks mentioned in https://github.com/ageitgey/face_recognition/wiki/Face-Recognition-Accuracy-Problems

Hello, Thanks it's working with adapted parameters .

pliablepixels commented 3 years ago

Could you share your adapted parameters? Might help if I recorded it somewhere incase others have the same problem