having issues getting hooks going

Discussion topics related to mobile applications for ZoneMinder
lorenjz
Posts: 24
Joined: Fri Feb 28, 2020 12:25 am

having issues getting hooks going

Post by lorenjz » Mon Jun 29, 2020 8:58 pm

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

User avatar
asker
Posts: 1413
Joined: Sun Mar 01, 2015 12:12 pm

Re: having issues getting hooks going

Post by asker » Mon Jun 29, 2020 11:52 pm

Code: Select all

sudo -u www-data /var/lib/zmeventnotification/bin/zm_event_start.sh <eid> <mid> 
There is no -e
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

lorenjz
Posts: 24
Joined: Fri Feb 28, 2020 12:25 am

Re: having issues getting hooks going

Post by lorenjz » Wed Jul 01, 2020 1:55 pm

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

lorenjz
Posts: 24
Joined: Fri Feb 28, 2020 12:25 am

Re: having issues getting hooks going

Post by lorenjz » Wed Jul 01, 2020 2:26 pm

Nevermind... I found that this: https://github.com/pliablepixels/zmeven ... issues/156 was the issue

lorenjz
Posts: 24
Joined: Fri Feb 28, 2020 12:25 am

Re: having issues getting hooks going

Post by lorenjz » Thu Jul 09, 2020 7:08 pm

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!

User avatar
asker
Posts: 1413
Joined: Sun Mar 01, 2015 12:12 pm

Re: having issues getting hooks going

Post by asker » 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.
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

lorenjz
Posts: 24
Joined: Fri Feb 28, 2020 12:25 am

Re: having issues getting hooks going

Post by lorenjz » Thu Jul 09, 2020 10:28 pm

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?

User avatar
asker
Posts: 1413
Joined: Sun Mar 01, 2015 12:12 pm

Re: having issues getting hooks going

Post by asker » Fri Jul 10, 2020 1:48 am

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.
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

lorenjz
Posts: 24
Joined: Fri Feb 28, 2020 12:25 am

Re: having issues getting hooks going

Post by lorenjz » Fri Jul 10, 2020 5:00 pm

@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?

User avatar
asker
Posts: 1413
Joined: Sun Mar 01, 2015 12:12 pm

Re: having issues getting hooks going

Post by asker » Fri Jul 10, 2020 11:38 pm

https://zmeventnotification.readthedocs ... aking.html
Option 1. Switch to yolo v3
Option 2. Upgrade opencv.
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

lorenjz
Posts: 24
Joined: Fri Feb 28, 2020 12:25 am

Re: having issues getting hooks going

Post by lorenjz » Sat Jul 11, 2020 2:05 pm

@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?

User avatar
asker
Posts: 1413
Joined: Sun Mar 01, 2015 12:12 pm

Re: having issues getting hooks going

Post by asker » Sat Jul 11, 2020 2:58 pm

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.
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

lorenjz
Posts: 24
Joined: Fri Feb 28, 2020 12:25 am

Re: having issues getting hooks going

Post by lorenjz » Wed Aug 19, 2020 11:10 am

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'

User avatar
asker
Posts: 1413
Joined: Sun Mar 01, 2015 12:12 pm

Re: having issues getting hooks going

Post by asker » Wed Aug 19, 2020 11:14 am

/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.
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

lorenjz
Posts: 24
Joined: Fri Feb 28, 2020 12:25 am

Re: having issues getting hooks going

Post by lorenjz » Thu Aug 20, 2020 1:00 pm

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'

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests