在珊瑚开发板上使用cpp tflite API

问题描述 投票:0回答:1

我正在尝试使用cpp tflite API在开发板上查询模型。该代码已使用usb棒进行了测试,并且可以正常运行,但是,在开发板上,我在此行遇到了错误:

model_interpreter_ = coral::BuildEdgeTpuInterpreter(*model_, this->edgetpu_context_.get());

这是错误:

INFO: Initialized TensorFlow Lite runtime.
ERROR: Failed to retrieve TPU context.
ERROR: Node number 0 (edgetpu-custom-op) failed to prepare.

使用python API,相同模型可以正常工作。

开发板上是否支持tflite cpp API?

在开发板上,我拥有最新版本(12-1)这就是我构建tflite lib的过程:

  1. 在本地为arm64构建tflite(使用构建通用脚本,与描述的here不同),我使用了分支v.2.0。*原因是缺乏在开发板上构建的虚拟内存和磁盘空间。

  2. 在开发板上安装了flatbuffer。

编辑:我能够从开发板上的tensorflow分支v2.0构建tflite,更新为链接到本地​​构建的lib,仍然得到相同的错误...

tensorflow tensorflow-lite tpu google-coral
1个回答
0
投票

想知道是否无法检测到tpu,可以尝试以下方法:

const auto& available_tpus = edgetpu::EdgeTpuManager::GetSingleton()->EnumerateEdgeTpu();
cout << available_tpus.size() << "\n"; // hopefully we'll see 1 here

然后创建上下文:

std::shared_ptr<edgetpu::EdgeTpuContext> edgetpu_context =
          edgetpu::EdgeTpuManager::GetSingleton()->OpenDevice(
            available_tpus[0].type, available_tpus[0].path);
© www.soinside.com 2019 - 2024. All rights reserved.