我刚开始尝试Tensorflow,我想在Android上做一些实验,但是我读到Tensorflow for Poets(移动版)支持.tflite,而我下载并发现谷歌搜索的模型是.pb。>
所以我决定使用toco进行转换,但是当我执行转换命令时,总是会收到此错误
ValueError:发现无效的张量“输入”。
CLI命令为:
toco --graph_def_file=tensorflow_inception_graph.pb --output_file=optimized_graph.tflite --input_format=TENSORFLOW_GRAPHDEF --output_format=TFLITE --input_shape=1,300,300,3 --input_array=input --o
utput_array=final_result --inference_type=FLOAT --inference_input_type=FLOAT
那是怎么了?
Stacktrace
File "/home/Mitro/venv/bin/toco", line 11, in <module>
sys.exit(main())
File "/home/Mitro/venv/lib/python3.5/site-packages/tensorflow/contrib/lite/python/tflite_convert.py", line 401, in main
app.run(main=run_main, argv=sys.argv[:1])
File "/home/Mitro/venv/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "/home/Mitro/venv/lib/python3.5/site-packages/tensorflow/contrib/lite/python/tflite_convert.py", line 397, in run_main
_convert_model(tflite_flags)
File "/home/Mitro/venv/lib/python3.5/site-packages/tensorflow/contrib/lite/python/tflite_convert.py", line 100, in _convert_model
converter = _get_toco_converter(flags)
File "/home/Mitro/venv/lib/python3.5/site-packages/tensorflow/contrib/lite/python/tflite_convert.py", line 87, in _get_toco_converter
return converter_fn(**converter_kwargs)
File "/home/Mitro/venv/lib/python3.5/site-packages/tensorflow/contrib/lite/python/lite.py", line 271, in from_frozen_graph
sess.graph, input_arrays)
File "/home/Mitro/venv/lib/python3.5/site-packages/tensorflow/contrib/lite/python/convert_saved_model.py", line 189, in get_tensors_from_tensor_names
",".join(invalid_tensors)))