Problem staring zm_detetct.py

Support for the docker image maintained by dlandon
warcanoid
Posts: 35
Joined: Mon Feb 17, 2020 3:22 pm

Problem staring zm_detetct.py

Post by warcanoid »

Installed in docker with: dlandon/zoneminder. I have problem starting `zm_detetct.py` when testing `zm_event_start.sh`:
```
$ ./zm_detect.py -c /etc/zm/zm.conf -e 500
Traceback (most recent call last):
File "./zm_detect.py", line 137, in <module>
log.init(process_name='zmesdetect')
File "/usr/local/lib/python3.7/dist-packages/zmes_hook_helpers/log.py", line 35, in init
g.logger = wrapperLogger(name=process_name, dump_console=dump_console)
File "/usr/local/lib/python3.7/dist-packages/zmes_hook_helpers/log.py", line 10, in __init__
zmlog.init(name=name)
File "/usr/local/lib/python3.7/dist-packages/pyzm/ZMLog.py", line 131, in init
with open(f) as s:
NotADirectoryError: [Errno 20] Not a directory: '/etc/zm/zm.conf'
```
OpenCV is installed, notifications, with images working,...

In Zoneminder web in log I do not get any `_zmesdetect`, I added it also in options-logging
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Problem staring zm_detetct.py

Post by asker »

The key log error here is:

Code: Select all

NotADirectoryError: [Errno 20] Not a directory: '/etc/zm/zm.conf'
1. I assume you have /etc/zm/zm.conf
2. You need to run this script as www-data
3. Edit: I just realized you are using dlandon's docker. It may be an environment related issue on his docker and how he organizes his docker image folders. My instructions assume standard paths. You may also want to raise it in his GitHub repo.
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
warcanoid
Posts: 35
Joined: Mon Feb 17, 2020 3:22 pm

Re: Problem staring zm_detetct.py

Post by warcanoid »

So?

Code: Select all

sudo -u www-data /mnt/Zoneminder/hook/zm_event_start.sh 1 1
Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 134, in <module>
    log.init(process_name='zmesdetect_'+'m'+args['monitorid'])
  File "/usr/local/lib/python3.7/dist-packages/zmes_hook_helpers/log.py", line 35, in init
    g.logger = wrapperLogger(name=process_name, dump_console=dump_console)
  File "/usr/local/lib/python3.7/dist-packages/zmes_hook_helpers/log.py", line 10, in __init__
    zmlog.init(name=name)
  File "/usr/local/lib/python3.7/dist-packages/pyzm/ZMLog.py", line 131, in init
    with open(f) as s:
NotADirectoryError: [Errno 20] Not a directory: '/etc/zm/zm.conf'
I dont have /etc/zm...

EDIT: created /etc/zm/zm.conf:

Code: Select all

sudo -u www-data /mnt/Zoneminder/hook/zm_event_start.sh 500 2
Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 134, in <module>
    log.init(process_name='zmesdetect_'+'m'+args['monitorid'])
  File "/usr/local/lib/python3.7/dist-packages/zmes_hook_helpers/log.py", line 35, in init
    g.logger = wrapperLogger(name=process_name, dump_console=dump_console)
  File "/usr/local/lib/python3.7/dist-packages/zmes_hook_helpers/log.py", line 10, in __init__
    zmlog.init(name=name)
  File "/usr/local/lib/python3.7/dist-packages/pyzm/ZMLog.py", line 144, in init
    config['logpath'] =  config_file['zm_root']['ZM_PATH_LOGS']
  File "/usr/lib/python3.7/configparser.py", line 1251, in __getitem__
    raise KeyError(key)
KeyError: 'ZM_PATH_LOGS'
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Problem staring zm_detetct.py

Post by asker »

You can't just "create" /etc/zm/zm.conf
This is specific to dlandon's docker environment. You may get better support on his GitHub repo on the right paths.

added:
Also, I just ran dlandon's docker - when I installed it I had an /etc/zm/zm.conf, and those commands worked, so not sure if your install is broken
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
warcanoid
Posts: 35
Joined: Mon Feb 17, 2020 3:22 pm

Re: Problem staring zm_detetct.py

Post by warcanoid »

Thank for helping!
This my install command:

Code: Select all

sudo docker run -d --name="Zoneminder" --net="bridge" --privileged="true" -p 888:443/tcp -p 9001:9001/tcp -e TZ="Europe/Berlin" -e SHMEM="50%" -e PUID="1000" -e PGID="1000" -e INSTALL_HOOK="1" -e INSTALL_FACE="1" -e INSTALL_TINY_YOLO="1" -e INSTALL_YOLO="0" -v "/mnt/Zoneminder":"/config":rw -v "/mnt/Zoneminder/data":"/var/cache/zoneminder":rw dlandon/zoneminder
How have you installed? Because have reintalled now, and stll not zm in etc
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Problem staring zm_detetct.py

Post by asker »

I did pretty much what you did.
This may be basic, but make sure you have exec'd into the docker before you look for /etc/zm etc. They will be inside the docker container, not your host.

Got your PM too, sorry, I don't have the available time for personal 1-1 help
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
warcanoid
Posts: 35
Joined: Mon Feb 17, 2020 3:22 pm

Re: Problem staring zm_detetct.py

Post by warcanoid »

I am in starting manual script via docker exec, but get this error now:

Code: Select all

Could not write image to ZoneMinder as eventpath not present
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Problem staring zm_detetct.py

Post by asker »

That is fine. You haven’t specified the path.
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
warcanoid
Posts: 35
Joined: Mon Feb 17, 2020 3:22 pm

Re: Problem staring zm_detetct.py

Post by warcanoid »

Thank you! That why wont load detecting automatic? It works just manual
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Problem staring zm_detetct.py

Post by asker »

If you are saying your hooks are not working, then you need to debug and post better information.
Please read
https://zmeventnotification.readthedocs ... ml#logging
and then
https://zmeventnotification.readthedocs ... leshooting

Some notes for you:
1. I know you've been trying to fix it yourself and things haven't worked. However, given I have very limited time, it is important that folks read and understand the extensive documentation I have put out - not sure if you have or not.
2. Users need to follow instructions on how to post problems (proper debug logs) see links above

3. After you post all debug logs, please also post your config ini files for zmeventnotification and objectconfig
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
warcanoid
Posts: 35
Joined: Mon Feb 17, 2020 3:22 pm

Re: Problem staring zm_detetct.py

Post by warcanoid »

It seem like I have not read the docs, but I have managed all with the docs, also secure notifications, but here with object detecting I am a bit lost.
I have tried url picture, with alarm and snapshot.
I have enabled all debug and logging, I can read log in web ui or via docker exec with tail -F /var/log/zm/zmesdetect*.log:

Code: Select all

==> /var/log/zm/zmesdetect_m1.log <==
02/18/20 14:50:10 zmesdetect_m1[20681] DBG zm_detect.py:476 [ALPR not in use, no need for look aheads in processing]
02/18/20 14:50:10 zmesdetect_m1[20681] INF zm_detect.py:493 [labels found: ['car']]
02/18/20 14:50:10 zmesdetect_m1[20681] DBG zm_detect.py:494 [match found in /var/lib/zmeventnotification/images/812-alarm.jpg, breaking file loop...]
02/18/20 14:50:10 zmesdetect_m1[20681] DBG zm_detect.py:543 [Writing out debug bounding box image to /var/lib/zmeventnotification/images/812-alarm-bbox.jpg...]
02/18/20 14:50:10 zmesdetect_m1[20681] ERR zm_detect.py:561 [Could not write image to ZoneMinder as eventpath not present]
02/18/20 14:50:10 zmesdetect_m1[20681] INF zm_detect.py:566 [Removing matches to past detections]
02/18/20 14:50:10 zmesdetect_m1[20681] DBG image_manip.py:27 [trying to load /var/lib/zmeventnotification/images/monitor-1-data.pkl]
02/18/20 14:50:10 zmesdetect_m1[20681] DBG zm_detect.py:569 [Saving detections for monitor 1 for future match]
02/18/20 14:50:10 zmesdetect_m1[20681] INF zm_detect.py:607 [Prediction string:[a] detected:car:46% ]
02/18/20 14:50:10 zmesdetect_m1[20681] DBG zm_detect.py:609 [Prediction string JSON:[{"type": "object", "label": "car", "box": [330, 79, 668, 317], "confidence": "45.57%"}]]

==> /var/log/zm/zmesdetect_m2.log <==
02/18/20 14:05:32 zmesdetect_m2[19131] DBG zm_detect.py:202 [No polygon area specfied, so adding a full image polygon:[{'name': 'full_image', 'value': [(0, 0), (1280, 0), (1280, 720), (0, 720)]}]]
02/18/20 14:05:32 zmesdetect_m2[19131] DBG zm_detect.py:204 [resizing to 1200 before analysis...]
02/18/20 14:05:32 zmesdetect_m2[19131] DBG utils.py:37 [resized polygons x=0.9375/y=0.9375: [{'name': 'full_image', 'value': [(0, 0), (1200, 0), (1200, 675), (0, 675)]}]]
02/18/20 14:05:32 zmesdetect_m2[19131] DBG zm_detect.py:222 [User ALPR if vehicle found: False]
02/18/20 14:05:34 zmesdetect_m2[19131] DBG face_train.py:19 [Face Recognition library load time took: 48.957 milliseconds]
02/18/20 14:05:34 zmesdetect_m2[19131] DBG face.py:23 [Initializing face recognition with model:cnn upsample:1, jitters:1]
02/18/20 14:05:34 zmesdetect_m2[19131] DBG face.py:48 [trained file not found, reading from images and doing training...]
02/18/20 14:05:34 zmesdetect_m2[19131] DBG face.py:49 [If you are using a GPU and run out of memory, do the training using zm_train_faces.py. In this case, other models like yolo may already take up a lot of GPU memory]
02/18/20 14:05:34 zmesdetect_m2[19131] ERR face_train.py:96 [No known faces found to train, encoding file not created]
02/18/20 14:05:34 zmesdetect_m2[19131] DBG face_train.py:112 [Face Recognition training took: 7.174 milliseconds]



==> /var/log/zm/zmesdetect_m1.log <==
02/18/20 15:11:47 zmesdetect_m1[21739] DBG zm_detect.py:494 [match found in /var/lib/zmeventnotification/images/818-alarm.jpg, breaking file loop...]
02/18/20 15:11:47 zmesdetect_m1[21739] DBG zm_detect.py:543 [Writing out debug bounding box image to /var/lib/zmeventnotification/images/818-alarm-bbox.jpg...]
02/18/20 15:11:47 zmesdetect_m1[21739] ERR zm_detect.py:561 [Could not write image to ZoneMinder as eventpath not present]
02/18/20 15:11:47 zmesdetect_m1[21739] INF zm_detect.py:566 [Removing matches to past detections]
02/18/20 15:11:47 zmesdetect_m1[21739] DBG image_manip.py:27 [trying to load /var/lib/zmeventnotification/images/monitor-1-data.pkl]
02/18/20 15:11:47 zmesdetect_m1[21739] DBG image_manip.py:92 [past detection car@[(470, 6), (754, 6), (754, 80), (470, 6)] approximately matches car@[(478, 4), (756, 4), (756, 82), (478, 4)] removing]
02/18/20 15:11:47 zmesdetect_m1[21739] DBG image_manip.py:92 [past detection car@[(333, 69), (665, 69), (665, 315), (333, 69)] approximately matches car@[(331, 71), (671, 71), (671, 317), (331, 71)] removing]
02/18/20 15:11:47 zmesdetect_m1[21739] DBG zm_detect.py:569 [Saving detections for monitor 1 for future match]
02/18/20 15:11:47 zmesdetect_m1[21739] INF zm_detect.py:607 [Prediction string:[a] detected:car:77% ]
02/18/20 15:11:47 zmesdetect_m1[21739] DBG zm_detect.py:609 [Prediction string JSON:[{"type": "object", "label": "car", "box": [553, 16, 687, 76], "confidence": "77.28%"}, {"type": "object", "label": "car", "box": [478, 4, 756, 82], "confidence": "58.21%"}, {"type": "object", "label": "car", "box": [331, 71, 671, 317], "confidence": "52.11%"}]]

==> /var/log/zm/zmesdetect_m2.log <==
02/18/20 14:05:32 zmesdetect_m2[19131] DBG zm_detect.py:202 [No polygon area specfied, so adding a full image polygon:[{'name': 'full_image', 'value': [(0, 0), (1280, 0), (1280, 720), (0, 720)]}]]
02/18/20 14:05:32 zmesdetect_m2[19131] DBG zm_detect.py:204 [resizing to 1200 before analysis...]
02/18/20 14:05:32 zmesdetect_m2[19131] DBG utils.py:37 [resized polygons x=0.9375/y=0.9375: [{'name': 'full_image', 'value': [(0, 0), (1200, 0), (1200, 675), (0, 675)]}]]
02/18/20 14:05:32 zmesdetect_m2[19131] DBG zm_detect.py:222 [User ALPR if vehicle found: False]
02/18/20 14:05:34 zmesdetect_m2[19131] DBG face_train.py:19 [Face Recognition library load time took: 48.957 milliseconds]
02/18/20 14:05:34 zmesdetect_m2[19131] DBG face.py:23 [Initializing face recognition with model:cnn upsample:1, jitters:1]
02/18/20 14:05:34 zmesdetect_m2[19131] DBG face.py:48 [trained file not found, reading from images and doing training...]
02/18/20 14:05:34 zmesdetect_m2[19131] DBG face.py:49 [If you are using a GPU and run out of memory, do the training using zm_train_faces.py. In this case, other models like yolo may already take up a lot of GPU memory]
02/18/20 14:05:34 zmesdetect_m2[19131] ERR face_train.py:96 [No known faces found to train, encoding file not created]
02/18/20 14:05:34 zmesdetect_m2[19131] DBG face_train.py:112 [Face Recognition training took: 7.174 milliseconds]

web ui log with manual forced alarm with car, and manual forced script via docker exec:

Code: Select all

2020-02-18 15:25:54.901443 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 21700 - Analysing at 20.00 fps]
2020-02-18 15:25:53.738516 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:21700 - Capturing at 20.00 fps, capturing bandwidth 84794bytes/sec]
2020-02-18 15:25:53.598949 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 21700 - Analysing at 20.00 fps]
2020-02-18 15:25:52.895750 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:25:52.891770 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]
2020-02-18 15:25:52.836130 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:21700 - Capturing at 20.00 fps, capturing bandwidth 53553bytes/sec]
2020-02-18 15:25:49.899578 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 21600 - Analysing at 20.00 fps]
2020-02-18 15:25:48.738569 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:21600 - Capturing at 20.00 fps, capturing bandwidth 66994bytes/sec]
2020-02-18 15:25:48.572034 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 21600 - Analysing at 20.00 fps]
2020-02-18 15:25:47.905280 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:25:47.895710 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]
2020-02-18 15:25:47.815013 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:21600 - Capturing at 20.00 fps, capturing bandwidth 72333bytes/sec]
2020-02-18 15:25:44.897352 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 21500 - Analysing at 20.00 fps]
2020-02-18 15:25:43.765276 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:21500 - Capturing at 20.00 fps, capturing bandwidth 67839bytes/sec]
2020-02-18 15:25:43.574685 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 21500 - Analysing at 20.00 fps]
2020-02-18 15:25:42.898140 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:25:42.891740 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]
2020-02-18 15:25:42.799618 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:21500 - Capturing at 20.00 fps, capturing bandwidth 87916bytes/sec]
2020-02-18 15:25:39.923180 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 21400 - Analysing at 20.00 fps]
2020-02-18 15:25:38.736868 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:21400 - Capturing at 20.00 fps, capturing bandwidth 87064bytes/sec]
2020-02-18 15:25:38.552099 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 21400 - Analysing at 20.00 fps]
2020-02-18 15:25:37.902320 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:25:37.895730 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]
2020-02-18 15:25:37.805146 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:21400 - Capturing at 20.00 fps, capturing bandwidth 59154bytes/sec]
2020-02-18 15:25:34.881642 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 21300 - Analysing at 20.00 fps]
2020-02-18 15:25:33.742775 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:21300 - Capturing at 20.00 fps, capturing bandwidth 69359bytes/sec]
2020-02-18 15:25:33.570157 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 21300 - Analysing at 20.00 fps]
2020-02-18 15:25:32.896880 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:25:32.891980 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]
2020-02-18 15:25:32.805200 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:21300 - Capturing at 20.00 fps, capturing bandwidth 70074bytes/sec]
2020-02-18 15:25:30.861488 zmesdetect_m1[22238].INF-zm_detect.py/566 [Removing matches to past detections]
2020-02-18 15:25:30.857631 zmesdetect_m1[22238].ERR-zm_detect.py/561 [Could not write image to ZoneMinder as eventpath not present]
2020-02-18 15:25:30.842708 zmesdetect_m1[22238].INF-zm_detect.py/493 [labels found: ['car', 'car', 'car']]
2020-02-18 15:25:30.837381 zmesdetect_m1[22238].INF-yolo.py/140 [object:car at [331, 71, 671, 317] has a acceptable confidence:0.5211133360862732 compared to min confidence of: 0.3, adding]
2020-02-18 15:25:30.833839 zmesdetect_m1[22238].INF-yolo.py/140 [object:car at [478, 4, 756, 82] has a acceptable confidence:0.5820584893226624 compared to min confidence of: 0.3, adding]
2020-02-18 15:25:30.827465 zmesdetect_m1[22238].INF-yolo.py/140 [object:car at [553, 16, 687, 76] has a acceptable confidence:0.7728151082992554 compared to min confidence of: 0.3, adding]
2020-02-18 15:25:29.890995 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 21200 - Analysing at 20.00 fps]
2020-02-18 15:25:28.732008 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:21200 - Capturing at 20.00 fps, capturing bandwidth 67827bytes/sec]
2020-02-18 15:25:28.568713 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 21200 - Analysing at 20.00 fps]
2020-02-18 15:25:27.899230 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:25:27.895700 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]
2020-02-18 15:25:27.811328 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:21200 - Capturing at 20.00 fps, capturing bandwidth 72350bytes/sec]
2020-02-18 15:25:24.996110 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 21100 - Analysing at 20.00 fps]
2020-02-18 15:25:23.719956 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:21100 - Capturing at 20.00 fps, capturing bandwidth 85591bytes/sec]
2020-02-18 15:25:23.567208 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 21100 - Analysing at 20.00 fps]
2020-02-18 15:25:22.895330 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:25:22.891710 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]
2020-02-18 15:25:22.807189 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:21100 - Capturing at 20.00 fps, capturing bandwidth 53275bytes/sec]
2020-02-18 15:25:20.566431 zmesdetect_m1[22238].INF-utils.py/96 [Sleeping for 5 seconds before downloading]
2020-02-18 15:25:20.562309 zmesdetect_m1[22238].INF-zm_detect.py/160 [Importing local classes for Yolo/Face]
2020-02-18 15:25:20.550706 zmesdetect_m1[22238].INF-zm_detect.py/138 [---------| app version: 5.7.4 |------------]
2020-02-18 15:25:19.875888 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 21000 - Analysing at 20.00 fps]
2020-02-18 15:25:19.631550 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Ending process:22204 to handle alarms]
2020-02-18 15:25:18.734233 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:21000 - Capturing at 20.00 fps, capturing bandwidth 67190bytes/sec]
2020-02-18 15:25:18.571012 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 21000 - Analysing at 20.00 fps]
2020-02-18 15:25:17.900000 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:25:17.895840 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 1 active child forks...]
2020-02-18 15:25:17.821056 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:21000 - Capturing at 20.00 fps, capturing bandwidth 67815bytes/sec]
2020-02-18 15:25:15.619900 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Not sending event end alarm, as we did not send a start alarm for this, or start hook processing failed]
2020-02-18 15:25:14.885972 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 20900 - Analysing at 20.00 fps]
2020-02-18 15:25:13.707431 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:20900 - Capturing at 20.00 fps, capturing bandwidth 66874bytes/sec]
2020-02-18 15:25:13.615660 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 hook end returned with text:  json:[] exit:127]
2020-02-18 15:25:13.609280 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Invoking hook on event end:/mnt/Zoneminder/hook/zm_event_end.sh 822 1 "vhod" "Forced Web: " "/var/cache/zoneminder/events/1/20/02/18/15/25/03"]
2020-02-18 15:25:13.574527 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 20900 - Analysing at 20.00 fps]
2020-02-18 15:25:12.896870 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:25:12.893090 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 1 active child forks...]
2020-02-18 15:25:12.839021 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:20900 - Capturing at 20.00 fps, capturing bandwidth 55867bytes/sec]
2020-02-18 15:25:11.604620 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Event 822 for Monitor 1 has finished]
2020-02-18 15:25:11.600600 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Sending event_start notification for EID:822 over MQTT]
2020-02-18 15:25:11.596620 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Monitor 1 event: should send out as  931.119179964066 is >= interval of ]
2020-02-18 15:25:11.592640 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Checking alarm rules for MQTT 192.168.1.27]
2020-02-18 15:25:11.585670 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 FCM push message returned a 200 with body {"multicast_id":3073562449016906026,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"1582035911165906"}]}]
2020-02-18 15:25:11.100589 zma_m1[21457].INF-zm_event.cpp/588 [Updating frames delta by -1.30 sec to match video file]
2020-02-18 15:25:11.090950 zma_m1[21457].INF-zm_monitor.cpp/1661 [vhod: 20850 - Closing event 822, alarm end]
2020-02-18 15:25:11.085369 zma_m1[21457].INF-zm_monitor.cpp/1656 [vhod: 20850 - Left alarm state (822) - 160(65) images]
2020-02-18 15:25:10.654170 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Sending event_start notification over FCM]
2020-02-18 15:25:10.650090 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Monitor 1 event: should send out as  930.996390104294 is >= interval of 0]
2020-02-18 15:25:10.646020 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Checking alarm rules for token ending in:...5sxQF8jrbQ]
2020-02-18 15:25:10.634590 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 FCM push message returned a 200 with body {"multicast_id":9068760980946703725,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"1582035910440338"}]}]
2020-02-18 15:25:09.952120 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Sending event_start notification over FCM]
2020-02-18 15:25:09.945100 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Monitor 1 event: should send out as  934.039570093155 is >= interval of 0]
2020-02-18 15:25:09.944702 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 20800 - Analysing at 20.00 fps]
2020-02-18 15:25:09.940380 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Checking alarm rules for token ending in:...w4M8bOGNjL]
2020-02-18 15:25:09.932500 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Matching alarm to connection rules...]
2020-02-18 15:25:08.714558 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:20800 - Capturing at 20.00 fps, capturing bandwidth 85829bytes/sec]
2020-02-18 15:25:08.597633 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 20800 - Analysing at 20.00 fps]
2020-02-18 15:25:07.927970 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 hook start returned with text: json:[] exit:127]
2020-02-18 15:25:07.919120 zmeventnotification[22204].INF-zmeventnotification.pl [|----> FORK:vhod (1), eid:822 Invoking hook on event start:/mnt/Zoneminder/hook/zm_event_start.sh 822 1 "vhod" "Forced Web" "/var/cache/zoneminder/events/1/20/02/18/15/25/03"]
2020-02-18 15:25:07.911850 zmeventnotification[22204].INF-zmeventnotification.pl [PARENT: Forked process:22204 to handle alarm eid:822]
2020-02-18 15:25:07.905640 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 1 new Events to process]
2020-02-18 15:25:07.902130 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: New event 822 reported for Monitor:1 (Name:vhod) Forced Web]
2020-02-18 15:25:07.895670 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]
2020-02-18 15:25:07.814061 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:20800 - Capturing at 20.00 fps, capturing bandwidth 69227bytes/sec]
2020-02-18 15:25:06.576405 zma_m1[21457].INF-zm_monitor.cpp/1648 [vhod: 20760 - Gone into alert state]
2020-02-18 15:25:04.865128 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 20700 - Analysing at 20.00 fps]
2020-02-18 15:25:03.716901 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:20700 - Capturing at 20.00 fps, capturing bandwidth 67532bytes/sec]
2020-02-18 15:25:03.590309 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 20700 - Analysing at 20.00 fps]
2020-02-18 15:25:03.425621 zmc_m1[21449].INF-zm_ffmpeg_camera.cpp/889 [Event video offset is -1.296 sec (<0 means video starts early)]
2020-02-18 15:25:03.419092 zmc_m1[21449].INF-zm_videostore.cpp/62 [Opening video storage stream /var/cache/zoneminder/events/1/20/02/18/15/25/03/822-video.mp4 format: mp4]
2020-02-18 15:25:03.353176 zma_m1[21457].INF-zm_monitor.cpp/1615 [vhod: 20695 - Opening new event 822, alarm start]
2020-02-18 15:25:03.339785 zma_m1[21457].INF-zm_monitor.cpp/1564 [vhod: 20695 - Gone into alarm state PreAlarmCount: 0 > AlarmFrameCount:1 Cause:Forced Web]
2020-02-18 15:25:02.898210 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:25:02.891700 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]
2020-02-18 15:25:02.797626 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:20700 - Capturing at 20.00 fps, capturing bandwidth 68342bytes/sec]
2020-02-18 15:24:59.884363 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 20600 - Analysing at 20.00 fps]
2020-02-18 15:24:58.695342 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:20600 - Capturing at 20.00 fps, capturing bandwidth 67634bytes/sec]
2020-02-18 15:24:58.677787 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 20600 - Analysing at 20.00 fps]
2020-02-18 15:24:57.900970 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:24:57.896100 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]
2020-02-18 15:24:57.820506 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:20600 - Capturing at 20.00 fps, capturing bandwidth 52288bytes/sec]
2020-02-18 15:24:54.934783 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 20500 - Analysing at 20.00 fps]
2020-02-18 15:24:53.717216 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:20500 - Capturing at 20.00 fps, capturing bandwidth 86388bytes/sec]
2020-02-18 15:24:53.575461 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 20500 - Analysing at 20.00 fps]
2020-02-18 15:24:52.900410 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:24:52.892250 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]
2020-02-18 15:24:52.799796 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:20500 - Capturing at 20.00 fps, capturing bandwidth 70532bytes/sec]
2020-02-18 15:24:49.889544 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 20400 - Analysing at 20.00 fps]
2020-02-18 15:24:48.710181 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:20400 - Capturing at 20.00 fps, capturing bandwidth 67444bytes/sec]
2020-02-18 15:24:48.465941 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 20400 - Analysing at 20.00 fps]
2020-02-18 15:24:47.904770 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:24:47.896270 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]
2020-02-18 15:24:47.721800 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:20400 - Capturing at 20.00 fps, capturing bandwidth 80356bytes/sec]
2020-02-18 15:24:44.892772 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 20300 - Analysing at 20.00 fps]
2020-02-18 15:24:43.697479 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:20300 - Capturing at 20.00 fps, capturing bandwidth 67292bytes/sec]
2020-02-18 15:24:43.464935 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 20300 - Analysing at 20.00 fps]
2020-02-18 15:24:42.897730 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:24:42.891620 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]
2020-02-18 15:24:42.694578 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:20300 - Capturing at 20.00 fps, capturing bandwidth 63099bytes/sec]
2020-02-18 15:24:39.927774 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 20200 - Analysing at 20.00 fps]
2020-02-18 15:24:38.693594 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:20200 - Capturing at 20.00 fps, capturing bandwidth 85781bytes/sec]
2020-02-18 15:24:38.487732 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 20200 - Analysing at 20.00 fps]
2020-02-18 15:24:37.901790 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:24:37.895580 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]
2020-02-18 15:24:37.702749 zmc_m1[21449].INF-zm_monitor.cpp/2546 [vhod: images:20200 - Capturing at 20.00 fps, capturing bandwidth 103901bytes/sec]
2020-02-18 15:24:34.916919 zma_m2[21463].INF-zm_monitor.cpp/1297 [Terasa: 20100 - Analysing at 20.00 fps]
2020-02-18 15:24:33.696660 zmc_m2[21455].INF-zm_monitor.cpp/2546 [Terasa: images:20100 - Capturing at 20.00 fps, capturing bandwidth 67479bytes/sec]
2020-02-18 15:24:33.486537 zma_m1[21457].INF-zm_monitor.cpp/1297 [vhod: 20100 - Analysing at 20.00 fps]
2020-02-18 15:24:32.897020 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 new Events to process]
2020-02-18 15:24:32.892010 zmeventnotification[21487].INF-zmeventnotification.pl [PARENT: There are 0 active child forks...]


objectconfig.ini:

Code: Select all

# Configuration file for object detection

# NOTE: ALL parameters here can be overriden
# on a per monitor basis if you want. Just
# duplicate it inside the correct [monitor-<num>] section

[general]
# This is an optional file
# If specified, you can specify tokens with secret values in that file
# and onlt refer to the tokens in your main config file
secrets = /etc/zm/secrets.ini
#wait=5
# portal/user/password are needed if you plan on using ZM's legacy
# auth mechanism to get images
portal=https://xxxxxx.xxx/zm
user=admin
password=xxxxxxxxxxxxx

# api portal is needed if you plan to use tokens to get images
# requires ZM 1.33 or above
api_portal=https://xxxxxxxxxx/zm/api

allow_self_signed=yes
# if yes, last detection will be stored for monitors
# and bounding boxes that match, along with labels
# will be discarded for new detections. This may be helpful
# in getting rid of static objects that get detected
# due to some motion. 
match_past_detections=yes
# The max difference in area between the objects if match_past_detection is on
# can also be specified in px like 300px. Default is 5%. Basically, bounding boxes of the same
# object can slightly differ ever so slightly between detection. Contributor @neillbell put in this PR
# to calculate the difference in areas and based on his tests, 5% worked well. YMMV. Change it if needed.
past_det_max_diff_area=5%

# sequence of models to run for detection
models=yolo,face
# if all, then we will loop through all models
# if first then the first success will break out
detection_mode=all

# If you need basic auth to access ZM 
#basic_user=user
#basic_password=password

# base data path for various files the ES+OD needs
# we support in config variable substitution as well
base_data_path=/var/lib/zmeventnotification

# this is the global detection pattern used for all monitors.
# choose any set of classes from here https://github.com/pjreddie/darknet/blob/master/data/coco.names
# for everything, make it .*
detect_pattern=(person|car|motorbike|bus|truck|boat)
#detect_pattern=.*

# global settings for 
# bestmatch, alarm, snapshot OR a specific frame ID
frame_id=bestmatch

# this is the to resize the image before analysis is done
resize=1200
# set to yes, if you want to remove images after analysis
# setting to yes is recommended to avoid filling up space
# keep to no while debugging/inspecting masks
# Note this does NOT delete debug images later
delete_after_analyze=no

# If yes, will write an image called <filename>-bbox.jpg as well
# which contains the bounding boxes. This has NO relation to 
# write_image_to_zm 
# Typically, if you enable delete_after_analyze you may
# also want to set  write_debug_image to no. 
write_debug_image=yes

# if yes, will write an image with bounding boxes
# this needs to be yes to be able to write a bounding box
# image to ZoneMinder that is visible from its console
write_image_to_zm=yes

# Adds percentage to detections
# hog/face shows 100% always
show_percent=yes

# color to be used to draw the polygons you specified
poly_color=(255,255,255)
#import_zm_zones=no


## Monitor specific settings
#
# - Format:  [monitor-<mid>]
#
# Parameters:
# polygon areas where object detection will be done.
# You can name them anything except the keywords defined in the optional
# params below. You can put as many polygons as you want per [monitor-<mid>]
# (see examples).
#
# detect_pattern: overrides the detection patterns used for this monitor.
#
# Examples:

[monitor-8]
# my driveway
match_past_detections=no
wait=5
detect_pattern=(person|car|motorbike|bus|truck|boat)

#alpr_pattern=^(.*x11)
#delete_after_analyze=no
#detect_pattern=.*
#import_zm_zones=yes
my_driveway_perimeter=306,356 1003,341 1074,683 154,715
# use license plate recognition for my driveway
# see alpr section later for more data needed
resize=no
models=yolo,alpr
# tiny switches to tiny yolo weights, instead of full Yolo. Much faster, but less accurate
yolo_type=tiny

[monitor-10]
# my front lawn
# here we want anything except potted plant
# exclusion in regular expressions is not
# as straightforward as you may think, so 
# follow this pattern
# detect_pattern = ^(?!object1|object2|objectN)
# the characters in front implement what is 
# called a negative look ahead

detect_pattern=^(?!potted plant|pottedplant|bench|broccoli)
#detect_pattern=.*

# local model overrides global
models=yolo

# setting import_zm_zones to yes will import ZM defined zones
#import_zm_zones=yes

[monitor-5]
# my basement
detect_pattern=(person)
#detect_pattern=.*
#poly_color=(255,0,0)
#detect_pattern=^(?!chair|bed)
param=219,304 1113,278 1066,863 177,852
models=yolo,face

[monitor-1]
# deck
#detect_pattern=^(?!chair|table|bench|bird|bicycle|frisbee)
#detect_pattern=^(?!chair|table|bench|bird)
models=yolo
yolo_type=tiny
#boundary=100,100 2988,10 2988,2220 10,2220
wait=5

[monitor-2]
#doorbell
detect_pattern=(person)
#detect_pattern=.*
# try face, if it works, don't do yolo
detection_mode=first
models=face,yolo
frame_id=bestmatch
# try diff. sizes. In my case, 600 was enough
#resize=600
# My doorbell camera needs more accurate face detection
# cnn did a much better job than HOG, but its _much_ slower
face_model=cnn
face_train_model=cnn
face_recog_dist_threshold=0.6
match_past_detections=no
wait=5

#if you hard code a frame, you need to make sure it is created
#before we acess it. wait (sec) helps
#frame_id=32
#wait=3



#[monitor-4]
# detect_pattern=(cat|dog)
# kitchen_door=313,221 392,210 418,592 367,659

# No 'detect_pattern', global value would be used.
# [monitor-7]
# entrance_door=313,221 392,210 418,592 367,659

# Machine learning options that are not specific to a model
[ml]
# You can now run the machine learning code on a different server
# This frees up your ZM server for other things
# To do this, you need to setup https://github.com/pliablepixels/mlapi
# on your desired server and confiure it with a user. See its instructions
# once set up, you can choose to do object/face recognition via that 
# external serer

# URL that will be used
#ml_gateway=http://0.0.0.0:5000/api/v1

# If you enable ml_gateway, and it is down
# you can set ml_fallback_local to yes
# if you want to instantiate local object detection
# on gateway failure. Default is no
#ml_fallback_local=yes

# API/password for remote gateway
ml_user=admin
ml_password=admin


# config files for yolo
[yolo]
#yolo_type=full
yolo_type=tiny

#yolo_min_confidence=0.5
yolo_min_confidence=0.3

config={{base_data_path}}/models/yolov3/yolov3.cfg
weights={{base_data_path}}/models/yolov3/yolov3.weights
labels={{base_data_path}}/models/yolov3/yolov3_classes.txt

tiny_config={{base_data_path}}/models/tinyyolo/yolov3-tiny.cfg
tiny_weights={{base_data_path}}/models/tinyyolo/yolov3-tiny.weights
tiny_labels={{base_data_path}}/models/tinyyolo/yolov3-tiny.txt

# config params for HOG
[hog]
stride=(4,4)
padding=(8,8)
scale=1.05
mean_shift=-1

[face]
# this directly will be where you store known images on a per directory basis
known_images_path={{base_data_path}}/known_faces

# if yes, then unknown faces will be stored and you can analyze them later
# and move to known_faces and retrain
save_unknown_faces=yes

# How many pixels to extend beyond the face for a better perspective
save_unknown_faces_leeway_pixels=50

# this directly is where zm_detect will store faces it could not identify
# (if save_unknown_faces is yes). You can then inspect this folder later, 
# and copy unknown faces to the right places in known_faces and retrain
unknown_images_path={{base_data_path}}/unknown_faces


# read https://github.com/ageitgey/face_recognition/wiki/Face-Recognition-Accuracy-Problems
# read https://github.com/ageitgey/face_recognition#automatically-find-all-the-faces-in-an-image
# and play around

# quick overview: 
# num_jitters is how many times to distort images 
# upsample_times is how many times to upsample input images (for small faces, for example)
# model can be hog or cnn. cnn may be more accurate, but I haven't found it to be 

face_num_jitters=1
face_model=hog
face_upsample_times=1

# This is maximum distance of the face under test to the closest matched
# face cluster. The larger this distance, larger the chances of misclassification.
#
face_recog_dist_threshold=0.6
# When we are first training the face recognition model with known faces,
# by default we use hog because we assume you will supply well lit, front facing faces
# However, if you are planning to train with profile photos or hard to see faces, you
# may want to change this to cnn. Note that this increases training time, but training only
# happens once, unless you retrain again by removing the training model
face_train_model=hog
#if a face doesn't match known names, we will detect it as 'unknown face'
# you can change that to something that suits your personality better ;-)
#unknown_face_name=invader

[alpr]

alpr_use_after_detection_only=yes

# -----| If you are using plate recognizer | ------
alpr_service=plate_recognizer
# If you want to host a local SDK https://app.platerecognizer.com/sdk/
#alpr_url=https://localhost:8080
# Plate recog replace with your api key
alpr_key=!PLATEREC_ALPR_KEY
# if yes, then it will log usage statistics of the ALPR service
platerec_stats=no
# If you want to specify regions. See http://docs.platerecognizer.com/#regions-supported
#platerec_regions=['us','cn','kr']
# minimal confidence for actually detecting a plate
platerec_min_dscore=0.1
# minimal confidence for the translated text
platerec_min_score=0.2


# ----| If you are using openALPR |-----
#alpr_service=open_alpr
#alpr_key=!OPENALPR_ALPR_KEY

# For an explanation of params, see http://doc.openalpr.com/api/?api=cloudapi
#openalpr_recognize_vehicle=1
#openalpr_country=us
#openalpr_state=ca
# openalpr returns percents, but we convert to between 0 and 1
#openalpr_min_confidence=0.3

zmeventnotification.ini:

Code: Select all

# Configuration file for zmeventnotification.pl 
[general]

secrets = /etc/zm/secrets.ini
#base_data_path=/var/lib/zmeventnotification
base_data_path=/mnt/Zoneminder
# The ES now supports a means for a special kind of 
# websocket connection which can dynamically control ES
# behaviour 
# Default is no
use_escontrol_interface=no

# this is where all escontrol admin overrides
# will be stored.
escontrol_interface_file=/var/lib/zmeventnotification/misc/escontrol_interface.dat

# the password for accepting control interfaces
escontrol_interface_password=xxxxxxxxx

# If you see the ES getting 'stuck' after several hours
# see https://rt.cpan.org/Public/Bug/Display.html?id=131058
# You can use restart_interval to have it automatically restart
# every  X seconds. (Default is 7200 = 2 hours) Set to 0 to disable this.
# restart_interval = 432000
restart_interval = 0

[network]
# Port for Websockets connection (default: 9000).
port = 9001

[auth]
# Check username/password against ZoneMinder database (default: yes).
enable = yes

# Authentication timeout, in seconds (default: 20).
timeout = 20

[fcm]
# Use FCM for messaging (default: yes).
enable = yes

# Custom FCM API key. Uncomment if you are using
# your own API key (most people will not need to uncomment)
# api_key =

# Auth token store location (default: /var/lib/zmeventnotification/push/tokens.txt).
token_file = /var/lib/zmeventnotification/push/tokens.txt

# Date format to use when sending notification
# over push (FCM)
# See https://metacpan.org/pod/POSIX::strftime::GNU
# For example, a 24 hr format would be
#date_format = %H:%M, %d-%b

date_format = %I:%M %p, %d-%b

# Use MQTT for messaging (default: no)
[mqtt]
enable = 1

# MQTT server (default: 127.0.0.1)
server = 192.168.1.27

# Authenticate to MQTT server as user
username = xxxxxxxxxxx

# Password 
password = xxxxxxxxxxxx

# Some MQTT brokers don't seem to honor
# keep alives resulting in missed notifications
# default:no
close_on_send = no


[ssl]
# Enable SSL (default: yes)
enable = yes

cert = !ES_CERT_FILE
key = !ES_KEY_FILE

[customize]
# Display messages to console (default: no).
console_logs = yes

# Interval, in seconds, after which we will check for new events (default: 5).
event_check_interval = 5

# Interval, in seconds, to reload known monitors (default: 300).
monitor_reload_interval = 300

# Read monitor alarm cause (Requires ZoneMinder >= 1.31.2, default: no)
# Enabling this to 1 for lower versions of ZM will result in a crash
read_alarm_cause = yes

# Tag event IDs with the alarm (default: no).
tag_alarm_event_id = yes

# Use custom notification sound (default: no).
use_custom_notification_sound = no

# include picture in alarm (Android only) (default: no).
include_picture = yes

# send event end notifications (default: no)
# Note that if you are using hooks for end notifications, they may change
# the final decision. This needs to be yes if you want end notifications with 
# or without hooks
#send_event_end_notification = yes

# URL to access the event image
# This URL can be anything you want
# What I've put here is a way to extract an image with the highest score given an eventID (even one that is recording)
# This requires the latest version of index.php which was merged on Oct 9, 2018 and may only work in ZM 1.32+
# https://github.com/ZoneMinder/zoneminder/blob/master/web/index.php
# If you use this URL as I've specified below, keep the EVENTID phrase intact. 
# The notification server will replace it with the correct eid of the alarm

# BESTMATCH should be used only if you are using bestmatch for FID in detect_wrapper.sh
# objdetect is ONLY available in ZM 1.33+
picture_url = !ZMES_PICTURE_URL
picture_portal_username=!ZM_USER
picture_portal_password=!ZM_PASSWORD

# This is a master on/off setting for hooks. If it is set to no
# hooks will not be used no matter what is set in the [hook] section
# This makes it easy for folks not using hooks to just turn this off
# default:no

use_hooks = yes

[hook]

# NOTE: This entire section is only valid if use_hooks is yes above

# Shell script name here to be called every time an alarm is detected
# the script will get passed $1=alarmEventID,  $2=alarmMonitorId
# $3 monitor Name, $4 alarm cause 
# script needs to return 0 to send alarm (default: none)
#

# This script is called when an event first starts. If the script returns "0"
# (success), then a notification is sent to channels specified in 
# event_start_notify_on_hook_success. If the script returns "1" (fail)
# then a notification is sent to channels specified in 
# event_start_notify_on_hook_fail
event_start_hook = /mnt/Zoneminder/hook/zm_event_start.sh


# This script is called when an event first starts. If the script returns "0"
# (success), then a notification is sent to channels specified in 
# event_end_notify_on_hook_success. If the script returns "1" (fail)
# then a notification is sent to channels specified in 
# event_end_notify_on_hook_fail
event_end_hook = /mnt/Zoneminder/hook/zm_event_end.sh


# Possible channels = web,fcm,mqtt
# all is short for web,fcm,mqtt
# use none for no notifications, or comment out the attribute 

# When an event starts and hook returns 0, send notification to all. Default: none
event_start_notify_on_hook_success = all

# When an event starts and hook returns 1, send notification only to desktop. Default: none
event_start_notify_on_hook_fail = all

# When an event ends and hook returns 0, send notification to fcm and web. Default: none
event_end_notify_on_hook_success = none

# When an event ends and hook returns 1, don't send notifications. Default: none
event_end_notify_on_hook_fail = all
#event_end_notify_on_hook_fail = web

# Since event_end and event_start are two different hooks, it is entirely possible
# that you can get an end notification but not a start notification. This can happen
# if your start script returns 1 but the end script returns 0, for example. To avoid
# this, set this to yes (default:yes)
event_end_notify_if_start_success = yes

# If yes, the text returned by the script
# overwrites the alarm header 
# useful if your script is detecting people, for example
# and you want that to be shown in your notification (default:yes)
use_hook_description = yes

# If yes will will append an [a] for alarmed frame match
# [s] for snapshot match or [x] if not using bestmatch
# really only a debugging feature but useful to know
# where object detection is working or failing
keep_frame_match_type = no

# list of monitors for which hooks will not run
# skip_monitors = 2


# if enabled, will pass the right folder for the hook script
# to store the detected image, so it shows up in ZM console view too
# Requires ZM >=1.33. Don't enable this if you are running an older version

# Note: you also need to set write_image_to_zm=yes in objectconfig.ini
# default: no
hook_pass_image_path = yes
So automatic the hook-object detecting wont start I think, because there is nothing in log, just starting zm_event_start.sh and zm_event_end.sh when alarm triggers.
But when I trigger manual, I got instant zmdetect in logs
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Problem staring zm_detetct.py

Post by asker »

Please post debug logs of /var/log/zm/zmeventnotification.log of an example where you are not running the detection manually and invoke an alarm. I'd like to see what zmeventnotification is doing.
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
warcanoid
Posts: 35
Joined: Mon Feb 17, 2020 3:22 pm

Re: Problem staring zm_detetct.py

Post by warcanoid »

this?

Code: Select all

tail -F  /var/log/zm/zmeventnotification.log
02/18/20 16:00:57.896319 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 16:00:57.904630 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 16:01:02.895488 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 16:01:02.901605 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 16:01:07.896590 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 16:01:07.904612 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 16:01:12.891692 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 16:01:12.898452 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 16:01:17.895546 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 16:01:17.901640 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 16:01:22.891686 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 16:01:22.898241 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 16:01:27.895588 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 16:01:27.901608 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 16:01:32.891587 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 16:01:32.900006 zmeventnotification[21487].INF [main:833] [PARENT: New event 838 reported for Monitor:1 (Name:vhod) Forced Web]
02/18/20 16:01:32.906346 zmeventnotification[21487].INF [main:833] [PARENT: There are 1 new Events to process]
02/18/20 16:01:32.912295 zmeventnotification[23529].INF [main:833] [PARENT: Forked process:23529 to handle alarm eid:838]
02/18/20 16:01:32.917228 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Invoking hook on event start:/mnt/Zoneminder/hook/zm_event_start.sh 838 1 "vhod" "Forced Web" "/var/cache/zoneminder/events/1/20/02/18/16/01/32"]
02/18/20 16:01:32.922678 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 hook start returned with text: json:[] exit:127]
02/18/20 16:01:34.926583 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Matching alarm to connection rules...]
02/18/20 16:01:34.931984 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Checking alarm rules for token ending in:...w4M8bOGNjL]
02/18/20 16:01:34.936615 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Monitor 1 event: should send out as  119.068059921265 is >= interval of 0]
02/18/20 16:01:34.941417 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Sending event_start notification over FCM]
02/18/20 16:01:35.696365 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 FCM push message returned a 200 with body {"multicast_id":7864008639738579149,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"1582038095518247"}]}]
02/18/20 16:01:35.706520 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Checking alarm rules for token ending in:...5sxQF8jrbQ]
02/18/20 16:01:35.710144 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Monitor 1 event: should send out as  119.259059906006 is >= interval of 0]
02/18/20 16:01:35.714486 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Sending event_start notification over FCM]
02/18/20 16:01:36.478104 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 FCM push message returned a 200 with body {"multicast_id":2485864778613711878,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"1582038096344792"}]}]
02/18/20 16:01:36.484211 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Checking alarm rules for MQTT 192.168.1.27]
02/18/20 16:01:36.487398 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Monitor 1 event: should send out as  119.3005900383 is >= interval of ]
02/18/20 16:01:36.490448 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Sending event_start notification for EID:838 over MQTT]
02/18/20 16:01:37.897308 zmeventnotification[21487].INF [main:833] [PARENT: There are 1 active child forks...]
02/18/20 16:01:37.907645 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 16:01:40.491997 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Event 838 for Monitor 1 has finished]
02/18/20 16:01:42.498801 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Invoking hook on event end:/mnt/Zoneminder/hook/zm_event_end.sh 838 1 "vhod" "Forced Web: " "/var/cache/zoneminder/events/1/20/02/18/16/01/32"]
02/18/20 16:01:42.510395 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 hook end returned with text:  json:[] exit:127]
02/18/20 16:01:42.891715 zmeventnotification[21487].INF [main:833] [PARENT: There are 1 active child forks...]
02/18/20 16:01:42.898440 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 16:01:44.513842 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Not sending event end alarm, as we did not send a start alarm for this, or start hook processing failed]
02/18/20 16:01:47.895719 zmeventnotification[21487].INF [main:833] [PARENT: There are 1 active child forks...]
02/18/20 16:01:47.902089 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 16:01:48.525163 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Ending process:23529 to handle alarms]
02/18/20 16:01:52.891836 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 16:01:52.895476 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 16:01:57.895829 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 16:01:57.899993 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]

Code: Select all

[PARENT: There are 0 new Events to process]
02/18/20 17:09:07.896159 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 17:09:07.903997 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 17:09:12.891928 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 17:09:12.898900 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 17:09:17.895936 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 17:09:17.903035 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 17:09:22.895652 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 17:09:22.902408 zmeventnotification[21487].INF [main:833] [PARENT: New event 873 reported for Monitor:1 (Name:vhod) Motion All]
02/18/20 17:09:22.905829 zmeventnotification[21487].INF [main:833] [PARENT: There are 1 new Events to process]
02/18/20 17:09:22.913341 zmeventnotification[26117].INF [main:833] [PARENT: Forked process:26117 to handle alarm eid:873]
02/18/20 17:09:22.918468 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Invoking hook on event start:/mnt/Zoneminder/hook/zm_event_start.sh 873 1 "vhod" "Motion All" "/var/cache/zoneminder/events/1/20/02/18/17/09/17"]
02/18/20 17:09:22.924730 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 hook start returned with text: json:[] exit:127]
02/18/20 17:09:24.928970 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Matching alarm to connection rules...]
02/18/20 17:09:24.936452 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Checking alarm rules for token ending in:...w4M8bOGNjL]
02/18/20 17:09:24.940191 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Monitor 1 event: should send out as  304.052959918976 is >= interval of 0]
02/18/20 17:09:24.943740 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Sending event_start notification over FCM]
02/18/20 17:09:25.261454 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 FCM push message returned a 200 with body {"multicast_id":2467680285901165809,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"1582042165063771"}]}]
02/18/20 17:09:25.267984 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Checking alarm rules for token ending in:...5sxQF8jrbQ]
02/18/20 17:09:25.271303 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Monitor 1 event: should send out as  304.747090101242 is >= interval of 0]
02/18/20 17:09:25.274512 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Sending event_start notification over FCM]
02/18/20 17:09:25.500386 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 FCM push message returned a 200 with body {"multicast_id":200097181772857284,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"1582042165370267"}]}]
02/18/20 17:09:25.506604 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Checking alarm rules for MQTT 192.168.1.27]
02/18/20 17:09:25.509915 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Monitor 1 event: should send out as  304.459850072861 is >= interval of ]
02/18/20 17:09:25.513156 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Sending event_start notification for EID:873 over MQTT]
02/18/20 17:09:27.516672 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Event 873 for Monitor 1 has finished]
02/18/20 17:09:27.896504 zmeventnotification[21487].INF [main:833] [PARENT: There are 1 active child forks...]
02/18/20 17:09:27.902663 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 17:09:29.524121 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Invoking hook on event end:/mnt/Zoneminder/hook/zm_event_end.sh 873 1 "vhod" "Motion: All" "/var/cache/zoneminder/events/1/20/02/18/17/09/17"]
02/18/20 17:09:29.538735 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 hook end returned with text:  json:[] exit:127]
02/18/20 17:09:31.544011 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Not sending event end alarm, as we did not send a start alarm for this, or start hook processing failed]
02/18/20 17:09:32.892216 zmeventnotification[21487].INF [main:833] [PARENT: There are 1 active child forks...]
02/18/20 17:09:32.900216 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 17:09:35.552518 zmeventnotification[26117].INF [main:833] [|----> FORK:vhod (1), eid:873 Ending process:26117 to handle alarms]
02/18/20 17:09:37.896432 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 17:09:37.903651 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 17:09:42.893324 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
02/18/20 17:09:42.901209 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 new Events to process]
02/18/20 17:09:47.896525 zmeventnotification[21487].INF [main:833] [PARENT: There are 0 active child forks...]
Is this ok with permission denied?

Code: Select all

root@44353fa5d618:/var/lib/zmeventnotification/bin# sudo -u www-data ./zm_event_start.sh 887 1
Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 170, in <module>
    filename1, filename2, filename1_bbox, filename2_bbox = utils.download_files(args)
  File "/usr/local/lib/python3.6/dist-packages/zmes_hook_helpers/utils.py", line 134, in download_files
    with open(filename1, 'wb') as output_file:
PermissionError: [Errno 13] Permission denied: '/var/lib/zmeventnotification/images/887-alarm.jpg'
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Problem staring zm_detetct.py

Post by asker »

No, it is not ok. For now, please don't run it manually.

Your logs show

Code: Select all

02/18/20 16:01:42.498801 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 Invoking hook on event end:/mnt/Zoneminder/hook/zm_event_end.sh 838 1 "vhod" "Forced Web: " "/var/cache/zoneminder/events/1/20/02/18/16/01/32"]
02/18/20 16:01:42.510395 zmeventnotification[23529].INF [main:833] [|----> FORK:vhod (1), eid:838 hook end returned with text:  json:[] exit:127]
For that specific event (838) please also paste the detect logs in /etc/zoneminder/zm/zmesdetect_m1.log
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
warcanoid
Posts: 35
Joined: Mon Feb 17, 2020 3:22 pm

Re: Problem staring zm_detetct.py

Post by warcanoid »

Have sent it in your inboox, because there is to many sensitive data. Only manual triggers are in there, I think. This event is missing at that time.
Have triggered with motion now, but nothing in log happen. Logs are in different folder: /var/log/zm#
Last edited by warcanoid on Tue Feb 18, 2020 5:29 pm, edited 1 time in total.
Post Reply