google-coral / tflite

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

Loading an edgetpu .tflite model with tensorflow.lite.Interpreter crashes #64

Closed enricoschroeder closed 1 year ago

enricoschroeder commented 1 year ago

Description

I am trying to load an *edgetpu.tflite model (for example the supplied mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite or any other model I tried) with the regular tensorflow.lite.Interpreter and the edgetpu delegate. This silently crashes (I suspect a segmentation fault in the background).

import tensorflow as tf

# Program silently crashes while executing code below
edgetpu_interpreter = tf.lite.Interpreter('./mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite',
                                         experimental_delegates=[tf.lite.experimental.load_delegate('edgetpu.dll')])

I tried with tensorflow 2.10.0 and 2.12.0. I can load the same model on the same machine with tflite-runtime 2.5.0 without any problems, however I need regular Tensorflow for dataset operations in my code and both (tflite-runtime and regular tensorflow) cannot be imported at the same time. Since the tflite Interpreter is included in the regular tensorflow package (and I have seen recommendations of using it instead of the dedicated tflite-runtime package), I would assume that this should work, shouldn't it?

Click to expand! ### Issue Type Bug ### Operating System Windows 10 ### Coral Device USB Accelerator ### Other Devices _No response_ ### Programming Language Python 3.9 ### Relevant Log Output _No response_
hjonnala commented 1 year ago

@enricoschroeder our recommendation is to use tflite-runtime 2.5.0.post1. If you would like use with tf 2.10, 2.12 or any other version, please build libedgetpu, pycoral and tflite_runtime pacakges for your platform, using the instructions at: https://coral.ai/docs/notes/build-coral/. Thanks!!

enricoschroeder commented 1 year ago

@hjonnala Thanks for the answer! Before I go down the rabbit hole to build everthing with a current tensorflow version: Am I right to expect that using the regular tensorflow.lite.Interpreter with a matching libedgetpu should work?

Also, is there any particular reason why you do not provide more up-to-date versions of everything?

hjonnala commented 1 year ago

@hjonnala Thanks for the answer! Before I go down the rabbit hole to build everthing with a current tensorflow version: Am I right to expect that using the regular tensorflow.lite.Interpreter with a matching libedgetpu should work?

Yes..

google-coral-bot[bot] commented 1 year ago

Are you satisfied with the resolution of your issue? Yes No