首页 > 解决方案 > AttributeError:“委托”对象没有属性“_library”

问题描述

我正在使用 Coral 开发板,但遇到了无法摆脱的错误。我正在尝试在 edgetpu 上运行官方教程的图像分类器示例以开始使用开发板。我一步一步地按照教程但是当我运行时

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

我收到以下错误

  File "classify_image.py", line 118, in <module>
    main()
  File "classify_image.py", line 95, in main
    interpreter = make_interpreter(args.model)
  File "classify_image.py", line 69, in make_interpreter
    {'device': device[0]} if device else {})
  File "/home/mendel/.local/lib/python3.5/site-packages/tflite_runtime/interpreter.py", line 165, in load_delegate
    delegate = Delegate(library, options)
  File "/home/mendel/.local/lib/python3.5/site-packages/tflite_runtime/interpreter.py", line 89, in __init__
    self._library = ctypes.pydll.LoadLibrary(library)
  File "/usr/lib/python3.5/ctypes/__init__.py", line 425, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib/python3.5/ctypes/__init__.py", line 347, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/aarch64-linux-gnu/libc++abi.so.1: undefined symbol: _Unwind_GetRegionStart
Exception ignored in: <bound method Delegate.__del__ of <tflite_runtime.interpreter.Delegate object at 0xffff76ecff98>>
Traceback (most recent call last):
  File "/home/mendel/.local/lib/python3.5/site-packages/tflite_runtime/interpreter.py", line 124, in __del__
    if self._library is not None:
AttributeError: 'Delegate' object has no attribute '_library'

看起来告诉解释器在 TPU 上委托操作的方式是不正确的。我看到很多人面临同样的错误,但没有人找到解决方案。你有什么想法 ?提前致谢。

标签: pythonpython-3.xtpugoogle-coral

解决方案


根据您上面的回答,您正在运行旧版本的 MendelOS。较新的内核应该4.14.98-imx代替4.9.51-imx. 另外,cat /etc/os-release:

PRETTY_NAME="Mendel GNU/Linux 4 (Day)"
NAME="Mendel GNU/Linux"
ID=mendel
ID_LIKE=debian
HOME_URL="https://coral.withgoogle.com/"
SUPPORT_URL="https://coral.withgoogle.com/"
BUG_REPORT_URL="https://coral.withgoogle.com/"
VERSION_CODENAME="day"

请按照此处的说明使用新的系统映像重新刷新板:

https://coral.ai/docs/dev-board/reflash/#flash-a-new-system-image


推荐阅读