Tensorflow lite 将保存的模型转换为tflite-';图像张量';具有无效的形状';[无,无,无,3]'; 正在尝试将保存的模型转换为tflite。

Tensorflow lite 将保存的模型转换为tflite-';图像张量';具有无效的形状';[无,无,无,3]'; 正在尝试将保存的模型转换为tflite。,tensorflow-lite,Tensorflow Lite,型号名称:ssd_mobilenet_v1_ppn_coco 我已尝试使用以下命令将模型转换为tflite pb: $tflite_convert --output_file=/tmp/dec.tflite --saved_model_dir=/ppn/saved_model/ 出现以下错误: ValueError:仅在第1维度中支持无。张量“image_Tensor”的形状“[None,None,None,3]”无效 为了获得关于模型的更多信息,我使用bazel从源代码构建了te

型号名称:ssd_mobilenet_v1_ppn_coco

我已尝试使用以下命令将模型转换为tflite pb:

$tflite_convert   --output_file=/tmp/dec.tflite  
 --saved_model_dir=/ppn/saved_model/
出现以下错误: ValueError:仅在第1维度中支持无。张量“image_Tensor”的形状“[None,None,None,3]”无效

为了获得关于模型的更多信息,我使用bazel从源代码构建了tensorflow,并运行以下程序:

$ bazel build tensorflow/tools/graph_transforms:summarize_graph
  bazel-bin/tensorflow/tools/graph_transforms/summarize_graph -- 
  in_graph=/Users/nadav/Desktop/tflite/
输出: 其他详情: tensorflow版本:1.13.1 在Python2.7和3.6.5中运行它

还尝试使用检查点(ckpt)文件而不是保存的模型,但不起作用

得到这个结果: ValueError:仅在第1维度中支持无。张量“image_Tensor”的形状“[None,None,None,3]”无效

预期:
两个文件:somefilename.pb somefilename.pbtxt

您可以这样转换

!tflite_convert --output_file model.tflite \
                --saved_model_dir   ssd_mobilenet_v1_ppn_shared_box_predictor_300x300_coco14_sync_2018_07_03/saved_model/ \
                --output_format TFLITE \
                --inference_type FLOAT \
                --input_arrays image_tensor \
                --input_shapes 1,300,300,3 \
                --output_arrays detection_boxes,detection_classes,detection_scores,num_detections

对于对象检测,最好遵循此步骤。

要转换为tflite,可以遵循以下教程链接

再培训模型转换:

对象检测模型转换:

有一个问题:检查失败:array.data\u type==array.final\u data\u type数组“image\u tensor”的实际数据类型与最终数据类型(data\u type=uint8,final\u data\u type=float)不匹配。嘿@新手,你找到解决你所面临问题的方法了吗?我也面临同样的问题。是的,我能够将.pb文件转换为.tflite文件。
!tflite_convert --output_file model.tflite \
                --saved_model_dir   ssd_mobilenet_v1_ppn_shared_box_predictor_300x300_coco14_sync_2018_07_03/saved_model/ \
                --output_format TFLITE \
                --inference_type FLOAT \
                --input_arrays image_tensor \
                --input_shapes 1,300,300,3 \
                --output_arrays detection_boxes,detection_classes,detection_scores,num_detections