Just switched to yolo only for all camras and done a litle more debugging. It seems that that zm_detect.py isnt writing the JSON string for some reason, cant work out why.
I compared the zmesdetect_m*.log files for the camera that won't work and one that does.
***WORKING CAMERA***
Code: Select all
08/20/20 20:22:54 zmesdetect_m3[26965] DBG1 zm_detect.py:267 [No polygon area specfied, so adding a full image polygon:[{'name': 'full_image', 'value': [(0, 0), (1920, 0), (1920, 1080), (0, 1080)]}]]
08/20/20 20:22:54 zmesdetect_m3[26965] DBG1 zm_detect.py:270 [resizing to 1200 before analysis...]
08/20/20 20:22:54 zmesdetect_m3[26965] DBG2 utils.py:38 [resized polygons x=0.625/y=0.625: [{'name': 'full_image', 'value': [(0, 0), (1200, 0), (1200, 675), (0, 675)]}]]
08/20/20 20:22:54 zmesdetect_m3[26965] DBG1 zm_detect.py:291 [User ALPR if vehicle found: False]
08/20/20 20:22:54 zmesdetect_m3[26965] DBG1 zm_detect.py:373 [Using model: yolo with /var/lib/zmeventnotification/images/20094-alarm.jpg]
08/20/20 20:22:54 zmesdetect_m3[26965] DBG1 yolo.py:48 [|---------- YOLO (input image: 1200w*675h, resized to: 416w*416h) ----------|]
08/20/20 20:22:54 zmesdetect_m3[26965] DBG1 yolo.py:59 [Initializing Yolo]
08/20/20 20:22:54 zmesdetect_m3[26965] DBG2 yolo.py:61 [config:/var/lib/zmeventnotification/models/yolov3/yolov3.cfg, weights:/var/lib/zmeventnotification/models/yolov3/yolov3.weights]
08/20/20 20:22:55 zmesdetect_m3[26965] DBG1 yolo.py:83 [Not using CUDA backend]
08/20/20 20:22:55 zmesdetect_m3[26965] DBG1 yolo.py:88 [YOLO initialization (loading model from disk) took: 441.67 milliseconds]
08/20/20 20:22:55 zmesdetect_m3[26965] DBG1 yolo.py:103 [YOLO detection took: 465.288 milliseconds]
08/20/20 20:22:55 zmesdetect_m3[26965] DBG1 yolo.py:136 [YOLO NMS filtering took: 0.739 milliseconds]
08/20/20 20:22:55 zmesdetect_m3[26965] INF yolo.py:162 [object:person at [173, 296, 513, 678] has a acceptable confidence:0.9815893769264221 compared to min confidence of: 0.3, adding]
08/20/20 20:22:55 zmesdetect_m3[26965] DBG2 image_manip.py:282 [intersection: polygon in process=[(173, 296), (513, 296), (513, 678), (173, 678)]]
08/20/20 20:22:55 zmesdetect_m3[26965] DBG2 image_manip.py:289 [full_image intersects object:person[[(173, 296), (513, 296), (513, 678), (173, 678)]]]
08/20/20 20:22:55 zmesdetect_m3[26965] DBG2 zm_detect.py:602 [ALPR not in use, no need for look aheads in processing]
08/20/20 20:22:55 zmesdetect_m3[26965] INF zm_detect.py:619 [labels found: ['person']]
08/20/20 20:22:55 zmesdetect_m3[26965] DBG2 zm_detect.py:622 [match found in /var/lib/zmeventnotification/images/20094-alarm.jpg, breaking file loop...]
08/20/20 20:22:55 zmesdetect_m3[26965] INF zm_detect.py:660 [Removing matches to past detections]
08/20/20 20:22:55 zmesdetect_m3[26965] DBG2 image_manip.py:164 [trying to load /var/lib/zmeventnotification/images/monitor-3-data.pkl]
08/20/20 20:22:55 zmesdetect_m3[26965] DBG1 zm_detect.py:666 [Saving detections for monitor 3 for future match]
08/20/20 20:22:55 zmesdetect_m3[26965] DBG1 zm_detect.py:696 [Writing out debug bounding box image to /var/lib/zmeventnotification/images/20094-alarm-bbox.jpg...]
08/20/20 20:22:55 zmesdetect_m3[26965] DBG1 zm_detect.py:703 [Writing detected image to /mnt/md0/events/3/2020-08-20/20094/objdetect.jpg]
08/20/20 20:22:56 zmesdetect_m3[26965] DBG1 zm_detect.py:707 [Writing JSON output to /mnt/md0/events/3/2020-08-20/20094/objects.json]
08/20/20 20:22:56 zmesdetect_m3[26965] INF zm_detect.py:761 [Prediction string:[a] detected:person:98% ]
08/20/20 20:22:56 zmesdetect_m3[26965] DBG1 zm_detect.py:764 [Prediction string JSON:[{"type": "object", "label": "person", "box": [173, 296, 513, 678], "confidence": "98.16%"}]]
**EOF**
***NOT WORKING CAMERA***
Code: Select all
08/20/20 20:03:48 zmesdetect_m2[26606] DBG1 zm_detect.py:267 [No polygon area specfied, so adding a full image polygon:[{'name': 'full_image', 'value': [(0, 0), (2048, 0), (2048, 2048), (0, 2048)]}]]
08/20/20 20:03:48 zmesdetect_m2[26606] DBG1 zm_detect.py:270 [resizing to 1200 before analysis...]
08/20/20 20:03:48 zmesdetect_m2[26606] DBG2 utils.py:38 [resized polygons x=0.5859375/y=0.5859375: [{'name': 'full_image', 'value': [(0, 0), (1200, 0), (1200, 1200), (0, 1200)]}]]
08/20/20 20:03:48 zmesdetect_m2[26606] DBG1 zm_detect.py:291 [User ALPR if vehicle found: False]
08/20/20 20:03:48 zmesdetect_m2[26606] DBG1 zm_detect.py:373 [Using model: yolo with /var/lib/zmeventnotification/images/20079-alarm.jpg]
08/20/20 20:03:48 zmesdetect_m2[26606] DBG1 yolo.py:48 [|---------- YOLO (input image: 1200w*1200h, resized to: 416w*416h) ----------|]
08/20/20 20:03:48 zmesdetect_m2[26606] DBG1 yolo.py:59 [Initializing Yolo]
08/20/20 20:03:48 zmesdetect_m2[26606] DBG2 yolo.py:61 [config:/var/lib/zmeventnotification/models/yolov3/yolov3.cfg, weights:/var/lib/zmeventnotification/models/yolov3/yolov3.weights]
08/20/20 20:03:48 zmesdetect_m2[26606] DBG1 yolo.py:83 [Not using CUDA backend]
08/20/20 20:03:48 zmesdetect_m2[26606] DBG1 yolo.py:88 [YOLO initialization (loading model from disk) took: 57.769 milliseconds]
08/20/20 20:03:49 zmesdetect_m2[26606] DBG1 yolo.py:103 [YOLO detection took: 440.549 milliseconds]
08/20/20 20:03:49 zmesdetect_m2[26606] DBG1 yolo.py:136 [YOLO NMS filtering took: 0.71 milliseconds]
08/20/20 20:03:49 zmesdetect_m2[26606] INF yolo.py:162 [object:person at [472, 356, 694, 700] has a acceptable confidence:0.9916108846664429 compared to min confidence of: 0.3, adding]
08/20/20 20:03:49 zmesdetect_m2[26606] INF yolo.py:162 [object:car at [348, 42, 722, 160] has a acceptable confidence:0.6264652609825134 compared to min confidence of: 0.3, adding]
08/20/20 20:03:49 zmesdetect_m2[26606] DBG2 image_manip.py:282 [intersection: polygon in process=[(472, 356), (694, 356), (694, 700), (472, 700)]]
08/20/20 20:03:49 zmesdetect_m2[26606] DBG2 image_manip.py:289 [full_image intersects object:person[[(472, 356), (694, 356), (694, 700), (472, 700)]]]
08/20/20 20:03:49 zmesdetect_m2[26606] DBG2 image_manip.py:282 [intersection: polygon in process=[(348, 42), (722, 42), (722, 160), (348, 160)]]
08/20/20 20:03:49 zmesdetect_m2[26606] DBG2 image_manip.py:289 [full_image intersects object:car[[(348, 42), (722, 42), (722, 160), (348, 160)]]]
08/20/20 20:03:49 zmesdetect_m2[26606] DBG2 zm_detect.py:602 [ALPR not in use, no need for look aheads in processing]
08/20/20 20:03:49 zmesdetect_m2[26606] INF zm_detect.py:619 [labels found: ['person', 'car']]
08/20/20 20:03:49 zmesdetect_m2[26606] DBG2 zm_detect.py:622 [match found in /var/lib/zmeventnotification/images/20079-alarm.jpg, breaking file loop...]
08/20/20 20:03:49 zmesdetect_m2[26606] INF zm_detect.py:660 [Removing matches to past detections]
08/20/20 20:03:49 zmesdetect_m2[26606] DBG2 image_manip.py:164 [trying to load /var/lib/zmeventnotification/images/monitor-2-data.pkl]
08/20/20 20:03:49 zmesdetect_m2[26606] DBG1 zm_detect.py:666 [Saving detections for monitor 2 for future match]
**EOF**
The difference seems to be on the last few lines of the "working camera". On the "non-working" camera, zm_detect.py isn't forming the JSON string at the end and assuming not setting the exit code to 0 either. I must be missing something obvious here!
Looking at the zmeventnotification log, it originally called the start hook like this (which seemed to find objects but return no JSON and ext code 1)...
Code: Select all
FORK:Front-Door (2), eid:20079 Invoking hook on event start:'/var/lib/zmeventnotification/bin/zm_event_start.sh' 20079 2 "Front-Door" "Motion FrontGarden" "/mnt/md0/events/2/2020-08-20/20079"]
If I run that same command manually afterwards, it works!
Code: Select all
root@cctv:/home/cctv# '/var/lib/zmeventnotification/bin/zm_event_start.sh' 20079 2 "Front-Door" "Motion FrontGarden" "/mnt/md0/events/2/2020-08-20/20079"]
[a] detected:person:99% car:63% --SPLIT--[{"type": "object", "label": "person", "box": [472, 356, 694, 700], "confidence": "99.16%"}, {"type": "object", "label": "car", "box": [348, 42, 722, 160], "confidence": "62.65%"}]
Stumped now...any help would be appreciated