Tensorflow Lite:使用Toco转换时检查失败

时间:2019-03-06 15:40:03

标签: tensorflow tensorflow-lite

我正在尝试使用toco中的以下命令将冻结的推理模型转换为.tflite。

toco\
--graph_def_file=frozen_inference_graph.pb \
--input_format=TENSORFLOW_GRAPHDEF \
--output_format=TFLITE \
--output_file=/leaves.tflite \
--inference_type=FLOAT \
--input_type=FLOAT \
--input_arrays=ImageTensor \
--output_arrays=SemanticPredictions \
--input_shapes=1,513,513,3 \

但是我遇到了错误

RuntimeError: TOCO failed see console for info.
b'2019-03-06 15:28:46.912978: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1080] Converting unsupported operation: ResizeNearestNeighbor
2019-03-06 15:28:46.956622: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before Removing unused ops: 1790 operators, 2758 arrays (0 quantized)
2019-03-06 15:28:47.000274: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] After Removing unused ops pass 1: 1780 operators, 2739 arrays (0 quantized)
2019-03-06 15:28:47.059984: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before general graph transformations: 1780 operators, 2739 arrays (0 quantized)
2019-03-06 15:28:47.261502: F tensorflow/contrib/lite/toco/graph_transformations/propagate_fixed_sizes.cc:624] Check failed: input_shape.dims().size() == op->size.size() (4 vs. 3)\nAborted (core dumped)\n'
None

据我了解,“((4 vs. 3)”中的4是指我的input_shapes 1,513,513,3的4个维度。但是,没有人搜索似乎有相同的错误,因此我不确定是什么导致了这个问题。

有人能够识别问题并提供解决方案吗?谢谢。

1 个答案:

答案 0 :(得分:0)

“ toco”已被弃用。您可以按照https://www.tensorflow.org/lite/convert/cmdline_examples中的详细说明尝试“ tflite_convert”吗?