ZMES
From the github: The Event Notification Server sits along with ZoneMinder and offers real time notifications, support for push notifications as well as Machine Learning powered recognition. As of today, it supports:
- detection of 80 types of objects (persons, cars, etc.) - face recognition - deep license plate recognition
I will add more algorithms over time. Ref: https://github.com/ZoneMinder/zmeventnotification
In plain terms, why would you want to use ZMES? Because it avoids false positives associated with weather, automobiles, nature, and a number of other factors. ZMES will get motion detection to detect correctly in the 90-99% range. To do this with Zoneminder's built in motion detection is more difficult.
Setup
Refer to https://zmeventnotification.readthedocs.io/en/latest/guides/install.html and then after that page: https://zmeventnotification.readthedocs.io/en/latest/guides/hooks.html
Make sure you look through and configure the three files
- secrets.ini
- zmeventnotification.ini
- objectconfig.ini
Test it is working with
sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini --eventid 2 --monitorid 1 --debug
Tips
Setup an email filter alert on events
Email alerts will work flawlessly, assuming there is a 'detected: person' events in your logs. See: https://forums.zoneminder.com/viewtopic.php?p=126956
Troubleshooting
Missed events in Mocord
If you run the above command:
sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini --eventid 2 --monitorid 1 --debug
You will see the debug information of what ZMES is trying to do. By default, it runs on either a frame:snapshot or an alarm frame. This means that it takes one picture of the video, and runs the neural net detection on that. If for some reason, e.g. a shadow instead of a person is on that alarm frame, then it may fail to detect a person. If you have a long mocord video (say 10 minutes) then there will be only one alarm frame analyzed. The solution appears to be to use modect, where there will be more alarm frames to test.
I installed opencv per the zmeventnotification docs, but import cv2 doesn't work...?
This happens to me following the default guides. I'm probably missing a step, but the below solves it for me (debian 11):
the install path is local to the build folder, but the module is further down a few directories. so the shared object / module needs to be copied to the path... therefore: root@zmes:/home/user/build# python3 -m site sys.path = [ '/home/user/build', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/usr/local/lib/python3.9/dist-packages', '/usr/lib/python3/dist-packages', ] USER_BASE: '/root/.local' (exists) USER_SITE: '/root/.local/lib/python3.9/site-packages' (doesn't exist) ENABLE_USER_SITE: True root@zmes:/home/user/build# cp lib/python3/cv2.cpython-39-x86_64-linux-gnu.so /usr/local/lib/python3.9/dist-packages/. root@zmes:/home/user/build# python3 Python 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> quit()