我刚刚按照本教程安装了新的 Google Edge TPUGoogle TPU USB 加速器
以下是有关我的系统的一些信息:
uname -a
Linux user-desktop 4.15.0-47-generic #50~16.04.1-Ubuntu SMP Fri Mar 15 16:06:21 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
我的python安装:
python3 -V
Python 3.5.2
因此,如果我尝试运行一些演示脚本,就会发生以下情况:
(演示1)
/usr/local/lib/python3.5/dist-packages/edgetpu/demo$ python3 object_detection.py --model ~/Downloads/mobilenet_ssd_v2_face_quant_postprocess_edgetpu.tflite --input ~/Downloads/face.jpg --output ~/detection_results.jpg
Traceback (most recent call last):
File "object_detection.py", line 110, in <module>
main()
File "object_detection.py", line 75, in main
engine = DetectionEngine(args.model)
File "/usr/local/lib/python3.5/dist-packages/edgetpu/detection/engine.py", line 55, in __init__
super().__init__(model_path)
File "/usr/local/lib/python3.5/dist-packages/edgetpu/swig/edgetpu_cpp_wrapper.py", line 300, in __init__
this = _edgetpu_cpp_wrapper.new_BasicEngine(*args)
RuntimeError: Failed to allocate tensors.
(演示2)
/usr/local/lib/python3.5/dist-packages/edgetpu/demo$ python3 classify_image.py --model ~/Downloads/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --label ~/Downloads/inat_bird_labels.txt --image ~/Downloads/parrot.jpg
Traceback (most recent call last):
File "classify_image.py", line 67, in <module>
main()
File "classify_image.py", line 58, in main
engine = ClassificationEngine(args.model)
File "/usr/local/lib/python3.5/dist-packages/edgetpu/classification/engine.py", line 38, in __init__
super().__init__(model_path)
File "/usr/local/lib/python3.5/dist-packages/edgetpu/swig/edgetpu_cpp_wrapper.py", line 300, in __init__
this = _edgetpu_cpp_wrapper.new_BasicEngine(*args)
RuntimeError: Failed to allocate tensors.
我严格按照安装说明进行操作。一些额外说明:我安装了英特尔媒体SDK之前。在安装过程中生成了以下输出:
~/edgetpu_api$ bash ./install.sh
Recognized as Linux on x86_64.
Warning: During normal operation, the Edge TPU Accelerator may heat up, depending
on the computation workloads and operating frequency. Touching the metal part of the
device after it has been operating for an extended period of time may lead to discomfort
and/or skin burns. As such, when running at the default operating frequency, the device is
intended to safely operate at an ambient temperature of 35C or less. Or when running at
the maximum operating frequency, it should be operated at an ambient temperature of
25C or less.
Google does not accept any responsibility for any loss or damage if the device is operated
outside of the recommended ambient temperature range.
.............................................................
Would you like to enable the maximum operating frequency? Y/N
N
Using default operating frequency.
Installing library dependencies...
[sudo] password for example_user:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgcc1 is already the newest version (1:6.0.1-0ubuntu1).
libunwind8 is already the newest version (1.1-4.1).
libusb-1.0-0 is already the newest version (2:1.0.20-1).
python3-numpy is already the newest version (1:1.11.0-1ubuntu1).
python3-pil is already the newest version (3.1.2-0ubuntu1.1).
libc++1 is already the newest version (3.7.0-1ubuntu0.1).
libc++abi1 is already the newest version (3.7.0-1ubuntu0.1).
python3-pip is already the newest version (8.1.1-2ubuntu0.4).
The following packages were automatically installed and are no longer required:
linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic linux-headers-4.15.0-42 linux-headers-4.15.0-42-generic linux-headers-4.15.0-43 linux-headers-4.15.0-43-generic linux-headers-4.15.0-45 linux-headers-4.15.0-45-generic
linux-image-4.15.0-29-generic linux-image-4.15.0-42-generic linux-image-4.15.0-43-generic linux-image-4.15.0-45-generic linux-modules-4.15.0-29-generic linux-modules-4.15.0-42-generic linux-modules-4.15.0-43-generic
linux-modules-4.15.0-45-generic linux-modules-extra-4.15.0-29-generic linux-modules-extra-4.15.0-42-generic linux-modules-extra-4.15.0-43-generic linux-modules-extra-4.15.0-45-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 215 not upgraded.
Done.
Installing device rule file [/etc/udev/rules.d/99-edgetpu-accelerator.rules]...
File already exists. Replacing it...
Done.
Installing Edge TPU runtime library [/usr/lib/x86_64-linux-gnu/libedgetpu.so.1.0]...
File already exists. Replacing it...
/sbin/ldconfig.real: /usr/local/cuda-10.0/targets/x86_64-linux/lib/libcudnn.so.7 is not a symbolic link
/sbin/ldconfig.real: /opt/intel/common/mdf/lib64/igfxcmrt64.so is not a symbolic link
/sbin/ldconfig.real: /opt/intel/mediasdk/lib64/libva-drm.so.2 is not a symbolic link
/sbin/ldconfig.real: /opt/intel/mediasdk/lib64/libva.so.2 is not a symbolic link
/sbin/ldconfig.real: /opt/intel/mediasdk/lib64/libmfxhw64.so.1 is not a symbolic link
/sbin/ldconfig.real: /opt/intel/mediasdk/lib64/libva-glx.so.2 is not a symbolic link
/sbin/ldconfig.real: /opt/intel/mediasdk/lib64/libmfx.so.1 is not a symbolic link
/sbin/ldconfig.real: /opt/intel/mediasdk/lib64/libva-x11.so.2 is not a symbolic link
/sbin/ldconfig.real: /opt/intel/mediasdk/lib64/libigdgmm.so.1 is not a symbolic link
Done.
Installing Edge TPU Python API...
The directory '/home/example_user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/example_user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
You are using pip version 18.1, however version 19.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Done.
有人能帮帮我吗?我不知道出了什么问题!
问候,蒂莫
编辑: 我还注意到,必须先拔下并插入 TPU,然后才能重新启动演示脚本
sudo python3 object_detection.py --model ~/Downloads/mobilenet_ssd_v2_face_quant_postprocess_edgetpu.tflite --input ~/Downloads/face.jpg --output ~/detection_results.jpg
Traceback (most recent call last):
File "object_detection.py", line 110, in <module>
main()
File "object_detection.py", line 75, in main
engine = DetectionEngine(args.model)
File "/usr/local/lib/python3.5/dist-packages/edgetpu/detection/engine.py", line 55, in __init__
super().__init__(model_path)
File "/usr/local/lib/python3.5/dist-packages/edgetpu/swig/edgetpu_cpp_wrapper.py", line 300, in __init__
this = _edgetpu_cpp_wrapper.new_BasicEngine(*args)
RuntimeError: No Edge TPU device detected!
编辑:
我在两个 Ubuntu 16.04 系统上进行了测试。在安装 EdgeTPU 之前,这两个系统上都安装了英特尔的“OpenVINO”和“MediaSDK”。这两个系统都引发了这些“*符号链接”问题。这两个系统上的棒子都无法工作……
编辑:我在空白的 ubuntu 16.04 系统上测试了安装指南,它可以正常工作。所以我认为这是由英特尔的 OpenVINO 或 MediaSDK 引起的。但即使卸载了 OpenVINO 和 MediaSDK 后,它仍然不起作用...
编辑:我用python写了一小段代码
from edgetpu.basic.edgetpu_utils import ListEdgeTpuPaths, EDGE_TPU_STATE_ASSIGNED, EDGE_TPU_STATE_NONE, EDGE_TPU_STATE_UNASSIGNED
print("Assigned: ", ListEdgeTpuPaths(state=EDGE_TPU_STATE_ASSIGNED))
print("Unassigned: ", ListEdgeTpuPaths(state=EDGE_TPU_STATE_UNASSIGNED))
print("None: ", ListEdgeTpuPaths(state=EDGE_TPU_STATE_NONE))
乘以多次后结果保持不变:
Assigned: ()
Unassigned: ('/sys/bus/usb/devices/1-3.4',)
None: ('/sys/bus/usb/devices/1-3.4',)
在跑步的时候
basic_engine = edgetpu.basic.basic_engine.BasicEngine(
%%%the_demo_network_path%%%
)
它返回
Traceback (most recent call last):
File "/media/corvitac/3TB_Data_Storage/corvitac-Server/corvitac_code/python_workspace/utilities/MachineLearning/EdgeTPU/demotest.py", line 10, in <module>
"/home/corvitac/Downloads/mobilenet_ssd_v2_face_quant_postprocess_edgetpu.tflite"
File "/usr/local/lib/python3.5/dist-packages/edgetpu/swig/edgetpu_cpp_wrapper.py", line 300, in __init__
this = _edgetpu_cpp_wrapper.new_BasicEngine(*args)
RuntimeError: Failed to allocate tensors.
如果我重试
print("Assigned: ", ListEdgeTpuPaths(state=EDGE_TPU_STATE_ASSIGNED))
print("Unassigned: ", ListEdgeTpuPaths(state=EDGE_TPU_STATE_UNASSIGNED))
print("None: ", ListEdgeTpuPaths(state=EDGE_TPU_STATE_NONE))
结果是
Assigned: ()
Unassigned: ()
None: ()
答案1
这真的很奇怪,但我解决了我的问题。正如你在我的描述中看到的,我的两个测试系统之间唯一的相似之处是英特尔 OpenVINO/MediaSDK。但 OpenVINO/MediaSDK 并没有导致问题!经过几天的测试,我注意到,将棒插入另一个 USB 控制器(在系统背面)解决了这个问题……我的另一台设备也是一样。
问题出在 USB 控制器上!我不知道为什么 Coral TPU 与其中一些发生冲突。
亲切的问候,
蒂莫
答案2
输出是什么lsusb
?你将需要看到类似这样的内容:
Bus 004 Device 002: ID 18d1:9302 Google Inc.
如果您没有看到该内容,但看到了“Global Unichip Corp”字样,那么可能需要拔下/重新插入或重新启动。
答案3
我在 coral dev board 上运行 classify_image 时遇到了第一个错误“RuntimeError: Failed to allocate tensors”。我发现问题是 edgetpu_compiler 的版本。我通过使用“edgetpu_compiler --min_runtime_version 10 your_model.tflite”重新编译模型解决了这个问题。
答案4
我遇到了同样的问题,只是按照他们的入门页面操作,这基本上是“Hello World”的 AI 版本。由于涉及的步骤很少,因此很难出错 :) 我最终买了一个 Raspberry Pi B+,只是想看看结果是相同还是不同,入门说明在该设备上运行良好。
我知道这不是您希望得到的答案,但我敢打赌,珊瑚所依赖的 x86 软件工具最近出现了一些退化。