首页 > 解决方案 > 使用 toco 命令将 .tflite 转换为 .pb 抛出错误“TENSORFLOW_GRAPHDEF”(从“TFLITE”、“GRAPHVIZ_DOT”中选择)

问题描述

我尝试使用现有帖子将 .tflite 转换为 .pb中提到的命令将 tflite 转换为 pb,但它的抛出错误。

使用的命令:

toco --output_file=/smartreply.pb --output_format=TENSORFLOW_GRAPHDEF --input_format=TFLITE --input_file=/smartreply.tflite --inference_type=FLOAT --input_type=FLOAT --input_array="" --output_array="" --input_shape=1,450,450,3 --dump_grapHviz=./

错误:

usage: toco [-h] --output_file OUTPUT_FILE
            (--graph_def_file GRAPH_DEF_FILE | --saved_model_dir SAVED_MODEL_DIR | --keras_model_file KERAS_MODEL_FILE)
            [--output_format {TFLITE,GRAPHVIZ_DOT}]
            [--inference_type {FLOAT,QUANTIZED_UINT8}]
            [--inference_input_type {FLOAT,QUANTIZED_UINT8}]
            [--input_arrays INPUT_ARRAYS] [--input_shapes INPUT_SHAPES]
            [--output_arrays OUTPUT_ARRAYS]
            [--saved_model_tag_set SAVED_MODEL_TAG_SET]
            [--saved_model_signature_key SAVED_MODEL_SIGNATURE_KEY]
            [--std_dev_values STD_DEV_VALUES] [--mean_values MEAN_VALUES]
            [--default_ranges_min DEFAULT_RANGES_MIN]
            [--default_ranges_max DEFAULT_RANGES_MAX]
            [--post_training_quantize] [--drop_control_dependency]
            [--reorder_across_fake_quant]
            [--change_concat_input_ranges {TRUE,FALSE}] [--allow_custom_ops]
            [--converter_mode {DEFAULT,TOCO_FLEX,TOCO_FLEX_ALL}]
            [--dump_graphviz_dir DUMP_GRAPHVIZ_DIR] [--dump_graphviz_video]
toco: error: argument --output_format: invalid choice: 'TENSORFLOW_GRAPHDEF' (choose from 'TFLITE', 'GRAPHVIZ_DOT')

标签: tensorflowtensorflow2.0tensorflow-lite

解决方案


目前您无法将 tflite 文件转换回 .pb


推荐阅读