我有一个 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,"
,因为我的解释是你不希望批量大小/通道暗淡的平均值,但文档说它需要一个输入,列表中的每个输入都应该匹配 input_arrays 中的一个元素。
我也不确定要为input_arrays
arg 放置什么,因为我看到的大多数代码示例都只是使用input
,但对我来说,您似乎需要图中节点的名称。
我想我在这里误解了一些东西,但我似乎无法弄清楚。任何帮助,将不胜感激!