A set of machine learning tools for smartphones and embedded devices! Lighter than Tensorflow.
It is assumed that Python and Tensorflow (pip) are installed on your PC. First, prepare the model to be converted.
import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_saved_model("test_model.pb")
tflite_model = converter.convert()
open("test_model.tflite", "wb").write(tflite_model)
import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_saved_model("Relative path to the model")
tflite_model = converter.convert()
open("Where to save the model", "wb").write(tflite_model)
You can also convert on the command line.
tflite_convert \
--saved_model_dir=test_model.pb \
--output_file=test_model.tflite
tflite_convert \
--saved_model_dir=Relative path to the model\
--output_file=Where to save the model
I will explain how to incorporate Tensorflow Lite into Android, so if you like, please do. The article is here
Also, please refer to the official information. Official article
Recommended Posts