为 Edge TPU 构建 Tensorflow Lite 失败

Building Tensorflow Lite for Edge TPU fails

我正在尝试使用 C++ 在 ARM 上获取 Tensorflow Lite + EdgeTpu 运行,但在使用 EdgeTpu 文档中的指定提交构建 Tensorflow Lite 时遇到问题。 (我有 Tensorflow Lite 正在研究最新的 Tensorflow 大师)。

根据 EdgeTpu 文档 (https://coral.ai/docs/edgetpu/tflite-cpp),需要使用提交构建 tensorflow lite:d855adfc5a0195788bf5f92c3c7352e638aa1109。但是在使用这些命令构建时:

./tensorflow/lite/tools/make/download_dependencies.sh
./tensorflow/lite/tools/make/build_aarch64_lib.sh

我收到这些错误消息:

tensorflow/tensorflow/lite/tools/make/gen/aarch64_armv8-a/lib/libtensorflow-lite.a(densify.o): In function `tflite::ops::builtin::densify::Eval(TfLiteContext*, TfLiteNode*)':
densify.cc:(.text+0x378): undefined reference to `tflite::optimize::sparsity::FormatConverter<signed char>::FormatConverter(std::vector<int, std::allocator<int> > const&, TfLiteSparsity const&)'
densify.cc:(.text+0x384): undefined reference to `tflite::optimize::sparsity::FormatConverter<signed char>::SparseToDense(signed char const*)'
densify.cc:(.text+0x5f0): undefined reference to `tflite::optimize::sparsity::FormatConverter<float>::FormatConverter(std::vector<int, std::allocator<int> > const&, TfLiteSparsity const&)'
densify.cc:(.text+0x5fc): undefined reference to `tflite::optimize::sparsity::FormatConverter<float>::SparseToDense(float const*)'
collect2: error: ld returned 1 exit status

所以它确实构建了 lib 文件,但是构建示例失败了。当我尝试将 lib 与我自己的代码一起使用时,我遇到了同样的错误。这些问题似乎同时在 tensorflow repo 上得到了解决。但是我需要使用 EdgeTpu 的特定提交。

得到了 github 个问题的答案。放在这里供以后参考。

原来指定的提交在 MAKEFILE 中缺少文件。应用此补丁:https://github.com/google-coral/edgetpu/issues/201 构建工作正常。