Error when I convert the frozen_pb file to tflite

2019-04-16 17:18发布

I use the mobileNet pre-trained model for object-detection.I have owned frozen_graph file, and I use tool to know the input_arrays and output_arrays.This is my command:

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

While I run the commend, the following message appear:

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

the final error is:

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

I really don't know what the error mean, can you give me a help? thanks:)

1条回答
Luminary・发光体
2楼-- · 2019-04-16 17:48

The simple answer is the TFLite doesn't support all TF operations yet. They're being worked on, but that's why you see all the 'unsupported operation' errors.

If you really want your model to work on mobile while awaiting them to be supported on TFLite, check out TensorFlow Mobile, which is a different platform: https://www.tensorflow.org/mobile/

查看更多
登录 后发表回答