toco无法将.pb转换为.tflite

时间:2019-03-23 13:34:52

标签: tensorflow tensorflow-lite toco

我使用Linux的Windows子系统,因为我认为Windows尚不支持toco。

我遵循此[说明](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_on_mobile_tensorflowlite.md),因为我想将自定义对象检测api数据集转换为tflite,然后在此过程中发生错误

我按照链接中的指示进行了尝试 toco --output_file SSDV2frozentflite/aaaa.tflite --graph_def_file SSDV2frozentflite/tflite_graph.pb --input_shapes 1,300,300,3 --input_arrays normalized_input_image_tensor --output_arrays 'TFLite_Detection_PostProcess','TFLite_Detection_PostProcess:1','TFLite_Detection_PostProcess:2','TFLite_Detection_PostProcess:3' --inference_type QUANTIZED_UINT8 --mean_values 128 --std_dev_values 128 --change_concat_input_ranges FALSE --allow_custom_ops

我得到这个错误

Traceback (most recent call last):
  File "/home/inayano/.local/bin/toco", line 10, in <module>
    sys.exit(main())
  File "/home/inayano/.local/lib/python2.7/site-packages/tensorflow/contrib/lite/python/tflite_convert.py", line 412, in main
    app.run(main=run_main, argv=sys.argv[:1])
  File "/home/inayano/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "/home/inayano/.local/lib/python2.7/site-packages/tensorflow/contrib/lite/python/tflite_convert.py", line 408, in run_main
    _convert_model(tflite_flags)
  File "/home/inayano/.local/lib/python2.7/site-packages/tensorflow/contrib/lite/python/tflite_convert.py", line 162, in _convert_model
    output_data = converter.convert()
  File "/home/inayano/.local/lib/python2.7/site-packages/tensorflow/contrib/lite/python/lite.py", line 464, in convert
    **converter_kwargs)
  File "/home/inayano/.local/lib/python2.7/site-packages/tensorflow/contrib/lite/python/convert.py", line 311, in toco_convert_graph_def
    input_data.SerializeToString())
  File "/home/inayano/.local/lib/python2.7/site-packages/tensorflow/contrib/lite/python/convert.py", line 135, in toco_convert_protos
    (stdout, stderr))
RuntimeError: TOCO failed see console for info.
2019-03-23 21:07:18.633417: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1080] Converting unsupported operation: TFLite_Detection_PostProcess
2019-03-23 21:07:18.653654: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before Removing unused ops: 878 operators, 1282 arrays (0 quantized)
2019-03-23 21:07:18.683696: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before general graph transformations: 878 operators, 1282 arrays (0 quantized)
2019-03-23 21:07:18.731459: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] After general graph transformations pass 1: 100 operators, 262 arrays (1 quantized)
2019-03-23 21:07:18.733397: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before pre-quantization graph transformations: 100 operators, 262 arrays (1 quantized)
2019-03-23 21:07:18.734528: F tensorflow/contrib/lite/toco/tooling_util.cc:1634] Array FeatureExtractor/MobilenetV2/Conv/Relu6, which is an input to the DepthwiseConv operator producing the output array FeatureExtractor/MobilenetV2/expanded_conv/depthwise/Relu6, is lacking min/max data, which is necessary for quantization. If accuracy matters, either target a non-quantized output format, or run quantized training with your model from a floating point checkpoint to change the input graph to contain min/max information. If you don't care about accuracy, you can pass --default_ranges_min= and --default_ranges_max= for easy experimentation.
Aborted (core dumped)

None ```

0 个答案:

没有答案