【发布时间】:2019-08-07 23:50:06
【问题描述】:
在我使用 object_detection\model_main.py 脚本用我自己的图像数据集重新训练预训练的 ssd mobilenet v1 模型后,我导出了两个 .pb 冻结图(使用 export_inference_graph.py 脚本)
python models\research\object_detection\export_inference_graph.py
--input_type image_tensor
--input_shape=1,300,300,3
--pipeline_config_path ssd_mobilenet_v1_test.config
--trained_checkpoint_prefix training/model.ckpt
--output_directory export\freeze\
和 .tflite 图形(带有 export_tflite_ssd_graph.py 脚本和 tflite_convert)。
python models\research\object_detection\export_tflite_ssd_graph.py
--input_type image_tensor
--pipeline_config_path ssd_mobilenet_v1_test.config
--trained_checkpoint_prefix training/model.ckpt
--output_directory export\tflite\
--max_detections 16
--add_postprocessing_op=true
tflite_convert
--output_file=export\tflite\model.tflite
--graph_def_file=export\tflite\tflite_graph.pb
--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_dev_values=128
--default_ranges_min=0
--default_ranges_max=6
--allow_custom_ops
Pb 图表似乎工作得很好,但是 tflite one 错误地检测到了 android 上的所有内容,所以无论我传递给它的任何图像,我都会在 16 个可能的检测中得到 16 个,甚至是填充黑色的图像(我在 android 设备上测试它. 它适用于预训练模型)。
更改转换选项(例如禁用/启用量化、图像标准/均值)并没有改变任何东西。我还将我的 tflite 图与示例 mobilenet 图进行了比较,它们看起来非常相似。有什么想法会导致这个问题吗?
(windows 10/cuda 9.0/cudnn 7.0/tf-nightly-gpu/models-master)
【问题讨论】:
-
您是否尝试过在 Python 中运行推理以确保 Android 集成没有问题?如果是这样,您能否在 TensorFlow 的 GitHub 页面上提交 issue 并包含重现问题所需的所有内容,包括模型(或模型的最小版本)。
标签: java python tensorflow tensorflow-lite