ZoneMinder / zmeventnotification

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

Migrated objectdetection.ini not picking up polygons? #315

Closed ptruman closed 4 years ago

ptruman commented 4 years ago

Hi

I've

Event Server version

6.0.2

The version of ZoneMinder you are using:

1.34.21

What is the nature of your issue

Query with polygons?

Details

I changed mobile, and the latest ZMNinja downloaded, which pointed out it wanted me to upgrade ZMEventNotification - which I've done (albeit in the dlandon docker image, as a test)

It's working, but picking up the whole image - not the defined polygons

I am using the default supplied objectdetection.ini and have only changed the following lines

detection_sequence=object (I removed ,face as I don't use it) bestmatch_order = 's,a' (this was commented out)

I then added the following the end and deleted all example monitor configs

[monitor-1]
# Front Drive
object_detection_pattern=(cat|dog|person|car|motorbike|truck)
Drive=710,620 1265,610 1650,1079 400,1079
Path=1140,490 1210,460 1280,585 715,615 795,475 900,490
Car_Space=875,290 1100,285 1185,465 800,470
Border=1105,285 1160,285 1260,450 1180,450
detection_sequence=yolo

I am getting detection notifications, but the alarm frame picks up objects in the whole image, and no polygons are drawn on it.

Debug Logs (if applicable)

root@zoneminder:/config/hook# sudo -u www-data /usr/bin/zmeventnotification.pl
10/16/20 11:19:17.984316 zmeventnotification[12848].INF [main:963] [PARENT: using config file: /etc/zm/zmeventnotification.ini]
10/16/20 11:19:18.046821 zmeventnotification[12848].INF [main:963] [PARENT: using secrets file: /etc/zm/secrets.ini]
10/16/20 11:19:18.195402 zmeventnotification[12848].INF [main:963] [PARENT: Push enabled via FCM]
10/16/20 11:19:18.475393 zmeventnotification[12848].INF [main:963] [PARENT: MQTT Disabled]
10/16/20 11:19:18.550755 zmeventnotification[12848].INF [main:963] [PARENT: |------- Starting ES version: 6.0.2 ---------|]
Can't ignore signal CHLD, forcing to default.
10/16/20 11:19:18.767008 zmeventnotification[12848].INF [main:963] [PARENT: Event Notification daemon v 6.0.2 starting]
10/16/20 11:19:18.773391 zmeventnotification[12848].INF [main:963] [PARENT: Re-loading monitors]
10/16/20 11:19:18.801183 zmeventnotification[12848].INF [main:963] [PARENT: Secure WS(WSS) is enabled...]
10/16/20 11:19:18.817227 zmeventnotification[12848].INF [main:963] [PARENT: Web Socket Event Server listening on port 9000]
10/16/20 11:20:23.831049 zmeventnotification[12848].INF [main:963] [PARENT: New event 39927 reported for Monitor:1 (Name:ONVIF_Camera) Motion Drive[last processed eid:]]
10/16/20 11:20:37.386642 zmeventnotification[12854].INF [main:963] [|----> FORK:ONVIF_Camera (1), eid:39927 Sending event_start notification over FCM]
10/16/20 11:20:37.939769 zmeventnotification[12854].INF [main:963] [|----> FORK:ONVIF_Camera (1), eid:39927 Sending event_start notification over FCM]
10/16/20 11:20:38.464164 zmeventnotification[12854].INF [main:963] [|----> FORK:ONVIF_Camera (1), eid:39927 Event 39927 for Monitor 1 has finished]
10/16/20 11:20:42.534501 zmeventnotification[12854].INF [main:963] [|----> FORK:ONVIF_Camera (1), eid:39927 Sending event_end notification over FCM]
10/16/20 11:20:42.905404 zmeventnotification[12854].INF [main:963] [|----> FORK:ONVIF_Camera (1), eid:39927 Sending event_end notification over FCM]

The ZM console shows motion picked up in the following defined polys:

[a] detected:car:92% Motion: Car Space, Drive, Path

But no polys are drawn on the alarm sample image, and it's identifying objects outside the defined polys, which wasn't happening before?

pliablepixels commented 4 years ago

Could you please post debug logs ? I'll need logs for zmesdetect_mX.log for that monitor assuming you've set up logs as per https://zmeventnotification.readthedocs.io/en/latest/guides/es_faq.html#es-hooks-logging

ptruman commented 4 years ago

Here you go.... It IS drawing boxes around what it's detected but not the shape of the Polygons or listing their names?

root@zoneminder:/var/run/zm# tail -F  /var/log/zm/zmesdetect*.log /var/log/zm/zmeventnotification.log
==> /var/log/zm/zmesdetect_m1.log <==
10/16/20 12:58:27 zmesdetect_m1[13948] INF zm_detect.py:196 [---------| hook version: 0.1.30, ES version: 6.0.2 , OpenCV version: 4.2.0|------------]
10/16/20 12:58:27 zmesdetect_m1[13948] INF zm_detect.py:225 [Importing local classes for Object/Face]
10/16/20 12:58:29 zmesdetect_m1[13948] INF zm_detect.py:628 [labels found: ['car', 'car', 'truck', 'car', 'car', 'truck', 'truck', 'car']]
10/16/20 12:58:32 zmesdetect_m1[13948] INF zm_detect.py:672 [Removing matches to past detections]
10/16/20 12:58:32 zmesdetect_m1[13948] INF zm_detect.py:777 [Prediction string:[a] detected:car:97% truck:93% ]
10/16/20 13:08:32 zmesdetect_m1[14018] INF zm_detect.py:196 [---------| hook version: 0.1.30, ES version: 6.0.2 , OpenCV version: 4.2.0|------------]
10/16/20 13:08:32 zmesdetect_m1[14018] INF zm_detect.py:225 [Importing local classes for Object/Face]
10/16/20 13:08:34 zmesdetect_m1[14018] INF zm_detect.py:628 [labels found: ['car', 'person', 'car', 'car', 'car', 'truck', 'truck', 'car', 'car']]
10/16/20 13:08:37 zmesdetect_m1[14018] INF zm_detect.py:672 [Removing matches to past detections]
10/16/20 13:08:37 zmesdetect_m1[14018] INF zm_detect.py:777 [Prediction string:[a] detected:person:100% car:96% truck:72% ]

==> /var/log/zm/zmeventnotification.log <==
10/16/20 13:10:56.411053 zmeventnotification[14227].DBG [main:954] [PARENT: checkEvents() new events found=0]
10/16/20 13:10:56.411098 zmeventnotification[14227].DBG [main:954] [PARENT: There are 0 new Events to process]
10/16/20 13:10:56.411139 zmeventnotification[14227].DBG [main:954] [PARENT: ---------->Tick END<--------------]
10/16/20 13:11:01.414327 zmeventnotification[14227].DBG [main:954] [PARENT: ---------->Tick START<--------------]
10/16/20 13:11:01.414455 zmeventnotification[14227].DBG [main:954] [PARENT: There are 0 active child forks...]
10/16/20 13:11:01.414508 zmeventnotification[14227].DBG [ZoneMinder::Memory::Mapped:84] [zmMemAttach already attached at 140436377272320 for 1]
10/16/20 13:11:01.414630 zmeventnotification[14227].DBG [ZoneMinder::Memory:300] [Shared data appears valid for monitor 1: 1]
10/16/20 13:11:01.414744 zmeventnotification[14227].DBG [main:954] [PARENT: checkEvents() new events found=0]
10/16/20 13:11:01.414789 zmeventnotification[14227].DBG [main:954] [PARENT: There are 0 new Events to process]
10/16/20 13:11:01.414831 zmeventnotification[14227].DBG [main:954] [PARENT: ---------->Tick END<--------------]
10/16/20 13:11:06.409950 zmeventnotification[14227].DBG [main:954] [PARENT: ---------->Tick START<--------------]
10/16/20 13:11:06.410070 zmeventnotification[14227].DBG [main:954] [PARENT: There are 0 active child forks...]
10/16/20 13:11:06.410139 zmeventnotification[14227].DBG [ZoneMinder::Memory::Mapped:84] [zmMemAttach already attached at 140436377272320 for 1]
10/16/20 13:11:06.410225 zmeventnotification[14227].DBG [ZoneMinder::Memory:300] [Shared data appears valid for monitor 1: 1]
10/16/20 13:11:06.410316 zmeventnotification[14227].DBG [main:954] [PARENT: checkEvents() new events found=0]
10/16/20 13:11:06.410360 zmeventnotification[14227].DBG [main:954] [PARENT: There are 0 new Events to process]
10/16/20 13:11:06.410401 zmeventnotification[14227].DBG [main:954] [PARENT: ---------->Tick END<--------------]
^C
root@zoneminder:/var/run/zm# tail -F  /var/log/zm/zmesdetect*.log /var/log/zm/zmeventnotification.log
==> /var/log/zm/zmesdetect_m1.log <==
10/16/20 13:12:52 zmesdetect_m1[14310] DBG1 image_manip.py:257 [past detection truck@[(828, 6), (966, 6), (966, 76), (828, 76)] approximately matches truck@[(824, 6), (968, 6), (968, 76), (824, 76)] removing]
10/16/20 13:12:52 zmesdetect_m1[14310] DBG1 image_manip.py:257 [past detection car@[(962, 104), (1172, 104), (1172, 184), (962, 184)] approximately matches car@[(964, 104), (1170, 104), (1170, 184), (964, 184)] removing]
10/16/20 13:12:52 zmesdetect_m1[14310] DBG1 image_manip.py:257 [past detection car@[(111, 498), (585, 498), (585, 676), (111, 676)] approximately matches car@[(114, 499), (588, 499), (588, 675), (114, 675)] removing]
10/16/20 13:12:52 zmesdetect_m1[14310] DBG1 image_manip.py:257 [past detection truck@[(642, 10), (796, 10), (796, 84), (642, 84)] approximately matches truck@[(641, 10), (797, 10), (797, 84), (641, 84)] removing]
10/16/20 13:12:52 zmesdetect_m1[14310] DBG1 zm_detect.py:678 [Saving detections for monitor 1 for future match]
10/16/20 13:12:53 zmesdetect_m1[14310] DBG2 zm_detect.py:696 [Drawing boxes around objects]
10/16/20 13:12:53 zmesdetect_m1[14310] DBG1 zm_detect.py:721 [Writing detected image to /var/cache/zoneminder/events/1/2020-10-16/39938/objdetect.jpg]
10/16/20 13:12:53 zmesdetect_m1[14310] DBG1 zm_detect.py:725 [Writing JSON output to /var/cache/zoneminder/events/1/2020-10-16/39938/objects.json]
10/16/20 13:12:53 zmesdetect_m1[14310] INF zm_detect.py:777 [Prediction string:[a] detected:car:97% person:82% ]
10/16/20 13:12:53 zmesdetect_m1[14310] DBG1 zm_detect.py:780 [Prediction string JSON:[{"type": "object", "label": "car", "box": [544, 136, 710, 304], "confidence": "99.81%"}, {"type": "object", "label": "car", "box": [730, 114, 958, 280], "confidence": "97.25%"}, {"type": "object", "label": "car", "box": [978, 374, 1198, 690], "confidence": "92.23%"}, {"type": "object", "label": "truck", "box": [824, 6, 968, 76], "confidence": "91.94%"}, {"type": "object", "label": "car", "box": [964, 104, 1170, 184], "confidence": "88.38%"}, {"type": "object", "label": "person", "box": [743, 558, 895, 676], "confidence": "82.47%"}, {"type": "object", "label": "car", "box": [114, 499, 588, 675], "confidence": "74.85%"}, {"type": "object", "label": "truck", "box": [641, 10, 797, 84], "confidence": "73.35%"}, {"type": "object", "label": "car", "box": [45, 87, 77, 109], "confidence": "41.10%"}]]

==> /var/log/zm/zmeventnotification.log <==
10/16/20 13:14:11.413194 zmeventnotification[14227].DBG [main:954] [PARENT: checkEvents() new events found=0]
10/16/20 13:14:11.413238 zmeventnotification[14227].DBG [main:954] [PARENT: There are 0 new Events to process]
10/16/20 13:14:11.413279 zmeventnotification[14227].DBG [main:954] [PARENT: ---------->Tick END<--------------]
10/16/20 13:14:16.414324 zmeventnotification[14227].DBG [main:954] [PARENT: ---------->Tick START<--------------]
10/16/20 13:14:16.414459 zmeventnotification[14227].DBG [main:954] [PARENT: There are 0 active child forks...]
10/16/20 13:14:16.414513 zmeventnotification[14227].DBG [ZoneMinder::Memory::Mapped:84] [zmMemAttach already attached at 140436377272320 for 1]
10/16/20 13:14:16.414631 zmeventnotification[14227].DBG [ZoneMinder::Memory:300] [Shared data appears valid for monitor 1: 1]
10/16/20 13:14:16.414745 zmeventnotification[14227].DBG [main:954] [PARENT: checkEvents() new events found=0]
10/16/20 13:14:16.414790 zmeventnotification[14227].DBG [main:954] [PARENT: There are 0 new Events to process]
10/16/20 13:14:16.414832 zmeventnotification[14227].DBG [main:954] [PARENT: ---------->Tick END<--------------]
10/16/20 13:14:21.410750 zmeventnotification[14227].DBG [main:954] [PARENT: ---------->Tick START<--------------]
10/16/20 13:14:21.410874 zmeventnotification[14227].DBG [main:954] [PARENT: There are 0 active child forks...]
10/16/20 13:14:21.410925 zmeventnotification[14227].DBG [ZoneMinder::Memory::Mapped:84] [zmMemAttach already attached at 140436377272320 for 1]
10/16/20 13:14:21.411012 zmeventnotification[14227].DBG [ZoneMinder::Memory:300] [Shared data appears valid for monitor 1: 1]
10/16/20 13:14:21.411114 zmeventnotification[14227].DBG [main:954] [PARENT: checkEvents() new events found=0]
10/16/20 13:14:21.411160 zmeventnotification[14227].DBG [main:954] [PARENT: There are 0 new Events to process]
10/16/20 13:14:21.411203 zmeventnotification[14227].DBG [main:954] [PARENT: ---------->Tick END<--------------]
10/16/20 13:14:26.413982 zmeventnotification[14227].DBG [main:954] [PARENT: ---------->Tick START<--------------]
10/16/20 13:14:26.414097 zmeventnotification[14227].DBG [main:954] [PARENT: There are 0 active child forks...]
10/16/20 13:14:26.414147 zmeventnotification[14227].DBG [ZoneMinder::Memory::Mapped:84] [zmMemAttach already attached at 140436377272320 for 1]
10/16/20 13:14:26.414232 zmeventnotification[14227].DBG [ZoneMinder::Memory:300] [Shared data appears valid for monitor 1: 1]
10/16/20 13:14:26.414333 zmeventnotification[14227].DBG [main:954] [PARENT: checkEvents() new events found=0]
10/16/20 13:14:26.414377 zmeventnotification[14227].DBG [main:954] [PARENT: There are 0 new Events to process]
10/16/20 13:14:26.414419 zmeventnotification[14227].DBG [main:954] [PARENT: ---------->Tick END<--------------]
10/16/20 13:14:31.414181 zmeventnotification[14227].DBG [main:954] [PARENT: ---------->Tick START<--------------]
10/16/20 13:14:31.414319 zmeventnotification[14227].DBG [main:954] [PARENT: There are 0 active child forks...]
10/16/20 13:14:31.414369 zmeventnotification[14227].DBG [ZoneMinder::Memory::Mapped:84] [zmMemAttach already attached at 140436377272320 for 1]
10/16/20 13:14:31.414471 zmeventnotification[14227].DBG [ZoneMinder::Memory:300] [Shared data appears valid for monitor 1: 1]
10/16/20 13:14:31.414612 zmeventnotification[14227].DBG [main:954] [PARENT: checkEvents() new events found=0]
10/16/20 13:14:31.414683 zmeventnotification[14227].DBG [main:954] [PARENT: There are 0 new Events to process]
10/16/20 13:14:31.414724 zmeventnotification[14227].DBG [main:954] [PARENT: ---------->Tick END<--------------]
ptruman commented 4 years ago

Hmm, I think this relates to the docker image - the normal install has located the objectconfig.ini in it's default place, not where the image expects it - I've linked the default to the image and now it's not firing, so it's probably to do with that (checking)

pliablepixels commented 4 years ago

okay, let me know if we can close this

ptruman commented 4 years ago

Yup, I've manually rebuilt my objectdetection.ini - and it now seems to be firing. I think the conversion script may have left something in it didn't like as I've now got polygons, updated pictures and ZMNinja alerts are now firing

On Sat, 17 Oct 2020 at 12:17, Pliable Pixels notifications@github.com wrote:

okay, let me know if we can close this

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pliablepixels/zmeventnotification/issues/315#issuecomment-710833868, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPGIY67HSSCNYKKAOPS5DLSLF4NLANCNFSM4STE3QVQ .