简体   繁体   中英

From tensorflow in python to tensorflow lite in android

Is it possible to bring a code written in python from an already trained neural network and bring it to android? I have tried with Java but the libraries that I need as Nd4j and OpenCV are very heavy, I have tried with BeeWare but it does not support TensorFlow and the same with Kivy, is there a way or not?

I think this link is what you're looking for. Convert the model on Python using the TensorFlow Lite Converter and later use that converted model in your Android app.

This is a code snippet from Google's website on how to convert it:

import tensorflow as tf

converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM