DAVIDNYARKO123 / edge-tpu-silva

Streamlining the process for seamless execution of PyCoral in running TensorFlow Lite models on an Edge TPU USB.
https://pypi.org/project/edge-tpu-silva/
24 stars 3 forks source link

ValueError: Failed to load delegate from libedgetpu.so.1 #3

Closed JuanCarlos-TiqueRangel closed 6 months ago

JuanCarlos-TiqueRangel commented 7 months ago

As was happened to you in the video I am facing same issue:

Loading 192_yolov8n_full_integer_quant_edgetpu.tflite for TensorFlow Lite Edge TPU inference...
Traceback (most recent call last):
  File "/home/edgeai/edgeai/.venv/lib/python3.9/site-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
    delegate = Delegate(library, options)
  File "/home/edgeai/edgeai/.venv/lib/python3.9/site-packages/tflite_runtime/interpreter.py", line 119, in __init__
    raise ValueError(capture.message)
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/edgeai/edgeai/example.py", line 6, in <module>
    for _, _ in outs:
  File "/home/edgeai/edgeai/.venv/lib/python3.9/site-packages/edge_tpu_silva/silva/silva_detect.py", line 38, in process_detection
    outs = model.predict(
  File "/home/edgeai/edgeai/.venv/lib/python3.9/site-packages/ultralytics/engine/model.py", line 445, in predict
    self.predictor.setup_model(model=self.model, verbose=is_cli)
  File "/home/edgeai/edgeai/.venv/lib/python3.9/site-packages/ultralytics/engine/predictor.py", line 297, in setup_model
    self.model = AutoBackend(
  File "/home/edgeai/edgeai/.venv/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/edgeai/edgeai/.venv/lib/python3.9/site-packages/ultralytics/nn/autobackend.py", line 337, in __init__
    interpreter = Interpreter(model_path=w, experimental_delegates=[load_delegate(delegate)])
  File "/home/edgeai/edgeai/.venv/lib/python3.9/site-packages/tflite_runtime/interpreter.py", line 162, in load_delegate
    raise ValueError('Failed to load delegate from {}\n{}'.format(
ValueError: Failed to load delegate from libedgetpu.so.1

The thing is I couldn't fix it. Please do you know what is the way to solve it ? I changed the threshold and I use images with exactly 240x240 and 192x192 for the models 192 and 240 but nothing works. Thank you in advance.

DAVIDNYARKO123 commented 6 months ago

Hello @JuanCarlos-TiqueRangel, If you've followed the installation process and are using the correct Python version, the error you're encountering might indicate that your USB accelerator isn't properly connected, possibly due to a loose connection. I experienced a similar issue during my Raspberry Pi 5 demonstration, and I resolved it by simply adjusting the USB cable to ensure a secure connection. You might also consider trying a different USB port. Keep in mind that the port you choose can affect the speed. Specifically, USB 3.0 ports will provide faster speeds than others.

JuanCarlos-TiqueRangel commented 6 months ago

@DAVIDNYARKO123 Thank you for your time and help. I just figured this out by restarting my Raspberry pi and then everything is working well !!.