Page 1 of 1

zmeventnotification hooks not drawing polygon

Posted: Thu Jun 25, 2020 4:40 pm
by Jeeper44
I've installed everything per the documents and I can see the the object detection is working. It appears my issue is that the polygons around the detected objects are not getting drawn. Looking the log files and the python code, it seems that the objects get detected, if they're over the threshold the polygon should get drawn and labelled, then the zm_detect.py looks for the polygons on the image. In my case, none of the polygons are being drawn so the final zm_detect.py always fails. All the permissions are correct, I can see the snapshot and alarm jpegs in the images folder. I've reinstalled the event server. The same results happen if I run the detection manually or in daemon mode inside ZM.

I'm stumped because the detection obviously finds a person with a 77% confidence rate, but in image_manip.py:305 it says that polygong does not fall into any polygons so removing. There are no polygons drawn on any of my snapshot or alarm images.

This is a typical detection log:

Code: Select all

06/25/20 11:28:13 zmesdetect_m10[73753] DBG1 yolo.py:102 [YOLO detection took: 209.665 milliseconds]
06/25/20 11:28:13 zmesdetect_m10[73753] DBG1 yolo.py:135 [YOLO NMS filtering took: 0.423 milliseconds]
06/25/20 11:28:13 zmesdetect_m10[73753] INF yolo.py:159 [object:person at [370, 296, 528, 574] has a acceptable confidence:0.7750177383422852 compared to min confidence of: 0.3, adding]
06/25/20 11:28:13 zmesdetect_m10[73753] INF yolo.py:159 [object:clock at [378, 96, 408, 128] has a acceptable confidence:0.6622167825698853 compared to min confidence of: 0.3, adding]
06/25/20 11:28:13 zmesdetect_m10[73753] INF yolo.py:164 [rejecting object:sofa at [12, 363, 224, 571] because its confidence is :0.2158951610326767 compared to min confidence of: 0.3]
06/25/20 11:28:13 zmesdetect_m10[73753] DBG2 image_manip.py:282 [intersection: polygon in process=[(370, 296), (528, 296), (528, 574), (370, 574)]]
06/25/20 11:28:14 zmesdetect_m10[73753] INF image_manip.py:305 [object:person at POLYGON ((370 296, 528 296, 528 574, 370 574, 370 296)) does not fall into any polygons, removing...]
06/25/20 11:28:14 zmesdetect_m10[73753] DBG2 image_manip.py:282 [intersection: polygon in process=[(378, 96), (408, 96), (408, 128), (378, 128)]]
06/25/20 11:28:14 zmesdetect_m10[73753] INF image_manip.py:305 [object:clock at POLYGON ((378 96, 408 96, 408 128, 378 128, 378 96)) does not fall into any polygons, removing...]
06/25/20 11:28:14 zmesdetect_m10[73753] DBG2 zm_detect.py:601 [ALPR not in use, no need for look aheads in processing]
06/25/20 11:28:14 zmesdetect_m10[73753] DBG1 zm_detect.py:630 [No match found in /var/lib/zmeventnotification/images/1927-snapshot.jpg using model:yolo]
06/25/20 11:28:14 zmesdetect_m10[73753] INF zm_detect.py:644 [No patterns found using any models in all files]

Re: zmeventnotification hooks not drawing polygon

Posted: Fri Jun 26, 2020 3:39 pm
by Jeeper44
I've been digging deeper into the failure and it appears that it might be leading back to ZM itself and the alarm api. I haven't dug into the ZM files yet, but I'm about to.

What I've found is the alarm reason isn't getting set, so most of the object detection just defaults to no detection. Looking back into the base zmeventnotification.pl pearl script to the actual commands that are being built, it uses alarm Start->Cause for the reason. On all my data dumps, on Alarm Start, the cause is always blank. On Alarm End, the cause is filled in (ie Motion: Door). With the start cause blank all the subsequent object detection files, even though they are properly identifying objects, never actually write the information out because they rely on the Reason variable.

Here's an example data dump from the ZM api

Code: Select all

FORK:$VAR1 = \{
            'EventId' => 2591,
            'Start' => {
                         'Cause' => '',
                         'Time' => 1593184889,
                         'State' => 'done'
                       },
            'MonitorId' => 10,
            'MonitorName' => 'Living Room',
            'End' => {
                       'Cause' => 'Motion: Door',
                       'State' => 'pending',
                       'Time' => 1593184897
                     }
          };

Re: zmeventnotification hooks not drawing polygon

Posted: Fri Jun 26, 2020 4:24 pm
by asker
Before you spend any more time debugging, please update the ES to the latest master - I fixed some issues related to zones.
I don't know if your issue is related to that, as the logs posted are partial.

Once you do update and if the problem persists please post full debug logs (from the time zm_detect starts).

Re: zmeventnotification hooks not drawing polygon

Posted: Fri Jun 26, 2020 5:54 pm
by Jeeper44
Switching to the Master from Stable did fix the problem. Now I just have to tweak the settings as when I walk into the room, I get a notification that there's a 50% chance there's a bottle on the table, but ignores the fact there's a person standing there, just using TinyYolo..LOL

Re: zmeventnotification hooks not drawing polygon

Posted: Fri Jun 26, 2020 6:35 pm
by asker
Yes, tinyYOLO is pretty inaccurate. I found the CSPN model to be a good balance between speed and accuracy. Seems to be as accurate (at least) as Yolo (full) but faster.

On the release tag, even if you reinstall stable, you should see it working - I pushed the tag up after I committed some of these fixes (lazy, I know, but I did not want to keep a broken release tagged)