在Windows上从.pb转换为.tflite时出错

时间:2019-07-27 06:16:27

标签: python tensorflow tensorflow-lite

我有一个冻结的张量流对象检测模型frozen_inference_graph.pb,我需要将其转换为.tflite格式才能在Android应用中使用。

我正在使用https://codelabs.developers.google.com/codelabs/tensorflow-for-poets-2-tflite/#2此处建议的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

这是我得到的错误:

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

1 个答案:

答案 0 :(得分:0)

转换器可以更改输入和/或输出类型,但只能更改一侧:如果模型具有浮点输入张量,则可以创建带有量化(uint8)输入的tflite模型,反之亦然。从命令中删除create or replace function ReverseNo(no1 in number) return number Is n number:=no1; p number; c number:=0; begin while ( n>0) LOOP p:=mod(n,10); c:=c*10+p; n:=(n-p)/10; END LOOP; DBMS_OUTPUT.PUT_LINE('NO IS ' || c); return c; end; ,它应该可以工作。

相关问题