【问题标题】:AttributeError: 'Delegate' object has no attribute '_library'AttributeError:“委托”对象没有属性“_library”
【发布时间】:2020-01-14 20:40:20
【问题描述】:

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

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 上委托操作的方式不正确。 我看到很多人面临同样的错误,但没有人找到解决方案。 你有什么想法 ?提前致谢。

【问题讨论】:

  • 你能否显示以下输出:“uname -a”和“cat /etc/os-release” 这个问题应该不会在开发板上发生。
  • @NamVu 第一个命令返回Linux green-calf 4.9.51-imx #1 SMP PREEMPT Tue May 14 20:34:37 UTC 2019 aarch64 GNU/Linux,第二个返回PRETTY_NAME="Mendel GNU/Linux 3 (Chef)" NAME="Mendel GNU/Linux" VERSION_ID="3" VERSION="3 (chef)" ID=mendel ID_LIKE=debian HOME_URL="https://coral.withgoogle.com/" SUPPORT_URL="https://coral.withgoogle.com/"

标签: python python-3.x tpu google-coral


【解决方案1】:

根据您上面的回答,您运行的是旧版本的 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

【讨论】:

  • 确实是我的内核版本的问题。非常感谢您的回答!
猜你喜欢
  • 2012-12-01
  • 2021-04-19
  • 2021-11-22
  • 1970-01-01
  • 1970-01-01
  • 2018-08-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多