Generates a 0 kb .tflite file while using tensorflow-lite

Viewed 333

I have followed this website to get a customized object classifier. From this, I got the frozen inference graph, saved model, checkpoints and all the necessary data. Now I want to generate a .tflite file from this model to deploy it in android studio. For this I followed this website and used the code below. This gave me a detect.tflite file with no errors. But the file is empty (0kb). I also tried the same code using the sample frozen graphs provided by the website. But the result was same. Is it because I am using windows 10 instead of Ubuntu ?

I also tried toco build and tflite_convert, but nothing works. Also can I use a CPU to create a .tflite file from a tensorflow model which is trained using GPU ?

bazel run -c opt tensorflow/lite/toco:toco -- --input_file=C:/tensorflow1/models/research/object_detection/sample_tflite_graph.pb --output_file=C:/tensorflow1/models/research/object_detection/sample_detect.tflite --input_shapes=1,300,300,3 --input_arrays=normalized_input_image_tensor --output_arrays='TFLite_Detection_PostProcess','TFLite_Detection_PostProcess:1','TFLite_Detection_PostProcess:2','TFLite_Detection_PostProcess:3' --inference_type=QUANTIZED_UINT8 --mean_values=128 --std_values=128 --change_concat_input_ranges=false --default_ranges_min=0 --default_ranges_max=6 --allow_custom_ops

(tensorflow1) C:\Users\devim\OneDrive\Documents\GitHub\tensorflow>bazel run tensorflow/lite/toco:toco -- --input_file=C:/tensorflow1/models/research/object_detection/sample_tflite_graph.pb --output_file=C:/tensorflow1/models/research/object_detection/sample_detect.tflite --input_shapes=1,300,300,3 --input_arrays=normalized_input_image_tensor --output_arrays='TFLite_Detection_PostProcess','TFLite_Detection_PostProcess:1','TFLite_Detection_PostProcess:2','TFLite_Detection_PostProcess:3' --inference_type=QUANTIZED_UINT8 --mean_values=128 --std_values=128 --change_concat_input_ranges=false --default_ranges_min=0 --default_ranges_max=6 --allow_custom_ops DEBUG: C:/users/devim/_bazel_devim/l7g3ilsc/external/build_bazel_rules_apple/apple/repositories.bzl:35:5: WARNING: build_bazel_rules_apple depends on bazel_skylib loaded from https://github.com/bazelbuild/bazel-skylib.git (tag 0.6.0), but we have detected it already loaded into your workspace from None (tag None). You may run into compatibility issues. To silence this warning, pass ignore_version_differences = True to apple_rules_dependencies().

INFO: Analysed target //tensorflow/lite/toco:toco (0 packages loaded, 0 targets configured). INFO: Found 1 target... Target //tensorflow/lite/toco:toco up-to-date:
C:/users/devim/_bazel_devim/l7g3ilsc/execroot/org_tensorflow/bazel-out/x64_windows-opt/bin/tensorflow/lite/toco/toco.exe INFO: Elapsed time: 8.960s, Critical Path: 0.02s INFO: 0 processes. INFO: Build completed successfully, 1 total action INFO: Running command line: C:/users/devim/_bazel_devim/l7g3ilsc/execroot/org_tensorflow/bazel-out/x64_windows-opt/bin/tensorflow/lite/toco/toco.exe '--input_file=C:/tensorflow1/models/research/object_detection/sample_tflite_graph.pb' '--output_file=C:/tensorflow1/models/research/object_detection/sample_detect.tflite' '--input_shapes=1,300,300,3' '--input_arrays=normalized_input_image_tensor' '--output_arrays='\''TFLite_Detection_PostProcess'\'','\''TFLite_Detection_PostProcess:1'\'','\''TFLite_Detection_PostProcess:2'\'','\''TFLite_Detection_PostProcess:3'\''' '--inference_type=QUANTIZED_UINT8' '--mean_values=128' '--std_values=128' '--change_concat_input_ranges=false' '--defaulINFO: Build completed successfully, 1 total action 2019-06-24 12:50:15.427241: I tensorflow/lite/toco/import_tensorflow.cc:1335] Converting unsupported operation: TFLite_Detection_PostProcess 2019-06-24 12:50:15.444580: I tensorflow/lite/toco/import_tensorflow.cc:1384] Unable to determine output type for op: TFLite_Detection_PostProcess 2019-06-24 12:50:15.505002: F tensorflow/lite/toco/tooling_util.cc:912] Check failed: GetOpWithOutput(model, output_array) Specified output array "'TFLite_Detection_PostProcess'" is not produced by any op in this graph. Is it a typo? To silence this message, pass this flag: allow_nonexistent_arrays

0 Answers
Related