繁体   English   中英

尝试使用toco转换TF模型时出错

[英]Error when attempting to convert TF model using toco

我有一个TF模型,需要将其转换为int8才能在嵌入式设备中实现。 我正在尝试使用toco进行转换,但是我无法确定如何正确地使用输入args实例化toco:

<USER>:~/.local/bin$ python3 toco \
>   --input_file=<PATH>/frozen_graph.pb \
>   --output_file=<PATH>/tflite_graph.tflite \
>   --input_format=TENSORFLOW_GRAPHDEF \
>   --output_format=TFLITE \
>   --inference_type=QUANTIZED_UINT8 \
>   --output_arrays=Sidmoid \
>   --input_arrays=IteratorGetNext \
>   --input_shapes=1:16:16:1 \
>   --mean_values=128 \
>   --std_values=127
WARNING:tensorflow:From <USER>.local/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Use the retry module or similar alternatives.
2018-04-27 11:40:33.699249: F tensorflow/contrib/lite/toco/model_cmdline_flags.cc:240] Check failed: mean_values.size() == model_flags->input_arrays_size() 
Aborted (core dumped)

我知道mean_values输入arg存在问题,但是我不了解以下用途:

--mean_values="" string mean_values parameter for image models, comma-separated list of doubles, used to compute input activations from input pixel data. Each entry in the list should match an entry in --input_arrays.

我也尝试过",128,128," ,因为我的解释是您不希望批次大小/通道",128,128,"的平均值,但是文档说,列表中的每个输入都需要一个输入来匹配一个元素在input_arrays中。

我也不确定为input_arrays arg放置什么,因为我在大多数地方看到的代码示例仅使用input但对我来说似乎您需要图形中节点的名称。

我想我对这里有些误解,但我似乎无法弄清楚。 任何帮助,将不胜感激!

对于任何想知道的人,是文档使我有些困惑:它说“ Input_shapes”是“对应于--input_arrays的形状的形状,用冒号分隔的字符串...”,但是尺寸仍应用逗号分隔:

bazel-bin/third_party/tensorflow/contrib/lite/toco/toco \
  --input_file=<my_path>/frozen_eval_graph.pb \
  --output_file=<my_path>/tflite_graph.tflite \
  --input_format=TENSORFLOW_GRAPHDEF \
  --output_format=TFLITE \
  --inference_type=QUANTIZED_UINT8 \
  --output_arrays=Sigmoid \
  --input_arrays=Reshape \
  --input_shapes=1,16,16,1 \
  --mean_values=128 \
  --std_values=127 \
  --variable_batch=true

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM