Coral USB problem

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
Post Reply
mpl
Posts: 2
Joined: Sat Jan 06, 2024 1:06 pm

Coral USB problem

Post by mpl »

Hello,

im trying to run the Coral USB on the ES.
sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini --debug --eventid 1 --monitorid 1
01/06/24 14:04:28 zmesdetect_m1[58497] INF ZMLog.py:292 [Setting up signal handler for logs]

01/06/24 14:04:28 zmesdetect_m1[58497] INF ZMLog.py:301 [Switching global logger to ZMLog]

01/06/24 14:04:28 zmesdetect_m1[58497] DBG1 zm_detect.py:267 [---------| app:6.1.29, pyzm:0.3.63, ES:(?) , OpenCV:4.6.0|------------]

01/06/24 14:04:29 zmesdetect_m1[58497] INF utils.py:404 [Reading config from: /etc/zm/objectconfig.ini]

01/06/24 14:04:29 zmesdetect_m1[58497] INF utils.py:409 [Reading secrets from: /etc/zm/secrets.ini]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 utils.py:381 [Secret token found in config: !ZM_PORTAL]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 utils.py:381 [Secret token found in config: !ZM_USER]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 utils.py:381 [Secret token found in config: !ZM_PASSWORD]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 utils.py:381 [Secret token found in config: !ZM_API_PORTAL]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 utils.py:381 [Secret token found in config: !ML_USER]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 utils.py:381 [Secret token found in config: !ML_PASSWORD]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 utils.py:381 [Secret token found in config: !PLATEREC_ALPR_KEY]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG1 utils.py:444 [allowing self-signed certs to work...]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 utils.py:454 [Now checking for monitor overrides]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG3 utils.py:521 [Finally, doing parameter substitution]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG1 zm_detect.py:301 [Importing local classes for Object/Face]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG1 zm_detect.py:326 [Connecting with ZM APIs]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 api.py:69 [API SSL certificate check has been disbled]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG1 api.py:173 [using username/password for login]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 api.py:202 [Using new token API]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 zm_detect.py:334 [using ml_sequence]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 zm_detect.py:346 [using stream_sequence]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG1 detect_sequence.py:160 [Resetting models, will be loaded on next run]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG3 detect_sequence.py:634 [Using automatic locking as we are switching between models]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 Media.py:51 [Media get SSL certificate check has been disbled]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 Media.py:99 [Using URL 1 for stream]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 Media.py:114 [We will only process frames: ['snapshot', 'alarm']]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 Media.py:137 [No need to start streams, we are picking images from https://192.168.178.191/zm/index.php?view=image&eid=1]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG3 Media.py:271 [Reading https://192.168.178.191/zm/index.php?vi ... d=snapshot]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG3 api.py:263 [make_request called with url=https://192.168.178.191/zm/index.php?vi ... d=snapshot payload={} type=get query={'token': None}]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG1 detect_sequence.py:654 [perf: Starting for frame:snapshot]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG1 detect_sequence.py:664 [Sequence of detection types to execute: ['object', 'face', 'alpr']]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG1 detect_sequence.py:669 [============ Frame: snapshot Running object detection type in sequence ==================]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 detect_sequence.py:178 [Loading sequence: TPU object detection]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 detect_sequence.py:179 [Initializing model type:object with options:{'name': 'TPU object detection', 'enabled': 'yes', 'object_weights': '/var/lib/zmeventnotification/models/coral_edgetpu/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite', 'object_labels': '/var/lib/zmeventnotification/models/coral_edgetpu/coco_indexed.names', 'object_min_confidence': 0.6, 'object_framework': 'coral_edgetpu', 'tpu_max_processes': 1, 'tpu_max_lock_wait': 100, 'max_detection_size': '90%', 'disable_locks': 'no'}]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 coral_edgetpu.py:37 [portalock: max:1, name:pyzm_uid33_tpu_lock, timeout:100]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 detect_sequence.py:178 [Loading sequence: YoloV4 GPU/CPU]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 detect_sequence.py:179 [Initializing model type:object with options:{'name': 'YoloV4 GPU/CPU', 'enabled': 'yes', 'object_config': '/var/lib/zmeventnotification/models/yolov4/yolov4.cfg', 'object_weights': '/var/lib/zmeventnotification/models/yolov4/yolov4.weights', 'object_labels': '/var/lib/zmeventnotification/models/yolov4/coco.names', 'object_min_confidence': 0.3, 'object_framework': 'opencv', 'object_processor': 'gpu', 'gpu_max_processes': 1, 'gpu_max_lock_wait': 100, 'cpu_max_processes': 3, 'cpu_max_lock_wait': 100, 'max_detection_size': '90%', 'disable_locks': 'no'}]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 yolo.py:54 [portalock: max:1, name:pyzm_uid33_gpu_lock, timeout:100]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG3 detect_sequence.py:689 [object has a same_model_sequence strategy of first]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG1 detect_sequence.py:701 [--------- Frame:snapshot Running variation: #1 -------------]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 coral_edgetpu.py:51 [Waiting for pyzm_uid33_tpu_lock portalock...]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG2 coral_edgetpu.py:53 [Got pyzm_uid33_tpu_lock portalock]

01/06/24 14:04:29 zmesdetect_m1[58497] DBG1 coral_edgetpu.py:89 [|--------- Loading "TPU object detection" model from disk -------------|]

Segmentation fault

Pycoral examples is working:
python3 examples/classify_image.py --model test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --labels test_data/inat_bird_labels.txt --input test_data/parrot.jpg /root/coral/pycoral/examples/classify_image.py:79: DeprecationWarning: ANTIALIAS is deprecated and will be removed in Pillow 10 (2023-07-01). Use LANCZOS or Resampling.LANCZOS instead.
image = Image.open(args.input).convert('RGB').resize(size, Image.ANTIALIAS)
----INFERENCE TIME----
Note: The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory.
13.6ms
4.3ms
4.4ms
4.3ms
4.3ms
-------RESULTS--------
Ara macao (Scarlet Macaw): 0.75781
ls -al /dev/bus/usb/002/
total 0
drwxr-xr-x 2 root root 80 Jan 5 23:19 .
drwxr-xr-x 3 root root 60 Jan 5 23:56 ..
crw-rw-r-- 1 root root 189, 128 Jan 5 18:51 001
crw-rw---- 1 root plugdev 189, 131 Jan 6 14:08 004
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
can someone help me?
MohanDavid
Posts: 4
Joined: Wed Nov 01, 2023 12:20 pm

Re: Coral USB problem

Post by MohanDavid »

I'm ready to help you craft a response to the issue with running Coral USB on the ES. While I can't directly access or execute code, I'll provide a comprehensive response based on the information you've shared and my knowledge of common troubleshooting steps.

Here's a structured response, addressing key points and potential solutions:

"I understand you're encountering a segmentation fault when attempting to run the Coral USB on the ES. Let's work together to troubleshoot this issue."

"From the logs you've provided, here are the key points I've gathered:"
The segmentation fault occurs when loading the "TPU object detection" model.
Pycoral examples are working successfully, indicating the Edge TPU is functional.

Verify Model Compatibility:
"Ensure that the ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite model is specifically compiled for Edge TPUs. You can check compatibility using the edgetpu_compiler tool."
Check Model File Integrity:
"Re-download or re-compile the model to rule out corruption. Verify its integrity using the edgetpu_compiler tool."
Experiment with Different Models:
"Try using a different Edge TPU-compatible model to isolate whether the issue is model-specific or related to the environment."
Inspect Memory Usage:
"Monitor memory usage during model loading. If memory is exhausted, consider reducing model size or allocating more memory."
Investigate Permissions:
"Ensure the www-data user has the necessary permissions to access the model file and Edge TPU device."

"To provide more specific guidance, please share the following details:"
Complete model configuration in /etc/zm/objectconfig.ini
Full output of edgetpu_compiler when checking model compatibility
Additional error messages or logs
Specifications of your ES system (OS version, hardware configuration)

Resources for Troubleshooting:

ZoneMinder Documentation: The official ZoneMinder documentation offers troubleshooting guides and community forums: https://zoneminder.readthedocs.io/
Coral Edge TPU Support: If you're using a Coral Edge TPU device, refer to the Coral documentation for troubleshooting model loading issues: https://coral.ai/docs/accelerator/get-started/voojio
YoloV4 Documentation: If you're using the YoloV4 model specifically, check the Yolo project documentation for potential error messages: https://github.com/topics/yolov4/omegle


"I'm ready to assist with further troubleshooting steps as needed. Please provide any additional information, and I'll do my best to help you resolve this issue."
Stay engaged and offer tailored guidance based on the user's responses and findings.
Last edited by MohanDavid on Thu Apr 18, 2024 8:49 am, edited 1 time in total.
User avatar
iconnor
Posts: 2904
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Coral USB problem

Post by iconnor »

Is www-data able to talk to the coral? Could be permissions
mpl
Posts: 2
Joined: Sat Jan 06, 2024 1:06 pm

Re: Coral USB problem

Post by mpl »

iconnor wrote: Fri Jan 12, 2024 2:09 pm Is www-data able to talk to the coral? Could be permissions
yes, iv try as root too...

iv find a suitable solution for me:

Installed Python3.9 with Pyenv and changed in the Pythonscripts

#!/usr/bin/python3 to #!/usr/local/bin/python3.9

installed all required packages with pip3.9 and it works :)

for facedetection Pillow < 10.0.0. Pillow > 10 not work.
Post Reply