ZMES

From ZoneMinder Wiki
Jump to navigationJump to search

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. Be warned that while ZMES is good, it is not perfect and there is room for improvement. However, object detection via tools like Yolo is still an emerging field, there is likely to be improvement in the near future.

You can also use external scripts (such as https://github.com/pjreddie/darknet or https://github.com/lbdc/zm-alarm) independently from ZM, as well as do custom object detection (search online) for other tasks such as automation, bird watching, insect monitoring, etc... All these scripts need is an image frame (which are easily obtained in ZM).

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

Email Alert on events via filters

Please see Filters

Face Recognition

Only activate ZMES on certain cameras

This is handled under the skip_monitors option in zmeventnotification.ini. If you have a high number of cameras, but only need ZMES on certain ones, then you will want to use this.

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 or adjust the zones.

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()


See Also