ZoneMinder / zmeventnotification

Machine Learning powered Secure Websocket & MQTT based ZoneMinder event notification server
416 stars 129 forks source link

Enable ALPR only for one Monitor #203

Closed connectnet closed 4 years ago

connectnet commented 4 years ago

Hi there! Zoneminder Vers. 1.34.0 / ZMeventnotification Vers. 5.4.2

I have a question for enabling only one monitor for the ALPR regcognition. This is my objectconfig.ini:

# 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

# 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=face,yolo

# if all, then we will loop through all models
# if first then the first success will break out
#detection_mode=first

# 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=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=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,0,0)
#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-1]
detect_pattern=(person|bicycle|motorbike|bus|truck|boat|dog|cat)
resize=600
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=5
detection_mode=first
models=face,yolo
poly_color=(255,0,0)
delete_after_analyze=yes

[Monitor-3]
# ALPR Camera
wait=5
match_past_detections=no
detect_pattern=(car)
alpr_pattern=^(.*x11)
poly_color=(255,0,0)
resize=yes
detection_mode=all
models=yolo,alpr

[Monitor-2]
detect_pattern=.*
wait=5
detection_mode=first
models=yolo
poly_color=(255,0,0)
delete_after_analyze=yes

# 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://192.168.1.21:5000/api/v1
# 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

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]
known_images_path={{base_data_path}}/known_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=************************************************
## 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=['de']
## 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=sk_*****************************************

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

So when I activate ALPR in section general:

[general]
models=face,yolo,alpr

all Monitors are sending pics to the alpr cloud-service when they detect cars with plates. So but thats not what I want. I only want that Monitor-3 detects plates and send the pictures into the cloud. Independently what Im writing into the Monitor section:

[Monitor-2]
models=yolo

it detects also alpr. Whats wrong? Is it my fault? Thanks for your help.

pliablepixels commented 4 years ago

I think the tags are case sensitive. Try [monitor-2] not [Monitor-2]

connectnet commented 4 years ago

Thats what I also thought, but with [monitor-2] its still the same.

pliablepixels commented 4 years ago

Please post debug logs of /var/log/zm/zmesdetect_m2.log when you trigger a detection

connectnet commented 4 years ago

Here is the zmesdetect_m2 for Monitor-2 (Plate is 12345):


01/29/20 15:33:17 zmesdetect_m2[9502] INF zm_detect.py:145 [---------| app version: 5.4.2 |------------]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:229 [secret filename: /etc/zm/secrets.ini]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:203 [Secret token found in config: !ZM_PORTAL]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:203 [Secret token found in config: !ZM_API_PORTAL]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:203 [Secret token found in config: !ZM_USER]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:203 [Secret token found in config: !ZM_PASSWORD]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:203 [Secret token found in config: !ML_USER]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:203 [Secret token found in config: !ML_PASSWORD]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:254 [allowing self-signed certs to work...]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:304 [key [config] is '/var/lib/zmeventnotification/models/yolov3/yolov3.cfg' after substitution]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:304 [key [weights] is '/var/lib/zmeventnotification/models/yolov3/yolov3.weights' after substitution]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:304 [key [labels] is '/var/lib/zmeventnotification/models/yolov3/yolov3_classes.txt' after substitution]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:304 [key [tiny_config] is '/var/lib/zmeventnotification/models/tinyyolo/yolov3-tiny.cfg' after substitution]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:304 [key [tiny_weights] is '/var/lib/zmeventnotification/models/tinyyolo/yolov3-tiny.weights' after substitution]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:304 [key [tiny_labels] is '/var/lib/zmeventnotification/models/tinyyolo/yolov3-tiny.txt' after substitution]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:304 [key [known_images_path] is '/var/lib/zmeventnotification/known_faces' after substitution]
01/29/20 15:33:17 zmesdetect_m2[9502] INF zm_detect.py:167 [Importing local classes for Yolo/Face]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:128 [Trying to download http://127.0.0.1/zm/index.php?view=image&eid=1031&fid=alarm&username=user&password=*****]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:142 [Trying to download http://127.0.0.1/zm/index.php?view=image&eid=1031&fid=snapshot&username=user&password=*****]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG zm_detect.py:209 [No polygon area specfied, so adding a full image polygon:[{'name': 'full_image', 'value': [(0, 0), (1920, 0), (1920, 1080), (0, 1080)]}]]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG zm_detect.py:211 [resizing to 1200 before analysis...]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG utils.py:37 [resized polygons x=0.625/y=0.625: [{'name': 'full_image', 'value': [(0, 0), (1200, 0), (1200, 675), (0, 675)]}]]
01/29/20 15:33:17 zmesdetect_m2[9502] DBG zm_detect.py:229 [User ALPR if vehicle found: True]
01/29/20 15:33:18 zmesdetect_m2[9502] DBG face.py:20 [Initializing face recognition with model:hog upsample:1, jitters:1]
01/29/20 15:33:18 zmesdetect_m2[9502] DBG face.py:39 [pre-trained faces found, using that. If you want to add new images, remove: /var/lib/zmeventnotification/known_faces/faces.dat]
01/29/20 15:33:18 zmesdetect_m2[9502] DBG zm_detect.py:271 [|--> model:face init took: 1.363976s]
01/29/20 15:33:18 zmesdetect_m2[9502] DBG zm_detect.py:300 [Using model: face with /var/lib/zmeventnotification/images/1031-alarm.jpg]
01/29/20 15:33:19 zmesdetect_m2[9502] DBG zm_detect.py:308 [|--> model:face detection took: 0.458396s]
01/29/20 15:33:19 zmesdetect_m2[9502] DBG zm_detect.py:316 [Appending known faces to filter list]
01/29/20 15:33:19 zmesdetect_m2[9502] DBG zm_detect.py:426 [There was no vehicle detected by Yolo in this image]
01/29/20 15:33:19 zmesdetect_m2[9502] DBG zm_detect.py:480 [No match found in /var/lib/zmeventnotification/images/1031-alarm.jpg using model:face]
01/29/20 15:33:19 zmesdetect_m2[9502] DBG zm_detect.py:300 [Using model: face with /var/lib/zmeventnotification/images/1031-snapshot.jpg]
01/29/20 15:33:19 zmesdetect_m2[9502] DBG zm_detect.py:308 [|--> model:face detection took: 0.448293s]
01/29/20 15:33:19 zmesdetect_m2[9502] DBG zm_detect.py:316 [Appending known faces to filter list]
01/29/20 15:33:19 zmesdetect_m2[9502] DBG zm_detect.py:440 [No vehicle detected, and no more images to try]
01/29/20 15:33:19 zmesdetect_m2[9502] DBG zm_detect.py:480 [No match found in /var/lib/zmeventnotification/images/1031-snapshot.jpg using model:face]
01/29/20 15:33:19 zmesdetect_m2[9502] DBG zm_detect.py:271 [|--> model:yolo init took: 2.8e-05s]
01/29/20 15:33:19 zmesdetect_m2[9502] DBG zm_detect.py:300 [Using model: yolo with /var/lib/zmeventnotification/images/1031-alarm.jpg]
01/29/20 15:33:19 zmesdetect_m2[9502] DBG yolo.py:50 [Initializing Yolo]
01/29/20 15:33:19 zmesdetect_m2[9502] DBG yolo.py:51 [config:/var/lib/zmeventnotification/models/yolov3/yolov3.cfg, weights:/var/lib/zmeventnotification/models/yolov3/yolov3.weights]
01/29/20 15:33:20 zmesdetect_m2[9502] INF yolo.py:102 [object:person at [670, 119, 774, 373] has a acceptable confidence:0.9989027380943298 compared to min confidence of: 0.3, adding]
01/29/20 15:33:20 zmesdetect_m2[9502] INF yolo.py:102 [object:car at [60, 194, 260, 366] has a acceptable confidence:0.9939146637916565 compared to min confidence of: 0.3, adding]
01/29/20 15:33:20 zmesdetect_m2[9502] INF yolo.py:102 [object:person at [763, 133, 823, 325] has a acceptable confidence:0.9779075384140015 compared to min confidence of: 0.3, adding]
01/29/20 15:33:20 zmesdetect_m2[9502] INF yolo.py:102 [object:car at [579, 108, 737, 216] has a acceptable confidence:0.9127088785171509 compared to min confidence of: 0.3, adding]
01/29/20 15:33:20 zmesdetect_m2[9502] INF yolo.py:104 [rejecting object:handbag at [749, 240, 783, 288] because its confidence is :0.23707309365272522 compared to min confidence of: 0.3]
01/29/20 15:33:20 zmesdetect_m2[9502] DBG zm_detect.py:308 [|--> model:yolo detection took: 1.323698s]
01/29/20 15:33:20 zmesdetect_m2[9502] DBG image_manip.py:127 [intersection: polygon in process=[(670, 119), (774, 119), (774, 373), (670, 373)]]
01/29/20 15:33:20 zmesdetect_m2[9502] DBG image_manip.py:133 [full_image intersects object:person[[(670, 119), (774, 119), (774, 373), (670, 373)]]]
01/29/20 15:33:20 zmesdetect_m2[9502] DBG image_manip.py:127 [intersection: polygon in process=[(60, 194), (260, 194), (260, 366), (60, 366)]]
01/29/20 15:33:20 zmesdetect_m2[9502] DBG image_manip.py:133 [full_image intersects object:car[[(60, 194), (260, 194), (260, 366), (60, 366)]]]
01/29/20 15:33:20 zmesdetect_m2[9502] DBG image_manip.py:127 [intersection: polygon in process=[(763, 133), (823, 133), (823, 325), (763, 325)]]
01/29/20 15:33:20 zmesdetect_m2[9502] DBG image_manip.py:133 [full_image intersects object:person[[(763, 133), (823, 133), (823, 325), (763, 325)]]]
01/29/20 15:33:20 zmesdetect_m2[9502] DBG image_manip.py:127 [intersection: polygon in process=[(579, 108), (737, 108), (737, 216), (579, 216)]]
01/29/20 15:33:20 zmesdetect_m2[9502] DBG image_manip.py:133 [full_image intersects object:car[[(579, 108), (737, 108), (737, 216), (579, 216)]]]
01/29/20 15:33:20 zmesdetect_m2[9502] DBG zm_detect.py:352 [Invoking ALPR as detected object is a vehicle or, we are trying hard to look for plates...]
01/29/20 15:33:20 zmesdetect_m2[9502] DBG alpr.py:62 [PlateRecognizer ALPR initialized with options: {'regions': ['de'], 'stats': 'no', 'min_dscore': 0.1, 'min_score': 0.2} and url: https://api.platerecognizer.com/v1]
01/29/20 15:33:20 zmesdetect_m2[9502] DBG alpr.py:36 [supplied object is a file]
01/29/20 15:33:21 zmesdetect_m2[9502] DBG alpr.py:97 [ALPR JSON: {'processing_time': 186.465, 'results': [{'box': {'ymin': 431, 'xmin': 262, 'ymax': 460, 'xmax': 340}, 'plate': '12345', 'region': {'score': 0.862, 'code': 'de'}, 'vehicle': {'score': 0.609, 'type': 'Car'}, 'score': 0.903, 'candidates': [{'score': 0.903, 'plate': '12345'}, {'score': 0.735, 'plate': '12345'}], 'dscore': 0.882}], 'filename': '14_33_b1031-alarm.jpg', 'version': 1, 'camera_id': None, 'timestamp': '2020-01-29T14:33:21.756578Z'}]
01/29/20 15:33:22 zmesdetect_m2[9502] DBG alpr.py:51 [ALPR will use 1920x1080 but Yolo uses 1200x675 so ALPR boxes will be scaled 0.625x and 0.625y]
01/29/20 15:33:22 zmesdetect_m2[9502] DBG image_manip.py:162 [Checking vehicle plates for validity]
01/29/20 15:33:22 zmesdetect_m2[9502] DBG image_manip.py:201 [Plate:12345 at POLYGON ((164 269, 212 269, 212 288, 164 288, 164 269)) intersects polygon:full_image at POLYGON ((0 0, 1200 0, 1200 675, 0 675, 0 0)) but does not contain polgyon, assuming it to be VALID]
01/29/20 15:33:22 zmesdetect_m2[9502] INF zm_detect.py:387 [ALPR Found 12345 at [164, 269, 212, 288] with score:0.903]
01/29/20 15:33:22 zmesdetect_m2[9502] INF zm_detect.py:473 [labels found: ['person', 'car', 'person', 'car', '12345']]
01/29/20 15:33:22 zmesdetect_m2[9502] DBG zm_detect.py:474 [match found in /var/lib/zmeventnotification/images/1031-alarm.jpg, breaking file loop...]
01/29/20 15:33:22 zmesdetect_m2[9502] DBG zm_detect.py:522 [Writing out debug bounding box image to /var/lib/zmeventnotification/images/1031-alarm-bbox.jpg...]
01/29/20 15:33:22 zmesdetect_m2[9502] DBG zm_detect.py:527 [Writing detected image to /var/cache/zoneminder/events/2/2020-01-29/1031/objdetect.jpg]
01/29/20 15:33:22 zmesdetect_m2[9502] DBG zm_detect.py:534 [Writing JSON output to /var/cache/zoneminder/events/2/2020-01-29/1031/objects.json]
01/29/20 15:33:22 zmesdetect_m2[9502] INF zm_detect.py:545 [Removing matches to past detections]
01/29/20 15:33:22 zmesdetect_m2[9502] DBG image_manip.py:27 [trying to load /var/lib/zmeventnotification/images/monitor-2-data.pkl]
01/29/20 15:33:22 zmesdetect_m2[9502] DBG image_manip.py:92 [past detection 12345@[(163, 269), (211, 269), (211, 287), (163, 269)] approximately matches 12345@[(164, 269), (212, 269), (212, 288), (164, 269)] removing]
01/29/20 15:33:22 zmesdetect_m2[9502] DBG zm_detect.py:548 [Saving detections for monitor 2 for future match]
01/29/20 15:33:22 zmesdetect_m2[9502] INF zm_detect.py:573 [Prediction string:[a] detected:person:100% car:99% ]
01/29/20 15:33:47 zmesdetect_m2[9788] INF zm_detect.py:145 [---------| app version: 5.4.2 |------------]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:229 [secret filename: /etc/zm/secrets.ini]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:203 [Secret token found in config: !ZM_PORTAL]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:203 [Secret token found in config: !ZM_API_PORTAL]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:203 [Secret token found in config: !ZM_USER]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:203 [Secret token found in config: !ZM_PASSWORD]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:203 [Secret token found in config: !ML_USER]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:203 [Secret token found in config: !ML_PASSWORD]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:254 [allowing self-signed certs to work...]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:304 [key [config] is '/var/lib/zmeventnotification/models/yolov3/yolov3.cfg' after substitution]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:304 [key [weights] is '/var/lib/zmeventnotification/models/yolov3/yolov3.weights' after substitution]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:304 [key [labels] is '/var/lib/zmeventnotification/models/yolov3/yolov3_classes.txt' after substitution]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:304 [key [tiny_config] is '/var/lib/zmeventnotification/models/tinyyolo/yolov3-tiny.cfg' after substitution]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:304 [key [tiny_weights] is '/var/lib/zmeventnotification/models/tinyyolo/yolov3-tiny.weights' after substitution]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:304 [key [tiny_labels] is '/var/lib/zmeventnotification/models/tinyyolo/yolov3-tiny.txt' after substitution]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:304 [key [known_images_path] is '/var/lib/zmeventnotification/known_faces' after substitution]
01/29/20 15:33:47 zmesdetect_m2[9788] INF zm_detect.py:167 [Importing local classes for Yolo/Face]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:128 [Trying to download http://127.0.0.1/zm/index.php?view=image&eid=1032&fid=alarm&username=user&password=*****]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:142 [Trying to download http://127.0.0.1/zm/index.php?view=image&eid=1032&fid=snapshot&username=user&password=*****]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG zm_detect.py:209 [No polygon area specfied, so adding a full image polygon:[{'name': 'full_image', 'value': [(0, 0), (1920, 0), (1920, 1080), (0, 1080)]}]]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG zm_detect.py:211 [resizing to 1200 before analysis...]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG utils.py:37 [resized polygons x=0.625/y=0.625: [{'name': 'full_image', 'value': [(0, 0), (1200, 0), (1200, 675), (0, 675)]}]]
01/29/20 15:33:47 zmesdetect_m2[9788] DBG zm_detect.py:229 [User ALPR if vehicle found: True]
01/29/20 15:33:49 zmesdetect_m2[9788] DBG face.py:20 [Initializing face recognition with model:hog upsample:1, jitters:1]
01/29/20 15:33:49 zmesdetect_m2[9788] DBG face.py:39 [pre-trained faces found, using that. If you want to add new images, remove: /var/lib/zmeventnotification/known_faces/faces.dat]
01/29/20 15:33:49 zmesdetect_m2[9788] DBG zm_detect.py:271 [|--> model:face init took: 1.598013s]
01/29/20 15:33:49 zmesdetect_m2[9788] DBG zm_detect.py:300 [Using model: face with /var/lib/zmeventnotification/images/1032-alarm.jpg]
01/29/20 15:33:49 zmesdetect_m2[9788] DBG zm_detect.py:308 [|--> model:face detection took: 0.459639s]
01/29/20 15:33:49 zmesdetect_m2[9788] DBG zm_detect.py:316 [Appending known faces to filter list]
01/29/20 15:33:49 zmesdetect_m2[9788] DBG zm_detect.py:426 [There was no vehicle detected by Yolo in this image]
01/29/20 15:33:49 zmesdetect_m2[9788] DBG zm_detect.py:480 [No match found in /var/lib/zmeventnotification/images/1032-alarm.jpg using model:face]
01/29/20 15:33:49 zmesdetect_m2[9788] DBG zm_detect.py:300 [Using model: face with /var/lib/zmeventnotification/images/1032-snapshot.jpg]
01/29/20 15:33:50 zmesdetect_m2[9788] DBG zm_detect.py:308 [|--> model:face detection took: 0.458967s]
01/29/20 15:33:50 zmesdetect_m2[9788] DBG zm_detect.py:316 [Appending known faces to filter list]
01/29/20 15:33:50 zmesdetect_m2[9788] DBG zm_detect.py:440 [No vehicle detected, and no more images to try]
01/29/20 15:33:50 zmesdetect_m2[9788] DBG zm_detect.py:480 [No match found in /var/lib/zmeventnotification/images/1032-snapshot.jpg using model:face]
01/29/20 15:33:50 zmesdetect_m2[9788] DBG zm_detect.py:271 [|--> model:yolo init took: 2.9e-05s]
01/29/20 15:33:50 zmesdetect_m2[9788] DBG zm_detect.py:300 [Using model: yolo with /var/lib/zmeventnotification/images/1032-alarm.jpg]
01/29/20 15:33:50 zmesdetect_m2[9788] DBG yolo.py:50 [Initializing Yolo]
01/29/20 15:33:50 zmesdetect_m2[9788] DBG yolo.py:51 [config:/var/lib/zmeventnotification/models/yolov3/yolov3.cfg, weights:/var/lib/zmeventnotification/models/yolov3/yolov3.weights]
01/29/20 15:33:51 zmesdetect_m2[9788] INF yolo.py:102 [object:car at [380, 110, 716, 244] has a acceptable confidence:0.9930741786956787 compared to min confidence of: 0.3, adding]
01/29/20 15:33:51 zmesdetect_m2[9788] INF yolo.py:102 [object:car at [58, 194, 260, 366] has a acceptable confidence:0.9909840226173401 compared to min confidence of: 0.3, adding]
01/29/20 15:33:51 zmesdetect_m2[9788] DBG zm_detect.py:308 [|--> model:yolo detection took: 1.287796s]
01/29/20 15:33:51 zmesdetect_m2[9788] DBG image_manip.py:127 [intersection: polygon in process=[(380, 110), (716, 110), (716, 244), (380, 244)]]
01/29/20 15:33:51 zmesdetect_m2[9788] DBG image_manip.py:133 [full_image intersects object:car[[(380, 110), (716, 110), (716, 244), (380, 244)]]]
01/29/20 15:33:51 zmesdetect_m2[9788] DBG image_manip.py:127 [intersection: polygon in process=[(58, 194), (260, 194), (260, 366), (58, 366)]]
01/29/20 15:33:51 zmesdetect_m2[9788] DBG image_manip.py:133 [full_image intersects object:car[[(58, 194), (260, 194), (260, 366), (58, 366)]]]
01/29/20 15:33:51 zmesdetect_m2[9788] DBG zm_detect.py:352 [Invoking ALPR as detected object is a vehicle or, we are trying hard to look for plates...]
01/29/20 15:33:51 zmesdetect_m2[9788] DBG alpr.py:62 [PlateRecognizer ALPR initialized with options: {'regions': ['de'], 'stats': 'no', 'min_dscore': 0.1, 'min_score': 0.2} and url: https://api.platerecognizer.com/v1]
01/29/20 15:33:51 zmesdetect_m2[9788] DBG alpr.py:36 [supplied object is a file]
01/29/20 15:33:52 zmesdetect_m2[9788] DBG alpr.py:97 [ALPR JSON: {'processing_time': 208.485, 'results': [{'box': {'ymin': 431, 'xmin': 261, 'ymax': 460, 'xmax': 340}, 'plate': '12345', 'region': {'score': 0.834, 'code': 'de'}, 'vehicle': {'score': 0.604, 'type': 'Car'}, 'score': 0.901, 'candidates': [{'score': 0.901, 'plate': '12345'}, {'score': 0.731, 'plate': '12345'}], 'dscore': 0.869}], 'filename': '14_33_b1032-alarm.jpg', 'version': 1, 'camera_id': None, 'timestamp': '2020-01-29T14:33:52.584888Z'}]
01/29/20 15:33:52 zmesdetect_m2[9788] DBG alpr.py:51 [ALPR will use 1920x1080 but Yolo uses 1200x675 so ALPR boxes will be scaled 0.625x and 0.625y]
01/29/20 15:33:52 zmesdetect_m2[9788] DBG image_manip.py:162 [Checking vehicle plates for validity]
01/29/20 15:33:52 zmesdetect_m2[9788] DBG image_manip.py:201 [Plate:12345 at POLYGON ((163 269, 212 269, 212 288, 163 288, 163 269)) intersects polygon:full_image at POLYGON ((0 0, 1200 0, 1200 675, 0 675, 0 0)) but does not contain polgyon, assuming it to be VALID]
01/29/20 15:33:53 zmesdetect_m2[9788] INF zm_detect.py:387 [ALPR Found 12345 at [163, 269, 212, 288] with score:0.901]
01/29/20 15:33:53 zmesdetect_m2[9788] INF zm_detect.py:473 [labels found: ['car', 'car', '12345']]
01/29/20 15:33:53 zmesdetect_m2[9788] DBG zm_detect.py:474 [match found in /var/lib/zmeventnotification/images/1032-alarm.jpg, breaking file loop...]
01/29/20 15:33:53 zmesdetect_m2[9788] DBG zm_detect.py:522 [Writing out debug bounding box image to /var/lib/zmeventnotification/images/1032-alarm-bbox.jpg...]
01/29/20 15:33:53 zmesdetect_m2[9788] DBG zm_detect.py:527 [Writing detected image to /var/cache/zoneminder/events/2/2020-01-29/1032/objdetect.jpg]
01/29/20 15:33:53 zmesdetect_m2[9788] DBG zm_detect.py:534 [Writing JSON output to /var/cache/zoneminder/events/2/2020-01-29/1032/objects.json]
01/29/20 15:33:53 zmesdetect_m2[9788] INF zm_detect.py:545 [Removing matches to past detections]
01/29/20 15:33:53 zmesdetect_m2[9788] DBG image_manip.py:27 [trying to load /var/lib/zmeventnotification/images/monitor-2-data.pkl]
01/29/20 15:33:53 zmesdetect_m2[9788] DBG image_manip.py:92 [past detection car@[(60, 194), (260, 194), (260, 366), (60, 194)] approximately matches car@[(58, 194), (260, 194), (260, 366), (58, 194)] removing]
01/29/20 15:33:53 zmesdetect_m2[9788] DBG image_manip.py:92 [past detection 12345@[(164, 269), (212, 269), (212, 288), (164, 269)] approximately matches 12345@[(163, 269), (212, 269), (212, 288), (163, 269)] removing]
01/29/20 15:33:53 zmesdetect_m2[9788] DBG zm_detect.py:548 [Saving detections for monitor 2 for future match]
01/29/20 15:33:53 zmesdetect_m2[9788] INF zm_detect.py:573 [Prediction string:[a] detected:car:99% ]
pliablepixels commented 4 years ago

there is something wrong with your monitor name in the config. It is not picking up the data under [monitor-2] - if it did you'd see log messages saying keys were overridden. I tested on my install and it works fine, so it is likely a monitor id/name issue in your config (or its not picking the objectconfig you think it is)

connectnet commented 4 years ago

ok. I got it. My monitors in zoneminder are named in german [Monitor-1] [Monitor-2] etc. But in objectconfig.ini it has to be named in lower case letters [monitor-1] [monitor-2] etc. Thats what you write in the first comment. Sorry for that. Now it "overrides" as required in the "Monitor specific setting section"

01/29/20 16:16:47 zmesdetect_m2[17131] DBG utils.py:273 [[monitor-2] overrides key:detect_pattern with value:.*]
01/29/20 16:16:47 zmesdetect_m2[17131] DBG utils.py:273 [[monitor-2] overrides key:wait with value:5]
01/29/20 16:16:47 zmesdetect_m2[17131] DBG utils.py:273 [[monitor-2] overrides key:detection_mode with value:first]
01/29/20 16:16:47 zmesdetect_m2[17131] DBG utils.py:273 [[monitor-2] overrides key:models with value:yolo]
01/29/20 16:16:47 zmesdetect_m2[17131] DBG utils.py:273 [[monitor-2] overrides key:poly_color with value:(255,0,0)]
01/29/20 16:16:47 zmesdetect_m2[17131] DBG utils.py:273 [[monitor-2] overrides key:delete_after_analyze with value:yes]

Thanks a lot for your patience.