【发布时间】:2018-09-10 10:22:31
【问题描述】:
我已经训练了一个检测模型,当嵌入到 tensorflow 示例应用程序中时效果很好。
在使用export_tflite_ssd_graph 冻结并使用 toco 转换为 tflite 后,结果确实表现相当糟糕并且“种类繁多”。
阅读this 回答的类似问题的准确性损失我想在 tensorflow docker 机器上尝试 tflite_diff_example_test。
由于文档现在还没有那么完善,我构建了引用 this SO Post 的工具
使用:
bazel build tensorflow/contrib/lite/testing/tflite_diff_example_test.cc 运行流畅。
在弄清楚我需要的所有输入参数后,我使用以下命令尝试了测试脚本:
~/.cache/bazel/_bazel_root/68a62076e91007a7908bc42a32e4cff9/external/bazel_tools/tools/test/test-setup.sh tensorflow/contrib/lite/testing/tflite_diff_example_test '--tensorflow_model=/tensorflow/shared/exported/tflite_graph.pb' '--tflite_model=/tensorflow/shared/exported/detect.tflite' '--input_layer=a,b,c,d' '--input_layer_type=float,float,float,float' '--input_layer_shape=1,3,4,3:1,3,4,3:1,3,4,3:1,3,4,3' '--output_layer=x,y'
和
bazel-bin/tensorflow/contrib/lite/testing/tflite_diff_example_test --tensorflow_model="/tensorflow/shared/exported/tflite_graph.pb" --tflite_model="/tensorflow/shared/exported/detect.tflite" --input_layer=a,b,c,d --input_layer_type=float,float,float,float --input_layer_shape=1,3,4,3:1,3,4,3:1,3,4,3:1,3,4,3 --output_layer=x,y
两种方式都失败了。错误:
方式:
tflite_diff_example_test.cc:line 1: /bazel: Is a directory tflite_diff_example_test.cc: line 3: syntax error near unexpected token '(' tflite_diff_example_test.cc: line 3: 'Licensed under the Apache License, Version 2.0 (the "License");' /root/.cache/bazel/_bazel_root/68a62076e91007a7908bc42a32e4cff9/external/bazel_tools/tools/test/test-setup.sh: line 184: /tensorflow/: Is a directory /root/.cache/bazel/_bazel_root/68a62076e91007a7908bc42a32e4cff9/external/bazel_tools/tools/test/test-setup.sh: line 276: /tensorflow/: Is a directory-
方式:
2018-09-10 09:34:27.650473: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA Failed to create session. Op type not registered 'TFLite_Detection_PostProcess' in binary running on d36de5b65187. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.)tf.contrib.resamplershould be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.
非常感谢任何帮助,使我能够使用给定测试的张量流比较两个图的输出。
【问题讨论】:
标签: tensorflow bazel tensorflow-lite