ZoneMinder / zmeventnotification

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

Detected faces not displayed in zm event web UI #160

Closed vinceg77 closed 4 years ago

vinceg77 commented 4 years ago

Event Server version 4.2

Hooks version 4.2.5

The version of ZoneMinder you are using: 1.33.14

What is the nature of your issue zmeventnotification is working fine, it detects objects and known faces Yolo detected objets are displayed well in ZM event web console under 'Motion' in 'Cause' column as well as within the pictures but recognized faces are not !

I tried hard but cannot figure out what is wrong and where or what I might have not understood... (moreover it used to work prior that I changed my zm config)

ZM webUI displays : ZM_Events

whereas manual detection for the same event shows :

root@Zoneminder:/home/vincent# sudo -u www-data /usr/bin/detect_wrapper.sh 383 2
[s] detected:Vincent:100% person:100%

(Vincent seems to be well recognized !!!)

Debug Logs (if applicable) My objectconfig.ini :


# NOTE: ALL parameters here can be overriden
# on a per monitor basis if you want. Just
# duplicate it inside the correct [monitor-<num>] section

[general]
portal=https://192.168.0.35/zm
user=Vincent
password=xxxxxxxx
allow_self_signed=yes
match_past_detections=no
past_det_max_diff_area=5%
models=yolo,face
detection_mode=all
image_path=/var/lib/zmeventnotification/images
detect_pattern=(person|car|motorbike|bicycle|bus|truck|cat|dog|umbrella)
frame_id=bestmatch
resize=1200
delete_after_analyze=yes
write_debug_image=no
write_image_to_zm=yes
show_percent=yes
poly_color=(255,255,255)

## ::::Monitor specific settings::::

[monitor-2]
#Doorbird (porte)
detect_pattern=(person|cat)
delete_after_analyze=yes
import_zm_zones=yes
resize=600
#zone_active1=356,716 356,289 843,289 843,716
face_model=hog

[yolo]
yolo_type=full
yolo_min_confidence=0.5

config=/var/lib/zmeventnotification/models/yolov3/yolov3.cfg
weights=/var/lib/zmeventnotification/models/yolov3/yolov3.weights
labels=/var/lib/zmeventnotification/models/yolov3/yolov3_classes.txt

# config params for HOG
[hog]
stride=(4,4)
padding=(8,8)
scale=1.05
mean_shift=-1

[face]
known_images_path=/var/lib/zmeventnotification/known_faces
face_num_jitters=1
face_model=hog
face_upsample_times=1

[alpr]
alpr_use_after_detection_only=yes
alpr_service=plate_recognizer
alpr_key=xxxxxxxxxxxxxxxxxxxxxxxxxx
alpr_pattern=.*
platerec_stats=no
platerec_regions=['fr']
platerec_min_dscore=0.3
platerec_min_score=0.6

tail -f /var/log/syslog | grep zmeventnotification :

Oct  3 14:54:36 Zoneminder zmeventnotification[503]: INF [New event 383 reported for Monitor:2 (Name:Doorbird (Porte)) Motion Active]
Oct  3 14:54:36 Zoneminder zmeventnotification[1280]: INF [Forking process:1280 to handle 1 alarms]
Oct  3 14:54:36 Zoneminder zmeventnotification[1280]: INF [processAlarms: EID:383 Monitor:Doorbird (Porte) (id):2 cause:Motion Active]
Oct  3 14:54:36 Zoneminder zmeventnotification[1280]: INF [Adding event path:/var/cache/zoneminder/events/2/2019-10-03/383 to hook for image storage]
Oct  3 14:54:36 Zoneminder zmeventnotification[1280]: INF [Invoking hook:'/usr/bin/detect_wrapper.sh' 383 2 "Doorbird (Porte)" "Motion Active" "/var/cache/zoneminder/events/2/2019-10-03/383"]
Oct  3 14:54:39 Zoneminder zmeventnotification[1227]: INF [New event 383 reported for Monitor:2 (Name:Doorbird (Porte)) Motion Active]
Oct  3 14:54:39 Zoneminder zmeventnotification[1304]: INF [Forking process:1304 to handle 1 alarms]
Oct  3 14:54:39 Zoneminder zmeventnotification[1304]: INF [processAlarms: EID:383 Monitor:Doorbird (Porte) (id):2 cause:Motion Active]
Oct  3 14:54:39 Zoneminder zmeventnotification[1304]: INF [Adding event path:/var/cache/zoneminder/events/2/2019-10-03/383 to hook for image storage]
Oct  3 14:54:39 Zoneminder zmeventnotification[1304]: INF [Invoking hook:'/usr/bin/detect_wrapper.sh' 383 2 "Doorbird (Porte)" "Motion Active" "/var/cache/zoneminder/events/2/2019-10-03/383"]
Oct  3 14:54:41 Zoneminder zmeventnotification[1280]: INF [For Monitor:2 event:383, hook script returned with text:[a] detected:person:100% exit:0]
Oct  3 14:54:41 Zoneminder zmeventnotification[1280]: INF [Matching alarm to connection rules...]
Oct  3 14:54:41 Zoneminder zmeventnotification[1280]: INF [Checking alarm rules for MQTT 192.168.0.28]
Oct  3 14:54:41 Zoneminder zmeventnotification[1280]: INF [Monitor 2 event: should send out as  744.363490104675 is >= interval of ]
Oct  3 14:54:41 Zoneminder zmeventnotification[1280]: INF [Sending notification over MQTT]
Oct  3 14:54:41 Zoneminder zmeventnotification[1280]: INF [Ending process:1280 to handle alarms]
Oct  3 14:54:44 Zoneminder zmeventnotification[1304]: INF [For Monitor:2 event:383, hook script returned with text:[a] detected:person:100% exit:0]
Oct  3 14:54:44 Zoneminder zmeventnotification[1304]: INF [Matching alarm to connection rules...]
Oct  3 14:54:44 Zoneminder zmeventnotification[1304]: INF [Checking alarm rules for MQTT 192.168.0.28]
Oct  3 14:54:44 Zoneminder zmeventnotification[1304]: INF [Monitor 2 event: last time not found, so should send]
Oct  3 14:54:44 Zoneminder zmeventnotification[1304]: INF [Sending notification over MQTT]
Oct  3 14:54:45 Zoneminder zmeventnotification[1304]: INF [Ending process:1304 to handle alarms]
Oct  3 14:54:46 Zoneminder zmeventnotification[503]: INF [Force updating event 383 with desc:[a] detected:person:100%]
Oct  3 14:54:49 Zoneminder zmeventnotification[1227]: INF [Force updating event 383 with desc:[a] detected:person:100%]
Oct  3 14:54:49 Zoneminder zmeventnotification[1227]: INF [New event 384 reported for Monitor:2 (Name:Doorbird (Porte)) Motion Active]
Oct  3 14:54:49 Zoneminder zmeventnotification[1328]: INF [Forking process:1328 to handle 1 alarms]
Oct  3 14:54:49 Zoneminder zmeventnotification[1328]: INF [processAlarms: EID:384 Monitor:Doorbird (Porte) (id):2 cause:Motion Active]

sudo -u www-data ./zmeventnotification.pl --config ./../zmeventnotification.ini :

CONSOLE DEBUG:2019-10-03,14:54:39 ---------->Tick END<--------------
CONSOLE INFO:2019-10-03,14:54:39 Forking process:1304 to handle 1 alarms
10/03/19 14:54:39.419345 zmeventnotification[1304].INF [main:547] [Forking process:1304 to handle 1 alarms]
CONSOLE INFO:2019-10-03,14:54:39 processAlarms: EID:383 Monitor:Doorbird (Porte) (id):2 cause:Motion Active
10/03/19 14:54:39.423536 zmeventnotification[1304].INF [main:547] [processAlarms: EID:383 Monitor:Doorbird (Porte) (id):2 cause:Motion Active]
CONSOLE INFO:2019-10-03,14:54:39 Adding event path:/var/cache/zoneminder/events/2/2019-10-03/383 to hook for image storage
10/03/19 14:54:39.514807 zmeventnotification[1304].INF [main:547] [Adding event path:/var/cache/zoneminder/events/2/2019-10-03/383 to hook for image storage]
CONSOLE INFO:2019-10-03,14:54:39 Invoking hook:'/usr/bin/detect_wrapper.sh' 383 2 "Doorbird (Porte)" "Motion Active" "/var/cache/zoneminder/events/2/2019-10-03/383"
10/03/19 14:54:39.517664 zmeventnotification[1304].INF [main:547] [Invoking hook:'/usr/bin/detect_wrapper.sh' 383 2 "Doorbird (Porte)" "Motion Active" "/var/cache/zoneminder/events/2/2019-10-03/383"]
CONSOLE DEBUG:2019-10-03,14:54:44 ---------->Tick START<--------------
CONSOLE DEBUG:2019-10-03,14:54:44 After tick: TOTAL: 1, FCM+WEB: 0, FCM: 0, WEB: 0, MQTT:1, invalid WEB: 0, PENDING: 0
CONSOLE DEBUG:2019-10-03,14:54:44 Empty job queue
CONSOLE DEBUG:2019-10-03,14:54:44 checkEvents() events found=0
CONSOLE DEBUG:2019-10-03,14:54:44 ---------->Tick END<--------------
Traceback (most recent call last):
  File "/usr/bin/detect.py", line 448, in <module>
    os.remove(filename1)
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/zmeventnotification/images/383-alarm.jpg'
CONSOLE INFO:2019-10-03,14:54:44 For Monitor:2 event:383, hook script returned with text:[a] detected:person:100% exit:0
10/03/19 14:54:44.990286 zmeventnotification[1304].INF [main:547] [For Monitor:2 event:383, hook script returned with text:[a] detected:person:100% exit:0]
CONSOLE DEBUG:2019-10-03,14:54:44 after appending motion text, alarm->cause is now:[a] detected:person:100% Motion Active
CONSOLE INFO:2019-10-03,14:54:44 Matching alarm to connection rules...
10/03/19 14:54:44.993047 zmeventnotification[1304].INF [main:547] [Matching alarm to connection rules...]
CONSOLE INFO:2019-10-03,14:54:44 Checking alarm rules for MQTT 192.168.0.28
10/03/19 14:54:44.995376 zmeventnotification[1304].INF [main:547] [Checking alarm rules for MQTT 192.168.0.28]
CONSOLE INFO:2019-10-03,14:54:44 Monitor 2 event: last time not found, so should send
10/03/19 14:54:44.996937 zmeventnotification[1304].INF [main:547] [Monitor 2 event: last time not found, so should send]
CONSOLE DEBUG:2019-10-03,14:54:44 shouldSendEventToConn returned true, so calling sendEvent
CONSOLE INFO:2019-10-03,14:54:44 Sending notification over MQTT
10/03/19 14:54:44.999362 zmeventnotification[1304].INF [main:547] [Sending notification over MQTT]
CONSOLE INFO:2019-10-03,14:54:45 Ending process:1304 to handle alarms
10/03/19 14:54:45.001622 zmeventnotification[1304].INF [main:547] [Ending process:1304 to handle alarms]
CONSOLE DEBUG:2019-10-03,14:54:49 ---------->Tick START<--------------
CONSOLE DEBUG:2019-10-03,14:54:49 After tick: TOTAL: 1, FCM+WEB: 0, FCM: 0, WEB: 0, MQTT:1, invalid WEB: 0, PENDING: 0
CONSOLE DEBUG:2019-10-03,14:54:49 PARENT GOT RAW TEXT-->event_description--TYPE--2--SPLIT--383--SPLIT--[a] detected:person:100%
CONSOLE DEBUG:2019-10-03,14:54:49 GOT JOB==> Update monitor 2 description:[a] detected:person:100%
CONSOLE INFO:2019-10-03,14:54:49 Force updating event 383 with desc:[a] detected:person:100%
10/03/19 14:54:49.418922 zmeventnotification[1227].INF [main:547] [Force updating event 383 with desc:[a] detected:person:100%]
CONSOLE DEBUG:2019-10-03,14:54:49 updating Notes clause for Event:383 with:[a] detected:person:100%
CONSOLE DEBUG:2019-10-03,14:54:49 PARENT GOT RAW TEXT-->timestamp--TYPE----SPLIT--2--SPLIT--1570107284.99923
CONSOLE DEBUG:2019-10-03,14:54:49 GOT JOB==> Update last sent timestamp of monitor:2 to 1570107284.99923 for id:
CONSOLE DEBUG:2019-10-03,14:54:49 Empty job queue
CONSOLE INFO:2019-10-03,14:54:49 New event 384 reported for Monitor:2 (Name:Doorbird (Porte)) Motion Active

10/03/19 14:54:49.425281 zmeventnotification[1227].INF [main:547] [New event 384 reported for Monitor:2 (Name:Doorbird (Porte)) Motion Active]
CONSOLE DEBUG:2019-10-03,14:54:49 HOOK: 384 Creating event object for Doorbird (Porte), setting state to recording
CONSOLE DEBUG:2019-10-03,14:54:49 checkEvents() events found=1
CONSOLE DEBUG:2019-10-03,14:54:49 ---------->Tick END<--------------

I have noticed here the :

FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/zmeventnotification/images/383-alarm.jpg'

.. but do not really knows why (my /var/lib/zmeventnotification/images is not empty)

pliablepixels commented 4 years ago
  1. Can you please post debug logs for detect.py
  2. You may want to update to the latest version
vinceg77 commented 4 years ago

thx @pliablepixels for your quick reply

I am gonna update to 4.3 right now.

Here is nano /var/log/zm/zmesdetect_m2.log for event #383 ;

10/03/19 14:54:39 zmesdetect_m2[1284] DBG yolo.py:50 [Initializing Yolo]
10/03/19 14:54:39 zmesdetect_m2[1284] DBG yolo.py:51 [config:/var/lib/zmeventnotification/models/yolov3/yolov3.cfg, weights:/var/lib/zmeventnotification/models/yolov3/yolov3.weights]
10/03/19 14:54:40 zmesdetect_m2[1308] INF detect.py:60 [---------| app version: 4.2.5 |------------]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG utils.py:216 [allowing self-signed certs to work...]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG utils.py:232 [[monitor-2] overrides key:detect_pattern with value:(person|cat)]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG utils.py:232 [[monitor-2] overrides key:delete_after_analyze with value:yes]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG utils.py:232 [[monitor-2] overrides key:import_zm_zones with value:yes]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG utils.py:232 [[monitor-2] overrides key:resize with value:600]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG utils.py:232 [[monitor-2] overrides key:models with value:face,yolo]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG utils.py:232 [[monitor-2] overrides key:detection_mode with value:all]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG utils.py:232 [[monitor-2] overrides key:face_model with value:hog]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG utils.py:58 [Getting ZM zones using https://192.168.0.35/zm/api/zones/forMonitor/2.json?user=xxx&pass=yyy]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG utils.py:89 [importing zoneminder polygon: Active [356,289 843,289 843,716 356,716]]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG utils.py:89 [importing zoneminder polygon: Inactive 1 [0,0 1276,0 1279,719 843,716 844,288 353,289 354,716 0,719]]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG utils.py:127 [Trying to download https://192.168.0.35/zm/index.php?view=image&eid=383&fid=alarm&username=Vincent&password=*****]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG utils.py:141 [Trying to download https://192.168.0.35/zm/index.php?view=image&eid=383&fid=snapshot&username=Vincent&password=*****]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG detect.py:106 [resizing to 600 before analysis...]
10/03/19 14:54:40 zmesdetect_m2[1308] DBG utils.py:36 [resized polygons x=0.46875/y=0.46805555555555556: [{'name': 'Active', 'value': [(166, 135), (395, 135), (395, 335), (166, 335)]}, {'name': 'Inactive 1', 'value': [(0, 0), (598, 0), (599, 33$
10/03/19 14:54:40 zmesdetect_m2[1308] DBG detect.py:124 [User ALPR if vehicle found: False]
10/03/19 14:54:41 zmesdetect_m2[1284] DBG detect.py:194 [|--> model:yolo detection took: 2.070344s]
10/03/19 14:54:41 zmesdetect_m2[1284] INF image_manip.py:118 [object:person at [347, 149, 453, 339] has an acceptable confidence:0.9971532225608826 (min confidence=0.5)]
10/03/19 14:54:41 zmesdetect_m2[1284] DBG image_manip.py:133 [intersection: polygon in process=[(347, 149), (453, 149), (453, 339), (347, 339)]]
10/03/19 14:54:41 zmesdetect_m2[1284] DBG image_manip.py:139 [Active intersects object:person[[(347, 149), (453, 149), (453, 339), (347, 339)]]]
10/03/19 14:54:41 zmesdetect_m2[1284] DBG detect.py:321 [ALPR not in use, no need for look aheads in processing]
10/03/19 14:54:41 zmesdetect_m2[1284] INF detect.py:337 [labels found: ['person']]
10/03/19 14:54:41 zmesdetect_m2[1284] DBG detect.py:338 [match found in /var/lib/zmeventnotification/images/383-alarm.jpg, breaking file loop...]
10/03/19 14:54:41 zmesdetect_m2[1284] DBG detect.py:391 [Writing detected image to /var/cache/zoneminder/events/2/2019-10-03/383/objdetect.jpg]
10/03/19 14:54:41 zmesdetect_m2[1284] DBG detect.py:398 [Writing JSON output to /var/cache/zoneminder/events/2/2019-10-03/383/objects.json]
10/03/19 14:54:41 zmesdetect_m2[1284] INF detect.py:437 [Prediction string:[a] detected:person:100% ]
10/03/19 14:54:42 zmesdetect_m2[1308] DBG face.py:17 [Initializing face recognition with model:hog upsample:1, jitters:1]
10/03/19 14:54:42 zmesdetect_m2[1308] DBG face.py:27 [face encoding file found, using that. If you want to add new images, remove faces.pickle]
10/03/19 14:54:42 zmesdetect_m2[1308] DBG detect.py:160 [|--> model:face init took: 2.124065s]
10/03/19 14:54:42 zmesdetect_m2[1308] DBG detect.py:189 [Using model: face with /var/lib/zmeventnotification/images/383-alarm.jpg]
10/03/19 14:54:42 zmesdetect_m2[1308] DBG detect.py:194 [|--> model:face detection took: 0.164241s]
10/03/19 14:54:42 zmesdetect_m2[1308] DBG detect.py:202 [Appending known faces to filter list]
10/03/19 14:54:42 zmesdetect_m2[1308] DBG detect.py:321 [ALPR not in use, no need for look aheads in processing]
10/03/19 14:54:42 zmesdetect_m2[1308] DBG detect.py:344 [No match found in /var/lib/zmeventnotification/images/383-alarm.jpg using model:face]
10/03/19 14:54:42 zmesdetect_m2[1308] DBG detect.py:189 [Using model: face with /var/lib/zmeventnotification/images/383-snapshot.jpg]
10/03/19 14:54:42 zmesdetect_m2[1308] DBG detect.py:194 [|--> model:face detection took: 0.163006s]
10/03/19 14:54:42 zmesdetect_m2[1308] DBG detect.py:202 [Appending known faces to filter list]
10/03/19 14:54:42 zmesdetect_m2[1308] DBG detect.py:321 [ALPR not in use, no need for look aheads in processing]
0/03/19 14:54:42 zmesdetect_m2[1308] DBG detect.py:160 [|--> model:yolo init took: 1.1e-05s]
10/03/19 14:54:42 zmesdetect_m2[1308] DBG detect.py:189 [Using model: yolo with /var/lib/zmeventnotification/images/383-alarm.jpg]
10/03/19 14:54:43 zmesdetect_m2[1308] DBG yolo.py:50 [Initializing Yolo]
10/03/19 14:54:43 zmesdetect_m2[1308] DBG yolo.py:51 [config:/var/lib/zmeventnotification/models/yolov3/yolov3.cfg, weights:/var/lib/zmeventnotification/models/yolov3/yolov3.weights]
10/03/19 14:54:44 zmesdetect_m2[1308] DBG detect.py:194 [|--> model:yolo detection took: 1.970097s]
10/03/19 14:54:44 zmesdetect_m2[1308] INF image_manip.py:118 [object:person at [347, 149, 453, 339] has an acceptable confidence:0.9971532225608826 (min confidence=0.5)]
10/03/19 14:54:44 zmesdetect_m2[1308] DBG image_manip.py:133 [intersection: polygon in process=[(347, 149), (453, 149), (453, 339), (347, 339)]]
10/03/19 14:54:44 zmesdetect_m2[1308] DBG image_manip.py:139 [Active intersects object:person[[(347, 149), (453, 149), (453, 339), (347, 339)]]]
10/03/19 14:54:44 zmesdetect_m2[1308] DBG detect.py:321 [ALPR not in use, no need for look aheads in processing]
10/03/19 14:54:44 zmesdetect_m2[1308] INF detect.py:337 [labels found: ['person']]
10/03/19 14:54:44 zmesdetect_m2[1308] DBG detect.py:338 [match found in /var/lib/zmeventnotification/images/383-alarm.jpg, breaking file loop...]
10/03/19 14:54:44 zmesdetect_m2[1308] DBG detect.py:391 [Writing detected image to /var/cache/zoneminder/events/2/2019-10-03/383/objdetect.jpg]
10/03/19 14:54:44 zmesdetect_m2[1308] DBG detect.py:398 [Writing JSON output to /var/cache/zoneminder/events/2/2019-10-03/383/objects.json]
10/03/19 14:54:44 zmesdetect_m2[1308] INF detect.py:437 [Prediction string:[a] detected:person:100% ]

PS : I changed the screenshot in my first post as it was not the right event picture (#343 instead of #383 !)

pliablepixels commented 4 years ago

Please post debug logs of detect after updating. I'm seeing some odd issues in the detect logs - not sure why yolo is running before face when you have face,yolo

vinceg77 commented 4 years ago

For yolo running (or not) before face, it might be my fault : I am not sure not having changed objectconfig.ini after event #383 and then having reported here the updated version. Sorry about that. I have not changed it since

I have updated zmeventnotification.pl to 4.3 (I just replaced the old 4.2 file with the new 4.3 in /usr/bin)

then generated a new event #512 where picture is recognized. The zm web UI still not displays the name of the file recognized in /var/lib/zmeventnotification/known_faces : 2019-10-03 17_53_35-ZM - Events

Here is the zmesdetect_m2.log for event #512 ;

10/03/19 17:31:36 zmesdetect_m2[6202] INF detect.py:60 [---------| app version: 4.2.5 |------------]
10/03/19 17:31:36 zmesdetect_m2[6202] DBG utils.py:216 [allowing self-signed certs to work...]
10/03/19 17:31:36 zmesdetect_m2[6202] DBG utils.py:232 [[monitor-2] overrides key:detect_pattern with value:(person|cat)]
10/03/19 17:31:36 zmesdetect_m2[6202] DBG utils.py:232 [[monitor-2] overrides key:delete_after_analyze with value:yes]
10/03/19 17:31:36 zmesdetect_m2[6202] DBG utils.py:232 [[monitor-2] overrides key:import_zm_zones with value:yes]
10/03/19 17:31:36 zmesdetect_m2[6202] DBG utils.py:232 [[monitor-2] overrides key:resize with value:600]
10/03/19 17:31:36 zmesdetect_m2[6202] DBG utils.py:232 [[monitor-2] overrides key:models with value:face,yolo]
10/03/19 17:31:36 zmesdetect_m2[6202] DBG utils.py:232 [[monitor-2] overrides key:detection_mode with value:all]
10/03/19 17:31:36 zmesdetect_m2[6202] DBG utils.py:232 [[monitor-2] overrides key:face_model with value:hog]
10/03/19 17:31:36 zmesdetect_m2[6202] DBG utils.py:58 [Getting ZM zones using https://192.168.0.35/zm/api/zones/forMonitor/2.json?user=xxx&pass=yyy]
10/03/19 17:31:36 zmesdetect_m2[6202] DBG utils.py:89 [importing zoneminder polygon: Active [356,289 843,289 843,716 356,716]]
10/03/19 17:31:36 zmesdetect_m2[6202] DBG utils.py:89 [importing zoneminder polygon: Inactive 1 [0,0 1276,0 1279,719 843,716 844,288 353,289 354,716 0,719]]
10/03/19 17:31:36 zmesdetect_m2[6202] DBG utils.py:127 [Trying to download https://192.168.0.35/zm/index.php?view=image&eid=512&fid=alarm&username=Vincent&password=*****]
10/03/19 17:31:37 zmesdetect_m2[6202] DBG utils.py:141 [Trying to download https://192.168.0.35/zm/index.php?view=image&eid=512&fid=snapshot&username=Vincent&password=*****]
10/03/19 17:31:37 zmesdetect_m2[6202] DBG detect.py:106 [resizing to 600 before analysis...]
10/03/19 17:31:37 zmesdetect_m2[6202] DBG utils.py:36 [resized polygons x=0.46875/y=0.46805555555555556: [{'name': 'Active', 'value': [(166, 135), (395, 135), (395, 335), (166, 335)]}, {'name': 'Inactive 1', 'value': [(0, 0), (598, 0), (599, 336), (395, 335), (395, 134), (165, 135), (165, 335), (0, 336)]}]]
10/03/19 17:31:37 zmesdetect_m2[6202] DBG detect.py:124 [User ALPR if vehicle found: False]
10/03/19 17:31:38 zmesdetect_m2[6202] DBG face.py:17 [Initializing face recognition with model:hog upsample:1, jitters:1]
10/03/19 17:31:38 zmesdetect_m2[6202] DBG face.py:27 [face encoding file found, using that. If you want to add new images, remove faces.pickle]
10/03/19 17:31:38 zmesdetect_m2[6202] DBG detect.py:160 [|--> model:face init took: 1.671442s]
10/03/19 17:31:38 zmesdetect_m2[6202] DBG detect.py:189 [Using model: face with /var/lib/zmeventnotification/images/512-alarm.jpg]
10/03/19 17:31:39 zmesdetect_m2[6202] DBG detect.py:194 [|--> model:face detection took: 0.173117s]
10/03/19 17:31:39 zmesdetect_m2[6202] DBG detect.py:202 [Appending known faces to filter list]
10/03/19 17:31:39 zmesdetect_m2[6202] DBG detect.py:321 [ALPR not in use, no need for look aheads in processing]
10/03/19 17:31:39 zmesdetect_m2[6202] DBG detect.py:344 [No match found in /var/lib/zmeventnotification/images/512-alarm.jpg using model:face]
10/03/19 17:31:39 zmesdetect_m2[6202] DBG detect.py:189 [Using model: face with /var/lib/zmeventnotification/images/512-snapshot.jpg]
10/03/19 17:31:39 zmesdetect_m2[6202] DBG detect.py:194 [|--> model:face detection took: 0.17116s]
10/03/19 17:31:39 zmesdetect_m2[6202] DBG detect.py:202 [Appending known faces to filter list]
10/03/19 17:31:39 zmesdetect_m2[6202] DBG detect.py:321 [ALPR not in use, no need for look aheads in processing]
10/03/19 17:31:39 zmesdetect_m2[6202] DBG detect.py:344 [No match found in /var/lib/zmeventnotification/images/512-snapshot.jpg using model:face]
10/03/19 17:31:39 zmesdetect_m2[6202] DBG detect.py:160 [|--> model:yolo init took: 1.1e-05s]
10/03/19 17:31:39 zmesdetect_m2[6202] DBG detect.py:189 [Using model: yolo with /var/lib/zmeventnotification/images/512-alarm.jpg]
10/03/19 17:31:39 zmesdetect_m2[6202] DBG yolo.py:50 [Initializing Yolo]
10/03/19 17:31:39 zmesdetect_m2[6202] DBG yolo.py:51 [config:/var/lib/zmeventnotification/models/yolov3/yolov3.cfg, weights:/var/lib/zmeventnotification/models/yolov3/yolov3.weights]
10/03/19 17:31:41 zmesdetect_m2[6202] DBG detect.py:194 [|--> model:yolo detection took: 1.950659s]
10/03/19 17:31:41 zmesdetect_m2[6202] INF image_manip.py:118 [object:person at [240, 146, 348, 336] has an acceptable confidence:0.9655240178108215 (min confidence=0.5)]
10/03/19 17:31:41 zmesdetect_m2[6202] DBG image_manip.py:133 [intersection: polygon in process=[(240, 146), (348, 146), (348, 336), (240, 336)]]
10/03/19 17:31:41 zmesdetect_m2[6202] DBG image_manip.py:139 [Active intersects object:person[[(240, 146), (348, 146), (348, 336), (240, 336)]]]
10/03/19 17:31:41 zmesdetect_m2[6202] INF image_manip.py:118 [object:car at [-4, 200, 270, 342] has an acceptable confidence:0.7490472197532654 (min confidence=0.5)]
10/03/19 17:31:41 zmesdetect_m2[6202] DBG image_manip.py:133 [intersection: polygon in process=[(-4, 200), (270, 200), (270, 342), (-4, 342)]]
10/03/19 17:31:41 zmesdetect_m2[6202] INF image_manip.py:144 [discarding "car" as it does not match your filters]
10/03/19 17:31:41 zmesdetect_m2[6202] DBG image_manip.py:146 [Active intersects object:car[[(-4, 200), (270, 200), (270, 342), (-4, 342)]] but does NOT match your detect_pattern filter of (person|cat)]
10/03/19 17:31:41 zmesdetect_m2[6202] DBG detect.py:321 [ALPR not in use, no need for look aheads in processing]
10/03/19 17:31:41 zmesdetect_m2[6202] INF detect.py:337 [labels found: ['person']]
10/03/19 17:31:41 zmesdetect_m2[6202] DBG detect.py:338 [match found in /var/lib/zmeventnotification/images/512-alarm.jpg, breaking file loop...]
10/03/19 17:31:41 zmesdetect_m2[6202] DBG detect.py:391 [Writing detected image to /var/cache/zoneminder/events/2/2019-10-03/512/objdetect.jpg]
10/03/19 17:31:41 zmesdetect_m2[6202] DBG detect.py:398 [Writing JSON output to /var/cache/zoneminder/events/2/2019-10-03/512/objects.json]
10/03/19 17:31:41 zmesdetect_m2[6202] INF detect.py:437 [Prediction string:[a] detected:person:97% ]
10/03/19 17:31:56 zmesdetect_m2[6239] INF detect.py:60 [---------| app version: 4.2.5 |------------]
pliablepixels commented 4 years ago

No, you need to update properly - please follow install instructions as the detection libraries need to be updated.

Some other thoughts:

  1. The logs show face runs first but no faces are detected
  2. When you run it manually for #512 is the face detected?
vinceg77 commented 4 years ago

1 & 2 : 2019-10-03 18_26_38-192 168 0 35 - KiTTY

I followed the "How do I safely upgrade zmeventnotification to new versions?" here to update... You mean I need to reinstall the whole thing ? Executing install.sh from a new downloaded zmeventnotification-master.zip would be ok to update ??

pliablepixels commented 4 years ago

I updated the instructions. After you download the new updates, do a sudo ./install.sh and follow along.

vinceg77 commented 4 years ago

Ok I have git cloned zmeventnotification / executed ./install.sh / reinstalled my own ini files (maybe you should warn users to backup their objectconfig.ini & zmeventnotification.ini prior to launch install.sh in the web page, hopefully I had done it) It is dark night here now, so I will act as a weirdo in front of my own doorbell tomorrow, in order to trigger an event ! :)

pliablepixels commented 4 years ago

Okay. When you post next:

  1. Please make sure configurations and logs are exactly correct
  2. Please post debug logs for a new detection when ES is running in manual mode
  3. Please post logs of running detect manually for the same event
vinceg77 commented 4 years ago

After updating it is now working : Detected face came back on zm web UI !!! : Inked2019-10-04 11_05_17-ZM - Events_LI

Here are the logs :

  1. objectconfig.ini is the same as in my first post. I do my best to provide accurate logs and informations !
  2. running in manuel mode :
    root@Zoneminder:/home/vincent# sudo -u www-data /usr/bin/detect_wrapper.sh 825 2
    [a] detected:Vincent:100% person:100%

    syslog ( (I still see some warnings and error here) : (I was holding my cell phone !!! :) )

    
    Oct  4 11:13:03 Zoneminder /detect.py[11131]: INF [zmesdetect_m2] [---------| app version: 4.3.7 |------------]
    Oct  4 11:13:03 Zoneminder web_php[9432]: INF [Login successful for user "Vincent"]
    Oct  4 11:13:04 Zoneminder zmc_m5[485]: INF [zmc_m5] [Doorbird (Rue): images:514600 - Capturing at 10.00 fps, capturing bandwidth 25064bytes/sec]
    Oct  4 11:13:04 Zoneminder zmc_m4[5474]: INF [zmc_m4] [Perron: images:346000 - Capturing at 20.00 fps, capturing bandwidth 70857bytes/sec]
    Oct  4 11:13:05 Zoneminder zma_m2[525]: INF [zma_m2] [Doorbird (Porte): 514900 - Analysing at 10.00 fps]
    Oct  4 11:13:05 Zoneminder zmfilter_2[2887]: WAR [No query in Filter!]
    Oct  4 11:13:05 Zoneminder zmfilter_2[2887]: ERR [Error parsing Sql. skipping filter 'Update DiskSpace']
    Oct  4 11:13:05 Zoneminder zmfilter_2[2887]: WAR [No filter found for SELECT * FROM `Filters` WHERE `Id` = ? AND( `AutoArchive` = 1#012    or `AutoVideo` = 1#012    or `AutoUpload` = 1#012    or `AutoEmail` = 1#012    or `AutoMessage` = 1#012    or `AutoExecute` = 1#012    or `AutoDelete` = 1#012    or `UpdateDiskSpace` = 1#012    or `AutoMove` = 1#012    or `AutoCopy` = 1#012    ) ORDER BY `Name` with values(2)]
    Oct  4 11:13:05 Zoneminder /detect.py[11131]: INF [zmesdetect_m2] [object:Vincent at (268, 147, 319, 199) has an acceptable confidence:1 (min confidence=0.5)]
    Oct  4 11:13:05 Zoneminder /detect.py[11131]: INF [zmesdetect_m2] [labels found: ['Vincent']]
    Oct  4 11:13:07 Zoneminder /detect.py[11131]: INF [zmesdetect_m2] [object:person at [203, 124, 391, 328] has an acceptable confidence:0.9991354942321777 (min confidence=0.5)]
    Oct  4 11:13:07 Zoneminder /detect.py[11131]: INF [zmesdetect_m2] [object:cell phone at [295, 296, 333, 310] has an acceptable confidence:0.8758274912834167 (min confidence=0.5)]
    Oct  4 11:13:07 Zoneminder /detect.py[11131]: INF [zmesdetect_m2] [discarding "cell phone" as it does not match your filters]
    Oct  4 11:13:07 Zoneminder /detect.py[11131]: INF [zmesdetect_m2] [object:car at [578, 158, 598, 240] has an acceptable confidence:0.6348605155944824 (min confidence=0.5)]
    Oct  4 11:13:07 Zoneminder /detect.py[11131]: INF [zmesdetect_m2] [discarding "car" as it does not match your filters]
    Oct  4 11:13:07 Zoneminder /detect.py[11131]: INF [zmesdetect_m2] [labels found: ['person']]
    Oct  4 11:13:07 Zoneminder /detect.py[11131]: ERR [zmesdetect_m2] [Could not write image to ZoneMinder as eventpath not present]
    Oct  4 11:13:07 Zoneminder /detect.py[11131]: INF [zmesdetect_m2] [Prediction string:[a] detected:Vincent:100% person:100% ]
3. zmesdetect_m2 log for the same event :

0/04/19 11:13:03 zmesdetect_m2[11131] INF detect.py:60 [---------| app version: 4.3.7 |------------] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG utils.py:216 [allowing self-signed certs to work...] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG utils.py:232 [[monitor-2] overrides key:detect_pattern with value:(person|cat)] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG utils.py:232 [[monitor-2] overrides key:delete_after_analyze with value:yes] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG utils.py:232 [[monitor-2] overrides key:import_zm_zones with value:yes] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG utils.py:232 [[monitor-2] overrides key:resize with value:600] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG utils.py:232 [[monitor-2] overrides key:models with value:face,yolo] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG utils.py:232 [[monitor-2] overrides key:detection_mode with value:all] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG utils.py:232 [[monitor-2] overrides key:face_model with value:hog] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG utils.py:58 [Getting ZM zones using https://192.168.0.35/zm/api/zones/forMonitor/2.json?user=xxx&pass=yyy] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG utils.py:89 [importing zoneminder polygon: Active [356,289 843,289 843,716 356,716]] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG utils.py:89 [importing zoneminder polygon: Inactive 1 [0,0 1276,0 1279,719 843,716 844,288 353,289 354,716 0,719]] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG utils.py:127 [Trying to download https://192.168.0.35/zm/index.php?view=image&eid=825&fid=alarm&username=Vincent&password=] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG utils.py:141 [Trying to download https://192.168.0.35/zm/index.php?view=image&eid=825&fid=snapshot&username=Vincent&password=] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG detect.py:106 [resizing to 600 before analysis...] 10/04/19 11:13:03 zmesdetect_m2[11131] DBG utils.py:36 [resized polygons x=0.46875/y=0.46805555555555556: [{'name': 'Active', 'value': [(166, 135), (395, 135), (395, 335), (166, 335)]}, {'name': 'Inactive 1', 'value': [(0, 0), (598, 0), (599, 33$ 10/04/19 11:13:03 zmesdetect_m2[11131] DBG detect.py:124 [User ALPR if vehicle found: False] 10/04/19 11:13:05 zmesdetect_m2[11131] DBG face.py:17 [Initializing face recognition with model:hog upsample:1, jitters:1] 10/04/19 11:13:05 zmesdetect_m2[11131] DBG face.py:27 [face encoding file found, using that. If you want to add new images, remove faces.pickle] 10/04/19 11:13:05 zmesdetect_m2[11131] DBG detect.py:160 [|--> model:face init took: 1.658418s] 10/04/19 11:13:05 zmesdetect_m2[11131] DBG detect.py:189 [Using model: face with /var/lib/zmeventnotification/images/825-alarm.jpg] 10/04/19 11:13:05 zmesdetect_m2[11131] DBG detect.py:194 [|--> model:face detection took: 0.207376s] 10/04/19 11:13:05 zmesdetect_m2[11131] DBG detect.py:202 [Appending known faces to filter list] 10/04/19 11:13:05 zmesdetect_m2[11131] INF image_manip.py:118 [object:Vincent at (268, 147, 319, 199) has an acceptable confidence:1 (min confidence=0.5)] 10/04/19 11:13:05 zmesdetect_m2[11131] DBG image_manip.py:133 [intersection: polygon in process=[(268, 147), (319, 147), (319, 199), (268, 199)]] 10/04/19 11:13:05 zmesdetect_m2[11131] DBG image_manip.py:139 [Active intersects object:Vincent[[(268, 147), (319, 147), (319, 199), (268, 199)]]] 10/04/19 11:13:05 zmesdetect_m2[11131] DBG detect.py:321 [ALPR not in use, no need for look aheads in processing] 10/04/19 11:13:05 zmesdetect_m2[11131] INF detect.py:337 [labels found: ['Vincent']] 10/04/19 11:13:05 zmesdetect_m2[11131] DBG detect.py:338 [match found in /var/lib/zmeventnotification/images/825-alarm.jpg, breaking file loop...] 10/04/19 11:13:05 zmesdetect_m2[11131] DBG detect.py:160 [|--> model:yolo init took: 1e-05s] 10/04/19 11:13:05 zmesdetect_m2[11131] DBG detect.py:189 [Using model: yolo with /var/lib/zmeventnotification/images/825-alarm.jpg] 10/04/19 11:13:05 zmesdetect_m2[11131] DBG yolo.py:50 [Initializing Yolo] 10/04/19 11:13:05 zmesdetect_m2[11131] DBG yolo.py:51 [config:/var/lib/zmeventnotification/models/yolov3/yolov3.cfg, weights:/var/lib/zmeventnotification/models/yolov3/yolov3.weights]

4. It does not appear above but I can see some error messages [Could not write image to ZoneMinder as eventpath not present] in zmesdetect_m2.log (see below). How should I correct these ?

10/04/19 10:51:29 zmesdetect_m2[9728] DBG yolo.py:50 [Initializing Yolo] 10/04/19 10:51:29 zmesdetect_m2[9728] DBG yolo.py:51 [config:/var/lib/zmeventnotification/models/yolov3/yolov3.cfg, weights:/var/lib/zmeventnotification/models/yolov3/yolov3.weights] 10/04/19 10:51:30 zmesdetect_m2[9728] DBG detect.py:194 [|--> model:yolo detection took: 1.495406s] 10/04/19 10:51:30 zmesdetect_m2[9728] INF image_manip.py:118 [object:person at [212, 225, 320, 333] has an acceptable confidence:0.9776769280433655 (min confidence=0.5)] 10/04/19 10:51:30 zmesdetect_m2[9728] DBG image_manip.py:133 [intersection: polygon in process=[(212, 225), (320, 225), (320, 333), (212, 333)]] 10/04/19 10:51:30 zmesdetect_m2[9728] DBG image_manip.py:139 [Active intersects object:person[[(212, 225), (320, 225), (320, 333), (212, 333)]]] 10/04/19 10:51:30 zmesdetect_m2[9728] DBG detect.py:321 [ALPR not in use, no need for look aheads in processing] 10/04/19 10:51:30 zmesdetect_m2[9728] INF detect.py:337 [labels found: ['person']] 10/04/19 10:51:30 zmesdetect_m2[9728] DBG detect.py:338 [match found in /var/lib/zmeventnotification/images/761-alarm.jpg, breaking file loop...] 10/04/19 10:51:30 zmesdetect_m2[9728] ERR detect.py:404 [Could not write image to ZoneMinder as eventpath not present] 10/04/19 10:51:30 zmesdetect_m2[9728] INF detect.py:437 [Prediction string:[a] detected:person:98% ] 10/04/19 10:52:09 zmesdetect_m2[9778] INF detect.py:60 [---------| app version: 4.3.7 |------------] 10/04/19 10:52:09 zmesdetect_m2[9778] DBG utils.py:216 [allowing self-signed certs to work...]

pliablepixels commented 4 years ago

Looks good.

When you run it manually like sudo -u www-data /usr/bin/detect_wrapper.sh 825 2 you can ignore that "Could not write image" error. That simply means that it does not know where to save the detected image. That is because you are not providing the image path. When the ES invokes this script, it invokes it using sudo -u www-data /usr/bin/detect_wrapper.sh 825 2 </path/to/where/this/event/is/located>

vinceg77 commented 4 years ago

Ok great ! Last thing is cnn face detection method is not working. I conclude that is normal, as there is no cnn.py in my /etc/zm/zmeventnotification/hook/zmes_hook_helpers/ Has it been deprecated ?

pliablepixels commented 4 years ago

CNN is a model, not a file. Please create a new issue with specific logs on what you mean by not working. I use CNN all the time.

vinceg77 commented 4 years ago

For sure I did get that CNN was a model not a file. But from my understanding the model needs a helper file to run ... (please don't blame my poor knowledge if I wrote another imprecision in this last sentence !)

Anyway as you mentioned it is another story, another issue. So I am closing this one.

I thank you really much for your responsive and relevant help !

pliablepixels commented 4 years ago

No it doesn't need a helper file. face.py handles both model types.

vinceg77 commented 4 years ago

Ok I understand.

I am going to do some more tests before opening another issue and will collect all relevant logs/info if I really need to open one.

Thanks again