Object detection does not work.

Forum for questions and support relating to 1.35.x development only.
Post Reply
wiri kim
Posts: 2
Joined: Mon Mar 22, 2021 9:26 am

Object detection does not work.

Post by wiri kim » Mon Mar 22, 2021 9:59 am

I installed it using docker.
I have finished configuring the objectconfig.ini, zmeventnotification.ini and secrets.ini files.
However, not only object detection, but also zmdetect log couldn't be seen.

FORK:Monitor-1 (1), eid:47 Not sending event end alarm, as we did not send a start alarm for this, or start hook processing failed]



Logs:

Code: Select all

Mar 22 18:56:22 e9614d5ffce1 zmc_m1[447]: INF [zmc_m1] [Monitor-1: images:65700 - Capturing at 10.00 fps, capturing bandwidth 242495bytes/sec]
Mar 22 18:56:22 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 23923 - Left alarm state (46) - 27(1) images]
Mar 22 18:56:22 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 23923 - Closing event 46, alarm end]
Mar 22 18:56:22 e9614d5ffce1 zmeventnotification[2265]: INF [|----> FORK:Monitor-1 (1), eid:46 Event 46 for Monitor 1 has finished]
Mar 22 18:56:23 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24000 - Analysing at 9.09 fps]
Mar 22 18:56:26 e9614d5ffce1 zmeventnotification[2265]: INF [|----> FORK:Monitor-1 (1), eid:46 Not sending event end alarm, as we did not send a start alarm for this, or start hook processing failed]
Mar 22 18:56:32 e9614d5ffce1 zmc_m1[447]: INF [zmc_m1] [Monitor-1: images:66000 - Capturing at 10.00 fps, capturing bandwidth 242610bytes/sec]
Mar 22 18:56:33 e9614d5ffce1 zmc_m1[447]: INF [zmc_m1] [Monitor-1: images:66100 - Capturing at 100.00 fps, capturing bandwidth 863068bytes/sec]
Mar 22 18:56:33 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24100 - Analysing at 10.00 fps]
Mar 22 18:56:33 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 9, image 66409, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:56:34 e9614d5ffce1 zmc_m1[447]: INF [zmc_m1] [Monitor-1: images:66500 - Capturing at 100.00 fps, capturing bandwidth 3215463bytes/sec]
Mar 22 18:56:42 e9614d5ffce1 zmc_m1[447]: INF [zmc_m1] [Monitor-1: images:66600 - Capturing at 12.50 fps, capturing bandwidth 97073bytes/sec]
Mar 22 18:56:43 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24300 - Analysing at 10.00 fps]
Mar 22 18:56:43 e9614d5ffce1 zmc_m1[447]: INF [zmc_m1] [Monitor-1: images:66700 - Capturing at 100.00 fps, capturing bandwidth 869249bytes/sec]
Mar 22 18:56:53 e9614d5ffce1 zmc_m1[447]: INF [zmc_m1] [Monitor-1: images:66900 - Capturing at 10.00 fps, capturing bandwidth 155594bytes/sec]
Mar 22 18:56:53 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24400 - Analysing at 10.00 fps]
Mar 22 18:56:53 e9614d5ffce1 zma_m1[452]: WAR [zma_m1] [Approaching buffer overrun, consider slowing capture, simplifying analysis or increasing ring buffer size]
Mar 22 18:56:53 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 9, image 67009, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:56:53 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 19, image 67099, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:56:53 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 9, image 67129, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:56:53 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 9, image 67189, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:03 e9614d5ffce1 zmc_m1[447]: INF [zmc_m1] [Monitor-1: images:67200 - Capturing at 10.00 fps, capturing bandwidth 242680bytes/sec]
Mar 22 18:57:03 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 9, image 67249, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:03 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 19, image 67279, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:03 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 9, image 67309, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:04 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24598 - Gone into alarm state PreAlarmCount: 0 > AlarmFrameCount:1 Cause:Motion All]
Mar 22 18:57:04 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 17, image 67497, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:04 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24598 - Opening new event 47, alarm start]
Mar 22 18:57:04 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24600 - Analysing at 9.09 fps]
Mar 22 18:57:04 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24601 - Gone into alert state]
Mar 22 18:57:04 e9614d5ffce1 zmeventnotification[472]: INF [PARENT: New event 47 reported for Monitor:1 (Name:Monitor-1) Motion All[last processed eid:46]]
Mar 22 18:57:13 e9614d5ffce1 zmc_m1[447]: INF [zmc_m1] [Monitor-1: images:67500 - Capturing at 10.00 fps, capturing bandwidth 242684bytes/sec]
Mar 22 18:57:13 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 5, image 67525, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:13 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 1, image 67541, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:13 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24611 - Gone back into alarm state]
Mar 22 18:57:13 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 12, image 67552, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:13 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 19, image 67579, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:13 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 2, image 67582, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:13 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 11, image 67591, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:13 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 9, image 67609, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:13 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 13, image 67613, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:13 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 11, image 67651, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:13 e9614d5ffce1 zma_m1[452]: WAR [zma_m1] [Approaching buffer overrun, consider slowing capture, simplifying analysis or increasing ring buffer size]
Mar 22 18:57:13 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 9, image 67669, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:14 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 8, image 67688, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:14 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 12, image 67692, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:14 e9614d5ffce1 zmc_m1[447]: INF [zmc_m1] [Monitor-1: images:67700 - Capturing at 100.00 fps, capturing bandwidth 1642350bytes/sec]
Mar 22 18:57:14 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 13, image 67713, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:14 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 2, image 67722, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:14 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 7, image 67727, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:14 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 16, image 67736, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:14 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 8, image 67748, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:14 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 12, image 67752, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:14 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24628 - Gone into alert state]
Mar 22 18:57:14 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 1, image 67781, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:14 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24633 - Gone back into alarm state]
Mar 22 18:57:14 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 7, image 67787, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:14 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 12, image 67792, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:14 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24634 - Gone into alert state]
Mar 22 18:57:14 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24635 - Gone back into alarm state]
Mar 22 18:57:14 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24637 - Gone into alert state]
Mar 22 18:57:23 e9614d5ffce1 zmc_m1[447]: INF [zmc_m1] [Monitor-1: images:67800 - Capturing at 11.11 fps, capturing bandwidth 86930bytes/sec]
Mar 22 18:57:23 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 19, image 67819, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:23 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 5, image 67825, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:23 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24642 - Left alarm state (47) - 49(23) images]
Mar 22 18:57:23 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24642 - Closing event 47, alarm end]
Mar 22 18:57:23 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 11, image 67831, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:23 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 11, image 67851, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:23 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 16, image 67856, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:24 e9614d5ffce1 zma_m1[452]: INF [zma_m1] [Monitor-1: 24700 - Analysing at 5.00 fps]
Mar 22 18:57:24 e9614d5ffce1 zmc_m1[447]: INF [zmc_m1] [Monitor-1: images:68000 - Capturing at 100.00 fps, capturing bandwidth 1645041bytes/sec]
Mar 22 18:57:24 e9614d5ffce1 zmc_m1[447]: WAR [zmc_m1] [Buffer overrun at index 9, image 68029, slow down capture, speed up analysis or increase ring buffer size]
Mar 22 18:57:24 e9614d5ffce1 zmeventnotification[2319]: INF [|----> FORK:Monitor-1 (1), eid:47 Event 47 for Monitor 1 has finished]
Mar 22 18:57:28 e9614d5ffce1 zmeventnotification[2319]: INF [|----> FORK:Monitor-1 (1), eid:47 Not sending event end alarm, as we did not send a start alarm for this, or start hook processing failed]



docker Run

Code: Select all

docker run -d --name="zm" \
--net="bridge" \
--privileged="false" \
--shm-size="8G" \
-p 8443:443/tcp \
-p 9000:9000/tcp \
-e TZ="Asia/Seoul" \
-e PUID="99" \
-e PGID="100" \
-e INSTALL_HOOK="1" \
-e INSTALL_FACE="1" \
-e INSTALL_TINY_YOLOV3="0" \
-e INSTALL_YOLOV3="1" \
-e INSTALL_TINY_YOLOV4="1" \
-e INSTALL_YOLOV4="1" \
-e MULTI_PORT_START="0" \
-e MULTI_PORT_END="0" \
-v "/mnt/zm":"/config":rw \
-v "/mnt/zm/data":"/var/cache/zoneminder":rw \
dlandon/zoneminder
Command:

Code: Select all

sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini --debug --eventid 3  --monitorid 1 --eventpath=/var/cache/zoneminder/events/1/2021-03-22/11
Logs:

Code: Select all

Unrecoverable error:__init__() got an unexpected keyword argument 'reflect' Traceback:Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 531, in <module>
    main_handler()
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 223, in main_handler
    log.init(name='zmesdetect_' + 'm' + args.get('monitorid'), override=g.config['pyzm_overrides'])
  File "/usr/local/lib/python3.8/dist-packages/pyzm/ZMLog.py", line 166, in init
    meta = MetaData(engine,reflect=True)
TypeError: __init__() got an unexpected keyword argument 'reflect'

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

# You can create your own custom attributes in the [custom] section

[general]

# Please don't change this. It is used by the config upgrade script
version=1.2

# You can now limit the # of detection process
# per target processor. If not specified, default is 1
# Other detection processes will wait to acquire lock

cpu_max_processes=3
tpu_max_processes=1
gpu_max_processes=1

# Time to wait in seconds per processor to be free, before
# erroring out. Default is 120 (2 mins)
cpu_max_lock_wait=100
tpu_max_lock_wait=100
gpu_max_lock_wait=100


#pyzm_overrides={'conf_path':'/etc/zm','log_level_debug':0}
pyzm_overrides={'log_level_debug':5}

# 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

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

max_detection_size=90%

# sequence of models to run for detection
detection_sequence=object,face,alpr
# 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

# 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=800
# 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=(255,255,255)
poly_thickness=2
#import_zm_zones=yes
only_triggered_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
#
# NOTE: This will DELAY the time taken to send you push notifications
# It will try to first creat the animation, which may take upto a minute
# depending on how soon it gets access to frames. See notes below

[animation]

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

# 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
animation_types='mp4,gif'

# 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

# When an event is detected, ZM it writes frames a little late
# On top of that, it looks like with caching enabled, the API layer doesn't
# get access to DB records for much longer (around 30 seconds), at least on my
# system. 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=4

# if animation_types is gif then when can generate a fast preview gif
# every second frame is skipped and the frame rate doubled
# to give quick preview, Default (no)
fast_gif=no

[remote]
# 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.183:5000/api/v1
#ml_gateway=http://10.6.1.13:5000/api/v1
#ml_gateway=http://192.168.1.21:5000/api/v1
#ml_gateway=http://10.9.0.2:5000/api/v1
#ml_fallback_local=yes
# API/password for remote gateway
ml_user=!ML_USER
ml_password=!ML_PASSWORD


# config for object
[object]

# If you are using legacy format (use_sequence=no) then these parameters will
# be used during ML inferencing
object_detection_pattern=(person|car|motorbike|bus|truck|boat)
object_min_confidence=0.3
object_framework=coral_edgetpu
object_processor=tpu
object_weights={{base_data_path}}/models/coral_edgetpu/ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite
object_labels={{base_data_path}}/models/coral_edgetpu/coco_indexed.names

# If you are using the new ml_sequence format (use_sequence=yes) then
# you can fiddle with these parameters and look at ml_sequence later
# Note that these can be named anything. You can add custom variables, ad-infinitum

# Google Coral
tpu_object_weights={{base_data_path}}/models/coral_edgetpu/ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite
tpu_object_labels={{base_data_path}}/models/coral_edgetpu/coco_indexed.names
tpu_object_framework=coral_edgetpu
tpu_object_processor=tpu
tpu_min_confidence=0.6

# Yolo v4 on GPU (falls back to CPU if no GPU)
yolo4_object_weights={{base_data_path}}/models/yolov4/yolov4.weights
yolo4_object_labels={{base_data_path}}/models/yolov4/coco.names
yolo4_object_config={{base_data_path}}/models/yolov4/yolov4.cfg
yolo4_object_framework=opencv
yolo4_object_processor=gpu

# Yolo v3 on GPU (falls back to CPU if no GPU)
yolo3_object_weights={{base_data_path}}/models/yolov3/yolov3.weights
yolo3_object_labels={{base_data_path}}/models/yolov3/coco.names
yolo3_object_config={{base_data_path}}/models/yolov3/yolov3.cfg
yolo3_object_framework=opencv
yolo3_object_processor=gpu

# Tiny Yolo V4 on GPU (falls back to CPU if no GPU)
tinyyolo_object_config={{base_data_path}}/models/tinyyolov4/yolov4-tiny.cfg
tinyyolo_object_weights={{base_data_path}}/models/tinyyolov4/yolov4-tiny.weights
tinyyolo_object_labels={{base_data_path}}/models/tinyyolov4/coco.names
tinyyolo_object_framework=opencv
tinyyolo_object_processor=gpu


[face]
face_detection_pattern=.*
known_images_path={{base_data_path}}/known_faces
unknown_images_path={{base_data_path}}/unknown_faces
save_unknown_faces=yes
save_unknown_faces_leeway_pixels=100
face_detection_framework=dlib

# 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)
face_num_jitters=1
face_model=cnn
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=cnn
#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_detection_pattern=.*
alpr_use_after_detection_only=yes
# 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 are using plate recognizer | ------
alpr_service=plate_recognizer
#alpr_service=open_alpr_cmdline

# If you want to host a local SDK https://app.platerecognizer.com/sdk/
#alpr_url=http://192.168.1.21: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=yes
# 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_service=open_alpr_cmdline

# If you want to host a local SDK https://app.platerecognizer.com/sdk/
#alpr_url=http://192.168.1.21: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=yes
# 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

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

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 -d
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

[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

# Use the new FCM V1 protocol (recommended)
use_fcmv1 = yes

# if yes, will replace notifications with the latest one
# default: no
replace_push_messages = no

# 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

# Set priority for android push. Default is default.
# You can set it to default, min, low, high or max
# There is weird foo going on here. If you set it to high,
# and don't interact with push, users report after a while they
# get delayed by Google. I haven't quite figured out what is the precise
# value to put here to make sure it always reaches you. Also make sure
# you read the zmES faq on delayed push
fcm_android_priority = default

# Use MQTT for messaging (default: no)
[mqtt]
enable = no
# Allow you to set a custom MQTT topic name
# default: zoneminder
#topic = my topic name

# 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

# MQTT over TLS
# Location to MQTT broker CA certificate. Uncomment this line will enable MQTT over TLS.
# tls_ca = /config/certs/ca.pem

# To enable 2-ways TLS, add client certificate and private key
# Location to client certificate and private key
# tls_cert = /config/es-pub.pem
# tls_key = /config/es-key.pem

# To allow insecure TLS (disable peer verifier), (default: no)
# tls_insecure = yes



[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]
# Link to json file that has rules which can be customized
# es_rules=/etc/zm/es_rules.json

# Display messages to console (default: no).
# Note that you can keep this to no and just
# use --debug when running from CLI too
console_logs = no
# debug level for ES messages. Default 4. Note that this is
# not controllable by ZM LOG_DEBUG_LEVEL as in Perl, ZM doesn't
# support debug levels
es_debug_level = 4

# 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 start notifications (default: yes)
# If no, starting notifications will not be sent out
send_event_start_notification = 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_end_hook completes. You can do
# your housekeeping work here
#event_end_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

What should I do? :cry: Any help would be much appreciated:)

wiri kim
Posts: 2
Joined: Mon Mar 22, 2021 9:26 am

Re: Object detection does not work.

Post by wiri kim » Wed Mar 24, 2021 2:44 am

I solved the problem. It needs to downgrade sqlalchemy to 1.3.23.

Code: Select all

pip3 install sqlalchemy==1.3.23

ptruman
Posts: 3
Joined: Sat Aug 29, 2020 9:10 pm

Re: Object detection does not work.

Post by ptruman » Wed Apr 07, 2021 8:40 am

wiri kim wrote:
Wed Mar 24, 2021 2:44 am
I solved the problem. It needs to downgrade sqlalchemy to 1.3.23.

Code: Select all

pip3 install sqlalchemy==1.3.23
Thanks for this - I managed (stupidly) to upgrade the docker image just before dlandon deprecated it, and was wondering why events had stopped.
I had this error, and then found it had somehow chewed my objectconfig.ini, secrets.ini, zmeventnotification.ini and relinked my models folder...

I've plugged those back in, and (thankfully) it's now not erroring - just need to see if zmevents fires to zmninja again.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests