# TFLite Model Maker
## Overview
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.
## Requirements
* Refer to
[requirements.txt](https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/requirements.txt)
for dependent libraries that're needed to use the library and run the demo
code.
* Note that you might also need to install `sndfile` for Audio tasks.
On Debian/Ubuntu, you can do so by `sudo apt-get install libsndfile1`
## Installation
There are two ways to install Model Maker.
* Install a prebuilt pip package:
[`tflite-model-maker`](https://pypi.org/project/tflite-model-maker/).
```shell
pip install tflite-model-maker
```
If you want to install nightly version
[`tflite-model-maker-nightly`](https://pypi.org/project/tflite-model-maker-nightly/),
please follow the command:
```shell
pip install tflite-model-maker-nightly
```
* Clone the source code from GitHub and install.
```shell
git clone https://github.com/tensorflow/examples
cd examples/tensorflow_examples/lite/model_maker/pip_package
pip install -e .
```
TensorFlow Lite Model Maker depends on TensorFlow
[pip package](https://www.tensorflow.org/install/pip). For GPU support, please
refer to TensorFlow's [GPU guide](https://www.tensorflow.org/install/gpu) or
[installation guide](https://www.tensorflow.org/install).
## End-to-End Example
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. For more detail, you could refer to
[Colab for image classification](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/tutorials/model_maker_image_classification.ipynb).
* Step 1. Import the required modules.
```python
from tflite_model_maker import image_classifier
from tflite_model_maker.image_classifier import DataLoader
```
* Step 2. Load input data specific to an on-device ML app.
```python
data = DataLoader.from_folder('flower_photos/')
```
* Step 3. Customize the TensorFlow model.
```python
model = image_classifier.create(data)
```
* Step 4. Evaluate the model.
```python
loss, accuracy = model.evaluate()
```
* Step 5. Export to Tensorflow Lite model and label file in `export_dir`.
```python
model.export(export_dir='/tmp/')
```
## Notebook
Currently, we support image classification, text classification and question
answer tasks. Meanwhile, we provide demo code for each of them in demo folder.
* [Overview for TensorFlow Lite Model Maker](https://www.tensorflow.org/lite/guide/model_maker)
* [Python API Reference](https://www.tensorflow.org/lite/api_docs/python/tflite_model_maker)
* [Colab for image classification](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/tutorials/model_maker_image_classification.ipynb)
* [Colab for text classification](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/tutorials/model_maker_text_classification.ipynb)
* [Colab for BERT question answer](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/tutorials/model_maker_question_answer.ipynb)
* [Colab for object detection](https://www.tensorflow.org/lite/tutorials/model_maker_object_detection)
Raw data
{
"_id": null,
"home_page": "http://github.com/tensorflow/examples",
"name": "tflite-model-maker",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "tensorflow,lite,model customization,transfer learning",
"author": "Google LLC",
"author_email": "packages@tensorflow.org",
"download_url": "https://files.pythonhosted.org/packages/aa/3a/50e3f57382333f9aa3fd4984d741fbe23d6c644ea38cbd4c6d273176b38a/tflite-model-maker-0.4.3.tar.gz",
"platform": null,
"description": "# TFLite Model Maker\n\n## Overview\n\nThe TFLite Model Maker library simplifies the process of adapting and converting\na TensorFlow neural-network model to particular input data when deploying this\nmodel for on-device ML applications.\n\n## Requirements\n\n* Refer to\n [requirements.txt](https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/requirements.txt)\n for dependent libraries that're needed to use the library and run the demo\n code.\n* Note that you might also need to install `sndfile` for Audio tasks.\nOn Debian/Ubuntu, you can do so by `sudo apt-get install libsndfile1`\n\n## Installation\n\nThere are two ways to install Model Maker.\n\n* Install a prebuilt pip package:\n [`tflite-model-maker`](https://pypi.org/project/tflite-model-maker/).\n\n```shell\npip install tflite-model-maker\n```\n\nIf you want to install nightly version\n[`tflite-model-maker-nightly`](https://pypi.org/project/tflite-model-maker-nightly/),\nplease follow the command:\n\n```shell\npip install tflite-model-maker-nightly\n```\n\n* Clone the source code from GitHub and install.\n\n```shell\ngit clone https://github.com/tensorflow/examples\ncd examples/tensorflow_examples/lite/model_maker/pip_package\npip install -e .\n```\n\nTensorFlow Lite Model Maker depends on TensorFlow\n[pip package](https://www.tensorflow.org/install/pip). For GPU support, please\nrefer to TensorFlow's [GPU guide](https://www.tensorflow.org/install/gpu) or\n[installation guide](https://www.tensorflow.org/install).\n\n## End-to-End Example\n\nFor instance, it could have an end-to-end image classification example that\nutilizes this library with just 4 lines of code, each of which representing one\nstep of the overall process. For more detail, you could refer to\n[Colab for image classification](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/tutorials/model_maker_image_classification.ipynb).\n\n* Step 1. Import the required modules.\n\n```python\nfrom tflite_model_maker import image_classifier\nfrom tflite_model_maker.image_classifier import DataLoader\n```\n\n* Step 2. Load input data specific to an on-device ML app.\n\n```python\ndata = DataLoader.from_folder('flower_photos/')\n```\n\n* Step 3. Customize the TensorFlow model.\n\n```python\nmodel = image_classifier.create(data)\n```\n\n* Step 4. Evaluate the model.\n\n```python\nloss, accuracy = model.evaluate()\n```\n\n* Step 5. Export to Tensorflow Lite model and label file in `export_dir`.\n\n```python\nmodel.export(export_dir='/tmp/')\n```\n\n## Notebook\n\nCurrently, we support image classification, text classification and question\nanswer tasks. Meanwhile, we provide demo code for each of them in demo folder.\n\n* [Overview for TensorFlow Lite Model Maker](https://www.tensorflow.org/lite/guide/model_maker)\n* [Python API Reference](https://www.tensorflow.org/lite/api_docs/python/tflite_model_maker)\n* [Colab for image classification](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/tutorials/model_maker_image_classification.ipynb)\n* [Colab for text classification](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/tutorials/model_maker_text_classification.ipynb)\n* [Colab for BERT question answer](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/tutorials/model_maker_question_answer.ipynb)\n* [Colab for object detection](https://www.tensorflow.org/lite/tutorials/model_maker_object_detection)\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "TFLite Model Maker: a model customization library for on-device applications.",
"version": "0.4.3",
"project_urls": {
"Download": "https://github.com/tensorflow/examples/tags",
"Homepage": "http://github.com/tensorflow/examples"
},
"split_keywords": [
"tensorflow",
"lite",
"model customization",
"transfer learning"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9bb9a1736d810dc854e67be0739fd3c31cc9d2d283b8ca101fa9823b3330e53e",
"md5": "3070393aaf9a0211935f5b98081fea80",
"sha256": "b3f2bbdfde4134e889be35cbc49ef8ff27c600be69d95a6b542ee59f238d0a5c"
},
"downloads": -1,
"filename": "tflite_model_maker-0.4.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3070393aaf9a0211935f5b98081fea80",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 580078,
"upload_time": "2024-01-23T00:26:08",
"upload_time_iso_8601": "2024-01-23T00:26:08.481282Z",
"url": "https://files.pythonhosted.org/packages/9b/b9/a1736d810dc854e67be0739fd3c31cc9d2d283b8ca101fa9823b3330e53e/tflite_model_maker-0.4.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "aa3a50e3f57382333f9aa3fd4984d741fbe23d6c644ea38cbd4c6d273176b38a",
"md5": "5a4ce9ec9a3d7a5e219ea56c0ebdbd0e",
"sha256": "f10dd3ecb57ffc166089663dd18d41b2c4bfeb790eb061a18c6efd4481fb9778"
},
"downloads": -1,
"filename": "tflite-model-maker-0.4.3.tar.gz",
"has_sig": false,
"md5_digest": "5a4ce9ec9a3d7a5e219ea56c0ebdbd0e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 326929,
"upload_time": "2024-01-23T00:26:10",
"upload_time_iso_8601": "2024-01-23T00:26:10.746768Z",
"url": "https://files.pythonhosted.org/packages/aa/3a/50e3f57382333f9aa3fd4984d741fbe23d6c644ea38cbd4c6d273176b38a/tflite-model-maker-0.4.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-23 00:26:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tensorflow",
"github_project": "examples",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "tflite-model-maker"
}