0

我使用 mobileNet 预训练模型进行对象检测。我拥有 freeze_graph 文件,并使用工具了解 input_arrays 和 output_arrays。这是我的命令:

bazel-bin/tensorflow/contrib/lite/toco/toco \
  --input_file=$(pwd)/mobilenet_v1_1.0_224/frozen_graph.pb \
  --input_format=TENSORFLOW_GRAPHDEF  --output_format=TFLITE \
  --output_file=/tmp/mobilenet_v1_1.0_224.tflite --inference_type=FLOAT \
  --input_type=FLOAT --input_arrays=image_tensor \
  --output_arrays=detection_boxes,detection_scores,detection_classes,num_detections  --input_shapes=1,224,224,3

当我运行推荐时,会出现以下消息:

2018-02-16 19:44:08.718034: W 
tensorflow/contrib/lite/toco/toco_cmdline_flags.cc:178] --input_type 
is deprecated. It was an ambiguous flag that set both --
input_data_types and --inference_input_type. If you are trying to 
complement the input file with information about the type of input 
arrays, use --input_data_type. If you are trying to control the 
quantization/dequantization of real-numbers input arrays in the 
output file, use --inference_input_type.
2018-02-16 19:44:08.856935: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayV3
2018-02-16 19:44:08.857029: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayScatterV3
2018-02-16 19:44:08.857055: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayV3
2018-02-16 19:44:08.857079: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.857099: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.857143: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.857162: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: LoopCond
2018-02-16 19:44:08.857238: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayReadV3
2018-02-16 19:44:08.857269: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.857287: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.857339: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayWriteV3
2018-02-16 19:44:08.857357: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.857388: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Exit
2018-02-16 19:44:08.857400: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArraySizeV3
2018-02-16 19:44:08.857428: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayGatherV3
2018-02-16 19:44:08.857524: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: LogicalAnd
2018-02-16 19:44:08.897050: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Equal
2018-02-16 19:44:08.898806: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] 
Convertingunsupported operation: Equal
2018-02-16 19:44:08.899023: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Unpack
2018-02-16 19:44:08.899129: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Unpack
2018-02-16 19:44:08.899194: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Exp
2018-02-16 19:44:08.899218: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Exp
2018-02-16 19:44:08.899485: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayV3
2018-02-16 19:44:08.899511: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayV3
2018-02-16 19:44:08.899529: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayV3
2018-02-16 19:44:08.899632: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayScatterV3
2018-02-16 19:44:08.899726: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayScatterV3
2018-02-16 19:44:08.899831: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayScatterV3
2018-02-16 19:44:08.899864: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayV3
2018-02-16 19:44:08.899883: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayV3
2018-02-16 19:44:08.899932: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayV3
2018-02-16 19:44:08.899969: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayV3
2018-02-16 19:44:08.899997: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.900021: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.900044: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.900084: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.900105: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.900195: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.900216: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: LoopCond
2018-02-16 19:44:08.900276: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayReadV3
2018-02-16 19:44:08.900296: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.900313: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.900327: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayReadV3
2018-02-16 19:44:08.900342: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.900354: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.900371: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayReadV3
2018-02-16 19:44:08.900388: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.900405: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.900548: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Equal
2018-02-16 19:44:08.900577: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Unpack
2018-02-16 19:44:08.900660: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Where
2018-02-16 19:44:08.900746: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Unpack
2018-02-16 19:44:08.900786: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.900903: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Where
2018-02-16 19:44:08.901007: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting  
unsupported operation: NonMaxSuppressionV2
2018-02-16 19:44:08.901039: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: ZerosLike
2018-02-16 19:44:08.901120: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Where
2018-02-16 19:44:08.901214: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Unpack
2018-02-16 19:44:08.901336: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Where
2018-02-16 19:44:08.901447: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: NonMaxSuppressionV2
2018-02-16 19:44:08.901485: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: ZerosLike
2018-02-16 19:44:08.901568: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Where
2018-02-16 19:44:08.901651: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Unpack
2018-02-16 19:44:08.901780: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Where
2018-02-16 19:44:08.901891: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: NonMaxSuppressionV2
2018-02-16 19:44:08.901926: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: ZerosLike
2018-02-16 19:44:08.902033: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Size
2018-02-16 19:44:08.902053: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Equal
2018-02-16 19:44:08.902096: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TopKV2
2018-02-16 19:44:08.902883: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayWriteV3
2018-02-16 19:44:08.902909: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.902936: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayWriteV3
2018-02-16 19:44:08.902960: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.902989: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayWriteV3
2018-02-16 19:44:08.903013: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.903037: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayWriteV3
2018-02-16 19:44:08.903061: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Enter
2018-02-16 19:44:08.903117: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Exit
2018-02-16 19:44:08.903135: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Exit
2018-02-16 19:44:08.903150: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Exit
2018-02-16 19:44:08.903165: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: Exit
2018-02-16 19:44:08.903187: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArraySizeV3
2018-02-16 19:44:08.903235: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayGatherV3
2018-02-16 19:44:08.903286: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArraySizeV3
2018-02-16 19:44:08.903352: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayGatherV3
2018-02-16 19:44:08.903400: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArraySizeV3
2018-02-16 19:44:08.903442: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayGatherV3
2018-02-16 19:44:08.903486: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArraySizeV3
2018-02-16 19:44:08.903547: I 
tensorflow/contrib/lite/toco/import_tensorflow.cc:1170] Converting 
unsupported operation: TensorArrayGatherV3
2018-02-16 19:44:08.932207: F 
tensorflow/contrib/lite/toco/tooling_util.cc:748] Check failed: d >= 
1 (0 vs. 1)
Abort trap: 6

最后的错误是:

Check failed: d >= 1 (0 vs. 1)
Abort trap: 6

我真的不知道错误是什么意思,你能帮我吗?谢谢:)

4

2 回答 2

0

简单的答案是 TFLite 还不支持所有的 TF 操作。他们正在处理中,但这就是为什么您会看到所有“不支持的操作”错误。

如果您真的希望您的模型在等待 TFLite 支持的同时在移动设备上工作,请查看 TensorFlow Mobile,这是一个不同的平台:https ://www.tensorflow.org/mobile/

于 2018-03-13T04:01:43.860 回答
0

由于不支持的操作,转换失败。TensorFlow Lite 仅支持可见的操作子集:https ://www.tensorflow.org/lite/guide/ops_compatibility

无论如何,您可以编写一个自定义操作来使其工作: https ://www.tensorflow.org/lite/guide/ops_custom

于 2019-05-04T19:44:05.077 回答