我正在尝试使用Tensorflow Lite Python解释器在树莓派3B +中进行对象检测
from tensorflow.contrib.lite.python import interpreter as interpreter_wrapper
但是当我运行这条线时 interpreter=interpreter_wrapper.Interpreter(model_path="mobilenet.tflite")
我收到此错误:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
interpreter = interpreter_wrapper.Interpreter(model_path="mobilenet.tflite")
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/lite/python/interpreter.py", line 50, in __init__
_interpreter_wrapper.InterpreterWrapper_CreateWrapperCPPFromFile(
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/lazy_loader.py", line 53, in __getattr__
module = self._load()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/lazy_loader.py", line 42, in _load
module = importlib.import_module(self.__name__)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 673, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/lite/python/interpreter_wrapper/tensorflow_wrap_interpreter_wrapper.py", line 28, in <module>
_tensorflow_wrap_interpreter_wrapper = swig_import_helper()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/lite/python/interpreter_wrapper/tensorflow_wrap_interpreter_wrapper.py", line 24, in swig_import_helper
_mod = imp.load_module('_tensorflow_wrap_interpreter_wrapper', fp, pathname, description)
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
File "<frozen importlib._bootstrap>", line 693, in _load
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 914, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: /usr/local/lib/python3.5/dist-packages/tensorflow/contrib/lite/python/interpreter_wrapper/_tensorflow_wrap_interpreter_wrapper.so: undefined symbol: _ZN6tflite12tensor_utils39NeonMatrixBatchVectorMultiplyAccumulateEPKfiiS2_iPfi
如果有人尝试过此操作,请帮助我修复此错误
谢谢
这是使用TensorFlow v1.14或更低版本运行TensorFlow Lite时发生的错误。要解决该错误,我们可以卸载常规的TensorFlow,然后使用Google提供的tflite_runtime软件包。
首先,我描述我的环境:
当我使用tensorflow在Google Colab中构建模型时,至少在我的程序中不必在这里使用它。
因此,不要使用“ interpreter = tf.lite.Interpreter(modelpath)”,而应使用此“ interpreter = Interpreter(modelpath)”。
就这样。感谢EdjeElectronics帮助我解决了这个问题。此处是其YouTube频道:https://www.youtube.com/watch?v = aimSGOAUI8Y&t = 26s
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句