Page 1 of 2

having issues getting hooks going

Posted: Mon Jun 29, 2020 8:58 pm
by lorenjz
I've been trying to read and exhaust all of the resources I could to track this down. I was successful in getting the notifications for zmninja setup. I'd like to get hooks going and some integration working with my home automation.

I do have encryption setup and working both for browsers and the zmninja. In the setup of that camera, storage tab, the jpeg writer is set to "Frames + Analysis (if available)". I've been trying all of this with one camera to minimize any configuration differences.

When I try this command:

Code: Select all

sudo -u www-data /var/lib/zmeventnotification/bin/zm_event_start.sh -e 2026
This is the response displayed on command line:
usage: zm_detect.py [-h] [-c CONFIG] [-e EVENTID] [-p EVENTPATH]
[-m MONITORID] [-v] [-o OUTPUT_PATH] [-f FILE] [-r REASON]
zm_detect.py: error: argument -e/--eventid: expected one argument
Did I misunderstand how the command was supposed to be executed?

Any input or suggestions would be greatly appreciated!

Edit:

I'm running Zoneminder 1.34.15
Zmninja v1.4.007

Re: having issues getting hooks going

Posted: Mon Jun 29, 2020 11:52 pm
by asker

Code: Select all

sudo -u www-data /var/lib/zmeventnotification/bin/zm_event_start.sh <eid> <mid> 
There is no -e

Re: having issues getting hooks going

Posted: Wed Jul 01, 2020 1:55 pm
by lorenjz
Thanks @asker!

It appears as though I have an error somewhere in my objectconfig. When I run zm_event_start.sh manually and then execute: tail -F /var/log/zm/zmesdetect_m*.log the log shows this:
07/01/20 08:49:14 zmesdetect_m17[7706] ERR utils.py:347 [Error parsing config:/etc/zm/objectconfig.ini]
07/01/20 08:49:14 zmesdetect_m17[7706] ERR utils.py:348 [Error was:Python type HTTPError cannot be converted]
Is there a log that would be more descriptive as to where the objectconfig.ini is causing the error?

Thanks again!

Loren

Re: having issues getting hooks going

Posted: Wed Jul 01, 2020 2:26 pm
by lorenjz
Nevermind... I found that this: https://github.com/pliablepixels/zmeven ... issues/156 was the issue

Re: having issues getting hooks going

Posted: Thu Jul 09, 2020 7:08 pm
by lorenjz
My vm running zoneminder died the other day. I'm tryiing to get everything back up and running. When I execute:
sudo -u www-data /var/lib/zmeventnotification/bin/zm_event_start.sh
I receive an error:
Traceback (most recent call last):
File "/var/lib/zmeventnotification/bin/zm_detect.py", line 15, in <module>
import imutils
ModuleNotFoundError: No module named 'imutils'
A I did do a couple of searches for that error and came up empty...

Any help would be greatly appreciated!

Re: having issues getting hooks going

Posted: Thu Jul 09, 2020 9:09 pm
by asker
That means you are missing "imutils" as a dependent package for detection to work. Not sure how you installed it, but I'd suggest reinstalling using the official install instructions of using install.sh to make sure all dependencies are pulled. make sure you monitor the output of the installation.

Re: having issues getting hooks going

Posted: Thu Jul 09, 2020 10:28 pm
by lorenjz
asker wrote:
Thu Jul 09, 2020 9:09 pm
That means you are missing "imutils" as a dependent package for detection to work. Not sure how you installed it, but I'd suggest reinstalling using the official install instructions of using install.sh to make sure all dependencies are pulled. make sure you monitor the output of the installation.
Yup, I did rerun sudo -H ./install.sh. I watched and noticed that during the script was running that one of the console lines printed:
Requirement already satisfied: imutils in /root/.local/lib/python3.8/site-packages (from zmes-hooks==5.15.6) (0.5.3)
I uninstalled imutils and then redownloaded the install folder from github. Then reran the script, restarted, and then tried again with the same result.

Thoughts?

Re: having issues getting hooks going

Posted: Fri Jul 10, 2020 1:48 am
by asker

Code: Select all

/root/.local/lib/python3.8/site-packages (from zmes-hooks==5.15.6) (0.5.3)
Is this path accessible by www-data? If not then when you run as www-data it won’t find libs.

Re: having issues getting hooks going

Posted: Fri Jul 10, 2020 5:00 pm
by lorenjz
@asker thanks for your help with all of this! I was able to get the imutils permissions thing sorted I think. Then I had this pop up
Traceback (most recent call last):
File "/var/lib/zmeventnotification/bin/zm_detect.py", line 402, in <module>
b, l, c = m.detect(image)
File "/usr/local/lib/python3.8/dist-packages/zmes_hook_helpers/yolo.py", line 64, in detect
self.net = cv2.dnn.readNet(weights_file_abs_path,
cv2.error: OpenCV(4.3.0) /io/opencv/modules/dnn/src/darknet/darknet_io.cpp:821: error: (-212:Parsing error) Unsupported activation: mish in function 'ReadDarknetFromCfgStream'
I couldn’t find anything in this forum or through google which leads me to believe that I have a bigger permissions error than the inutile. Would you agree, or is there something else going on that I need to track down?

Re: having issues getting hooks going

Posted: Fri Jul 10, 2020 11:38 pm
by asker
https://zmeventnotification.readthedocs ... aking.html
Option 1. Switch to yolo v3
Option 2. Upgrade opencv.

Re: having issues getting hooks going

Posted: Sat Jul 11, 2020 2:05 pm
by lorenjz
@asker, kicking myself for not remembering reading that however...

After going through the breaking changes post. I couldn't find the differences. Here is what I did:
  • Downloaded the latest version from github last night
  • Ran install.sh reinstalling everything including the config files to ensure that the appropriate yolo naming convention was in place
  • Reconfigured the config files for my setup
After all of that I'm still getting the same error. I assume that the second point from the release notes is the subject that is causing the error I'm experiencing. If I understand correctly lines 319 through 332 would be what needs adjustment, however mine appear to match the latest release on github:

Code: Select all

config={{base_data_path}}/models/yolov3/yolov3.cfg
weights={{base_data_path}}/models/yolov3/yolov3.weights
labels={{base_data_path}}/models/yolov3/coco.names
Did I misunderstand something or could it be that my install of opencv is messed up somehow?

Re: having issues getting hooks going

Posted: Sat Jul 11, 2020 2:58 pm
by asker
The breaking post bullet I was referring to what this:

If you plan to use YoloV4, the minimum version requirement is the version after 4.3.0. As of Jun 30,2020, that is the master branch of openCV as 4.3.0 is the latest stable version. The updated version of YoloV4 that requires certain functions that were committed on Apr 30. See here. So if you suddently see an error like: Unsupported activation: mish in function 'ReadDarknetFromCfgStream' popping up with YoloV4, that is a sign that you need to get a later version of OpenCV.
The error you are getting ('mish') should only happen if you are using YoloV4 not V3 like you have posted.

Re: having issues getting hooks going

Posted: Wed Aug 19, 2020 11:10 am
by lorenjz
asker wrote:
Fri Jul 10, 2020 11:38 pm
https://zmeventnotification.readthedocs ... aking.html
Option 1. Switch to yolo v3
Option 2. Upgrade opencv.
Zoneminder: 1.34.18
hook version 0.1.24
ES version 6.0.0
opencv 4.4.0
I've upgraded to and tried both versions of yolo. I still get:

Code: Select all

Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 311, in <module>
    m = object_detection.Object(logger=g.logger, options=g.config)
  File "/usr/local/lib/python3.8/dist-packages/pyzm/ml/object.py", line 26, in __init__
    self.model =  yolo.Yolo(options=options, logger=logger)
  File "/usr/local/lib/python3.8/dist-packages/pyzm/ml/yolo.py", line 58, in __init__
    self.net = cv2.dnn.readNet(weights_file_abs_path,
cv2.error: OpenCV(4.4.0-dev) /home/loren/opencv_base/opencv/modules/dnn/src/darknet/darknet_importer.cpp:214: error: (-212:Parsing error) Failed to parse NetParameter file: /var/lib/zmeventnotification/models/yolov3/yolov3.object_weights in function 'readNetFromDarknet'

Re: having issues getting hooks going

Posted: Wed Aug 19, 2020 11:14 am
by asker
/var/lib/zmeventnotification/models/yolov3/yolov3.object_weights is invalid. That file does not exist. Was it a typo?
Should be /var/lib/zmeventnotification/models/yolov3/yolov3.weights which means your objectconfig.ini entry for object_weights has this error.

Re: having issues getting hooks going

Posted: Thu Aug 20, 2020 1:00 pm
by lorenjz
You are right that was the cause of the error.
Thank you!


Just checking to see if there might be a typo in zmeventnotification.ini.

If line 215 is
#event_start_hook_notify_userscript = '{{base_data_path}}/contrib/example.py'
should line 227 be:
#event_end_hook_notify_userscript = '{{base_data_path}}/contrib/example.py'