Mask_RCNN:如何保存经过训练的模型并将其转换为tflite

时间:2020-02-05 11:14:50

标签: tensorflow keras tensorflow-lite file-conversion tf-lite

我按照以下教程操作 https://machinelearningmastery.com/how-to-train-an-object-detection-model-with-keras/

成功训练后,我得到了5个 .h5 文件:

mask_rcnn_kangaroo_cfg_0001.h5
mask_rcnn_kangaroo_cfg_0002.h5
mask_rcnn_kangaroo_cfg_0003.h5
mask_rcnn_kangaroo_cfg_0004.h5
mask_rcnn_kangaroo_cfg_0005.h5

我是这个新手,所以我的理解可能是错误的:

如何将这些 .h5 文件转换为 .pb 文件,或者更好地转换为 .tflite 文件,因此我可以在Android对象检测应用程序?

1 个答案:

答案 0 :(得分:0)

您不需要将这些.h5转换为.pb,您可以将keras .h5文件直接转换为tflite。这是how to上的官方文档。

请确保该模型具有TFLite支持的图层,如here所述。

一旦有了.tflite模型,就可以在Android上运行解释器。