[英]Error while converting from .pb to .tflite on windows
I have a frozen tensorflow object detection model frozen_inference_graph.pb
and I need to convert it in .tflite
format to use it in an android app.我有一个冻结的 tensorflow 对象检测模型frozen_inference_graph.pb
,我需要将它转换为.tflite
格式以在 android 应用程序中使用它。
I am using tflite_convert
as suggested here, https://codelabs.developers.google.com/codelabs/tensorflow-for-poets-2-tflite/#2我按照这里的建议使用tflite_convert
, https: tflite_convert
tflite_convert
--graph_def_file=frozen_inference_graph.pb
--output_file=new_graph.tflite
--input_format=TENSORFLOW_GRAPHDEF
--output_format=TFLITE
--input_shape=1,224,224,3
--input_array=image_tensor
--output_array=detection_boxes,detection_scores,detection_classes,num_detections
--inference_type=FLOAT
--input_data_type=FLOAT
This is the error that I'm getting:这是我得到的错误:
Check failed: array.data_type == array.final_data_type Array "image_tensor"
has mis-matching actual and final data types (data_type=uint8, final_data_type=float).
Fatal Python error: Aborted
Edit: I read the tflite docs and it was mentioned that, only models frozen using freeze.py
can be converted using tflite_convert
.编辑:我读了tflite文档和它被提及,仅使用冻结款freeze.py
可以使用转换tflite_convert
。 But I used export_inference_graph.py
to get frozen_inference_graph.pb
.但我使用export_inference_graph.py
来获取frozen_inference_graph.pb
。 Is there any other way to convert an object detection model to tflite
.有没有其他方法可以将对象检测模型转换为tflite
。 I am using the model ssd_mobilenet_v1_coco_11_06_2017
.我正在使用模型ssd_mobilenet_v1_coco_11_06_2017
。
The convertor can change input and/or output types, but only one side: if the model has float input tensor, you can create a tflite model with quantized (uint8) input
, but not vice versa.转换器可以更改输入和/或输出类型,但只有一方面:如果模型具有浮点输入张量,则可以创建具有quantized (uint8) input
的 tflite 模型,但反之则不然。
Remove --input_data_type=FLOAT
from your command, and it should work.从您的命令中删除--input_data_type=FLOAT
,它应该可以工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.