What do you mean when object detection matches a previous detection?
I have "match_past_detections=yes" in my objectconfig.ini.
I've only seen this for single events with motion detection called once. I do see quite a lot of "27/02/20 14:36:21.272223 zmeventnotification[10335].DBG [main:827] [PARENT: We've already worked on Monitor:6, Event:36797, not doing anything more" type entries (1421 so far today) but I don't know that this is anything to do with the "approximately matches" problem.
The event in question found an object but didn't set "detected:" in Event.Notes because it matched a previous detection in the previous event; this behaviour is as expected.
Here's an extract from zmesdetect_m1.log
Code: Select all
02/27/20 14:28:08 zmesdetect_m1[13890] INF zm_detect.py:571 [labels found: ['car', 'car', 'truck', 'car', 'car', 'truck']]
02/27/20 14:28:08 zmesdetect_m1[13890] DBG zm_detect.py:574 [match found in /var/lib/zmeventnotification/images/36787-alarm.jpg, breaking file loop...]
02/27/20 14:28:08 zmesdetect_m1[13890] DBG zm_detect.py:588 [detection mode is set to first, breaking out of model loop...]
02/27/20 14:28:08 zmesdetect_m1[13890] DBG zm_detect.py:628 [Writing out debug bounding box image to /var/lib/zmeventnotification/images/36787-alarm-bbox.jpg...]
02/27/20 14:28:08 zmesdetect_m1[13890] DBG zm_detect.py:634 [Writing detected image to /var/cache/zoneminder/events/1/2020-02-27/36787/objdetect.jpg]
02/27/20 14:28:08 zmesdetect_m1[13890] DBG zm_detect.py:638 [Writing JSON output to /var/cache/zoneminder/events/1/2020-02-27/36787/objects.json]
02/27/20 14:28:08 zmesdetect_m1[13890] INF zm_detect.py:649 [Removing matches to past detections]
02/27/20 14:28:08 zmesdetect_m1[13890] DBG image_manip.py:28 [trying to load /var/lib/zmeventnotification/images/monitor-1-data.pkl]
02/27/20 14:28:08 zmesdetect_m1[13890] DBG image_manip.py:98 [past detection car@[(102, 206), (300, 206), (300, 320), (102, 206)] approximately matches car@[(102, 204), (302, 204), (302, 320), (102, 204)] removing]
02/27/20 14:28:08 zmesdetect_m1[13890] DBG image_manip.py:98 [past detection car@[(399, 62), (457, 62), (457, 116), (399, 62)] approximately matches car@[(399, 61), (457, 61), (457, 117), (399, 61)] removing]
02/27/20 14:28:08 zmesdetect_m1[13890] DBG image_manip.py:98 [past detection truck@[(354, 142), (492, 142), (492, 260), (354, 142)] approximately matches truck@[(360, 142), (496, 142), (496, 262), (360, 142)] removing]
02/27/20 14:28:08 zmesdetect_m1[13890] DBG image_manip.py:98 [past detection car@[(313, 54), (357, 54), (357, 118), (313, 54)] approximately matches car@[(313, 54), (357, 54), (357, 118), (313, 54)] removing]
02/27/20 14:28:08 zmesdetect_m1[13890] DBG image_manip.py:98 [past detection car@[(558, 250), (640, 250), (640, 390), (558, 250)] approximately matches car@[(558, 250), (640, 250), (640, 388), (558, 250)] removing]
02/27/20 14:28:08 zmesdetect_m1[13890] DBG image_manip.py:98 [past detection truck@[(154, 79), (308, 79), (308, 183), (154, 79)] approximately matches truck@[(154, 80), (310, 80), (310, 184), (154, 80)] removing]
02/27/20 14:28:08 zmesdetect_m1[13890] DBG zm_detect.py:655 [Saving detections for monitor 1 for future match]
all of the detections were removed because they "approximately matched"... which is Good.
The corresponding from zmeventnotification.log (grep 36787 zmeventnotification.log for brevity):
Code: Select all
27/02/20 14:28:06.271617 zmeventnotification[10335].INF [main:836] [PARENT: New event 36787 reported for Monitor:1 (Name:Carpark) Motion Close]
27/02/20 14:28:06.285030 zmeventnotification[13886].INF [main:836] [PARENT: Forked process:13886 to handle alarm eid:36787]
27/02/20 14:28:06.287011 zmeventnotification[13886].DBG [ZoneMinder::Object:115] [Loading ZoneMinder::Event from Events WHERE Id = 36787]
27/02/20 14:28:06.289860 zmeventnotification[13886].DBG [main:827] [|----> FORK:Carpark (1), eid:36787 Adding event path:/var/cache/zoneminder/events/1/2020-02-27/36787 to hook for image storage]
27/02/20 14:28:06.290041 zmeventnotification[13886].INF [main:836] [|----> FORK:Carpark (1), eid:36787 Invoking hook on event start:'/var/lib/zmeventnotification/bin/zm_event_start.sh' 36787 1 "Carpark" "Motion Close" "/var/cache/zoneminder/events/1/2020-02-27/36787"]
27/02/20 14:28:08.206241 zmeventnotification[13886].DBG [main:827] [|----> FORK:Carpark (1), eid:36787 parse of hook: and []]
27/02/20 14:28:08.206428 zmeventnotification[13886].INF [main:836] [|----> FORK:Carpark (1), eid:36787 hook start returned with text: json:[] exit:1]
27/02/20 14:28:10.207991 zmeventnotification[13886].INF [main:836] [|----> FORK:Carpark (1), eid:36787 Matching alarm to connection rules...]
27/02/20 14:28:10.209394 zmeventnotification[13886].INF [main:836] [|----> FORK:Carpark (1), eid:36787 Checking alarm rules for MQTT 192.168.1.125]
27/02/20 14:28:10.210446 zmeventnotification[13886].INF [main:836] [|----> FORK:Carpark (1), eid:36787 Monitor 1 event: should send out as 4.76916003227234 is >= interval of ]
27/02/20 14:28:10.211009 zmeventnotification[13886].DBG [main:827] [|----> FORK:Carpark (1), eid:36787 shouldSendEventToConn returned true, so calling sendEvent]
27/02/20 14:28:10.211100 zmeventnotification[13886].DBG [main:827] [|----> FORK:Carpark (1), eid:36787 isAllowedChannel: got type:event_start resCode:1]
27/02/20 14:28:10.211155 zmeventnotification[13886].INF [main:836] [|----> FORK:Carpark (1), eid:36787 Not sending over MQTT as notify filters are on_success:all and on_fail:none]
27/02/20 14:28:10.211740 zmeventnotification[13886].DBG [main:827] [|----> FORK:Carpark (1), eid:36787 child finished writing to parent]
27/02/20 14:28:11.266663 zmeventnotification[10335].DBG [main:827] [PARENT: We've already worked on Monitor:1, Event:36787, not doing anything more]
27/02/20 14:28:16.270862 zmeventnotification[10335].DBG [main:827] [PARENT: We've already worked on Monitor:1, Event:36787, not doing anything more]
27/02/20 14:28:21.267194 zmeventnotification[10335].DBG [main:827] [PARENT: We've already worked on Monitor:1, Event:36787, not doing anything more]
27/02/20 14:28:26.267834 zmeventnotification[10335].DBG [main:827] [PARENT: We've already worked on Monitor:1, Event:36787, not doing anything more]
27/02/20 14:28:28.216316 zmeventnotification[13886].DBG [main:827] [|----> FORK:Carpark (1), eid:36787 For 1 (Carpark), SHM says: state=0, eid=36787]
27/02/20 14:28:28.216516 zmeventnotification[13886].INF [main:836] [|----> FORK:Carpark (1), eid:36787 Event 36787 for Monitor 1 has finished]
27/02/20 14:28:28.219166 zmeventnotification[13886].DBG [main:827] [|----> FORK:Carpark (1), eid:36787 Event end object is: state=>pending with cause=>Motion: Close]
27/02/20 14:28:30.219880 zmeventnotification[13886].DBG [main:827] [|----> FORK:Carpark (1), eid:36787 Adding event path:/var/cache/zoneminder/events/1/2020-02-27/36787 to hook for image storage]
27/02/20 14:28:30.220154 zmeventnotification[13886].INF [main:836] [|----> FORK:Carpark (1), eid:36787 Invoking hook on event end:'/var/lib/zmeventnotification/bin/zm_event_end.sh' 36787 1 "Carpark" "Motion: Close" "/var/cache/zoneminder/events/1/2020-02-27/36787"]
27/02/20 14:28:30.284537 zmeventnotification[13886].DBG [main:827] [|----> FORK:Carpark (1), eid:36787 parse of hook:Motion: Close
27/02/20 14:28:30.284714 zmeventnotification[13886].INF [main:836] [|----> FORK:Carpark (1), eid:36787 hook end returned with text:Motion: Close
27/02/20 14:28:32.286416 zmeventnotification[13886].INF [main:836] [|----> FORK:Carpark (1), eid:36787 Not sending event end alarm, as we did not send a start alarm for this, or start hook processing failed]
27/02/20 14:28:36.288509 zmeventnotification[13886].DBG [main:827] [|----> FORK:Carpark (1), eid:36787 exiting]
27/02/20 14:28:36.288795 zmeventnotification[13886].INF [main:836] [|----> FORK:Carpark (1), eid:36787 Ending process:13886 to handle alarms]
27/02/20 14:28:41.261941 zmeventnotification[10335].DBG [main:827] [PARENT: RAW TEXT-->active_event_delete--TYPE--1--SPLIT--36787]
27/02/20 14:28:41.262017 zmeventnotification[10335].DBG [main:827] [PARENT: Job: Deleting active_event eid:36787, mid:1]
Line 27/02/20 14:28:30.220154 in the above zmeventnotification.log shows where it calls zm_event_end.sh with no "detected:" in the Notes string; again as expected because the detections were removed as "approximately matches".
I noticed the problem because I had events showing the the ZM console with no detection link; my zm_event_end.sh didn't delete them because there was a valid objdetect.jpg. I've seen 10 of these in the last 20 hours.
What I would like to do in zm_event_end.sh is something like:
Code: Select all
if [ -f ${5}/objdetect.jpg ]
then
if grep -q approximate_match ${5}/objects.json
then
delete_event "$@"
else
( echo -n "$(date) ${cmd}[$$] Not Deleting Event ${1} \"${2}-${3}\" \"${4}\" " ;
echo "as it has object detected and was not an approximate match" ) >> $LOGPATH 2>&1
fi
else
delete_event "$@"
fi
Does this make sense?
<edit>PS - Thinking about the chain of processes here... If it's more convenient for zm_detect.py to write a file in the event's storage location (it's already writing other files there) indicating it was ignored because of a 100% approximate match that would be peachy too.