【问题标题】:Building TF micro hello world: make: *** [tensorflow/lite/micro/examples/hello_world/Makefile.inc:34: test_hello_world_test] Error 1构建 TF micro hello world: make: *** [tensorflow/lite/micro/examples/hello_world/Makefile.inc:34: test_hello_world_test] 错误 1
【发布时间】:2020-08-14 22:42:24
【问题描述】:

我正在关注 Pete Warden 和 Daniel Situnayake 所著的 TinyML 书籍,其中介绍了如何使用 TFLite 将神经网络部署到微控制器。他们严格按照this git repo 末尾的说明进行操作。

为了尝试检查错误,他们建议在开发机器(即我的 PC)上测试代码,但是在运行“make”时我遇到了一些错误并且无法构建。

跑步时 $ git clone --depth 1 https://github.com/tensorflow/tensorflow.git 然后$ make -f tensorflow/lite/micro/tools/make/Makefile test_hello_world_test 我得到以下输出:

$ make -f tensorflow/lite/micro/tools/make/Makefile test_hello_world_test
tensorflow/lite/micro/tools/make/Makefile:305: warning: overriding recipe for target 'tensorflow/lite/micro/tools/make/downloads/ruy'
tensorflow/lite/micro/tools/make/Makefile:305: warning: ignoring old recipe for target 'tensorflow/lite/micro/tools/make/downloads/ruy'
tensorflow/lite/micro/tools/make/Makefile:305: warning: overriding recipe for target 'tensorflow/lite/micro/tools/make/downloads/person_model_grayscale'
tensorflow/lite/micro/tools/make/Makefile:305: warning: ignoring old recipe for target 'tensorflow/lite/micro/tools/make/downloads/person_model_grayscale'
tensorflow/lite/micro/tools/make/Makefile:305: warning: overriding recipe for target 'tensorflow/lite/micro/tools/make/downloads/person_model_int8'
tensorflow/lite/micro/tools/make/Makefile:305: warning: ignoring old recipe for target 'tensorflow/lite/micro/tools/make/downloads/person_model_int8'
g++ -std=c++11 -DTF_LITE_STATIC_MEMORY -Werror -Wsign-compare -Wdouble-promotion -Wshadow -Wunused-variable -Wmissing-field-initializers -Wunused-function -DNDEBUG -O3 -I. -Itensorflow/lite/micro/tools/make/downloads/ -Itensorflow/lite/micro/tools/make/downloads/gemmlowp -Itensorflow/lite/micro/tools/make/downloads/flatbuffers/include -Itensorflow/lite/micro/tools/make/downloads/ruy -Itensorflow/lite/micro/tools/make/downloads/kissfft -o tensorflow/lite/micro/tools/make/gen/windows_x86_64/bin/hello_world_test tensorflow/lite/micro/tools/make/gen/windows_x86_64/obj/tensorflow/lite/micro/examples/hello_world/hello_world_test.o tensorflow/lite/micro/tools/make/gen/windows_x86_64/obj/tensorflow/lite/micro/examples/hello_world/model.o  tensorflow/lite/micro/tools/make/gen/windows_x86_64/lib/libtensorflow-microlite.a  -lm
tensorflow/lite/micro/testing/test_linux_binary.sh tensorflow/lite/micro/tools/make/gen/windows_x86_64/bin/hello_world_test '~~~ALL TESTS PASSED~~~'
make: *** [tensorflow/lite/micro/examples/hello_world/Makefile.inc:34: test_hello_world_test] Error 1

虽然它说“所有测试都通过了”,但由于错误,它没有构建;当更改源文件以引入一些错误(检查一切是否正常)时,它仍然会打印该消息。

我尝试寻找类似的问题,但没有任何效果。以下是关于我的电脑的一些信息:

  • Windows 10 家庭版 64 位
  • GNU Make 4.3
  • gcc.exe (Rev5, Built by MSYS2 project) 5.3.0
  • Conda 已安装
  • 控制台:Git Bash (MINGW64)
  • $make$gcc 都在 PATH 中

如果您需要更多信息,请告诉我,谢谢。

【问题讨论】:

  • 看起来https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/testing/test_linux_binary.sh 中的某些内容以错误终止而没有消息。我会向它添加调试打印,看看它什么时候开始繁荣。
  • 注意~~~ALL TESTS PASSED~~~a regular expression that's required to be in the output logs。该字符串在测试日志中被 grep,以查看是否所有测试都通过了。对于任何阅读本文的人:不要那样做。
  • 我添加了一些调试打印,但我仍然得到相同的输出。由于先前的错误,我认为程序无法运行。我也将 gcc 更新到 8.2.0,但没有任何变化。
  • 可能是张量流“管理”以某种方式输出错误。我会在github.com/tensorflow/tensorflow/issues 上打开一个问题
  • 我一定会的;我找到了一些解决方法,但并不完全。甚至在 Ubuntu 上尝试过并遇到了类似的问题。当(如果)问题得到解决时,我会发布答案。谢谢。

标签: c++ tensorflow makefile gnu-make tensorflow-lite


【解决方案1】:

我仍然需要在 github 上打开一个问题,因为我认为这不是预期的行为,但这里有一个解决方法,可让您在开发机器上测试 TF 微代码。

第一步是前往你刚刚克隆的 git repo 的根目录。然后,不要在 make 上将 test_ 前缀添加到目标,只需将其“制作”为“普通目标”:

$ make -f tensorflow/lite/micro/tools/make/Makefile hello_world_test

根据您运行的操作系统,可执行文件(输出)将位于不同的路径中,但只需将 windows_x86_64 更改为您相应的文件夹即可。现在是时候运行输出了:

$ tensorflow/lite/micro/tools/make/gen/windows_x86_64/bin/hello_world_test.exe

正如预期的那样返回:

Testing LoadModelAndPerformInference
1/1 tests passed
~~~ALL TESTS PASSED~~~

我已经用不同的组合和项目对其进行了测试,效果很好。似乎 Make 在生成测试文件后无法执行它,因此解决方案是分步执行。

请记住,您需要 Make 版本 3.82 或更高版本才能正常工作。如果您使用的是 Windows。您可以使用 Git Bash 控制台并通过 chocolatey 安装最新版本的 Make。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-03
    • 2014-12-23
    • 2018-08-18
    • 2020-06-12
    • 1970-01-01
    • 2018-09-21
    相关资源
    最近更新 更多