TFLite Model Maker
The TFLite Model Maker library simplifies the process of adapting and converting a TensorFlow neural-network model to particular input data when deploying this model for on-device ML applications.
- Refer to requirements.txt for dependent libraries that're needed to use the library and run the demo code.
Two alternative methods to install Model Maker library with its dependencies.
- Install directly.
pip install git+https://github.com/tensorflow/examples.git#egg=tensorflow-examples[model_maker]
- Clone the repo from the HEAD, and then install with pip.
git clone https://github.com/tensorflow/examples cd examples pip install .[model_maker]
For instance, it could have an end-to-end image classification example that utilizes this library with just 4 lines of code, each of which representing one step of the overall process:
- Load input data specific to an on-device ML app.
data = ImageClassifierDataLoader.from_folder('flower_photos/')
- Customize the TensorFlow model.
model = image_classifier.create(data)
- Evaluate the model.
loss, accuracy = model.evaluate()
- Export to Tensorflow Lite model.
Currently, we support image classification and text classification tasks and provide demo code and colab for each of them in demo folder.