Closed yosyp closed 3 years ago
@yosyp I'm sure you've already looked into this, but just preliminary debugging steps;
Since this message ValueError: Failed to load delegate from libedgetpu.1.dylib
could appears for something as trivial as the system can't find it, can you check if /usr/local/lib
is in your LD_LIBRARY_PATH
?
Also, does this returns anything?
python3.7 -c "from ctypes import *; cdll.LoadLibrary('libedgetpu.1.dylib'); print('success')"
@Namburger thank you for the suggestion.
$ python3.7 -c "from ctypes import *; cdll.LoadLibrary('libedgetpu.1.dylib'); print('success')"
success
It appears that $LD_LIBRARY_PATH
was not set. Setting the path resolved the issue:
$ export LD_LIBRARY_PATH=/usr/local/lib/
$ python3 classify_image.py \
--model models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite \
--labels models/inat_bird_labels.txt \
--input images/parrot.jpg
[]
models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite
----INFERENCE TIME----
Note: The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory.
109.6ms
10.8ms
9.2ms
8.7ms
8.5ms
-------RESULTS--------
Ara macao (Scarlet Macaw): 0.77734
I would like to suggest adding the following line to google-coral/edgetpu/blob/master/scripts/runtime/install.sh#L88
:
export LD_LIBRARY_PATH=/usr/local/lib/
and probably to also updating~/bash_profile
with that variable in the script or in the documentation,
echo "export LD_LIBRARY_PATH=/usr/local/lib/" >> ~/.bash_profile
Thank you for your help Nam.
@yosyp Awesome!
Hello, and thank you for this awesome repository!
The Darwin build of libedgetpu for macOS devices as linked in the Coral documentation here does not seem to work with the Coral USB Accelerator, throwing a
ValueError: Failed to load delegate from libedgetpu.1.dylib
I have tested this on 2 difference MacBook Pro laptops with USB-C ports, using macOS 10.14.5 and 10.15.7.
Full STDOUT of the error message using the example classification code from the documentation:
I can confirm that the Coral USB Accelerator is recognized by the MacBook using a USB-C to USB-A hub:
As well as using a direct USB-C to USB-C cable from the accelerator to the machine:
Can also confirm the locations of the libedgetpu libraries are in the local library directories with their shasums:
Building the library from source on both machines using the latest repo commit
f8cac1044e3ca32b6a9c8712ac6d063e58f19fe1
results in the same behavior. I believe this may be stemming from thetflite_plugin_create_delegate()
function in /edgetpu_delegate_for_custom_op_tflite_plugin.cc#L101 which callsGetEdgeTpuContext()
which cannot open the recognized device. Maybe the libusb version for macOS does not expose USB devices the same way as with Linux?