小编ASM*_*SMS的帖子

创建填充有元数据的 Tflite 模型时出现问题(用于对象检测)

我正在尝试在 Android 上运行 tflite 模型以进行对象检测。对于相同的,

  1. 我已经成功地用我的图像集训练了模型,如下所示:

(a) 培训:

!python3 object_detection/model_main.py \
--pipeline_config_path=/content/drive/My\ Drive/Detecto\ Tutorial/models/research/object_detection/samples/configs/ssd_mobilenet_v2_coco.config \
--model_dir=training/
Run Code Online (Sandbox Code Playgroud)

(修改配置文件以指向提到我的特定 TFrecords 的位置)

(b) 导出推理图

!python /content/drive/'My Drive'/'Detecto Tutorial'/models/research/object_detection/export_inference_graph.py \
--input_type=image_tensor \
--pipeline_config_path=/content/drive/My\ Drive/Detecto\ Tutorial/models/research/object_detection/samples/configs/ssd_mobilenet_v2_coco.config \
--output_directory={output_directory} \
--trained_checkpoint_prefix={last_model_path}
Run Code Online (Sandbox Code Playgroud)

(c) 创建 tflite 就绪图

!python /content/drive/'My Drive'/'Detecto Tutorial'/models/research/object_detection/export_tflite_ssd_graph.py \
  --pipeline_config_path=/content/drive/My\ Drive/Detecto\ Tutorial/models/research/object_detection/samples/configs/ssd_mobilenet_v2_coco.config \
  --output_directory={output_directory} \
  --trained_checkpoint_prefix={last_model_path} \
  --add_postprocessing_op=true
Run Code Online (Sandbox Code Playgroud)
  1. 我使用图形文件中的 tflite_convert 创建了一个 tflite 模型,如下所示

    !tflite_convert
    --graph_def_file=/content/drive/My\ Drive/Detecto\ Tutorial/models/research/fine_tuned_model/tflite_graph.pb
    --output_file=/content/drive/My\ Drive/Detecto\ Tutorial/models/research/fine_tuned_model /detect3.tflite
    --output_format = 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', …

python android metadata tensorflow tensorflow-lite

0
推荐指数
1
解决办法
2164
查看次数

标签 统计

android ×1

metadata ×1

python ×1

tensorflow ×1

tensorflow-lite ×1