google-coral / tflite

Examples using TensorFlow Lite API to run inference on Coral devices
https://coral.withgoogle.com
Apache License 2.0
182 stars 68 forks source link

tflite_runtime on Windows 10 raises a ValueError: Failed to load delegate from edgetpu.dll #46

Closed cgalleguillosm closed 3 years ago

cgalleguillosm commented 3 years ago

Hello everyone, I'm trying to run the following example using a Coral m2 module:

python 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

but the following error is raised:


Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\site-packages\tflite_runtime\interpreter.py", line 152, in load_delegate
    delegate = Delegate(library, options)
  File "C:\Program Files\Python38\lib\site-packages\tflite_runtime\interpreter.py", line 111, in __init__
    raise ValueError(capture.message)
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "examples/classify_image.py", line 84, in <module>
    main()
  File "examples/classify_image.py", line 61, in main
    interpreter = make_interpreter(*args.model.split('@'))
  File "C:\Program Files\Python38\lib\site-packages\pycoral\utils\edgetpu.py", line 66, in make_interpreter
    delegates = [load_edgetpu_delegate({'device': device} if device else {})]
  File "C:\Program Files\Python38\lib\site-packages\pycoral\utils\edgetpu.py", line 42, in load_edgetpu_delegate
    return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {})
  File "C:\Program Files\Python38\lib\site-packages\tflite_runtime\interpreter.py", line 154, in load_delegate
    raise ValueError('Failed to load delegate from {}\n{}'.format(
ValueError: Failed to load delegate from edgetpu.dll
python -c "from ctypes import *; cdll.LoadLibrary('edgetpu.dll'); print('success')"
success
print(tflite_runtime.__git_version__)
48c3bae94a8b324525b45f157d638dfd4e8c3be1

Please help me.

manoj7410 commented 3 years ago

@cgalleguillosm Is this issue still reproducible ?

jdmi commented 3 years ago

@manoj7410 I have exactly the same error

johncblacker commented 3 years ago

I have the same problem...but when I try print(tflite_runtime.__git_version__) I get the error: name 'tflite_runtime' is not defined Running on windows 10, Python 3.8.5. I did get "success" as noted in previous post.

johncblacker commented 3 years ago

OOOopppps. I forgot to import tflite_runtime, which worked, then the version is: a4dfb8d1a71385bd6d122e4f27f86dcebb96712d

hjonnala commented 3 years ago

@johncblacker have you installed edgetpu runtime from here https://coral.ai/software/#edgetpu-runtime?

AkkiSony commented 3 years ago

I am getting the same error. Traceback (most recent call last): File "C:\Program Files\Python38\lib\site-packages\tflite_runtime\interpreter.py", line 152, in load_delegate delegate = Delegate(library, options) File "C:\Program Files\Python38\lib\site-packages\tflite_runtime\interpreter.py", line 111, in init raise ValueError(capture.message) ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "examples/classify_image.py", line 84, in main() File "examples/classify_image.py", line 61, in main interpreter = make_interpreter(*args.model.split('@')) File "C:\Program Files\Python38\lib\site-packages\pycoral\utils\edgetpu.py", line 66, in make_interpreter delegates = [load_edgetpu_delegate({'device': device} if device else {})] File "C:\Program Files\Python38\lib\site-packages\pycoral\utils\edgetpu.py", line 42, in load_edgetpu_delegate return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {}) File "C:\Program Files\Python38\lib\site-packages\tflite_runtime\interpreter.py", line 154, in load_delegate raise ValueError('Failed to load delegate from {}\n{}'.format( ValueError: Failed to load delegate from edgetpu.dll


Note: Python version - 3.8.8

I installed Edge TPU from: https://coral.ai/docs/accelerator/get-started/#runtime-on-windows edgetpu_runtime_20210726.zip

I already installed Pycoral library and tflite_runtime using pip commmand with their respective wheel file (windows-10).

**_$ python Python 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 15:50:08) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import tflite_runtime print(tflite_runtime.__git_version_) 48c3bae94a8b324525b45f157d638dfd4e8c3be1**

Please can you tell me how can I overcome this error - ValueError: Failed to load delegate from edgetpu.dll ?

Thanks in advance. @hjonnala

johncblacker commented 3 years ago

@johncblacker have you installed edgetpu runtime from here https://coral.ai/software/#edgetpu-runtime?

Yes I did. In fact I initially started with version 20210726 and got the load error, then I went back to version 20200728 and had problems with the edgetpu not being recognized and windows threw an error when I plugged in the device; Finally late yesterday I went to version 20201204 and received a different error. I'm running python 3.8.5 and there is only one wheel to load for that so I couldn't change versions of that code. Sometimes this version of driver results in device error after I start app: Unknown USB Device (Device Descriptor Request Failed). But, today I tried again and after the "Unknown USB Device... error I unplugged device and plugged it back in then ran the example and it worked with this result: Note: The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory. 115.8ms 14.5ms 14.5ms 14.6ms 14.2ms -------RESULTS-------- Ara macao (Scarlet Macaw): 0.75781 Seems to be somewhat touchy, though. Yesterday when I tried with this version of driver I received a totally different error. I might also note that I am running the device using a USB 2.0 cable (not the google supplied one) into a USB 3.0 port on my P/C. I'm going to search for a USB 3 cable and see if that makes a difference.

hemanthreddyjonnala commented 3 years ago

@AkkiSony I have seen this issue when I installed new version of edgetpu runtime without uninstalling the previous version. Please try the below steps:

For tflite runtime and pycoral installation please refer to the attacement.

Thanks pycoral_python3.8_windows.txt

AkkiSony commented 3 years ago

@hjonnala Thanks for detailed explanation! :) I will try to upgrade the edgetpu runtime. However, is it necessary to install pycoral and tflite_run time again??? Just upgrading the version of edge tpu would'nt work?"

Apart from this, why is the previous version of edge tpu giving me errors? Why am I not able to run the demo in the older version? My cuurent version is edgetpu_runtime_20210119

Thanks again for the clarity of explanation! :)

johncblacker commented 3 years ago

@AkkiSony I have seen this issue when I installed new version of edgetpu runtime without uninstalling the previous version. Please try the below steps:

For tflite runtime and pycoral installation please refer to the attacement.

Thanks pycoral_python3.8_windows.txt

Thank you for the detailed text file, I've printed it for reference. Whenever I switched from one version of the driver (runtime) to another I always uninstalled the device (from the device manager) and checked the box to remove the old files; that way there should be no remnants hanging around. I rebooted, then I installed the next version I wanted to try, then I rebooted. So, now I'm running with 20201204 and I seem to be able to run all the examples I've tried so far (3 of them). I read online about some people having problems with the google supplied cable for the coral, so I switched to one of my own cables, but I don't know if that has had any effect since I haven't switched back to the google cable. As noted above, when I first tried running an example today I had a problem with the device. My coral was unplugged this morning, so I plugged it in and then looked in the windows device manager to verify it was found under usb devices and it was. Then I tried an example and it failed to load the delegate and the device went from being a USB device to the USB controller section as an Unknown device! I unplugged the coral, checked device manager, then tried the example again and it worked! So, something's "flaky" but I haven't a clue what. Since then I've been able to run other examples without errors. It seems to me that the owners of this repository and those developing the installation instructions don't seem to be working in tandem. I also have to wonder why there are so many different python versions - what new release feature are they using, or is there simply some kind of check for python version in the code somewhere. At any rate, one of the benefits of Python has always been the compatibility from older releases to newer ones (not versions, just releases) so why so many versions to have to deal with?

AkkiSony commented 3 years ago

@AkkiSony I have seen this issue when I installed new version of edgetpu runtime without uninstalling the previous version. Please try the below steps:

@hemanthreddyjonnala I tried all these methods, yet I am getting the same error as stated above! :/ I haven#t modified anything with pycoral and tflite_runtime after installing the new edge tpu runtime.

hjonnala commented 3 years ago

@johncblacker I am not sure why there are so many versions.

@AkkiSony currently I am having issue (segmentation fault) with edgetpu_runtime_20210726.zip installation. I have tried installing the previous version edgetpu_runtime_20210119 without reboot and it is working fine.

AkkiSony commented 3 years ago

@AkkiSony currently I am having issue (segmentation fault) with edgetpu_runtime_20210726.zip installation. I have tried installing the previous version edgetpu_runtime_20210119 without reboot and it is working fine.

I was using version 20210119 previously. But after your suggestion, I upgraded to 20210726 version. Now, I will get back to the previous version itself. Meanwhile should I also downgrade the pycoral and tflite_runtime version aswell? I have installed pycoral-2.0.0-cp38 and tflite_runtime-2.5.0 using pip install command. Will this be compatible with edgetpu_runtime_20210119?

hjonnala commented 3 years ago

@AkkiSony I haven't downgraded pycoral 2.0.0 and tflite runtime 2.5. Please let us know if you see any issues.

AkkiSony commented 3 years ago

@hemanthreddyjonnala I alwys get this $ bash examples/install_requirements.sh classify_image.py NOT FOUND: mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite NOT FOUND: mobilenet_v2_1.0_224_inat_bird_quant.tflite NOT FOUND: inat_bird_labels.txt NOT FOUND: parrot.jpg

I am unable to download the models. Please let me know how can I solve this?

hjonnala commented 3 years ago

@hemanthreddyjonnala I alwys get this $ bash examples/install_requirements.sh classify_image.py NOT FOUND: mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite NOT FOUND: mobilenet_v2_1.0_224_inat_bird_quant.tflite NOT FOUND: inat_bird_labels.txt NOT FOUND: parrot.jpg

I am unable to download the models. Please let me know how can I solve this?

I am not sure how to resolve this issue as I haven't faced this issue. I will check the internal team and let you know if any resolution for this.

AkkiSony commented 3 years ago

Okay. If I download them manually and place them in the test_data folder. Should the demo work fine? Or is there any additional dependencies which will be installed from the install_requirements.sh file?

Because, when I tried copying the required files and placed it in test_data repo. When I execute the the below commaND; i am getting the below error.

$ python 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 RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd Traceback (most recent call last): File "examples/classify_image.py", line 40, in from pycoral.utils.edgetpu import make_interpreter File "C:\Users\AkshayaC\Anaconda3\envs\coral_env\lib\site-packages\pycoral\utils\edgetpu.py", line 24, in from pycoral.pybind._pywrap_coral import GetRuntimeVersion as get_runtime_version SystemError: initialization of _pywrap_coral raised unreported exception (coral_env)

hemanthreddyjonnala commented 3 years ago

@AkkiSony can you please share the output of pip freeze.

 (pycoral_venv) C:\Users\heman\coral\pycoral>py 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
----INFERENCE TIME----
Note: The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory.
14.4ms
9.1ms
8.2ms
7.4ms
6.0ms
-------RESULTS--------
Ara macao (Scarlet Macaw): 0.75781

(pycoral_venv) C:\Users\heman\coral\pycoral>pip freeze
numpy==1.21.1
Pillow==8.3.1
pycoral @ https://github.com/google-coral/pycoral/releases/download/v2.0.0/pycoral-2.0.0-cp38-cp38-win_amd64.whl
tflite-runtime @ https://github.com/google-coral/pycoral/releases/download/v2.0.0/tflite_runtime-2.5.0.post1-cp38-cp38-win_amd64.whl
AkkiSony commented 3 years ago

pip freeze gives me a huge output log file. Hence, I have only copy pasted, the region we are interested with. Let me know if this is sufficient!

numpy @ file:///D:/bld/numpy_1621506450533/work Pillow @ file:///D:/bld/pillow_1625678130042/work pycoral @ file:///C:/Users/XXX/Coral-USB/installation-whl-files/pycoral-2.0.0-cp38-cp38-win_amd64.whl tflite-runtime @ file:///C:/Users/XXX/Coral-USB/installation-whl-files/tflite_runtime-2.5.0.post1-cp38-cp38-win_amd64.whl

manoj7410 commented 3 years ago

@AkkiSony Can you run : pip3 install numpy --upgrade ?

AkkiSony commented 3 years ago

pip3 install numpy --upgrade Requirement already satisfied: numpy in c:\users\XXX\anaconda3\envs\coral_env\lib\site-packages (1.20.3) WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)'))': /simple/numpy/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)'))': /simple/numpy/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)'))': /simple/numpy/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)'))': /simple/numpy/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)'))': /simple/numpy/ Could not fetch URL https://pypi.org/simple/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/numpy/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)'))) - skipping (coral_env)

manoj7410 commented 3 years ago

@AkkiSony Try with 'pip3 install numpy --upgrade --ignore-installed'

AkkiSony commented 3 years ago

pip3 install numpy --upgrade --ignore-installed --proxy="proxy mentioned here" WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)'))': /simple/numpy/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)'))': /simple/numpy/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)'))': /simple/numpy/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)'))': /simple/numpy/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)'))': /simple/numpy/ Could not fetch URL https://pypi.org/simple/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/numpy/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)'))) - skipping ERROR: Could not find a version that satisfies the requirement numpy (from versions: none) ERROR: No matching distribution found for numpy

manoj7410 commented 3 years ago

Are you working on a restricted network ? Can you try with an open network like a mobile hotspot ?

AkkiSony commented 3 years ago

I am working behind a company proxy. Hence, I cannot use hotspot! :/

johncblacker commented 3 years ago

@hemanthreddyjonnala I alwys get this $ bash examples/install_requirements.sh classify_image.py NOT FOUND: mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite NOT FOUND: mobilenet_v2_1.0_224_inat_bird_quant.tflite NOT FOUND: inat_bird_labels.txt NOT FOUND: parrot.jpg

I am unable to download the models. Please let me know how can I solve this?

I would suggest running the install-requirements.sh separately using git-bash. This script puts the required files into two directories - models and test_data. If you have downloaded the files yourself, that's OK, you simply have to point to the correct locations when you run the example by modifying your command line arguments.

I too found that python3 didn't exist, so if you use "python" make sure it's the version you're expecting: try python -V to find out. If it is correct version, just go into the install-requirements.sh script and change python3 to python and it should work fine. Another option would be to setup an alias so that "python3" will execute "python." In my python 3.8 directory, python3 is the name of a .dll file. There seems to be a lot of confusion as to the inter-operability of the pycoral api, the edgetpu runtime and the drivers - too bad google doesn't have an accurate table identifying which versions of these components are compatible with each other...but I couldn't find one.

AkkiSony commented 3 years ago

try python -V to find out

I found out it is the required version "Python 3.8.8"

just go into the install-requirements.sh script and change python3 to python and it should work fine.

There is no mention of python in the install-requirements.sh file. :/

AkkiSony commented 3 years ago

If you have downloaded the files yourself, that's OK, you simply have to point to the correct locations when you run the example by modifying your command line arguments.

$ python 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 RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd Traceback (most recent call last): File "examples/classify_image.py", line 40, in from pycoral.utils.edgetpu import make_interpreter File "C:\Users\AkshayaC\Anaconda3\envs\coral_env\lib\site-packages\pycoral\utils\edgetpu.py", line 24, in from pycoral.pybind._pywrap_coral import GetRuntimeVersion as get_runtime_version SystemError: initialization of _pywrap_coral raised unreported exception

I get the following error! :/

johncblacker commented 3 years ago

OK, I'm running numpy 1.21.1, tflite runtime: tflite-runtime==2.5.0.post1, python 3.8.5, my drivers: edgetpu_runtime_20201204. I am not using anaconda. I'm sorry about wrong info earlier...the install-requirements.sh script puts output into examples/test_data directory. But, like I said location doesn't matter if you specify correctly in calling arguments. I verified this morning that my example still runs after updating my windows to 21H1 feature experience pack: 120.2212.3530.0, osbuild: 19043.1110 I'd verify that the device manager shows your coral device in Universal Serial Bus devices. My pycoral is 2.0.0 according to pip show pycoral. The other thing that comes to mind is your virus protection program - I'm using PCMatic and have had a few issues with their "super shield" stopping me from running programs I knew were OK. You might disable your virus program for a short time and try your example. Also, another thing that comes to mind is try running as "administrator" and see if that helps. If you can't make your configuration work then If I were you I'd start from scratch and remove the runtime, the drivers and pycoral api and start over again with the versions that some of have proven work. Good luck. BTW it would be extremely helpful if the google support people responding in this thread would identify themselves as such. I do not work for google, just a frustrated coral noob trying to make this work on Windows 10 (already have it working on Raspberry Pi 3b+ and it was straightforward on that platform!).

AkkiSony commented 3 years ago

I am still not able to solve this dll error! :( And I also see that this issue is faced by others as well. Please let us know a solution at the earliest.

AkkiSony commented 3 years ago

Guys any reply please? Is there a possible solution for this error?

AkkiSony commented 3 years ago

edgetpu_runtime_20201204.

Can you please send me the link to install this version.

manoj7410 commented 3 years ago

@AkkiSony You can find runtimes at : https://coral.ai/software/#edgetpu-runtime

AkkiSony commented 3 years ago

Thanks pycoral_python3.8_windows.txt

Thanks for sharing the document. @hjonnala This was very useful. :) Yet, it's sad that i am still getting the edgetpu.dll error!

johncblacker commented 3 years ago

I am running python 3.8.5 using the edgetpu_runtime_20201204 version of the runtime. If you're having .dll issues it might be better to simply uninstall all the edgetpu and pycoral items and start over. Please not what versions of the items that result.

johncblacker commented 3 years ago

Here's the info on my edgetpu.dll: File version 14.0.0.0 Product name edgetpu Productversion 14.0.0.0 Copyright 2019-2020 size 804kb date modified 12/4/2020 10:48pm

johncblacker commented 3 years ago

After you remove the previous version by removing the device AND deleting the driver files, reboot. Then, install the new edgetpu version, reboot again. Look at your .dll and make sure it matches mine, then you should be OK.

AkkiSony commented 3 years ago

@johncblacker Thanks a ton! :) :) :) You finally made it work for me! :) The demo worked! :) I think reboot was the main thing which I did not do previously after uninstalling and installing it. This worked with me! :)

Thanks pycoral_python3.8_windows.txt This document really helped me a lot! :) @hjonnala I should thank you for always replying spontaneously! :)

Now, I want to run an object detection model. I have trained my model using https://colab.research.google.com/github/google-coral/tutorials/blob/master/retrain_detection_qat_tf1.ipynb Now, when I run the code, I am getting the following error!

(pycoral_venv) C:\pycoral_venv\Scripts\coral\pycoral>python examples\detect_image.py --model 3-classes-training\model_quantized_edgetpu.tflite --labels 3-classes-training\labels.txt.txt --input 3-classes-training\holes-test-input.jpg --output holes-output.jpg Traceback (most recent call last): File "examples\detect_image.py", line 108, in main() File "examples\detect_image.py", line 74, in main interpreter.allocate_tensors() File "C:\pycoral_venv\lib\site-packages\tflite_runtime\interpreter.py", line 408, in allocate_tensors return self._interpreter.AllocateTensors() RuntimeError: Failed to prepare for TPU. Failed precondition: Package requires runtime version (14), which is newer than this runtime version (13).Node number 2 (EdgeTpuDelegateForCustomOp) failed to prepare.

Do i have to update the Edge TPU runtme to a newer version!?

AkkiSony commented 3 years ago

@johncblacker @hemanthreddyjonnala I installed the edgte tpu version 20210726, and now I get back the .dll error! :( :(

(pycoral_venv) C:\pycoral_venv\Scripts\coral\pycoral1>python 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 Traceback (most recent call last): File "C:\pycoral_venv\lib\site-packages\tflite_runtime\interpreter.py", line 160, in load_delegate delegate = Delegate(library, options) File "C:\pycoral_venv\lib\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 "examples\classify_image.py", line 121, in main() File "examples\classify_image.py", line 71, in main interpreter = make_interpreter(*args.model.split('@')) File "C:\pycoral_venv\lib\site-packages\pycoral\utils\edgetpu.py", line 87, in make_interpreter delegates = [load_edgetpu_delegate({'device': device} if device else {})] File "C:\pycoral_venv\lib\site-packages\pycoral\utils\edgetpu.py", line 52, in load_edgetpu_delegate return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {}) File "C:\pycoral_venv\lib\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 edgetpu.dll


That's the output of pip freeze:

(pycoral_venv) C:\pycoral_venv\Scripts\coral\pycoral1>pip freeze numpy==1.21.1 Pillow==8.3.1 pycoral @ https://github.com/google-coral/pycoral/releases/download/v2.0.0/pycoral-2.0.0-cp38-cp38-win_amd64.whl tflite-runtime @ https://github.com/google-coral/pycoral/releases/download/v2.0.0/tflite_runtime-2.5.0.post1-cp38-cp38-win_amd64.whl

Is there any issue with the latest release of EDGE-TPU runtime???

johncblacker commented 3 years ago

@johncblacker @hemanthreddyjonnala I installed the edgte tpu version 20210726, and now I get back the .dll error! :( :(

(pycoral_venv) C:\pycoral_venv\Scripts\coral\pycoral1>python 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 Traceback (most recent call last): File "C:\pycoral_venv\lib\site-packages\tflite_runtime\interpreter.py", line 160, in load_delegate delegate = Delegate(library, options) File "C:\pycoral_venv\lib\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 "examples\classify_image.py", line 121, in main() File "examples\classify_image.py", line 71, in main interpreter = make_interpreter(*args.model.split('@')) File "C:\pycoral_venv\lib\site-packages\pycoral\utils\edgetpu.py", line 87, in make_interpreter delegates = [load_edgetpu_delegate({'device': device} if device else {})] File "C:\pycoral_venv\lib\site-packages\pycoral\utils\edgetpu.py", line 52, in load_edgetpu_delegate return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {}) File "C:\pycoral_venv\lib\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 edgetpu.dll

That's the output of pip freeze:

(pycoral_venv) C:\pycoral_venv\Scripts\coral\pycoral1>pip freeze

numpy==1.21.1 Pillow==8.3.1 pycoral @ https://github.com/google-coral/pycoral/releases/download/v2.0.0/pycoral-2.0.0-cp38-cp38-win_amd64.whl tflite-runtime @ https://github.com/google-coral/pycoral/releases/download/v2.0.0/tflite_runtime-2.5.0.post1-cp38-cp38-win_amd64.whl Is there any issue with the latest release of EDGE-TPU runtime???

Does your device manager show the coral device in USB devices? Before and after you try to run, look to see.

AkkiSony commented 3 years ago

@johncblacker coral-TPU-error-18 Yes, I can see it.

hjonnala commented 3 years ago

@johncblacker yes, there is an issue with latest edgetpu runtime 14 for windows.

AkkiSony commented 3 years ago

@hjonnala Thanks. But is there a way for me to solve this issue? :/ Or will there be any update coming soon? Will working with Coral Dev board solve the issue?

johncblacker commented 3 years ago

You will get that error if the system cannot find the coral device.

Aug 10, 2021 7:37:29 AM AkkiSony @.***>:

@hjonnala[https://github.com/hjonnala] Thanks. But is there a way for me to solve this issue? :/ Or will there be any update coming soon?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub[https://github.com/google-coral/tflite/issues/46#issuecomment-895956303], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AB6WAAQXRF5K5ROB5UISCTDT4EFPRANCNFSM43NLV3WQ]. Triage notifications on the go with GitHub Mobile for iOS[https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675] or Android[https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email]. [data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAAaSURBVFiF7cEBAQAAAIIg/69uSEABAAAA7wYQIAABRwGgiAAAAABJRU5ErkJggg==###24x24:true###][Tracking image][https://github.com/notifications/beacon/AB6WAARUWZJP7N7BUAKNZ23T4EFPRA5CNFSM43NLV3W2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGVTTKTY.gif]

AkkiSony commented 3 years ago

@johncblacker coral-TPU-error-18 Yes, I can see it.

But the system is able to find it! @johncblacker

johncblacker commented 3 years ago

Is it still there after you get error?

Aug 10, 2021 7:57:20 AM AkkiSony @.***>:

@johncblacker[https://github.com/johncblacker] [https://user-images.githubusercontent.com/85996229/128859833-c2721446-962c-4de9-9a7e-e43dace323b8.PNG][coral-TPU-error-18][https://user-images.githubusercontent.com/85996229/128859833-c2721446-962c-4de9-9a7e-e43dace323b8.PNG] Yes, I can see it.

But the system is able to find it! @johncblacker[https://github.com/johncblacker]

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub[https://github.com/google-coral/tflite/issues/46#issuecomment-895967257], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AB6WAARTJNV33S4FTSHPGA3T4EHZ7ANCNFSM43NLV3WQ]. Triage notifications on the go with GitHub Mobile for iOS[https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675] or Android[https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email]. [data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAAaSURBVFiF7cEBAQAAAIIg/69uSEABAAAA7wYQIAABRwGgiAAAAABJRU5ErkJggg==###24x24:true###][Tracking image][https://github.com/notifications/beacon/AB6WAAUM5UAVBP3XWFUYAG3T4EHZ7A5CNFSM43NLV3W2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGVTWAGI.gif]

AkkiSony commented 3 years ago

@johncblacker Yes, its there before and after I get the error. :/ It worked fine with runtime 20201204. But it has problems with version 20210726. :( My object detection model requires runtimeversion(14).

hjonnala commented 3 years ago

@hjonnala Thanks. But is there a way for me to solve this issue? :/ Or will there be any update coming soon? Will working with Coral Dev board solve the issue?

Coral Dev Board works on Mendel LInux Operating System. There won't be any issues with the Coral Dev Board.

On windows as of now only workaround is to use previous runtime version edgetpu_runtime_20201204.

If I were you,

AkkiSony commented 3 years ago

@hjonnala Thanks for your suggestions! :)

  • I would try with different terminals (Bash, cmd, anaconda etc) I tried with it with GIT BASH and CMD prompt on the windows side. Dint work!

  • try with opening the shell as administrator

Again, dint work!

  • try with or without virtual env

I tried without virtual environment. BUt it said pycoral not found even after installling it! :/

  • Try it on a different windows computer

I wish I could try this. But I cannot do it! As I am working on a company PC.

hjonnala commented 3 years ago

try it on own PC it might be a different operating system, you would be able to know if there is any issue with USB accelerator.

How are you connecting USB accelerator to PC? with USB hub or direct connection?