我们正在尝试使用deeplabv3和mobilenetv2在android上运行语义分割模型,并在bazel的帮助下使用TOCO和tflite_convert遵循了官方的tensorflow lite转换过程。
我们能够使用以下命令成功转换模型:
CUDA_VISIBLE_DEVICES =“ 0” toco --output_file = toco256.tflite --graph_def_file = path / to / deeplab / deeplabv3_mnv2_pascal_trainval / frozen_inference_graph.pb --input_arrays = ImageTensor --output_arrays = SemanticPredictions --Input_shape,= 3,mn_2 --inference_type = FLOAT-平均值= 128 --std_dev_values = 127 --allow_custom_ops --post_training_quantize
tflite文件的大小约为2.25 Mb,但是当我们尝试使用官方基准工具测试模型时,它失败并显示以下错误报告:-
bazel run -c opt tensorflow/contrib/lite/tools/benchmark:benchmark_model -- --graph=`realpath toco256.tflite`
INFO: Analysed target //tensorflow/contrib/lite/tools/benchmark:benchmark_model (0 packages loaded).
INFO: Found 1 target...
Target //tensorflow/contrib/lite/tools/benchmark:benchmark_model up-to-date:
bazel-bin/tensorflow/contrib/lite/tools/benchmark/benchmark_model
INFO: Elapsed time: 0.154s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action …Run Code Online (Sandbox Code Playgroud)