我正在学习皮特·沃顿( Pete )和丹尼尔·西图纳亚克( Daniel )的TinyML书,内容是如何将神经网络应用于微控制器,并为微控制器配备TFLite。他们严格遵循这个git回购末尾的指令。
为了尝试检查错误,他们建议在开发机器(即我的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
尽管它说“所有测试都通过了”,但由于错误,它没有进行构建;当更改源文件以引入一些错误(检查是否正常)时,它仍然打印该消息。
我试过寻找类似的问题,但都没有效果。以下是有关我的个人电脑的一些信息:
$make
和$gcc
都在路径中。如果您需要更多的信息,请告诉我,谢谢。
发布于 2020-08-20 02:36:00
我仍然必须在github上打开一个问题,因为我不认为这是预期的行为,但是这里有一个解决办法,允许您在开发机器上测试TF微代码。
第一步是进入您刚才克隆的git的根目录。然后,不要将test_
前缀添加到make上的目标中,只需将其作为“普通目标”:
$ 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在生成测试文件后执行测试文件时遇到了问题,所以解决方案是在不同的步骤中执行它。
请记住,您需要使版本3.82或更高版本才能起作用。如果您正在使用Windows。您可以使用Git控制台并通过巧克力味安装Make的最新版本。
https://stackoverflow.com/questions/63420827
复制相似问题