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

Usb Accelerator gets disconnected when running the example on windows #38

Closed teraSurfer closed 3 years ago

teraSurfer commented 3 years ago

I'm running the classify image example on windows with the frogfish wheel of tflite-runtime (tflite_runtime-2.5.0-cp37-cp37m-win_amd64.whl) on the newest edgetpu runtime (edgetpu_runtime_20201105.zip). I get a device disconnection sound and powershell freezes. If I close it and try again in a different window, I get a value error.

Traceback (most recent call last):
  File "classify_image.py", line 123, in <module>
    main()
  File "classify_image.py", line 100, in main
    interpreter = make_interpreter(args.model)
  File "classify_image.py", line 74, in make_interpreter
    {'device': device[0]} if device else {})
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\tflite_runtime\interpreter.py", line 155, in load_delegate
    library, str(e)))
ValueError: Failed to load delegate from edgetpu.dll

I'm new to coral and any help would be great.

Namburger commented 3 years ago

@teraSurfer Did you also install a newest verison of tflite_runtimepip package? https://www.tensorflow.org/lite/guide/python

teraSurfer commented 3 years ago

@Namburger Yes, I did. I'm using tflite_runtime-2.5.0-cp37-cp37m-win_amd64.whl

Namburger commented 3 years ago

Can you share the outputs of these commands:

$ python3 -c 'print(__import__("tflite_runtime").__git_version__)' 
$ python3 -c "from ctypes import *; cdll.LoadLibrary('edgetpu.dll); print('success')" 
teraSurfer commented 3 years ago

Sharing the outputs:

python3 -c 'print(__import__("tflite_runtime").__git_version__)'
48c3bae94a8b324525b45f157d638dfd4e8c3be1
python3 -c "from ctypes import *; cdll.LoadLibrary('edgetpu.dll); print('success')" 
<CDLL 'edgetpu.dll', handle 7ffe1e8f0000 at 0x1bcdbfbe6c8>
success
Namburger commented 3 years ago

Hi @teraSurfer sorry for the late response, we are able to reproduce the issue and is actively working on this now, for now please downgrade the library using these instruction: https://github.com/google-coral/edgetpu/issues/260#issuecomment-731194060

mpreach commented 3 years ago

I have the same issue by getting the example "classify_image.py" up and running on a M.2 module in a Win10 env.:

Traceback (most recent call last): File "classify_image.py", line 122, in <module> main() File "classify_image.py", line 99, in main interpreter = make_interpreter(args.model) File "classify_image.py", line 72, in make_interpreter tflite.load_delegate(EDGETPU_SHARED_LIB, File "C:\Users\Office\AppData\Local\Programs\Python\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

I downgraded from 3.8 to 3.7 to 3.6. Every time with the same issue.

python3 -c 'print(import("tflite_runtime").__git_version__)' 48c3bae94a8b324525b45f157d638dfd4e8c3be1

python3 -c "from ctypes import *; cdll.LoadLibrary('edgetpu.dll'); print('success')" <CDLL 'edgetpu.dll', handle 7ffa3f340000 at 0x27f5a8ed828>

Any suggestion or recommendations ??? Any help would be appreciated.

Namburger commented 3 years ago

@mpreach Please downgrade the tflite_runtime package to this one (which ever python version you have):

pip3 install https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp36-cp36m-win_amd64.whl
pip3 install https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp37-cp37m-win_amd64.whl
mpreach commented 3 years ago

@Namburger I downgraded to the 2.1.0 Version. Problem is still existing.

` Traceback (most recent call last): File "classify_image.py", line 122, in main() File "classify_image.py", line 99, in main interpreter = make_interpreter(args.model) File "classify_image.py", line 73, in make_interpreter {'device': device[0]} if device else {}) File "C:\Users\Office\AppData\Local\Programs\Python\Python36\lib\site-packages\tflite_runtime\interpreter.py", line 166, in load_delegate library, str(e))) ValueError: Failed to load delegate from edgetpu.dll

Any other suggestions or recommendations ?

Namburger commented 3 years ago

@mpreach Wait, sorry, you should be using the dll form here instead: https://dl.google.com/coral/edgetpu_api/edgetpu_runtime_20200728.zip

mpreach commented 3 years ago

@Namburger: Works now.