zmeventnotification Errors

Forum for questions and support relating to the 1.34.x releases only.
Post Reply
Helipil0t
Posts: 10
Joined: Tue May 12, 2020 5:21 pm

zmeventnotification Errors

Post by Helipil0t »

So I'm fairly certain I have zmeventnotification (Master Branch) installed properly and all of it's dependencies with GPU acceleration (OpenCV / YOLOV3 etc...)
I can't seem to get it working. I have it running and keep getting an error: "EOFError: Ran out of input"
I also get the following ocasionally:

Code: Select all

05/18/20 17:57:00.461582 zmeventnotification[327081].WAR [main:1257] [ Memory verify failed for Driveway(id:1)]
Confirmed my GPU is being used by Python3. zmNinja isn't writing anything to Tokens.txt (I'm still unclear how this is supposed to work).
I feel like I'm very close to getting this running properly.

Can someone maybe point me in the right direction? Is this something that's not configured properly or is there in fact an issue with the code in image_manip.py?

I'd appreciate the help. Cheers!

Here are my logs of the error:

Code: Select all

CONSOLE DBG-2:2020-05-18,17:43:34 PARENT: ---------->Tick END<--------------
Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 680, in <module>
    bbox_t, label_t, conf_t = img.processPastDetection(
  File "/usr/local/lib/python3.8/dist-packages/zmes_hook_helpers/image_manip.py", line 167, in processPastDetection
    saved_bs = pickle.load(fh)
EOFError: Ran out of input
Here's a longer snapshot if it helps:

Code: Select all

CONSOLE DBG-2:2020-05-18,17:35:28 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-05-18,17:35:28 PARENT: There are 0 active child forks...
CONSOLE INF:2020-05-18,17:35:28 PARENT: New event 87 reported for Monitor:1 (Name:Driveway) Motion New[last processed eid:]
05/18/20 17:35:28.743397 zmeventnotification[322486].INF [main:887] [PARENT: New event 87 reported for Monitor:1 (Name:Driveway) Motion New[last processed eid:]]
CONSOLE DBG-2:2020-05-18,17:35:28 PARENT: checkEvents() new events found=1
CONSOLE DBG-2:2020-05-18,17:35:28 PARENT: There are 1 new Events to process
CONSOLE DBG-2:2020-05-18,17:35:28 PARENT: ---------->Tick END<--------------
CONSOLE DBG-1:2020-05-18,17:35:28 PARENT: Forked process:322810 to handle alarm eid:87
CONSOLE DBG-2:2020-05-18,17:35:28 |----> FORK:Driveway (1), eid:87 Adding event path:/home/camera/Amcrest/events/1/2020-05-18/87 to hook for image storage
CONSOLE DBG-1:2020-05-18,17:35:28 |----> FORK:Driveway (1), eid:87 Invoking hook on event start:'/var/lib/zmeventnotification/bin/zm_event_start.sh' 87 1 "Driveway" "Motion New" "/home/camera/Amcrest/events/1/2020-05-18/87"
CONSOLE DBG-2:2020-05-18,17:35:30 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-05-18,17:35:30 PARENT: There are 1 active child forks...
CONSOLE DBG-2:2020-05-18,17:35:30 PARENT: We've already worked on Monitor:1, Event:87, not doing anything more
CONSOLE DBG-2:2020-05-18,17:35:30 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-05-18,17:35:30 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-05-18,17:35:30 PARENT: ---------->Tick END<--------------
CONSOLE DBG-2:2020-05-18,17:35:32 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-05-18,17:35:32 PARENT: There are 1 active child forks...
CONSOLE DBG-2:2020-05-18,17:35:32 PARENT: We've already worked on Monitor:1, Event:87, not doing anything more
CONSOLE DBG-2:2020-05-18,17:35:32 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-05-18,17:35:32 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-05-18,17:35:32 PARENT: ---------->Tick END<--------------
Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 680, in <module>
    bbox_t, label_t, conf_t = img.processPastDetection(
  File "/usr/local/lib/python3.8/dist-packages/zmes_hook_helpers/image_manip.py", line 167, in processPastDetection
    saved_bs = pickle.load(fh)
EOFError: Ran out of input
CONSOLE DBG-2:2020-05-18,17:35:34 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-05-18,17:35:34 PARENT: There are 1 active child forks...
CONSOLE DBG-2:2020-05-18,17:35:34 PARENT: We've already worked on Monitor:1, Event:87, not doing anything more
CONSOLE DBG-2:2020-05-18,17:35:34 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-05-18,17:35:34 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-05-18,17:35:34 PARENT: ---------->Tick END<--------------
CONSOLE DBG-2:2020-05-18,17:35:35 |----> FORK:Driveway (1), eid:87 parse of hook: and []
CONSOLE DBG-1:2020-05-18,17:35:35 |----> FORK:Driveway (1), eid:87 hook start returned with text: json:[] exit:1
CONSOLE DBG-2:2020-05-18,17:35:36 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-05-18,17:35:36 PARENT: There are 1 active child forks...
CONSOLE DBG-2:2020-05-18,17:35:36 PARENT: We've already worked on Monitor:1, Event:87, not doing anything more
CONSOLE DBG-2:2020-05-18,17:35:36 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-05-18,17:35:36 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-05-18,17:35:36 PARENT: ---------->Tick END<--------------
CONSOLE DBG-1:2020-05-18,17:35:37 |----> FORK:Driveway (1), eid:87 Matching alarm to connection rules...
CONSOLE DBG-2:2020-05-18,17:35:38 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-05-18,17:35:38 PARENT: There are 1 active child forks...
CONSOLE DBG-2:2020-05-18,17:35:38 PARENT: We've already worked on Monitor:1, Event:87, not doing anything more
CONSOLE DBG-2:2020-05-18,17:35:38 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-05-18,17:35:38 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-05-18,17:35:38 PARENT: ---------->Tick END<--------------
CONSOLE INF:2020-05-18,17:35:39 |----> FORK:Driveway (1), eid:87 Event 87 for Monitor 1 has finished
05/18/20 17:35:39.308711 zmeventnotification[322810].INF [main:887] [|----> FORK:Driveway (1), eid:87 Event 87 for Monitor 1 has finished]
Last edited by Helipil0t on Tue May 19, 2020 4:10 am, edited 1 time in total.
Helipil0t
Posts: 10
Joined: Tue May 12, 2020 5:21 pm

Re: zmeventnotification Errors

Post by Helipil0t »

OK So I"m getting there. I tried again using the Stable branch and everything seems to be running fine. I tried without hooks and am able to get notifications. With Hooks I'm still having issues. Not sure why but I setup a test zone to analyze traffic. Event Notifications don't get sent. Here are my logs:

Code: Select all

CONSOLE INF:2020-05-18,23:57:29 PARENT: New event 110 reported for Monitor:1 (Name:Driveway) Motion Traffic[last processed eid:109]
05/18/20 23:57:29.998836 zmeventnotification[5722].INF [main:887] [PARENT: New event 110 reported for Monitor:1 (Name:Driveway) Motion Traffic[last processed eid:109]]
CONSOLE DBG-2:2020-05-18,23:57:29 PARENT: checkEvents() new events found=1
CONSOLE DBG-2:2020-05-18,23:57:29 PARENT: There are 1 new Events to process
CONSOLE DBG-2:2020-05-18,23:57:29 PARENT: ---------->Tick END<--------------
CONSOLE DBG-1:2020-05-18,23:57:30 PARENT: Forked process:43386 to handle alarm eid:110
CONSOLE DBG-2:2020-05-18,23:57:30 |----> FORK:Driveway (1), eid:110 Adding event path:/home/camera/Amcrest/events/1/2020-05-18/110 to hook for image storage
CONSOLE DBG-1:2020-05-18,23:57:30 |----> FORK:Driveway (1), eid:110 Invoking hook on event start:'/var/lib/zmeventnotification/bin/zm_event_start.sh' 110 1 "Driveway" "Motion Traffic" "/home/camera/Amcrest/events/1/2020-05-18/110"
CONSOLE DBG-2:2020-05-18,23:57:30 |----> FORK:Driveway (1), eid:110 parse of hook: and []
CONSOLE DBG-1:2020-05-18,23:57:30 |----> FORK:Driveway (1), eid:110 hook start returned with text: json:[] exit:1
CONSOLE DBG-1:2020-05-18,23:57:32 |----> FORK:Driveway (1), eid:110 Matching alarm to connection rules...
CONSOLE DBG-1:2020-05-18,23:57:32 |----> FORK:Driveway (1), eid:110 Checking alarm rules for token ending in:...zVyEcaPsZT
CONSOLE DBG-1:2020-05-18,23:57:32 |----> FORK:Driveway (1), eid:110 Monitor 1 event: last time not found, so should send
CONSOLE DBG-1:2020-05-18,23:57:32 |----> FORK:Driveway (1), eid:110 shouldSendEventToConn returned true, so calling sendEvent
CONSOLE DBG-2:2020-05-18,23:57:32 |----> FORK:Driveway (1), eid:110 isAllowedChannel: got type:event_start resCode:1
CONSOLE INF:2020-05-18,23:57:32 |----> FORK:Driveway (1), eid:110 Not sending over FCM as notify filters are on_success:all and on_fail:none
05/18/20 23:57:32.758691 zmeventnotification[43386].INF [main:887] [|----> FORK:Driveway (1), eid:110 Not sending over FCM as notify filters are on_success:all and on_fail:none]
CONSOLE DBG-2:2020-05-18,23:57:34 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-05-18,23:57:34 PARENT: RAW TEXT-->timestamp--TYPE--1589860447.542--SPLIT--1--SPLIT--1589860652.75839
CONSOLE DBG-2:2020-05-18,23:57:34 PARENT: Job: Update last sent timestamp of monitor:1 to 1589860652.75839 for id:1589860447.542
CONSOLE DBG-2:2020-05-18,23:57:34 PARENT: There are 1 active child forks...
CONSOLE DBG-2:2020-05-18,23:57:34 PARENT: We've already worked on Monitor:1, Event:110, not doing anything more
CONSOLE DBG-2:2020-05-18,23:57:34 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-05-18,23:57:34 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-05-18,23:57:34 PARENT: ---------->Tick END<--------------
CONSOLE DBG-2:2020-05-18,23:57:39 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-05-18,23:57:39 PARENT: There are 1 active child forks...
CONSOLE DBG-2:2020-05-18,23:57:39 PARENT: We've already worked on Monitor:1, Event:110, not doing anything more
CONSOLE DBG-2:2020-05-18,23:57:39 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-05-18,23:57:39 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-05-18,23:57:39 PARENT: ---------->Tick END<--------------
CONSOLE DBG-2:2020-05-18,23:57:44 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-05-18,23:57:44 PARENT: There are 1 active child forks...
CONSOLE DBG-2:2020-05-18,23:57:44 PARENT: We've already worked on Monitor:1, Event:110, not doing anything more
CONSOLE DBG-2:2020-05-18,23:57:44 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-05-18,23:57:44 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-05-18,23:57:44 PARENT: ---------->Tick END<--------------
CONSOLE INF:2020-05-18,23:57:45 |----> FORK:Driveway (1), eid:110 Event 110 for Monitor 1 has finished
05/18/20 23:57:45.249422 zmeventnotification[43386].INF [main:887] [|----> FORK:Driveway (1), eid:110 Event 110 for Monitor 1 has finished]
CONSOLE DBG-2:2020-05-18,23:57:47 |----> FORK:Driveway (1), eid:110 Adding event path:/home/camera/Amcrest/events/1/2020-05-18/110 to hook for image storage
CONSOLE DBG-1:2020-05-18,23:57:47 |----> FORK:Driveway (1), eid:110 Invoking hook on event end:'/var/lib/zmeventnotification/bin/zm_event_end.sh' 110 1 "Driveway" "Motion: Traffic" "/home/camera/Amcrest/events/1/2020-05-18/110"
CONSOLE DBG-2:2020-05-18,23:57:47 |----> FORK:Driveway (1), eid:110 parse of hook:Motion: Traffic and []
CONSOLE DBG-1:2020-05-18,23:57:47 |----> FORK:Driveway (1), eid:110 hook end returned with text:Motion: Traffic  json:[] exit:0
CONSOLE INF:2020-05-18,23:57:49 |----> FORK:Driveway (1), eid:110 Not sending event end alarm, as we did not send a start alarm for this, or start hook processing failed
05/18/20 23:57:49.254258 zmeventnotification[43386].INF [main:887] [|----> FORK:Driveway (1), eid:110 Not sending event end alarm, as we did not send a start alarm for this, or start hook processing failed]
CONSOLE DBG-2:2020-05-18,23:57:49 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-05-18,23:57:49 PARENT: There are 1 active child forks...
CONSOLE DBG-2:2020-05-18,23:57:49 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-05-18,23:57:49 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-05-18,23:57:49 PARENT: ---------->Tick END<--------------
CONSOLE DBG-1:2020-05-18,23:57:53 |----> FORK:Driveway (1), eid:110 exiting
CONSOLE DBG-1:2020-05-18,23:57:53 |----> FORK:Driveway (1), eid:110 Ending process:43386 to handle alarms
CONSOLE DBG-2:2020-05-18,23:57:54 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-05-18,23:57:54 PARENT: RAW TEXT-->active_event_delete--TYPE--1--SPLIT--110
CONSOLE DBG-2:2020-05-18,23:57:54 PARENT: Job: Deleting active_event eid:110, mid:1
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


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

# It seems certain systems don't follow regular
# ZM conventions on install paths. This may cause 
# problems with pyzm that the hooks use to do logging
# Look at https://pyzm.readthedocs.io/en/latest/source/pyzm.html#pyzm.ZMLog.init for parameters. Default is "{}"
# You can also use this to control logging irrespective of ZM log settings
#pyzm_overrides = {'conf_path':'/etc/zm'}
pyzm_overrides={'log_level_debug':2}

# base path where ZM config files reside
# this is needed by pyzm especially if your paths are different
# default is /etc/zm
base_zm_conf_path=/etc/zm

# portal/user/password are needed if you plan on using ZM's legacy
# auth mechanism to get images
portal=!ZM_PORTAL
user=!ZM_USER
password=!ZM_PASSWORD

# api portal is needed if you plan to use tokens to get images
# requires ZM 1.33 or above
api_portal=!ZM_API_PORTAL

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
# 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=
basic_password=



# 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|dog|cat|bird|car|motorbike|bus|truck)
detect_pattern=.*

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

# Typically best match means it will first try alarm 
# and then snapshot. If you want it the reverse way, 
# make the order 's,a'. Don't get imaginative here -
# 's,a' is the only thing it understands. Everything else
# means alarm then snapshot.
#bestmatch_order = 's,a'

# 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=yes

# 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=no

# 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=(0,0,255)

# If yes, will import zones automatically from monitors
#import_zm_zones=no

# This section gives you an option to get brief animations 
# of the event, delivered as part of the push notification to mobile devices
# Animations are created only if an object is detected

[animation]
# Seems like GIF/MP4 animations only
# work in IOS. Too bad.

# NOTE: Animation ONLY works with ZM 1.35 master as of Mar 16, 2020
# You also require zmNinja 1.3.91 or above
# If you are not running that version, animation will not work
# Animation frames will be created, but they won't be pushed to your device

# If yes, object detection will attempt to create 
# a short GIF file around the object detection frame
# that can be sent via push notifications for instant playback
# Note this required additional software support. Default:no
create_animation=no

# Format of animation burst
# valid options are "mp4", "gif", "mp4,gif"
# Note that gifs will be of a shorter duration
# as they take up much more disk space than mp4
# Note that if you use mp4, the thumbnail that shows 
# with push notifications may look transparent. My guess
# is this is related to how the video is being formed
# in ZM as it is a partial video when we process it
animation_types='mp4'

# default width of animation image. Be cautious when you increase this
# most mobile platforms give a very brief amount of time (in seconds) 
# to download the image.
# Given your ZM instance will be serving the image, it will anyway be slow
# Making the total animation size bigger resulted in the notification not 
# getting an image at all (timed out)
animation_width=640

# animation_retry_sleep refers to how long to wait before trying to grab
# frame information if it failed. animation_max_tries defines how many times it 
# will try and retrieve frames before it gives up
animation_retry_sleep=15
animation_max_tries=3


## 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-6]
# 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

[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


#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]

# Starting version 4.2 of OpenCV, the DNN models support CUDA
# If you have compiled OpenCV 4.2 with CUDA support correctly
# set this to yes. Note that if you have just installed a package
# chances are it is not properly set up with CUDA. It is much better
# you compile OpenCV from source (and uninstall any opencv packages you
# installed via pip or apt-get)
# Read https://www.pyimagesearch.com/2020/02/03/how-to-use-opencvs-dnn-module-with-nvidia-gpus-cuda-and-cudnn/ on how to do it right.
# Play special attention to putting in the right CUDA_ARCH_BIN value that
# matches your GPU or you'll face "invalid device errors in make_policy"
# while trying to actually run it (compile will work fine)

use_opencv_dnn_cuda=yes

# 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://192.168.1.21: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=!ML_USER
ml_password=!ML_PASSWORD


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

#yolo_min_confidence=0.5
yolo_min_confidence=0.3

# For Yolo full
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

# FOR CSPN. Note that model name is yolo
#config={{base_data_path}}/models/cspn/csresnext50-panet-spp-original-optimal.cfg
#weights={{base_data_path}}/models/cspn/csresnext50-panet-spp-original-optimal_final.weights
#labels={{base_data_path}}/models/cspn/coco.names


# For tiny Yolo
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]

# keep this to yes. no mode is not supported today
alpr_use_after_detection_only=yes


# plate_recognizer, open_alpr, open_alpr_cmdline
alpr_service=plate_recognizer

# Many of the ALPR providers offer both a cloud version
# and local SDK version. Sometimes local SDK format differs from
# the cloud instance. Set this to local or cloud. Default cloud
alpr_api_type=cloud

# If you want to host a local SDK https://app.platerecognizer.com/sdk/
#alpr_url=https://localhost:8080/alpr
# 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 web service |-----
#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


# ----| If you are using openALPR command line |-----

# Before you do any of this, make sure you have openALPR
# compiled and working properly as per http://doc.openalpr.com/compiling.html
# the alpr binary needs to be operational and capable of detecting plates

# Note this is not really very accurate unless you 
# have a camera directly with a good view of the palates
# the cloud based API service is far more accurate

#openalpr_cmdline_binary=alpr

# Do an alpr -help to see options, plug them in here
# like say '-j -p ca -c US' etc.
# keep the -j because its JSON

# Note that alpr_pattern is honored
# For the rest, just stuff them in the cmd line options

#openalpr_cmdline_params=-j
#openalpr_cmdline_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

# 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=!ESCONTROL_INTERFACE_PASSWORD

# 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

# list of monitors which ES will ignore
# Note that there is an attribute later that does
# not process hooks for specific monitors. This one is different
# It can be used to completely skip ES processing for the 
# monitors defined
# skip_monitors = 2,3,4

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

# Address for Websockets server (default: [::]).
# If you are facing connection issues or SSL issues, put in your IP here
# If you want to listen to multiple interfaces try 0.0.0.0

#address = 1.2.3.4

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

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

[push]
# This is to enable sending push notifications via any 3rd party service. 
# Typically, if you enable this, you might want to turn off fcm
# Note that zmNinja will only receive notifications via FCM, but other 3rd
# party services have their own apps to get notifications
use_api_push = no

# This is the script that will send the notification
# Some sample scripts are provided, write your own
# Each script gets:
# arg1 - event ID
# arg2 - Monitor ID
# arg3 - Monitor Name
# arg4 - alarm cause
# arg5 - Type of event (event_start or event_end)
# arg6 (optional) - image path 

api_push_script=/var/lib/zmeventnotification/bin/pushapi_pushover.py

[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 = {{base_data_path}}/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 = no

# MQTT server (default: 127.0.0.1)
server = 127.0.0.1

# Authenticate to MQTT server as user
# username = !MQTT_USERNAME

# Password 
# password = !MQTT_PASSWORD

# Set retain flag on MQTT messages (default: no)
retain = no


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

cert = !ES_CERT_FILE
key = !ES_KEY_FILE

#cert = /etc/apache2/ssl/zoneminder.crt
#key = /etc/apache2/ssl/zoneminder.key

# Location to SSL cert (no default).
# cert = /etc/apache2/ssl/yourportal/zoneminder.crt

# Location to SSL key (no default).
# key = /etc/apache2/ssl/yourportal/zoneminder.key

[customize]
# Display messages to console (default: no).
console_logs = yes
# debug level for ES messages. Default 2. Note that this is
# not controllable by ZM LOG_DEBUG_LEVEL as in Perl, ZM doesn't
# support debug levels
es_debug_level = 2

# 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 (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+
# objdetect_mp4 and objdetect_gif is ONLY available
# in ZM 1.35+
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 = '{{base_data_path}}/bin/zm_event_start.sh'

#This script is called after event_start_hook completes. You can do 
# your housekeeping work here
#event_start_hook_notify_userscript = '{{base_data_path}}/contrib/example.py'


# This script is called when an event ends. 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 = '{{base_data_path}}/bin/zm_event_end.sh'

#This script is called after event_start_hook completes. You can do 
# your housekeeping work here
#event_start_hook_notify_userscript = '{{base_data_path}}/contrib/example.py'


# Possible channels = web,fcm,mqtt,api
# all is short for web,fcm,mqtt,api
# 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 = none

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

# When an event ends and hook returns 1, don't send notifications. Default: none
event_end_notify_on_hook_fail = none
#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 = yes

# list of monitors for which hooks will not run
# hook_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
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmeventnotification Errors

Post by asker »

The reason you are not getting notifications is because no objects are found:

Code: Select all

CONSOLE DBG-2:2020-05-18,23:57:30 |----> FORK:Driveway (1), eid:110 parse of hook: and []

Take a look at debug logs for zm_detect (and make sure you have pyzm_overrides={'log_level_debug':2} in objectconfig.ini so we see more detect logs). My suspicion is you may see the same error in zm_detect.py
Also please make sure you post the version logs that zm_detect logs when it starts (to make sure you are using the correct ES and hooks versions)
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
Post Reply