ZoneMinder / zmeventnotification

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

No Object Detection #368

Closed tibmeister closed 3 years ago

tibmeister commented 3 years ago

Event Server version 6.1.14

Hooks version (if you are using Object Detection) app:6.1.14, pyzm:0.3.36

The version of ZoneMinder you are using: 1.34.23

What is the nature of your issue Bug

Details

Alarm trigger does not perform any object detection since upgrading ES and ZM.

Debug Logs (if applicable)


03/10/21 22:58:21 zmesdetect_m2[29068] INF ZMLog.py:223 [Setting up signal handler for logs]
03/10/21 22:58:22 zmesdetect_m2[29068] INF zm_detect.py:280 [---------| app:6.1.14, pyzm:0.3.36, ES:6.1.14 , OpenCV:4.5.1-pre|------------]
03/10/21 22:58:22 zmesdetect_m2[29068] DBG1 utils.py:406 [secret filename: /etc/zm/secrets.ini]
03/10/21 22:58:22 zmesdetect_m2[29068] DBG2 utils.py:379 [Secret token found in config: !ZM_PORTAL]
03/10/21 22:58:22 zmesdetect_m2[29068] DBG2 utils.py:379 [Secret token found in config: !ZM_USER]
03/10/21 22:58:22 zmesdetect_m2[29068] DBG2 utils.py:379 [Secret token found in config: !ZM_PASSWORD]
03/10/21 22:58:22 zmesdetect_m2[29068] DBG2 utils.py:379 [Secret token found in config: !ZM_API_PORTAL]
03/10/21 22:58:22 zmesdetect_m2[29068] DBG1 utils.py:441 [allowing self-signed certs to work...]
03/10/21 22:58:22 zmesdetect_m2[29068] DBG2 utils.py:171 [import_zm_zones: match_reason=True and reason=Forced Web]
03/10/21 22:58:22 zmesdetect_m2[29068] DBG2 utils.py:174 [Getting ZM zones using https://zm.tiberiansun.us:2417/zm/api/zones/forMonitor/2.json?username=xxx&password=yyy&user=xxx&pass=yyy]
03/10/21 22:58:22 zmesdetect_m2[29068] DBG2 utils.py:218 [Skipping Day - Driveway End as it is inactive]
03/10/21 22:58:22 zmesdetect_m2[29068] DBG2 utils.py:218 [Skipping Day - Porch as it is inactive]
03/10/21 22:58:22 zmesdetect_m2[29068] INF zm_detect.py:305 [Importing local classes for Object/Face]
03/10/21 22:58:22 zmesdetect_m2[29068] INF zm_detect.py:328 [Connecting with ZM APIs]
03/10/21 22:58:22 zmesdetect_m2[29068] DBG2 api.py:69 [API SSL certificate check has been disbled]
03/10/21 22:58:22 zmesdetect_m2[29068] DBG1 api.py:171 [using username/password for login]
03/10/21 22:58:22 zmesdetect_m2[29068] FAT zm_detect.py:580 [Unrecoverable error:'str' object has no attribute 'lineno' Traceback:Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pyzm/api.py", line 193, in _login
    r.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://zm.tiberiansun.us:2417/api/host/login.json

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 575, in <module>
    main_handler()
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 329, in main_handler
    zmapi = zmapi.ZMApi(options=api_options)
  File "/usr/local/lib/python3.6/dist-packages/pyzm/api.py", line 77, in __init__
    self._login()
  File "/usr/local/lib/python3.6/dist-packages/pyzm/api.py", line 221, in _login
    self.logger.Error('Got API login error: {}'.format(err), 'error')
  File "/usr/local/lib/python3.6/dist-packages/pyzm/ZMLog.py", line 422, in Error
    _log('ERR',message,caller)
  File "/usr/local/lib/python3.6/dist-packages/pyzm/ZMLog.py", line 350, in _log
    line = caller.lineno
AttributeError: 'str' object has no attribute 'lineno'
]

My object detection config

[object]

# 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 .*
#object_detection_pattern=(person|car|motorbike|bus|truck|boat)
object_detection_pattern=.*

object_min_confidence=0.3

# For Google Coral Edge TPU
#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

# For YoloV3 full
#object_framework=opencv
#object_processor=cpu # or gpu
#object_config={{base_data_path}}/models/yolov3/yolov3.cfg
#object_weights={{base_data_path}}/models/yolov3/yolov3.weights
#object_labels={{base_data_path}}/models/yolov3/coco.names

# FOR YoloV4. 
#object_framework=opencv
#object_processor=cpu # or gpu
#object_config={{base_data_path}}/models/yolov4/yolov4.cfg
#object_weights={{base_data_path}}/models/yolov4/yolov4.weights
#object_labels={{base_data_path}}/models/yolov4/coco.names

# For tiny Yolo V3
object_framework=opencv
object_processor=cpu 
object_config={{base_data_path}}/models/tinyyolov3/yolov3-tiny.cfg
object_weights={{base_data_path}}/models/tinyyolov3/yolov3-tiny.weights
object_labels={{base_data_path}}/models/tinyyolov3/coco.names

# For tiny Yolo V4
#object_framework=opencv
#object_processor=cpu # or gpu
#object_config={{base_data_path}}/models/tinyyolov4/yolov4-tiny.cfg
#object_weights={{base_data_path}}/models/tinyyolov4/yolov4-tiny.weights
#object_labels={{base_data_path}}/models/tinyyolov4/coco.names

Hooks sections

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 = fcm,mqtt,api,web

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

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

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

Thanks!

ghost commented 3 years ago

Its saying it cant find the login file in url. is your API setup for that path? requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://zm.tiberiansun.us:2417/api/host/login.json try curl or wget to that api adddress and see what happens. Seems your other stuff is set up fine.

ghost commented 3 years ago
wget https://zm.tiberiansun.us:2417/zm/api/host/login.json
--2021-03-11 00:53:21--  https://zm.tiberiansun.us:2417/zm/api/host/login.json
Resolving zm.tiberiansun.us (zm.tiberiansun.us)... 69.49.75.202
Connecting to zm.tiberiansun.us (zm.tiberiansun.us)|69.49.75.202|:2417... connected.
HTTP request sent, awaiting response... 401 Unauthorized

Username/Password Authentication Failed.

see how I changed it to https://zm.tiberiansun.us:2417/zm/api/host/login.json from https://zm.tiberiansun.us:2417/api/host/login.json

Change your API in zmNinja app

pliablepixels commented 3 years ago

Check secrets.ini for api and portal URLs. I suspect one of them don't have /zm at the end.

tibmeister commented 3 years ago

secrets.ini

was

ZM_PORTAL=https://zm.tiberiansun.us:2417/zm
ZM_API_PORTAL=https://zm.tiberiansun.us:2417/api

changed

ZM_PORTAL=https://zm.tiberiansun.us:2417/zm
ZM_API_PORTAL=https://zm.tiberiansun.us:2417/zm/api

I haven't touched the secrets.ini file for some months, so not sure how that was altered.

pliablepixels commented 3 years ago

Is this issue resolved then? (the software doesn't do any write operations to secrets.ini)

tibmeister commented 3 years ago

Oh I'm sure I restored an older version at some point trying to troubleshoot various things.