TensorFlow Lite目标检测iOS不适用于自定义训练模型

2024-07-04 08:16:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经训练了我的ssd\u mobilenet\u v2\u量化\u 300x300\u coco\u 2019\u 01\u 03目标检测模型。一切都很顺利。我还将其转换为.tflite文件并将其命名为检测tx.tflite。你知道吗

我下载了official ObjectDetection Example App,它在inlcuded.tflite模型中运行顺利。你知道吗

我将ModelDataHandler.swift中的代码更改为:

enum MobileNetSSD {
  static let modelInfo: FileInfo = (name: "detectx", extension: "tflite")
  static let labelsInfo: FileInfo = (name: "labelmap", extension: "txt")
}

当然也打动了我的心检测tx.tflite到Model文件夹中,以便找到它。你知道吗

但是,当我尝试运行该应用程序时,它崩溃并出现以下错误:

Failed to load the model file with name: detectx (lldb)

这就是我如何将经过训练的模型导出到tflite_图形.pb

python export_tflite_ssd_graph.py \
    --pipeline_config_path training/ssd_mobilenet_v2_quantized_300x300_coco.config \
    --trained_checkpoint_prefix training/model.ckpt-145 \
    --output_directory inference_graph_TFLITE_COBA

我就是这样把它转换成.tflite的:

tflite_convert --graph_def_file=inference_graph_TFLITE_COBA/tflite_graph.pb --output_file=detectx.tflite 
--input_shapes=1,300,300,3 --input_arrays=normalized_input_image_tensor 
--output_arrays=TFLite_Detection_PostProcess,TFLite_Detection_PostProcess:1,TFLite_Detection_Post
Process:2,TFLite_Detection_PostProcess:3 --allow_custom_ops

这成功地产生了检测tx.tflite就像我在上面写的那样。你知道吗

我不明白为什么这样不行。我尝试了许多不同的ssd移动网络模型,也产生了相同的错误。有人能帮我吗?我非常困惑。你知道吗

非常感谢。我真的很感激你的帮助。你知道吗


Tags: name模型inputoutputv2filegraphssd

热门问题