Skip to content

Commit

Permalink
Update tflite-model-maker APIs to 0.3.2.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 374055079
  • Loading branch information
lintian06 authored and copybara-github committed May 16, 2021
1 parent f288eff commit df7ce56
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
17 changes: 12 additions & 5 deletions tensorflow_examples/lite/model_maker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,39 +42,44 @@ 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).

* 1. Import the required modules.
* Step 1. Import the required modules.

```python
from tflite_model_maker import image_classifier
from tflite_model_maker.image_classifier import DataLoader
```

* 2. Load input data specific to an on-device ML app.
* Step 2. Load input data specific to an on-device ML app.

```python
data = DataLoader.from_folder('flower_photos/')
```

* 3. Customize the TensorFlow model.
* Step 3. Customize the TensorFlow model.

```python
model = image_classifier.create(data)
```

* 4. Evaluate the model.
* Step 4. Evaluate the model.

```python
loss, accuracy = model.evaluate()
```

* 5. Export to Tensorflow Lite model and label file in `export_dir`.
* Step 5. Export to Tensorflow Lite model and label file in `export_dir`.

```python
model.export(export_dir='/tmp/')
Expand All @@ -86,6 +91,8 @@ 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)
4 changes: 4 additions & 0 deletions tensorflow_examples/lite/model_maker/RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release 0.3

## 0.3.2

* Minor fix: Move librosa to an optional library for audio task.

## 0.3.1

* Polish document showing in
Expand Down
4 changes: 2 additions & 2 deletions tensorflow_examples/lite/model_maker/pip_package/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@
# Set package version.
if nightly:
project_name = '{}-nightly'.format(project_name)
version = '0.3.2' # Version prefix, usually major.minor.micro.
version = '0.3.3' # Version prefix, usually major.minor.micro.
version = '{:s}.dev{:s}'.format(version, datestring)
classifiers += [
'Development Status :: 4 - Beta',
]
else:
# LINT.IfChange(model_maker_pip_version)
version = '0.3.1'
version = '0.3.2'
# LINT.ThenChange(../public/__init__.py, ../RELEASE.md)

# Path to model_maker dir: <repo>/tensorflow_examples/lite/model_maker
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_examples/lite/model_maker/public/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
from tensorflow_examples.lite.model_maker.core.task import configs
# pylint: enable=g-bad-import-order

__version__ = '0.3.1'
__version__ = '0.3.2'

0 comments on commit df7ce56

Please sign in to comment.