neo-ZMES - Public Beta

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
tsp84
Posts: 227
Joined: Thu Dec 24, 2020 4:04 am

Re: neo-ZMES - Public Beta

Post by tsp84 »

I haven't touched anything that relates to getting that push token or the custom push script. The gotify notifications work for me so I'm assuming it's something in your environment.

The user your showing in screenshot is Juan but the user in the script is named 'view_only_username'

Check your zm-secrets.yml file and objectconfig.yml
juan11perez
Posts: 64
Joined: Tue Apr 27, 2021 3:41 am

Re: neo-ZMES - Public Beta

Post by juan11perez »

i found the error in my gotify config. I've moved it several times so I missed something.

i dont have a 'view_only_username' , I only the default admin and juan

the view_only user is on your config screenshot. maybe it's hardcoded somewhere?
tsp84
Posts: 227
Joined: Thu Dec 24, 2020 4:04 am

Re: neo-ZMES - Public Beta

Post by tsp84 »

Sorry had a nap lol.

Line 64-66 of the default zm_secrets.yml file has this ->

Code: Select all

# A ZM API user with view only privs for the clickable url
PUSHOVER_USER: view_only_username
PUSHOVER_PASS: 'vbekjrhiurevfbg7438tr6yvb54r37-82'

PUSHOVER_USER and PUSHOVER_PASS are the user and password that is used for the push_user and push_pass in objectconfig.yml

In objectconfig.yml

Code: Select all

# The ZM API user for the clickable URL link in the pushover notification. I HIGHLY recommend https on your ZM host,
# making a user with VIEW privileges of stream and events only and using that for push_user and pass
# example: make a user named 'push_view' and VIEW privs only for STREAM and EVENT
push_user: '{[PUSHOVER_USER]}'
push_pass: '{[PUSHOVER_PASS]}'
That means you have the 'secrets' option inside of objectconfig.yml pointing towards the default zm_secrets.yml file. If you upgraded there may be a file zm_secrets.yml.~1~ or ~2~. Check your zm_secrets.yml file as that's where its getting the 'view_only_username' from.

This is a note inside of the gotify_zmes.sh file

Code: Select all


# If you configured push_user and push_pass in objectconfig then the token will be for that user.
# If you did not configure push_user it will pass you the token that ZMES is using (not recommended).
# I recommend making a ZM API user with VIEW privileges and using that for push_user and push_pass.
Comment out push_user and push_pass in objectconfig.yml for it to use the ZM_USER creds or set it up with a user ->

Code: Select all

# This should force it to use whatever credentials you are using for ZMES to login to ZM API
#push_user: '{[PUSHOVER_USER]}'
#push_pass: '{[PUSHOVER_PASS]}'

# Set it up without using {[secrets]], *** DONT FORGET to quote strings that have special characters in them
push_user: juan
push_pass: 'juanspassword89674^%#%^$#^&%*^)(&-0923-049812-039874'
#---------------------------------------------------------------------------------------------------------------
#use secrets

# in objectconfig.yml *** DONT FORGET to quote {[secrets]} and {{vars}}
push_user: '{[juans_user]}'
push_pass: '{[juans_user_password]}'

# in zm_secrets.yml, *** DONT FORGET to quote strings that have special characters in them
juans_user: juan
juans_user_password: "iujqgfd56&^$&^$79y123fg4eyugfdfq8ywa09*)(&)(7yhqced98eyas9ghxIU{GXIUIUXG&IWSGH"
juan11perez
Posts: 64
Joined: Tue Apr 27, 2021 3:41 am

Re: neo-ZMES - Public Beta

Post by juan11perez »

Ok, so that fixed it. no errors. Sorry about that, but i couldn't work out that the pushover user/pass is used for the custom script as well.

Code: Select all

root@UNRAID:/config/hook# sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.yml --debug --eventid 140
encrypted_data = {'gAAAAABhmb-WVXyT0pxCLeX_kTpfTHmvC3FilX0QkP2jeG8SkbAmDdzbATbpdv2VW8tpo5M8NjDUpKFTkxcxhnBkauJRP7Um-w==': 'gAAAAABhmb-WxysCpfBN-rjLdBOSSvz7HnSsAk6-1Wl7ZyLvUTudxIYhTZ6q5YhlWNVR6XcBoEAm73uxw6E5kGU9SMTwoE1yhw==', 'gAAAAABhmb-WzLjYW6gyoZEH9OrNGThWZHzzZeBCX9Pu-UKKEW0-UBdZR2xd3Vc9vh7qJsl_9z4JLpFZ0J-xEL_rmsNE2t16Jg==': 'gAAAAABhmb-WHsT3b1UysCHi4W-07NLEIAWi49HPDkzcdfkt9bNL8IXu_HMBUqnAGQqIgMk-gMQVFPavvkNroYjjnfYa7vqBbw==', 'gAAAAABhmb-WKvvKUS3rM_GGQfhKq8laz-NgiGe71TJZYRenhD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cp-i2aHrnnaBAQ6hUEyGRqh2SMGY48mggeSfaK7g0r33MLjvjFffxJRGv4HayDGHylr5SZ1edvA4tRo9RY7kcRFJJX6fO46omJ', 'gAAAAABhmb-XszVtFlEsQ-TgSxn_dPHJ-zKvtoAdRH1nNtRnPnMKJOrhPl3C_xsnzCZsUIbtvQViqdtLSVdc67TVCAgz9ze4MQ==': 'gAAAAABhmb-Xbck9yzH9NXxjMClYXu93CDvI7NuepzM9eev3hDx_UI-RTgLlIznWJ1os0ixjFHTB9zwLdPuk09vklh708KE4vDK48DaTprXYlVKR9z8yV8w=', 'name': 'mlapi_one'}
11/21/21 07:40:06.642479 zmesdetect_m6[6650] DBG1 new_yaml.py:242->[config:init: the supplied config file exists -> '/etc/zm/objectconfig.yml']
11/21/21 07:40:06.715257 zmesdetect_m6[6650] DBG1 new_yaml.py:265->[config::init: default configuration built (no secrets or substitution vars replaced, yet!)]
11/21/21 07:40:06.716052 zmesdetect_m6[6650] DBG1 new_yaml.py:170->[config:zmes:proc: 39 built in default keys added to the 'base' config -> ['force_mpd', 'same_model_high_conf', 'skip_mons', 'force_live', 'sanitize_str', 'version', 'basic_user', 'basic_password', 'image_path', 'max_detection_size', 'delete_after_analyze', 'write_debug_image', 'write_image_to_zm', 'hass_enabled', 'hass_people', 'hass_notify', 'hass_cooldown', 'push_err_device', 'push_jpg', 'push_jpg_key', 'push_gif', 'push_gif_key', 'push_debug_device', 'push_cooldown', 'mqtt_topic', 'mqtt_broker', 'mqtt_port', 'tls_cert', 'tls_key', 'fp16_target', 'alpr_api_type', 'alpr_url', 'openalpr_recognize_vehicle', 'openalpr_country', 'openalpr_state', 'openalpr_min_confidence', 'smart_fs_thresh', 'frame_strategy', 'same_model_sequence_strategy']]
11/21/21 07:40:06.716348 zmesdetect_m6[6650] DBG1 new_yaml.py:114->[config:zmes:proc: substituting '{{variables}}' for the 'base' config keys]
11/21/21 07:40:06.717159 zmesdetect_m6[6650] DBG1 new_yaml.py:136->[config:zmes: successfully replaced 3 default sub vars in the base config -> ['base_data_path', 'yolo4_models', 'coral_models']]
11/21/21 07:40:06.717533 zmesdetect_m6[6650] DBG1 new_yaml.py:285->[config:zmes: the configured secrets file exists and is a file -> '/etc/zm/zm_secrets.yml']
11/21/21 07:40:06.717864 zmesdetect_m6[6650] DBG1 new_yaml.py:291->[config:zmes: starting '{[secrets]}' substitution]
11/21/21 07:40:06.72375 zmesdetect_m6[6650] DBG1 new_yaml.py:324->[config:zmes: successfully replaced 17 secrets in the base config -> ['PLATEREC_ALPR_KEY', 'ML_USER', 'ZM_PORTAL', 'PUSHOVER_ERR_TOKEN', 'ML_PASSWORD', 'ZM_PASSWORD', 'MQTT_PASSWORD', 'PUSHOVER_PASS', 'PUSHOVER_USER_KEY', 'MQTT_USERNAME', 'mlapi_one_key', 'HA_SERVER', 'HA_TOKEN', 'ZM_USER', 'PUSHOVER_APP_TOKEN', 'ZM_API_PORTAL', 'PUSHOVER_USER']]
11/21/21 07:40:06.724117 zmesdetect_m6[6650] DBG1 new_yaml.py:329->[config:zmes: there are 2 secrets configured that have no substitution candidates in the base config or the secrets file -> ['AWS_SECRET_ACCESS_KEY', 'AWS_ACCESS_KEY_ID']]
11/21/21 07:40:06.725612 zmesdetect_m6[6650] DBG1 new_yaml.py:358->[config:zmes: starting '{{variable}}' substitution]
11/21/21 07:40:06.730076 zmesdetect_m6[6650] DBG1 new_yaml.py:375->[config:zmes: successfully replaced 51 sub vars in the base config -> ['face_detection_pattern', 'disable_locks', 'frame_set', 'object_detection_pattern', 'openalpr_cmdline_min_confidence', 'known_images_path', 'tpu_face_weights_mobilenetv2', 'unknown_images_path', 'match_past_detections', 'cpu_max_processes', 'smart_fps_thresh', 'yolo4_object_processor', 'contained_area', 'object_min_confidence', 'tpu_tf2_mobilenetv2', 'platerec_min_score', 'yolo4_object_framework', 'platerec_stats', 'openalpr_cmdline_binary', 'cpu_max_lock_wait', 'openalpr_cmdline_params', 'tpu_min_confidence', 'tpu_efficientdet_lite3', 'frame_strategy', 'yolo4_object_weights', 'save_unknown_faces', 'face_recog_dist_threshold', 'face_detection_framework', 'gpu_max_processes', 'show_models', 'alpr_detection_pattern', 'tpu_object_weights_mobilenetv2', 'face_train_model', 'tpu_object_framework', 'face_num_jitters', 'save_unknown_faces_leeway_pixels', 'tpu_object_labels', 'face_model', 'gpu_max_lock_wait', 'yolo4_object_labels', 'past_det_max_diff_area', 'tpu_max_lock_wait', 'alpr_key', 'same_model_sequence_strategy', 'tpu_max_processes', 'yolo4_object_config', 'face_upsample_times', 'platerec_min_dscore', 'tpu_object_weights_mobiledet', 'max_detection_size', 'model_sequence']]
11/21/21 07:40:06.73138 zmesdetect_m6[6650] DBG1 new_yaml.py:187->[config:zmes:proc: Base config has been built, all properly configured {[secrets]} and {{vars}} have been replaced! Remember you must manually build per monitor overrode configurations]
11/21/21 07:40:06.731689 zmesdetect_m6[6650] DBG1 zm_detect.py:540->[perf:zmes: building the intial config took 0.089231 ]
11/21/21 07:40:06.732054 zmesdetect_m6[6650] DBG1 new_yaml.py:762->[zmes:api create: building ZM API Session]
11/21/21 07:40:06.735909 zmesdetect_m6[6650] DBG1 api.py:114->[api: SSL certificate verification disabled (encryption enabled, vulnerable to MITM attacks)]
11/21/21 07:40:06.736551 zmesdetect_m6[6650] DBG1 api.py:283->[api: no token found, trying user/pass for login]
11/21/21 07:40:06.801482 zmesdetect_m6[6650] DBG1 api.py:320->[api: detected API ver 2.0+, using token system]
11/21/21 07:40:06.801967 zmesdetect_m6[6650] DBG1 api.py:335->[api: access token expires on: 2021-11-21 09:40:06.801949 (7200s)]
11/21/21 07:40:06.802327 zmesdetect_m6[6650] DBG1 api.py:347->[api: refresh token expires on: 2021-11-22 07:40:06.802319 (86400s)]
11/21/21 07:40:06.8208 zmesdetect_m6[6650] DBG1 new_yaml.py:795->[zmes:api create: ZM API created]
11/21/21 07:40:07.055925 zmesdetect_m6[6650] DBG1 ZMLog:336->[------|  FORKED NEO --- app->Hooks: 7.0.3 - pyzm: 1.0.3 - ES: 7.0.3 - OpenCV:4.5.4 |------]
11/21/21 07:40:07.056329 zmesdetect_m6[6650] DBG1 ZMLog:336->[zmes: Setting up signal handlers for log 'rotation' and log 'interrupt']
11/21/21 07:40:06.894366 zmesdetect_m6[6650] DBG1 zm_detect.py:652->[zmes: this is a 'PAST' (debugging?) event!]
11/21/21 07:40:07.057403 zmesdetect_m6[6650] DBG1 ZMLog:336->[|----------= Encrypted Route Name: 'mlapi_one' | Gateway URL: 'http://192.168.1.100:5002/api/v1' | Weight: 0 =----------|]
11/21/21 07:40:06.896294 zmesdetect_m6[6650] DBG1 zm_detect.py:103->[zmes:mlapi:login: No need to login, access token is valid for 421.11444544792175 sec]
11/21/21 07:40:07.010247 zmesdetect_m6[6650] DBG1 zm_detect.py:318->[
** Gateway URL: 'http://192.168.1.100:5002/api/v1/detect/object?type=object' using auth_header={'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGc......'} 
**** params={'delete': True, 'response_format': 'zm_detect'}
****** JSON: stream: 140 - mid: 6 - reason: None - stream options: {'frame_strategy': 'first', 'frame_set': 'snapshot, alarm, snapshot', 'contig_frames_before_error': 2, 'delay_between_attempts': 2.143256, 'max_attempts': 3, 'delay_between_snapshots': 1, 'smart_fps_thresh': '5', 'save_frames': 'no', 'save_frames_dir': None, 'PAST_EVENT': True} - files: {}
]
11/21/21 07:40:07.058992 zmesdetect_m6[6650] DBG1 ZMLog:336->[Connected to ZoneMinder Logging system with user 'www-data' -> '/var/log/zm/zmesdetect_m6.log']
11/21/21 07:40:08.336688 zmesdetect_m6[6650] DBG1 zm_detect:383->[zmes:mlapi: parsed JSON detection data in multipart response]
11/21/21 07:40:08.337 zmesdetect_m6[6650] DBG1 zm_detect:379->[zmes:mlapi: parsed the matched image from bytes to a jpeg encoded array in multipart response]
11/21/21 07:40:08.34818 zmesdetect_m6[6650] DBG1 zm_detect:763->[perf:zmes:mlapi: Monitor: office (6)->'Event': 140 mlapi detection took: 1.450705]
11/21/21 07:40:08.348521 zmesdetect_m6[6650] DBG1 pyzm_utils:1336->['success'->  True  ]
11/21/21 07:40:08.348772 zmesdetect_m6[6650] DBG1 pyzm_utils:1297->[--- --- ---]
11/21/21 07:40:08.349038 zmesdetect_m6[6650] DBG1 pyzm_utils:1298->['matched_data'->  labels-->['person']  ]
11/21/21 07:40:08.349276 zmesdetect_m6[6650] DBG1 pyzm_utils:1298->['matched_data'->  model_names-->['coral']  ]
11/21/21 07:40:08.34954 zmesdetect_m6[6650] DBG1 pyzm_utils:1298->['matched_data'->  confidences-->[0.72265625]  ]
11/21/21 07:40:08.349795 zmesdetect_m6[6650] DBG1 pyzm_utils:1298->['matched_data'->  frame_id-->s-23  ]
11/21/21 07:40:08.350054 zmesdetect_m6[6650] DBG1 pyzm_utils:1298->['matched_data'->  type-->['object']  ]
11/21/21 07:40:08.35031 zmesdetect_m6[6650] DBG1 pyzm_utils:1298->['matched_data'->  boxes-->[[390, 407, 1811, 1073]]  ]
11/21/21 07:40:08.350563 zmesdetect_m6[6650] DBG1 pyzm_utils:1298->['matched_data'->  image_dimensions-->{'original': [1080, 1920], 'resized': None}  ]
11/21/21 07:40:08.350816 zmesdetect_m6[6650] DBG1 pyzm_utils:1298->['matched_data'->  polygons-->[{'name': 'full_image', 'value': [[0, 0], [1920, 0], [1920, 1080], [0, 1080]], 'pattern': None}]  ]
11/21/21 07:40:08.351106 zmesdetect_m6[6650] DBG1 pyzm_utils:1298->['matched_data'->  error_boxes-->[[1555, 875, 1914, 1076]]  ]
11/21/21 07:40:08.351394 zmesdetect_m6[6650] DBG1 pyzm_utils:1298->['matched_data'->  image--><uint-8 encoded jpg>  ]
11/21/21 07:40:08.351454 zmesdetect_m6[6650] INF zm_detect:862->[zmes:prediction: '[s-23] person(72%)']
11/21/21 07:40:08.35193 zmesdetect_m6[6650] DBG1 zm_detect:864->[zmes:prediction:JSON: {"frame_id": "23", "labels": ["person"], "confidences": [0.72265625], "boxes": [[390, 407, 1811, 1073]], "image_dimensions": {"original": [1080, 1920], "resized": null}}]
11/21/21 07:40:08.353523 zmesdetect_m6[6650] DBG1 zm_detect:1223->[zmes: writing objects.json and objdetect.jpg to '/var/cache/zoneminder/events/6/2021-11-21/140']
11/21/21 07:40:08.36113 zmesdetect_m6[6650] DBG2 zm_detect:1395->[api:make_req: 'put'->http://192.168.1.100:8088/zm/api/events/140.json payload={'Event[Notes]': '[s-23] :detected:person(72%) Motion: All'} query={'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjM3NDY2MDA2LCJleHAiOjE2Mzc0NzMyMDYsInVzZXIiOiJqdWFuIiwidHlwZSI6ImFjY2VzcyJ9.qVF3GBdxUwKH3d4nt3D0hyrkRPNE7GTCTlK3mwICen4...'}]
11/21/21 07:40:08.371427 zmesdetect_m6[6650] DBG1 zm_detect:1406->[zmes: replaced old note -> '[s-24] :detected:person(72%) Motion: All' with new note -> '[s-23] :detected:person(72%) Motion: All']
11/21/21 07:40:08.371897 zmesdetect_m6[6650] DBG1 zm_detect:1606->[perf:zmes:FINAL: 'Monitor': office (6)->'Event': 140-->'Frame ID':23 [PAST event] [total:1.730134] [detection:1.450705] [after core detection: 0.023204] ]
11/21/21 07:40:08.372577 zmesdetect_m6[6650] DBG1 zm_detect:1607->[ZM Log: Closing all log handlers NOW]
root@UNRAID:/config/hook# 
However still no face detection. I'm adding a pastebin for my mlapi and objectconfig to see if I'm missing some setting.
mlapiconfig
https://pastebin.com/LDiDkvx6

objectconfig
https://pastebin.com/ZDzqRf4j
tsp84
Posts: 227
Joined: Thu Dec 24, 2020 4:04 am

Re: neo-ZMES - Public Beta

Post by tsp84 »

Try just running face instead of 'object, face' to confirm that face detection is working as expected.

I think the frame_strategy is stopping it because it is finding an object (a person) and then stopping (I have to code some logic that will allow it to finish the current models sequences before bailing when the frame_strategy is set to 'first')

Post the mlapi logs, there may be a clue there. I am assuming it's because it finds an object before it runs face detection due to the frame_strategy.

Code: Select all

model_sequence :  object, face
# Change it to
model_sequence :  face

# Also you can change your frame strategy so it processes all the frames in the frame_set buffer
frame_strategy: first
# Chage it to
frame_strategy: most
juan11perez
Posts: 64
Joined: Tue Apr 27, 2021 3:41 am

Re: neo-ZMES - Public Beta

Post by juan11perez »

ok, made the changes.
also noticed that objectconfig.yml has frame_strategy: '{{frame_strategy}}' but it's not defined like in mlapi.

no detection. this is mlapi.log
https://pastebin.com/5KmfHh9C
tsp84
Posts: 227
Joined: Thu Dec 24, 2020 4:04 am

Re: neo-ZMES - Public Beta

Post by tsp84 »

Make sure to restart mlapi even though it rehashed the config, I have to add logic for it to reload models on a rehash. Ill keep looking at your conf and pick through the logs to see if I spot the issue
tsp84
Posts: 227
Joined: Thu Dec 24, 2020 4:04 am

Re: neo-ZMES - Public Beta

Post by tsp84 »

NVM, its on my end, 3-4 lines of code was messed about. Was supposed to be in a diff branch.

I just pushed pyzm, just reclone and reinstall pyzm
juan11perez
Posts: 64
Joined: Tue Apr 27, 2021 3:41 am

Re: neo-ZMES - Public Beta

Post by juan11perez »

yessss !!! it works..... and following the model_sequence : object, face

but frame_strategy: most needs to be like this. if set to first it doesnt work

Code: Select all

root@UNRAID:/var/lib/zmeventnotification# sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.yml --debug --eventid 294
encrypted_data = {'gAAAAABhmhC8ybGJ8v9Z0Mb0fBaw34eKF5tB-E0zuh0kRfAdemPXN1nablT5s8zv7eBZfSzhrcs-8K0ZSI-90cknlXlrjCxgiw==': 'gAAAAABhmhC81KHEIr01qe-_rej0T9SW7MjSZe5VXH939OXNxvQiKhHRjXDDWMX-u4LdHkercPQsnk1Hs6Uu7OGPzcNldR86uQ==', 'gAAAAABhmhC8LKmqe-KRAc24FkznApt6CEUAM8VUyKvh0aiCa1k0EeRl1jVVd-dAuWo7WFakcof9j-zU47Xbb1_Leyqu4bj7Dw==': 'gAAAAABhmhC8NbAk7F2KoIVOScDikugsx9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1_zJCIeZ81jX2U96psKDZVtNPqV2fq-3TZtkgqTDa9d6cgNI5Dtqic8A==': 'gAAAAABhmhC8dkjMOMbJ0pKfsRlwnV4IyKCx7ejFSGqo7Zt-ZWLQkiwt5vuw1x-pc2xHpPrrMwNFICO8x6Etslk6b2I8JDmxoBMNNs5QHd4yXONcDoQ6DUL8FPGVanZwv9Cr0rgkEBik', 'gAAAAABhmhC8CzddoMP8sAYvwl8jG8w3fZnztO_u-8cdi5qqM57Zcg18VS8_nw247T_ZT_Heplx5g6gElew2L32cxhSOl0Jvmw==': 'gAAAAABhmhC8AThnNoJ323QF_LZd41iRKm4U7mLfLgWcQ2rKzyUXVWykc8jBbhwXfjdctqtJI7_xLdU-7kKOpg3ZTaMtLyz2gLSpwQeE2FfywgDWqdgl5-I=', 'name': 'mlapi_one'}
11/21/21 13:26:19.835217 zmesdetect_m6[5442] DBG1 new_yaml.py:242->[config:init: the supplied config file exists -> '/etc/zm/objectconfig.yml']
11/21/21 13:26:19.916129 zmesdetect_m6[5442] DBG1 new_yaml.py:265->[config::init: default configuration built (no secrets or substitution vars replaced, yet!)]
11/21/21 13:26:19.917029 zmesdetect_m6[5442] DBG1 new_yaml.py:170->[config:zmes:proc: 38 built in default keys added to the 'base' config -> ['force_mpd', 'same_model_high_conf', 'skip_mons', 'force_live', 'sanitize_str', 'version', 'basic_user', 'basic_password', 'image_path', 'max_detection_size', 'delete_after_analyze', 'write_debug_image', 'write_image_to_zm', 'hass_enabled', 'hass_people', 'hass_notify', 'hass_cooldown', 'push_err_device', 'push_jpg', 'push_jpg_key', 'push_gif', 'push_gif_key', 'push_debug_device', 'push_cooldown', 'mqtt_topic', 'mqtt_broker', 'mqtt_port', 'tls_cert', 'tls_key', 'fp16_target', 'alpr_api_type', 'alpr_url', 'openalpr_recognize_vehicle', 'openalpr_country', 'openalpr_state', 'openalpr_min_confidence', 'smart_fs_thresh', 'same_model_sequence_strategy']]
11/21/21 13:26:19.917339 zmesdetect_m6[5442] DBG1 new_yaml.py:114->[config:zmes:proc: substituting '{{variables}}' for the 'base' config keys]
11/21/21 13:26:19.91821 zmesdetect_m6[5442] DBG1 new_yaml.py:136->[config:zmes: successfully replaced 3 default sub vars in the base config -> ['yolo4_models', 'base_data_path', 'coral_models']]
11/21/21 13:26:19.918594 zmesdetect_m6[5442] DBG1 new_yaml.py:285->[config:zmes: the configured secrets file exists and is a file -> '/etc/zm/zm_secrets.yml']
11/21/21 13:26:19.918934 zmesdetect_m6[5442] DBG1 new_yaml.py:291->[config:zmes: starting '{[secrets]}' substitution]
11/21/21 13:26:19.924849 zmesdetect_m6[5442] DBG1 new_yaml.py:324->[config:zmes: successfully replaced 17 secrets in the base config -> ['ML_PASSWORD', 'ZM_PASSWORD', 'HA_SERVER', 'ML_USER', 'MQTT_USERNAME', 'PUSHOVER_USER_KEY', 'ZM_API_PORTAL', 'HA_TOKEN', 'ZM_PORTAL', 'MQTT_PASSWORD', 'mlapi_one_key', 'ZM_USER', 'PLATEREC_ALPR_KEY', 'PUSHOVER_ERR_TOKEN', 'PUSHOVER_APP_TOKEN', 'PUSHOVER_USER', 'PUSHOVER_PASS']]
11/21/21 13:26:19.925291 zmesdetect_m6[5442] DBG1 new_yaml.py:329->[config:zmes: there are 2 secrets configured that have no substitution candidates in the base config or the secrets file -> ['AWS_SECRET_ACCESS_KEY', 'AWS_ACCESS_KEY_ID']]
11/21/21 13:26:19.926922 zmesdetect_m6[5442] DBG1 new_yaml.py:358->[config:zmes: starting '{{variable}}' substitution]
11/21/21 13:26:19.932408 zmesdetect_m6[5442] DBG1 new_yaml.py:375->[config:zmes: successfully replaced 51 sub vars in the base config -> ['contained_area', 'face_detection_pattern', 'tpu_efficientdet_lite3', 'platerec_min_dscore', 'yolo4_object_weights', 'cpu_max_processes', 'yolo4_object_config', 'tpu_tf2_mobilenetv2', 'save_unknown_faces', 'tpu_object_weights_mobiledet', 'cpu_max_lock_wait', 'gpu_max_processes', 'object_detection_pattern', 'face_upsample_times', 'alpr_key', 'openalpr_cmdline_min_confidence', 'tpu_max_processes', 'disable_locks', 'gpu_max_lock_wait', 'same_model_sequence_strategy', 'tpu_max_lock_wait', 'face_model', 'yolo4_object_labels', 'alpr_detection_pattern', 'save_unknown_faces_leeway_pixels', 'tpu_face_weights_mobilenetv2', 'tpu_object_framework', 'max_detection_size', 'yolo4_object_processor', 'face_recog_dist_threshold', 'face_num_jitters', 'show_models', 'tpu_object_labels', 'known_images_path', 'frame_strategy', 'smart_fps_thresh', 'frame_set', 'object_min_confidence', 'model_sequence', 'face_detection_framework', 'match_past_detections', 'openalpr_cmdline_params', 'face_train_model', 'platerec_min_score', 'unknown_images_path', 'tpu_min_confidence', 'tpu_object_weights_mobilenetv2', 'openalpr_cmdline_binary', 'platerec_stats', 'past_det_max_diff_area', 'yolo4_object_framework']]
11/21/21 13:26:19.934226 zmesdetect_m6[5442] DBG1 new_yaml.py:187->[config:zmes:proc: Base config has been built, all properly configured {[secrets]} and {{vars}} have been replaced! Remember you must manually build per monitor overrode configurations]
11/21/21 13:26:19.934644 zmesdetect_m6[5442] DBG1 zm_detect.py:540->[perf:zmes: building the intial config took 0.099448 ]
11/21/21 13:26:19.935158 zmesdetect_m6[5442] DBG1 new_yaml.py:762->[zmes:api create: building ZM API Session]
11/21/21 13:26:19.940661 zmesdetect_m6[5442] DBG1 api.py:114->[api: SSL certificate verification disabled (encryption enabled, vulnerable to MITM attacks)]
11/21/21 13:26:19.941506 zmesdetect_m6[5442] DBG1 api.py:283->[api: no token found, trying user/pass for login]
11/21/21 13:26:20.003337 zmesdetect_m6[5442] DBG1 api.py:320->[api: detected API ver 2.0+, using token system]
11/21/21 13:26:20.004059 zmesdetect_m6[5442] DBG1 api.py:335->[api: access token expires on: 2021-11-21 15:26:20.004030 (7200s)]
11/21/21 13:26:20.004432 zmesdetect_m6[5442] DBG1 api.py:347->[api: refresh token expires on: 2021-11-22 13:26:20.004421 (86400s)]
11/21/21 13:26:20.02595 zmesdetect_m6[5442] DBG1 new_yaml.py:795->[zmes:api create: ZM API created]
11/21/21 13:26:20.261976 zmesdetect_m6[5442] DBG1 ZMLog:336->[------|  FORKED NEO --- app->Hooks: 7.0.3 - pyzm: 1.0.3 - ES: 7.0.3 - OpenCV:4.5.4 |------]
11/21/21 13:26:20.262335 zmesdetect_m6[5442] DBG1 ZMLog:336->[zmes: Setting up signal handlers for log 'rotation' and log 'interrupt']
11/21/21 13:26:20.104863 zmesdetect_m6[5442] DBG1 zm_detect.py:652->[zmes: this is a 'PAST' (debugging?) event!]
11/21/21 13:26:20.26331 zmesdetect_m6[5442] DBG1 ZMLog:336->[|----------= Encrypted Route Name: 'mlapi_one' | Gateway URL: 'http://192.168.1.100:5002/api/v1' | Weight: 0 =----------|]
11/21/21 13:26:20.107171 zmesdetect_m6[5442] DBG1 zm_detect.py:103->[zmes:mlapi:login: No need to login, access token is valid for 292.2192554473877 sec]
11/21/21 13:26:20.211154 zmesdetect_m6[5442] DBG1 zm_detect.py:318->[
** Gateway URL: 'http://192.168.1.100:5002/api/v1/detect/object?type=object' using auth_header={'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGc......'} 
**** params={'delete': True, 'response_format': 'zm_detect'}
****** JSON: stream: 294 - mid: 6 - reason: None - stream options: {'frame_strategy': 'most', 'frame_set': 'snapshot, alarm, snapshot', 'contig_frames_before_error': 2, 'delay_between_attempts': 2.143256, 'max_attempts': 3, 'delay_between_snapshots': 1, 'smart_fps_thresh': '5', 'save_frames': 'no', 'save_frames_dir': None, 'PAST_EVENT': True} - files: {}
]
11/21/21 13:26:20.264989 zmesdetect_m6[5442] DBG1 ZMLog:336->[Connected to ZoneMinder Logging system with user 'www-data' -> '/var/log/zm/zmesdetect_m6.log']
11/21/21 13:26:24.584147 zmesdetect_m6[5442] DBG1 zm_detect:383->[zmes:mlapi: parsed JSON detection data in multipart response]
11/21/21 13:26:24.584468 zmesdetect_m6[5442] DBG1 zm_detect:379->[zmes:mlapi: parsed the matched image from bytes to a jpeg encoded array in multipart response]
11/21/21 13:26:24.595984 zmesdetect_m6[5442] DBG1 zm_detect:763->[perf:zmes:mlapi: Monitor: office (6)->'Event': 294 mlapi detection took: 4.488341]
11/21/21 13:26:24.596385 zmesdetect_m6[5442] DBG1 pyzm_utils:1336->['success'->  True  ]
11/21/21 13:26:24.596684 zmesdetect_m6[5442] DBG1 pyzm_utils:1297->[--- --- ---]
11/21/21 13:26:24.596983 zmesdetect_m6[5442] DBG1 pyzm_utils:1298->['matched_data'->  labels-->['person', 'Juan']  ]
11/21/21 13:26:24.59725 zmesdetect_m6[5442] DBG1 pyzm_utils:1298->['matched_data'->  model_names-->['coral', 'face_dlib']  ]
11/21/21 13:26:24.597541 zmesdetect_m6[5442] DBG1 pyzm_utils:1298->['matched_data'->  confidences-->[0.66796875, 1]  ]
11/21/21 13:26:24.597838 zmesdetect_m6[5442] DBG1 pyzm_utils:1298->['matched_data'->  frame_id-->s-68  ]
11/21/21 13:26:24.598078 zmesdetect_m6[5442] DBG1 pyzm_utils:1298->['matched_data'->  type-->['object', 'face']  ]
11/21/21 13:26:24.598307 zmesdetect_m6[5442] DBG1 pyzm_utils:1298->['matched_data'->  boxes-->[[256, 446, 1798, 1062], [818, 554, 1210, 948]]  ]
11/21/21 13:26:24.598533 zmesdetect_m6[5442] DBG1 pyzm_utils:1298->['matched_data'->  image_dimensions-->{'original': [1080, 1920], 'resized': None}  ]
11/21/21 13:26:24.598878 zmesdetect_m6[5442] DBG1 pyzm_utils:1298->['matched_data'->  polygons-->[{'name': 'full_image', 'value': [[0, 0], [1920, 0], [1920, 1080], [0, 1080]], 'pattern': None}]  ]
11/21/21 13:26:24.599162 zmesdetect_m6[5442] DBG1 pyzm_utils:1298->['matched_data'->  image--><uint-8 encoded jpg>  ]
11/21/21 13:26:24.599222 zmesdetect_m6[5442] INF zm_detect:862->[zmes:prediction: '[s-68] person(67%), Juan(100%)']
11/21/21 13:26:24.599719 zmesdetect_m6[5442] DBG1 zm_detect:864->[zmes:prediction:JSON: {"frame_id": "68", "labels": ["person", "Juan"], "confidences": [0.66796875, 1], "boxes": [[256, 446, 1798, 1062], [818, 554, 1210, 948]], "image_dimensions": {"original": [1080, 1920], "resized": null}}]
11/21/21 13:26:24.602135 zmesdetect_m6[5442] DBG1 zm_detect:1223->[zmes: writing objects.json and objdetect.jpg to '/var/cache/zoneminder/events/6/2021-11-21/294']
11/21/21 13:26:24.609647 zmesdetect_m6[5442] DBG2 zm_detect:1395->[api:make_req: 'put'->http://192.168.1.100:8088/zm/api/events/294.json payload={'Event[Notes]': '[s-68] :detected:person(67%), Juan(100%) Motion: All'} query={'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjM3NDg2NzgwLCJleHAiOjE2Mzc0OTM5ODAsInVzZXIiOiJqdWFuIiwidHlwZSI6ImFjY2VzcyJ9.kP2yXHy1rQcBm8lLLXFi-TwubY1AhstQmCAkp632Xvw...'}]
11/21/21 13:26:24.618519 zmesdetect_m6[5442] DBG1 zm_detect:1406->[zmes: replaced old note -> '[s-63] :detected:person(65%), Juan(100%) Motion: All' with new note -> '[s-68] :detected:person(67%), Juan(100%) Motion: All']
11/21/21 13:26:24.618939 zmesdetect_m6[5442] DBG1 zm_detect:1606->[perf:zmes:FINAL: 'Monitor': office (6)->'Event': 294-->'Frame ID':68 [PAST event] [total:4.784413] [detection:4.488341] [after core detection: 0.022493] ]
11/21/21 13:26:24.619442 zmesdetect_m6[5442] DBG1 zm_detect:1607->[ZM Log: Closing all log handlers NOW]
root@UNRAID:/var/lib/zmeventnotification# 
Last edited by juan11perez on Sun Nov 21, 2021 9:42 am, edited 1 time in total.
tsp84
Posts: 227
Joined: Thu Dec 24, 2020 4:04 am

Re: neo-ZMES - Public Beta

Post by tsp84 »

I will test alpr and files tmrw they were working before the YAML config change, might need some tweaking though.
tsp84
Posts: 227
Joined: Thu Dec 24, 2020 4:04 am

Re: neo-ZMES - Public Beta

Post by tsp84 »

Im adjusting how that logic works, I'll push today for a fix that will let the sequences keep going if frame is set to 'first' and then break at the end of processing that frame.
juan11perez
Posts: 64
Joined: Tue Apr 27, 2021 3:41 am

Re: neo-ZMES - Public Beta

Post by juan11perez »

Thank you for all your support. I have replaced pyzm and it now detects face with frame_strategy: first
tsp84
Posts: 227
Joined: Thu Dec 24, 2020 4:04 am

Re: neo-ZMES - Public Beta

Post by tsp84 »

No problem! Glad someone is testing it out!
juan11perez
Posts: 64
Joined: Tue Apr 27, 2021 3:41 am

Re: neo-ZMES - Public Beta

Post by juan11perez »

@tsp84
Good day. Are you passing mqtt to homeassistant to send HA notifications? if yes can you share your automation?
I was using the below with the oringinal zm and the json was parsing fine, but it's not doing the job with neozm

Code: Select all

  - id: notify_person_detected
    alias: Notify person detected
    # initial_state: true
    mode: single  
    trigger:
    - platform: mqtt
      topic: zm136/#
    condition:
    - "{{trigger.payload_json['eventtype'] == 'event_start'}}"
    - "{{trigger.payload_json['detection'].labels.0 == 'person'}}"
    - "{{trigger.payload_json['detection'].confidences.0 >= 0.7}}"
    action:
    - variables:
        zm_token: '{{states("sensor.zm_token")}}'  
        message: >
          {% if trigger.payload_json['detection'].labels.1 in ['unknown','Juan','Magda','Sofia','Bruno','Xiomara'] %}
            {{trigger.payload_json['detection'].labels.1 |title}} detected with {{trigger.payload_json['detection'].confidences.1|round(1)*100}}% confidence
          {% elif trigger.payload_json['detection'].labels.2 in ['unknown','Juan','Magda','Sofia','Bruno','Xiomara'] %}
            {{trigger.payload_json['detection'].labels.2 |title}} detected with {{trigger.payload_json['detection'].confidences.2|round(1)*100}}% confidence
          {% elif trigger.payload_json['detection'].labels.3 in ['unknown','Juan','Magda','Sofia','Bruno','Xiomara'] %}
            {{trigger.payload_json['detection'].labels.3 |title}} detected with {{trigger.payload_json['detection'].confidences.3|round(1)*100}}% confidence   
          {% elif trigger.payload_json['detection'].labels.4 in ['unknown','Juan','Magda','Sofia','Bruno','Xiomara'] %}
            {{trigger.payload_json['detection'].labels.4 |title}} detected with {{trigger.payload_json['detection'].confidences.4|round(1)*100}}% confidence                     
          {% else %}
            {{trigger.payload_json['detection'].labels.0 |title}} detected with {{trigger.payload_json['detection'].confidences.0|round(1)*100}}% confidence
          {% endif %}
    - condition: template
      value_template: "{{trigger.payload_json['monitor'] == 2}}"
    - service: notify.mobile_app_group
      data:
        title: "{{ trigger.payload_json['name'].split(':')[0]|title }} Camera" 
        message: "{{message}}"
        data:
          icon: https://mydomain/local/travel_time/hass.jpg
          tag: "{{trigger.payload_json['eventid']}}"
          image: "https://mydomain/zm/index.php?view=image&eid={{trigger.payload_json['eventid']}}&fid=objdetect&popup=1&token={{zm_token}}"
          ttl: 86400
          priority: high 
          clickAction: '/lovelace-01-dash/1' 
          actions:
          - action: "URI" # Must be set to URI if you plan to use a URI
            title: "Open Clip"
            uri: "https://mydomain/zm/cgi-bin/nph-zms?mode=jpeg&frame=1&replay=none&source=event&event={{trigger.payload_json['eventid']}}&connkey=77493&token={{zm_token}}"
The section -- trigger.payload_json['detection'].labels.0 -- is throwing the error "labels" is not an attribute. However, when I use the template editor in HA it can read it fine.
tsp84
Posts: 227
Joined: Thu Dec 24, 2020 4:04 am

Re: neo-ZMES - Public Beta

Post by tsp84 »

At the moment it doesnt send the labels it just sends the whole 'Notes' string ->

Code: Select all


[mqtt:publish: sending -> topic: 'zmes/data/1' data: {"eid": "50599", "mid": 1, "name": "Front", "reason": "[120] :detected:person(85%-yolo[GPU])", "z
  one": "Front - Substream", "cause": "Linked", "type": "start", "start_time": "2021-11-26 17:10:32", "past_event": null}]
 
If you would like that data available I can make a separate topic or something. HA has a limit of 255 chars unless you change things to attributes or something and I haven't played around much with it yet. So if there are a lot of labels and the message is > 255 it just errors out with 0 data received in HA.

I can make a push shortly where it sends the labels confs and boxes to 1 topic and then the other data stays in the topic it is already in.

What data would you like to see passed with MQTT ?
Post Reply