ZoneMinder / zmeventnotification

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

Reducing detection latency #363

Closed cliffjao closed 3 years ago

cliffjao commented 3 years ago

Looking at the debug logs below, it looks like there's 2 seconds before zmesdetect kicks in and another 2 seconds after it returns before the notification is sent over FCM. The actual ML detection time is only about 2 seconds, which is surprising to me. Is there any way to reduce this latency?

2021-02-15 09:18:37 zmeventnotification     15331   INF |----> FORK:Side (6), eid:137531 Sending event_start notification over FCM  zmeventnotification.pl  
2021-02-15 09:18:35 zmesdetect_m6       15335   INF Prediction string:[a] detected:person:98%   zm_detect.py    779
2021-02-15 09:18:33 zmesdetect_m6       15335   INF Detecting using remote API Gateway http://eagle:5000/api/v1 zm_detect.py    44
2021-02-15 09:18:33 zmesdetect_m6       15335   INF Importing remote shim classes for Object/Face   zm_detect.py    229
2021-02-15 09:18:32 zmesdetect_m6       15335   INF ---------| pyzm version: 0.3.34, ES version: 6.0.6 , OpenCV version: 4.5.0|------------
2021-02-15 09:18:30 zmeventnotification     1128    INF PARENT: New event 137531 reported for Monitor:6 (Name:Side) Motion Side[last processed eid:137508]
pliablepixels commented 3 years ago

https://zmeventnotification.readthedocs.io/en/latest/guides/es_faq.html#how-do-i-reduce-the-time-of-delay-from-an-alarm-occuring-in-zm-to-the-notification-being-sent-out has some thoughts.

cliffjao commented 3 years ago

Ah, yea. I referenced that previously. I already have my poll interval set to 1 second, and I'm already using MLAPI. Maybe part of this is the limitation of polling.