首先,我从Mobilenet下载了一个量化模型。它包含在Mobilenet\u v1\u 1.0\u 224中。然后我做了以下事情
bazel-bin/tensorflow/contrib/lite/toco/toco \
> --input_files=Sample/mobilenet_v1_1.0_224/quantized_graph.pb \
> --input_format=TENSORFLOW_GRAPHDEF --output_format=TFLITE \
> --output_file=Sample/mobilenet_v1_1.0_224/quantized_graph.tflite --inference_type=QUANTIZED_UINT8 \
> --input_shape=1,224,224,3 \
> --input_array=input \
> --output_array=MobilenetV1/Predictions/Reshape_1 \
> --mean_value=128 \
> --std_value=127
以下是图表摘要
bazel-bin/tensorflow/tools/graph_transforms/summarize_graph
Found 1 possible inputs: (name=input, type=float(1), shape=[1,224,224,3])
No variables spotted.
Found 1 possible outputs: (name=MobilenetV1/Predictions/Reshape_1, op=Reshape)
Found 4227041 (4.23M) const parameters, 0 (0) variable parameters, and 0 control_edges
Op types used: 91 Const, 27 Add, 27 Relu6, 15 Conv2D, 13 DepthwiseConv2dNative, 13 Mul, 10 Dequantize, 2 Reshape, 1 Identity, 1 Placeholder, 1 BiasAdd, 1 AvgPool, 1 Softmax, 1 Squeeze
To use with tensorflow/tools/benchmark:benchmark_model try these arguments:
bazel run tensorflow/tools/benchmark:benchmark_model
因此,通过进行转换,我遇到了以下错误
2018-03-01 23:12:03.353786:I
tensorflow/contrib/lite/toco/import\u tensorflow。抄送:1172]
不支持的操作:反量化2018-03-01 23:12:03.354513:I
tensorflow/contrib/lite/toco/import\u tensorflow。抄送:1172]
不支持的操作:反量化2018-03-01 23:12:03.355177:I
tensorflow/contrib/lite/toco/import\u tensorflow。抄送:1172]
不支持的操作:反量化2018-03-01 23:12:03.355556:I
tensorflow/contrib/lite/toco/import\u tensorflow。抄送:1172]
不支持的操作:反量化2018-03-01 23:12:03.355921:I
tensorflow/contrib/lite/toco/import\u tensorflow。抄送:1172]
不支持的操作:反量化2018-03-01 23:12:03.356281:I
tensorflow/contrib/lite/toco/import\u tensorflow。抄送:1172]
不支持的操作:反量化2018-03-01 23:12:03.356632:I
tensorflow/contrib/lite/toco/import\u tensorflow。抄送:1172]
不支持的操作:反量化2018-03-01 23:12:03.357540:I
tensorflow/contrib/lite/toco/import\u tensorflow。抄送:1172]
不支持的操作:反量化2018-03-01 23:12:03.358776:I
tensorflow/contrib/lite/toco/import\u tensorflow。抄送:1172]
不支持的操作:反量化2018-03-01 23:12:03.360448:I
tensorflow/contrib/lite/toco/import\u tensorflow。抄送:1172]
不支持的操作:反量化2018-03-01 23:12:03.366319:I
tensorflow/contrib/lite/toco/graph\u转换/graph\u转换。抄送:39]
删除未使用的操作前:140个操作员,232个阵列(0量化)
2018-03-01 23:12:03.371405:I
tensorflow/contrib/lite/toco/graph\u转换/graph\u转换。抄送:39]
常规图形转换之前:140个运算符,232个数组(0
量化)2018-03-01 23:12:03.374916:I
tensorflow/contrib/lite/toco/graph\u转换/graph\u转换。抄送:39]
一般图变换后通过1:63个运算符,152个数组
(1量化)2018-03-01 23:12:03.376325:I
tensorflow/contrib/lite/toco/graph\u转换/graph\u转换。抄送:39]
预量化图变换之前:63个操作符,152个
阵列(1量化)2018-03-01 23:12:03.377492:F
tensorflow/contrib/lite/toco/tooling\u util。抄送:1272]阵列
MobilenetV1/MobilenetV1/Conv2d\u 0/Relu6,它是
产生输出数组的DepthwiseConv运算符
MobilenetV1/MobilenetV1/Conv2d\u 1\u depthwise/Relu6缺少最小值/最大值
量化所需的数据。任一目标a
非量化输出格式,或将输入图形更改为包含
最小/最大信息,或通过--默认值\u ranges\u min=和
--default\u ranges\u max=如果您不关心结果的准确性。
谢谢你的帮助