Tflite 文件转换

问题描述 投票:0回答:1

如何将 .py 文件内带有图像检测模式的 .py 文件转换为 tflite 文件,以便在 android studio 中作为应用程序实现

import tensorflow as tf
 
# Convert the model
converter = tf.lite.TFLiteConverter.from_saved_model("Modal.py") 
tflite_model = converter.convert()
 
# Save the model.
with open('fruits_model.tflite', 'wb') as f:
  f.write(tflite_model)

python android-studio mobile-application tflite
1个回答
0
投票

通常您无法直接从脚本/py 文件进行转换,您是否在寻找 .pt 文件? Google 有一个用于转换 PyTorch 模型的新库:https://github.com/google-ai-edge/ai-edge-torch

© www.soinside.com 2019 - 2024. All rights reserved.