ZoneMinder / zmeventnotification

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

zm_detect.py Fails to write image with polygons #374

Closed williamsrAndrew closed 3 years ago

williamsrAndrew commented 3 years ago

Event Server version

6.1.5

Hooks version (if you are using Object Detection)

hooks:6.1.5 pyzm:0.3.25

Are you using MLAPI? (Y/N)

No

The version of ZoneMinder you are using:

1.34.23

What is the nature of your issue

Bug

Details

zm_detect.py fails to write an image when an object is detected. The error that is produced points towards polygons=matched_data['polygons'] in the main_handler. I am able to fix the issue by changing matched_data['polygons'] to g.polygons, but I am unsure if this is the right way to do it. I am not going to post the entire output of --debug unless it will help with this issue.

Run script:

root@zoneminder-574b887558-zfk2j:/# sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini --eventid 319 --monitorid 2

Error Output:

03/17/21 13:50:25 zmesdetect_m2[42665] DBG1 zm_detect.py:457 [Prediction string JSON:{"labels": ["person"], "boxes": [[212, 176, 288, 328]], "frame_id": "snapshot", "confidences": [0.9830121397972107], "image_dimensions": {"original": [1920, 2560], "resized": [600, 800]}}]

[s] detected:person:98% --SPLIT--{"labels": ["person"], "boxes": [[212, 176, 288, 328]], "frame_id": "snapshot", "confidences": [0.9830121397972107], "image_dimensions": {"original": [1920, 2560], "resized": [600, 800]}}
03/17/21 13:50:26 zmesdetect_m2[42665] FAT zm_detect.py:534 [Unrecoverable error:'polygons' Traceback:Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 531, in <module>
    main_handler()
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 463, in main_handler
    polygons=matched_data['polygons'], poly_thickness = g.config['poly_thickness'])
KeyError: 'polygons'
]
pliablepixels commented 3 years ago

You need to update pyzm and ES/hooks

williamsrAndrew commented 3 years ago

Thanks, I will try that! I am using dlandon's docker image, and I started running into some problems with a recent update, my configs were a mish-mash of old and new, so I'm trying to get everything sorted out.