chore: import upstream snapshot with attribution
cffconvert / validate (push) Has been skipped
License Check / license-check (push) Failing after 2s

This commit is contained in:
wehub-resource-sync
2026-07-13 12:14:16 +08:00
commit 8a852e4b4e
36502 changed files with 9277225 additions and 0 deletions
@@ -0,0 +1,44 @@
page_type: reference
description: Public API for tf.lite namespace.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite" />
<meta itemprop="path" content="Stable" />
</div>
# Module: tf.lite
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Public API for tf.lite namespace.
## Modules
[`experimental`](../tf/lite/experimental) module: Public API for tf.lite.experimental namespace.
## Classes
[`class Interpreter`](../tf/lite/Interpreter): Interpreter interface for running TensorFlow Lite models.
[`class OpsSet`](../tf/lite/OpsSet): Enum class defining the sets of ops available to generate TFLite models.
[`class Optimize`](../tf/lite/Optimize): Enum defining the optimizations to apply when generating a tflite model.
[`class RepresentativeDataset`](../tf/lite/RepresentativeDataset): Representative dataset used to optimize the model.
[`class TFLiteConverter`](../tf/lite/TFLiteConverter): Converts a TensorFlow model into TensorFlow Lite model.
[`class TargetSpec`](../tf/lite/TargetSpec): Specification of target device used to optimize the model.
@@ -0,0 +1,778 @@
page_type: reference
description: Interpreter interface for running TensorFlow Lite models.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite.Interpreter" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="allocate_tensors"/>
<meta itemprop="property" content="get_input_details"/>
<meta itemprop="property" content="get_output_details"/>
<meta itemprop="property" content="get_signature_list"/>
<meta itemprop="property" content="get_signature_runner"/>
<meta itemprop="property" content="get_tensor"/>
<meta itemprop="property" content="get_tensor_details"/>
<meta itemprop="property" content="invoke"/>
<meta itemprop="property" content="reset_all_variables"/>
<meta itemprop="property" content="resize_tensor_input"/>
<meta itemprop="property" content="set_tensor"/>
<meta itemprop="property" content="tensor"/>
</div>
# tf.lite.Interpreter
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L354-L942">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Interpreter interface for running TensorFlow Lite models.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tf.lite.Interpreter(
model_path=None,
model_content=None,
experimental_delegates=None,
num_threads=None,
experimental_op_resolver_type=<a href="../../tf/lite/experimental/OpResolverType#AUTO"><code>tf.lite.experimental.OpResolverType.AUTO</code></a>,
experimental_preserve_all_tensors=False
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the guide</th>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/guide/signatures">Signatures in TensorFlow Lite</a></li>
<li><a href="https://www.tensorflow.org/model_optimization/guide/combine/cqat_example">Cluster preserving quantization aware training (CQAT) Keras example</a></li>
<li><a href="https://www.tensorflow.org/model_optimization/guide/combine/pqat_example">Pruning preserving quantization aware training (PQAT) Keras example</a></li>
<li><a href="https://www.tensorflow.org/model_optimization/guide/clustering/clustering_example">Weight clustering in Keras example</a></li>
<li><a href="https://www.tensorflow.org/model_optimization/guide/combine/pcqat_example">Sparsity and cluster preserving quantization aware training (PCQAT) Keras example</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/performance/post_training_integer_quant">Post-training integer quantization</a></li>
<li><a href="https://www.tensorflow.org/lite/examples/jax_conversion/overview">Jax Model Conversion For TFLite</a></li>
<li><a href="https://www.tensorflow.org/lite/examples/on_device_training/overview">On-Device Training with TensorFlow Lite</a></li>
<li><a href="https://www.tensorflow.org/lite/examples/style_transfer/overview">Artistic Style Transfer with TensorFlow Lite</a></li>
<li><a href="https://www.tensorflow.org/lite/performance/post_training_float16_quant">Post-training float16 quantization</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
Models obtained from `TfLiteConverter` can be run in Python with
`Interpreter`.
As an example, lets generate a simple Keras model and convert it to TFLite
(`TfLiteConverter` also supports other input formats with `from_saved_model`
and `from_concrete_function`)
<pre class="devsite-click-to-copy prettyprint lang-py">
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">x = np.array([[1.], [2.]])</code>
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">y = np.array([[2.], [4.]])</code>
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">model = tf.keras.models.Sequential([</code>
<code class="devsite-terminal" data-terminal-prefix="..."> tf.keras.layers.Dropout(0.2),</code>
<code class="devsite-terminal" data-terminal-prefix="..."> tf.keras.layers.Dense(units=1, input_shape=[1])</code>
<code class="devsite-terminal" data-terminal-prefix="..."> ])</code>
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">model.compile(optimizer=&#x27;sgd&#x27;, loss=&#x27;mean_squared_error&#x27;)</code>
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">model.fit(x, y, epochs=1)</code>
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">converter = tf.lite.TFLiteConverter.from_keras_model(model)</code>
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">tflite_model = converter.convert()</code>
</pre>
`tflite_model` can be saved to a file and loaded later, or directly into the
`Interpreter`. Since TensorFlow Lite pre-plans tensor allocations to optimize
inference, the user needs to call `allocate_tensors()` before any inference.
<pre class="devsite-click-to-copy prettyprint lang-py">
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">interpreter = tf.lite.Interpreter(model_content=tflite_model)</code>
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">interpreter.allocate_tensors() # Needed before execution!</code>
</pre>
#### Sample execution:
<pre class="devsite-click-to-copy prettyprint lang-py">
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">output = interpreter.get_output_details()[0] # Model has single output.</code>
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">input = interpreter.get_input_details()[0] # Model has single input.</code>
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">input_data = tf.constant(1., shape=[1, 1])</code>
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">interpreter.set_tensor(input[&#x27;index&#x27;], input_data)</code>
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">interpreter.invoke()</code>
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">interpreter.get_tensor(output[&#x27;index&#x27;]).shape</code>
<code class="no-select nocode">(1, 1)</code>
</pre>
Use `get_signature_runner()` for a more user-friendly inference API.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_path`<a id="model_path"></a>
</td>
<td>
Path to TF-Lite Flatbuffer file.
</td>
</tr><tr>
<td>
`model_content`<a id="model_content"></a>
</td>
<td>
Content of model.
</td>
</tr><tr>
<td>
`experimental_delegates`<a id="experimental_delegates"></a>
</td>
<td>
Experimental. Subject to change. List of
[TfLiteDelegate](https://www.tensorflow.org/lite/performance/delegates)
objects returned by lite.load_delegate().
</td>
</tr><tr>
<td>
`num_threads`<a id="num_threads"></a>
</td>
<td>
Sets the number of threads used by the interpreter and
available to CPU kernels. If not set, the interpreter will use an
implementation-dependent default number of threads. Currently, only a
subset of kernels, such as conv, support multi-threading. num_threads
should be >= -1. Setting num_threads to 0 has the effect to disable
multithreading, which is equivalent to setting num_threads to 1. If set
to the value -1, the number of threads used will be
implementation-defined and platform-dependent.
</td>
</tr><tr>
<td>
`experimental_op_resolver_type`<a id="experimental_op_resolver_type"></a>
</td>
<td>
The op resolver used by the interpreter. It
must be an instance of OpResolverType. By default, we use the built-in
op resolver which corresponds to tflite::ops::builtin::BuiltinOpResolver
in C++.
</td>
</tr><tr>
<td>
`experimental_preserve_all_tensors`<a id="experimental_preserve_all_tensors"></a>
</td>
<td>
If true, then intermediate tensors used
during computation are preserved for inspection, and if the passed op
resolver type is AUTO or BUILTIN, the type will be changed to
BUILTIN_WITHOUT_DEFAULT_DELEGATES so that no Tensorflow Lite default
delegates are applied. If false, getting intermediate tensors could
result in undefined values or None, especially when the graph is
successfully modified by the Tensorflow Lite default delegate.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Raises</h2></th></tr>
<tr>
<td>
`ValueError`<a id="ValueError"></a>
</td>
<td>
If the interpreter was unable to create.
</td>
</tr>
</table>
## Methods
<h3 id="allocate_tensors"><code>allocate_tensors</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L511-L513">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>allocate_tensors()
</code></pre>
<h3 id="get_input_details"><code>get_input_details</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L651-L679">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_input_details()
</code></pre>
Gets model input tensor details.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A list in which each item is a dictionary with details about
an input tensor. Each dictionary contains the following fields
that describe the tensor:
+ `name`: The tensor name.
+ `index`: The tensor index in the interpreter.
+ `shape`: The shape of the tensor.
+ `shape_signature`: Same as `shape` for models with known/fixed shapes.
If any dimension sizes are unknown, they are indicated with `-1`.
+ `dtype`: The numpy data type (such as `np.int32` or `np.uint8`).
+ `quantization`: Deprecated, use `quantization_parameters`. This field
only works for per-tensor quantization, whereas
`quantization_parameters` works in all cases.
+ `quantization_parameters`: A dictionary of parameters used to quantize
the tensor:
~ `scales`: List of scales (one if per-tensor quantization).
~ `zero_points`: List of zero_points (one if per-tensor quantization).
~ `quantized_dimension`: Specifies the dimension of per-axis
quantization, in the case of multiple scales/zero_points.
+ `sparsity_parameters`: A dictionary of parameters used to encode a
sparse tensor. This is empty if the tensor is dense.
</td>
</tr>
</table>
<h3 id="get_output_details"><code>get_output_details</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L728-L738">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_output_details()
</code></pre>
Gets model output tensor details.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A list in which each item is a dictionary with details about
an output tensor. The dictionary contains the same fields as
described for `get_input_details()`.
</td>
</tr>
</table>
<h3 id="get_signature_list"><code>get_signature_list</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L740-L765">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_signature_list()
</code></pre>
Gets list of SignatureDefs in the model.
Example,
```
signatures = interpreter.get_signature_list()
print(signatures)
# {
# 'add': {'inputs': ['x', 'y'], 'outputs': ['output_0']}
# }
Then using the names in the signature list you can get a callable from
get_signature_runner().
```
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A list of SignatureDef details in a dictionary structure.
It is keyed on the SignatureDef method name, and the value holds
dictionary of inputs and outputs.
</td>
</tr>
</table>
<h3 id="get_signature_runner"><code>get_signature_runner</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L790-L835">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_signature_runner(
signature_key=None
)
</code></pre>
Gets callable for inference of specific SignatureDef.
Example usage,
```
interpreter = tf.lite.Interpreter(model_content=tflite_model)
interpreter.allocate_tensors()
fn = interpreter.get_signature_runner('div_with_remainder')
output = fn(x=np.array([3]), y=np.array([2]))
print(output)
# {
# 'quotient': array([1.], dtype=float32)
# 'remainder': array([1.], dtype=float32)
# }
```
None can be passed for signature_key if the model has a single Signature
only.
All names used are this specific SignatureDef names.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`signature_key`
</td>
<td>
Signature key for the SignatureDef, it can be None if and
only if the model has a single SignatureDef. Default value is None.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
This returns a callable that can run inference for SignatureDef defined
by argument 'signature_key'.
The callable will take key arguments corresponding to the arguments of the
SignatureDef, that should have numpy values.
The callable will returns dictionary that maps from output names to numpy
values of the computed results.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr>
<td>
`ValueError`
</td>
<td>
If passed signature_key is invalid.
</td>
</tr>
</table>
<h3 id="get_tensor"><code>get_tensor</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L837-L852">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_tensor(
tensor_index, subgraph_index=0
)
</code></pre>
Gets the value of the output tensor (get a copy).
If you wish to avoid the copy, use `tensor()`. This function cannot be used
to read intermediate results.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`tensor_index`
</td>
<td>
Tensor index of tensor to get. This value can be gotten from
the 'index' field in get_output_details.
</td>
</tr><tr>
<td>
`subgraph_index`
</td>
<td>
Index of the subgraph to fetch the tensor. Default value
is 0, which means to fetch from the primary subgraph.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
a numpy array.
</td>
</tr>
</table>
<h3 id="get_tensor_details"><code>get_tensor_details</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L634-L649">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_tensor_details()
</code></pre>
Gets tensor details for every tensor with valid tensor details.
Tensors where required information about the tensor is not found are not
added to the list. This includes temporary tensors without a name.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A list of dictionaries containing tensor information.
</td>
</tr>
</table>
<h3 id="invoke"><code>invoke</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L904-L917">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>invoke()
</code></pre>
Invoke the interpreter.
Be sure to set the input sizes, allocate tensors and fill values before
calling this. Also, note that this function releases the GIL so heavy
computation can be done in the background while the Python interpreter
continues. No other function on this object should be called while the
invoke() call has not finished.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr>
<td>
`ValueError`
</td>
<td>
When the underlying interpreter fails raise ValueError.
</td>
</tr>
</table>
<h3 id="reset_all_variables"><code>reset_all_variables</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L919-L920">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>reset_all_variables()
</code></pre>
<h3 id="resize_tensor_input"><code>resize_tensor_input</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L699-L726">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>resize_tensor_input(
input_index, tensor_size, strict=False
)
</code></pre>
Resizes an input tensor.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`input_index`
</td>
<td>
Tensor index of input to set. This value can be gotten from
the 'index' field in get_input_details.
</td>
</tr><tr>
<td>
`tensor_size`
</td>
<td>
The tensor_shape to resize the input to.
</td>
</tr><tr>
<td>
`strict`
</td>
<td>
Only unknown dimensions can be resized when `strict` is True.
Unknown dimensions are indicated as `-1` in the `shape_signature`
attribute of a given tensor. (default False)
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr>
<td>
`ValueError`
</td>
<td>
If the interpreter could not resize the input tensor.
</td>
</tr>
</table>
#### Usage:
```
interpreter = Interpreter(model_content=tflite_model)
interpreter.resize_tensor_input(0, [num_test_images, 224, 224, 3])
interpreter.allocate_tensors()
interpreter.set_tensor(0, test_images)
interpreter.invoke()
```
<h3 id="set_tensor"><code>set_tensor</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L681-L697">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>set_tensor(
tensor_index, value
)
</code></pre>
Sets the value of the input tensor.
Note this copies data in `value`.
If you want to avoid copying, you can use the `tensor()` function to get a
numpy buffer pointing to the input buffer in the tflite interpreter.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`tensor_index`
</td>
<td>
Tensor index of tensor to set. This value can be gotten from
the 'index' field in get_input_details.
</td>
</tr><tr>
<td>
`value`
</td>
<td>
Value of tensor to set.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr>
<td>
`ValueError`
</td>
<td>
If the interpreter could not set the tensor.
</td>
</tr>
</table>
<h3 id="tensor"><code>tensor</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L854-L902">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tensor(
tensor_index
)
</code></pre>
Returns function that gives a numpy view of the current tensor buffer.
This allows reading and writing to this tensors w/o copies. This more
closely mirrors the C++ Interpreter class interface's tensor() member, hence
the name. Be careful to not hold these output references through calls
to `allocate_tensors()` and `invoke()`. This function cannot be used to read
intermediate results.
#### Usage:
```
interpreter.allocate_tensors()
input = interpreter.tensor(interpreter.get_input_details()[0]["index"])
output = interpreter.tensor(interpreter.get_output_details()[0]["index"])
for i in range(10):
input().fill(3.)
interpreter.invoke()
print("inference %s" % output())
```
Notice how this function avoids making a numpy array directly. This is
because it is important to not hold actual numpy views to the data longer
than necessary. If you do, then the interpreter can no longer be invoked,
because it is possible the interpreter would resize and invalidate the
referenced tensors. The NumPy API doesn't allow any mutability of the
the underlying buffers.
#### WRONG:
```
input = interpreter.tensor(interpreter.get_input_details()[0]["index"])()
output = interpreter.tensor(interpreter.get_output_details()[0]["index"])()
interpreter.allocate_tensors() # This will throw RuntimeError
for i in range(10):
input.fill(3.)
interpreter.invoke() # this will throw RuntimeError since input,output
```
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`tensor_index`
</td>
<td>
Tensor index of tensor to get. This value can be gotten from
the 'index' field in get_output_details.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A function that can return a new numpy array pointing to the internal
TFLite tensor state at any point. It is safe to hold the function forever,
but it is not safe to hold the numpy array forever.
</td>
</tr>
</table>
@@ -0,0 +1,75 @@
page_type: reference
description: Enum class defining the sets of ops available to generate TFLite models.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite.OpsSet" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="EXPERIMENTAL_TFLITE_BUILTINS_ACTIVATIONS_INT16_WEIGHTS_INT8"/>
<meta itemprop="property" content="SELECT_TF_OPS"/>
<meta itemprop="property" content="TFLITE_BUILTINS"/>
<meta itemprop="property" content="TFLITE_BUILTINS_INT8"/>
</div>
# tf.lite.OpsSet
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/convert.py#L158-L196">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Enum class defining the sets of ops available to generate TFLite models.
<!-- Placeholder for "Used in" -->
Warning: Experimental interface, subject to change.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
EXPERIMENTAL_TFLITE_BUILTINS_ACTIVATIONS_INT16_WEIGHTS_INT8<a id="EXPERIMENTAL_TFLITE_BUILTINS_ACTIVATIONS_INT16_WEIGHTS_INT8"></a>
</td>
<td>
`<OpsSet.EXPERIMENTAL_TFLITE_BUILTINS_ACTIVATIONS_INT16_WEIGHTS_INT8: 'EXPERIMENTAL_TFLITE_BUILTINS_ACTIVATIONS_INT16_WEIGHTS_INT8'>`
</td>
</tr><tr>
<td>
SELECT_TF_OPS<a id="SELECT_TF_OPS"></a>
</td>
<td>
`<OpsSet.SELECT_TF_OPS: 'SELECT_TF_OPS'>`
</td>
</tr><tr>
<td>
TFLITE_BUILTINS<a id="TFLITE_BUILTINS"></a>
</td>
<td>
`<OpsSet.TFLITE_BUILTINS: 'TFLITE_BUILTINS'>`
</td>
</tr><tr>
<td>
TFLITE_BUILTINS_INT8<a id="TFLITE_BUILTINS_INT8"></a>
</td>
<td>
`<OpsSet.TFLITE_BUILTINS_INT8: 'TFLITE_BUILTINS_INT8'>`
</td>
</tr>
</table>
@@ -0,0 +1,97 @@
page_type: reference
description: Enum defining the optimizations to apply when generating a tflite model.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite.Optimize" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="DEFAULT"/>
<meta itemprop="property" content="EXPERIMENTAL_SPARSITY"/>
<meta itemprop="property" content="OPTIMIZE_FOR_LATENCY"/>
<meta itemprop="property" content="OPTIMIZE_FOR_SIZE"/>
</div>
# tf.lite.Optimize
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/lite.py#L98-L154">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Enum defining the optimizations to apply when generating a tflite model.
<!-- Placeholder for "Used in" -->
DEFAULT The default optimization strategy that enables post-training
quantization. The type of post-training quantization that will be used is
dependent on the other converter options supplied. Refer to the
[documentation](/tensorflow/lite/g3doc/performance/post_training_quantization.md)
for further information on the types available and how to use them.
OPTIMIZE_FOR_SIZE
Deprecated. Does the same as DEFAULT.
OPTIMIZE_FOR_LATENCY
Deprecated. Does the same as DEFAULT.
EXPERIMENTAL_SPARSITY
Experimental flag, subject to change.
Enable optimization by taking advantage of the sparse model weights
trained with pruning.
The converter will inspect the sparsity pattern of the model weights and
do its best to improve size and latency.
The flag can be used alone to optimize float32 models with sparse weights.
It can also be used together with the DEFAULT optimization mode to
optimize quantized models with sparse weights.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
DEFAULT<a id="DEFAULT"></a>
</td>
<td>
`<Optimize.DEFAULT: 'DEFAULT'>`
</td>
</tr><tr>
<td>
EXPERIMENTAL_SPARSITY<a id="EXPERIMENTAL_SPARSITY"></a>
</td>
<td>
`<Optimize.EXPERIMENTAL_SPARSITY: 'EXPERIMENTAL_SPARSITY'>`
</td>
</tr><tr>
<td>
OPTIMIZE_FOR_LATENCY<a id="OPTIMIZE_FOR_LATENCY"></a>
</td>
<td>
`<Optimize.OPTIMIZE_FOR_LATENCY: 'OPTIMIZE_FOR_LATENCY'>`
</td>
</tr><tr>
<td>
OPTIMIZE_FOR_SIZE<a id="OPTIMIZE_FOR_SIZE"></a>
</td>
<td>
`<Optimize.OPTIMIZE_FOR_SIZE: 'OPTIMIZE_FOR_SIZE'>`
</td>
</tr>
</table>
@@ -0,0 +1,65 @@
page_type: reference
description: Representative dataset used to optimize the model.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite.RepresentativeDataset" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
</div>
# tf.lite.RepresentativeDataset
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/lite.py#L158-L179">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Representative dataset used to optimize the model.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tf.lite.RepresentativeDataset(
input_gen
)
</code></pre>
<!-- Placeholder for "Used in" -->
This is a generator function that provides a small dataset to calibrate or
estimate the range, i.e, (min, max) of all floating-point arrays in the model
(such as model input, activation outputs of intermediate layers, and model
output) for quantization. Usually, this is a small subset of a few hundred
samples randomly chosen, in no particular order, from the training or
evaluation dataset.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`input_gen`<a id="input_gen"></a>
</td>
<td>
A generator function that generates input samples for the
model and has the same order, type and shape as the inputs to the model.
Usually, this is a small subset of a few hundred samples randomly
chosen, in no particular order, from the training or evaluation dataset.
</td>
</tr>
</table>
@@ -0,0 +1,535 @@
page_type: reference
description: Converts a TensorFlow model into TensorFlow Lite model.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite.TFLiteConverter" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="convert"/>
<meta itemprop="property" content="experimental_from_jax"/>
<meta itemprop="property" content="from_concrete_functions"/>
<meta itemprop="property" content="from_keras_model"/>
<meta itemprop="property" content="from_saved_model"/>
</div>
# tf.lite.TFLiteConverter
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/lite.py#L1628-L1866">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Converts a TensorFlow model into TensorFlow Lite model.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tf.lite.TFLiteConverter(
funcs, trackable_obj=None
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the guide</th>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/guide/model_analyzer">TensorFlow Lite Model Analyzer</a></li>
<li><a href="https://www.tensorflow.org/lite/guide/signatures">Signatures in TensorFlow Lite</a></li>
<li><a href="https://www.tensorflow.org/lite/guide/authoring">TFLite Authoring Tool</a></li>
<li><a href="https://www.tensorflow.org/guide/migrate/tflite">Migrating your TFLite code to TF2</a></li>
<li><a href="https://www.tensorflow.org/model_optimization/guide/combine/cqat_example">Cluster preserving quantization aware training (CQAT) Keras example</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/performance/post_training_integer_quant">Post-training integer quantization</a></li>
<li><a href="https://www.tensorflow.org/lite/performance/quantization_debugger">Inspecting Quantization Errors with Quantization Debugger</a></li>
<li><a href="https://www.tensorflow.org/lite/examples/jax_conversion/overview">Jax Model Conversion For TFLite</a></li>
<li><a href="https://www.tensorflow.org/lite/performance/post_training_quant">Post-training dynamic range quantization</a></li>
<li><a href="https://www.tensorflow.org/lite/examples/on_device_training/overview">On-Device Training with TensorFlow Lite</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
#### Example usage:
```python
# Converting a SavedModel to a TensorFlow Lite model.
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
tflite_model = converter.convert()
# Converting a tf.Keras model to a TensorFlow Lite model.
converter = tf.lite.TFLiteConverter.from_keras_model(model)
tflite_model = converter.convert()
# Converting ConcreteFunctions to a TensorFlow Lite model.
converter = tf.lite.TFLiteConverter.from_concrete_functions([func], model)
tflite_model = converter.convert()
# Converting a Jax model to a TensorFlow Lite model.
converter = tf.lite.TFLiteConverter.experimental_from_jax([func], [[
('input1', input1), ('input2', input2)]])
tflite_model = converter.convert()
```
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`funcs`<a id="funcs"></a>
</td>
<td>
List of TensorFlow ConcreteFunctions. The list should not contain
duplicate elements.
</td>
</tr><tr>
<td>
`trackable_obj`<a id="trackable_obj"></a>
</td>
<td>
tf.AutoTrackable object associated with `funcs`. A
reference to this object needs to be maintained so that Variables do not
get garbage collected since functions have a weak reference to
Variables. This is only required when the tf.AutoTrackable object is not
maintained by the user (e.g. `from_saved_model`).
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`optimizations`<a id="optimizations"></a>
</td>
<td>
Experimental flag, subject to change. Set of optimizations to
apply. e.g {tf.lite.Optimize.DEFAULT}. (default None, must be None or a
set of values of type <a href="../../tf/lite/Optimize"><code>tf.lite.Optimize</code></a>)
</td>
</tr><tr>
<td>
`representative_dataset`<a id="representative_dataset"></a>
</td>
<td>
A generator function used for integer quantization
where each generated sample has the same order, type and shape as the
inputs to the model. Usually, this is a small subset of a few hundred
samples randomly chosen, in no particular order, from the training or
evaluation dataset. This is an optional attribute, but required for full
integer quantization, i.e, if <a href="https://www.tensorflow.org/api_docs/python/tf#int8"><code>tf.int8</code></a> is the only supported type in
`target_spec.supported_types`. Refer to <a href="../../tf/lite/RepresentativeDataset"><code>tf.lite.RepresentativeDataset</code></a>.
(default None)
</td>
</tr><tr>
<td>
`target_spec`<a id="target_spec"></a>
</td>
<td>
Experimental flag, subject to change. Specifications of target
device, including supported ops set, supported types and a set of user's
defined TensorFlow operators required in the TensorFlow Lite runtime.
Refer to <a href="../../tf/lite/TargetSpec"><code>tf.lite.TargetSpec</code></a>.
</td>
</tr><tr>
<td>
`inference_input_type`<a id="inference_input_type"></a>
</td>
<td>
Data type of the input layer. Note that integer types
(tf.int8 and tf.uint8) are currently only supported for post training
integer quantization and quantization aware training. (default tf.float32,
must be in {tf.float32, tf.int8, tf.uint8})
</td>
</tr><tr>
<td>
`inference_output_type`<a id="inference_output_type"></a>
</td>
<td>
Data type of the output layer. Note that integer
types (tf.int8 and tf.uint8) are currently only supported for post
training integer quantization and quantization aware training. (default
tf.float32, must be in {tf.float32, tf.int8, tf.uint8})
</td>
</tr><tr>
<td>
`allow_custom_ops`<a id="allow_custom_ops"></a>
</td>
<td>
Boolean indicating whether to allow custom operations.
When False, any unknown operation is an error. When True, custom ops are
created for any op that is unknown. The developer needs to provide these
to the TensorFlow Lite runtime with a custom resolver. (default False)
</td>
</tr><tr>
<td>
`exclude_conversion_metadata`<a id="exclude_conversion_metadata"></a>
</td>
<td>
Whether not to embed the conversion metadata
into the converted model. (default False)
</td>
</tr><tr>
<td>
`experimental_new_converter`<a id="experimental_new_converter"></a>
</td>
<td>
Experimental flag, subject to change. Enables
MLIR-based conversion. (default True)
</td>
</tr><tr>
<td>
`experimental_new_quantizer`<a id="experimental_new_quantizer"></a>
</td>
<td>
Experimental flag, subject to change. Enables
MLIR-based quantization conversion instead of Flatbuffer-based conversion.
(default True)
</td>
</tr><tr>
<td>
`experimental_enable_resource_variables`<a id="experimental_enable_resource_variables"></a>
</td>
<td>
Experimental flag, subject to
change. Enables
[resource variables](https://tensorflow.org/guide/migrate/tf1_vs_tf2#resourcevariables_instead_of_referencevariables)
to be converted by this converter. This is only allowed if the
from_saved_model interface is used. (default True)
</td>
</tr>
</table>
## Methods
<h3 id="convert"><code>convert</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/lite.py#L1853-L1866">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>convert()
</code></pre>
Converts a TensorFlow GraphDef based on instance variables.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
The converted data in serialized format.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr>
<td>
`ValueError`
</td>
<td>
No concrete functions is specified.
Multiple concrete functions are specified.
Input shape is not specified.
Invalid quantization parameters.
</td>
</tr>
</table>
<h3 id="experimental_from_jax"><code>experimental_from_jax</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/lite.py#L1830-L1850">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>experimental_from_jax(
serving_funcs, inputs
)
</code></pre>
Creates a TFLiteConverter object from a Jax model with its inputs.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`serving_funcs`
</td>
<td>
A array of Jax functions with all the weights applied
already.
</td>
</tr><tr>
<td>
`inputs`
</td>
<td>
A array of Jax input placeholders tuples list, e.g.,
jnp.zeros(INPUT_SHAPE). Each tuple list should correspond with the
serving function.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
TFLiteConverter object.
</td>
</tr>
</table>
<h3 id="from_concrete_functions"><code>from_concrete_functions</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/lite.py#L1710-L1746">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>from_concrete_functions(
funcs, trackable_obj=None
)
</code></pre>
Creates a TFLiteConverter object from ConcreteFunctions.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`funcs`
</td>
<td>
List of TensorFlow ConcreteFunctions. The list should not contain
duplicate elements. Currently converter can only convert a single
ConcreteFunction. Converting multiple functions is under development.
</td>
</tr><tr>
<td>
`trackable_obj`
</td>
<td>
An `AutoTrackable` object (typically `tf.module`)
associated with `funcs`. A reference to this object needs to be
maintained so that Variables do not get garbage collected since
functions have a weak reference to Variables.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
TFLiteConverter object.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr class="alt">
<td colspan="2">
Invalid input type.
</td>
</tr>
</table>
<h3 id="from_keras_model"><code>from_keras_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/lite.py#L1814-L1828">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>from_keras_model(
model
)
</code></pre>
Creates a TFLiteConverter object from a Keras model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`model`
</td>
<td>
tf.Keras.Model
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
TFLiteConverter object.
</td>
</tr>
</table>
<h3 id="from_saved_model"><code>from_saved_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/lite.py#L1748-L1812">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>from_saved_model(
saved_model_dir, signature_keys=None, tags=None
)
</code></pre>
Creates a TFLiteConverter object from a SavedModel directory.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`saved_model_dir`
</td>
<td>
SavedModel directory to convert.
</td>
</tr><tr>
<td>
`signature_keys`
</td>
<td>
List of keys identifying SignatureDef containing inputs
and outputs. Elements should not be duplicated. By default the
`signatures` attribute of the MetaGraphdef is used. (default
saved_model.signatures)
</td>
</tr><tr>
<td>
`tags`
</td>
<td>
Set of tags identifying the MetaGraphDef within the SavedModel to
analyze. All tags in the tag set must be present. (default
{tf.saved_model.SERVING} or {'serve'})
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
TFLiteConverter object.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr class="alt">
<td colspan="2">
Invalid signature keys.
</td>
</tr>
</table>
@@ -0,0 +1,113 @@
page_type: reference
description: Specification of target device used to optimize the model.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite.TargetSpec" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
</div>
# tf.lite.TargetSpec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/lite.py#L182-L227">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Specification of target device used to optimize the model.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tf.lite.TargetSpec(
supported_ops=None,
supported_types=None,
experimental_select_user_tf_ops=None,
experimental_supported_backends=None
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the guide</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/guide/authoring">TFLite Authoring Tool</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`supported_ops`<a id="supported_ops"></a>
</td>
<td>
Experimental flag, subject to change. Set of <a href="../../tf/lite/OpsSet"><code>tf.lite.OpsSet</code></a>
options, where each option represents a set of operators supported by the
target device. (default {tf.lite.OpsSet.TFLITE_BUILTINS}))
</td>
</tr><tr>
<td>
`supported_types`<a id="supported_types"></a>
</td>
<td>
Set of <a href="https://www.tensorflow.org/api_docs/python/tf/dtypes/DType"><code>tf.dtypes.DType</code></a> data types supported on the target
device. If initialized, optimization might be driven by the smallest type
in this set. (default set())
</td>
</tr><tr>
<td>
`experimental_select_user_tf_ops`<a id="experimental_select_user_tf_ops"></a>
</td>
<td>
Experimental flag, subject to change. Set
of user's TensorFlow operators' names that are required in the TensorFlow
Lite runtime. These ops will be exported as select TensorFlow ops in the
model (in conjunction with the tf.lite.OpsSet.SELECT_TF_OPS flag). This is
an advanced feature that should only be used if the client is using TF ops
that may not be linked in by default with the TF ops that are provided
when using the SELECT_TF_OPS path. The client is responsible for linking
these ops into the target runtime.
</td>
</tr><tr>
<td>
`experimental_supported_backends`<a id="experimental_supported_backends"></a>
</td>
<td>
Experimental flag, subject to change.
Set containing names of supported backends. Currently only "GPU" is
supported, more options will be available later.
</td>
</tr>
</table>
@@ -0,0 +1,53 @@
# Copyright 2026 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
toc:
- title: tf.lite
section:
- title: Overview
path: /lite/api_docs/python/tf/lite
- title: Interpreter
path: /lite/api_docs/python/tf/lite/Interpreter
- title: OpsSet
path: /lite/api_docs/python/tf/lite/OpsSet
- title: Optimize
path: /lite/api_docs/python/tf/lite/Optimize
- title: RepresentativeDataset
path: /lite/api_docs/python/tf/lite/RepresentativeDataset
- title: TFLiteConverter
path: /lite/api_docs/python/tf/lite/TFLiteConverter
- title: TargetSpec
path: /lite/api_docs/python/tf/lite/TargetSpec
- title: experimental
status: experimental
section:
- title: Overview
path: /lite/api_docs/python/tf/lite/experimental
- title: Analyzer
path: /lite/api_docs/python/tf/lite/experimental/Analyzer
- title: OpResolverType
path: /lite/api_docs/python/tf/lite/experimental/OpResolverType
- title: QuantizationDebugOptions
path: /lite/api_docs/python/tf/lite/experimental/QuantizationDebugOptions
- title: QuantizationDebugger
path: /lite/api_docs/python/tf/lite/experimental/QuantizationDebugger
- title: load_delegate
path: /lite/api_docs/python/tf/lite/experimental/load_delegate
- title: authoring
section:
- title: Overview
path: /lite/api_docs/python/tf/lite/experimental/authoring
- title: compatible
path: /lite/api_docs/python/tf/lite/experimental/authoring/compatible
@@ -0,0 +1,27 @@
page_type: reference
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
# All symbols in TensorFlow Lite
<!-- Insert buttons and diff -->
## Primary symbols
* <a href="../tf/lite"><code>tf.lite</code></a>
* <a href="../tf/lite/Interpreter"><code>tf.lite.Interpreter</code></a>
* <a href="../tf/lite/OpsSet"><code>tf.lite.OpsSet</code></a>
* <a href="../tf/lite/Optimize"><code>tf.lite.Optimize</code></a>
* <a href="../tf/lite/RepresentativeDataset"><code>tf.lite.RepresentativeDataset</code></a>
* <a href="../tf/lite/TFLiteConverter"><code>tf.lite.TFLiteConverter</code></a>
* <a href="../tf/lite/TargetSpec"><code>tf.lite.TargetSpec</code></a>
* <a href="../tf/lite/experimental"><code>tf.lite.experimental</code></a>
* <a href="../tf/lite/experimental/Analyzer"><code>tf.lite.experimental.Analyzer</code></a>
* <a href="../tf/lite/experimental/OpResolverType"><code>tf.lite.experimental.OpResolverType</code></a>
* <a href="../tf/lite/experimental/QuantizationDebugOptions"><code>tf.lite.experimental.QuantizationDebugOptions</code></a>
* <a href="../tf/lite/experimental/QuantizationDebugger"><code>tf.lite.experimental.QuantizationDebugger</code></a>
* <a href="../tf/lite/experimental/authoring"><code>tf.lite.experimental.authoring</code></a>
* <a href="../tf/lite/experimental/authoring/compatible"><code>tf.lite.experimental.authoring.compatible</code></a>
* <a href="../tf/lite/experimental/load_delegate"><code>tf.lite.experimental.load_delegate</code></a>
@@ -0,0 +1,44 @@
page_type: reference
description: Public API for tf.lite.experimental namespace.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite.experimental" />
<meta itemprop="path" content="Stable" />
</div>
# Module: tf.lite.experimental
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Public API for tf.lite.experimental namespace.
## Modules
[`authoring`](../../tf/lite/experimental/authoring) module: Public API for tf.lite.experimental.authoring namespace.
## Classes
[`class Analyzer`](../../tf/lite/experimental/Analyzer): Provides a collection of TFLite model analyzer tools.
[`class OpResolverType`](../../tf/lite/experimental/OpResolverType): Different types of op resolvers for Tensorflow Lite.
[`class QuantizationDebugOptions`](../../tf/lite/experimental/QuantizationDebugOptions): Debug options to set up a given QuantizationDebugger.
[`class QuantizationDebugger`](../../tf/lite/experimental/QuantizationDebugger): Debugger for Quantized TensorFlow Lite debug mode models.
## Functions
[`load_delegate(...)`](../../tf/lite/experimental/load_delegate): Returns loaded Delegate object.
@@ -0,0 +1,149 @@
page_type: reference
description: Provides a collection of TFLite model analyzer tools.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite.experimental.Analyzer" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="analyze"/>
</div>
# tf.lite.experimental.Analyzer
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/analyzer.py#L35-L105">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Provides a collection of TFLite model analyzer tools.
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the guide</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/guide/model_analyzer">TensorFlow Lite Model Analyzer</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
#### Example:
```python
model = tf.keras.applications.MobileNetV3Large()
fb_model = tf.lite.TFLiteConverterV2.from_keras_model(model).convert()
tf.lite.experimental.Analyzer.analyze(model_content=fb_model)
# === TFLite ModelAnalyzer ===
#
# Your TFLite model has 1 subgraph(s). In the subgraph description below,
# T# represents the Tensor numbers. For example, in Subgraph#0, the MUL op
# takes tensor #0 and tensor #19 as input and produces tensor #136 as output.
#
# Subgraph#0 main(T#0) -> [T#263]
# Op#0 MUL(T#0, T#19) -> [T#136]
# Op#1 ADD(T#136, T#18) -> [T#137]
# Op#2 CONV_2D(T#137, T#44, T#93) -> [T#138]
# Op#3 HARD_SWISH(T#138) -> [T#139]
# Op#4 DEPTHWISE_CONV_2D(T#139, T#94, T#24) -> [T#140]
# ...
```
Warning: Experimental interface, subject to change.
## Methods
<h3 id="analyze"><code>analyze</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/analyzer.py#L63-L105">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@staticmethod</code>
<code>analyze(
model_path=None, model_content=None, gpu_compatibility=False, **kwargs
)
</code></pre>
Analyzes the given tflite_model with dumping model structure.
This tool provides a way to understand users' TFLite flatbuffer model by
dumping internal graph structure. It also provides additional features
like checking GPU delegate compatibility.
Warning: Experimental interface, subject to change.
The output format is not guaranteed to stay stable, so don't
write scripts to this.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`model_path`
</td>
<td>
TFLite flatbuffer model path.
</td>
</tr><tr>
<td>
`model_content`
</td>
<td>
TFLite flatbuffer model object.
</td>
</tr><tr>
<td>
`gpu_compatibility`
</td>
<td>
Whether to check GPU delegate compatibility.
</td>
</tr><tr>
<td>
`**kwargs`
</td>
<td>
Experimental keyword arguments to analyze API.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
Print analyzed report via console output.
</td>
</tr>
</table>
@@ -0,0 +1,85 @@
page_type: reference
description: Different types of op resolvers for Tensorflow Lite.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite.experimental.OpResolverType" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="AUTO"/>
<meta itemprop="property" content="BUILTIN"/>
<meta itemprop="property" content="BUILTIN_REF"/>
<meta itemprop="property" content="BUILTIN_WITHOUT_DEFAULT_DELEGATES"/>
</div>
# tf.lite.experimental.OpResolverType
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L309-L337">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Different types of op resolvers for Tensorflow Lite.
<!-- Placeholder for "Used in" -->
* `AUTO`: Indicates the op resolver that is chosen by default in TfLite
Python, which is the "BUILTIN" as described below.
* `BUILTIN`: Indicates the op resolver for built-in ops with optimized kernel
implementation.
* `BUILTIN_REF`: Indicates the op resolver for built-in ops with reference
kernel implementation. It's generally used for testing and debugging.
* `BUILTIN_WITHOUT_DEFAULT_DELEGATES`: Indicates the op resolver for
built-in ops with optimized kernel implementation, but it will disable
the application of default TfLite delegates (like the XNNPACK delegate) to
the model graph. Generally this should not be used unless there are issues
with the default configuration.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
AUTO<a id="AUTO"></a>
</td>
<td>
`<OpResolverType.AUTO: 0>`
</td>
</tr><tr>
<td>
BUILTIN<a id="BUILTIN"></a>
</td>
<td>
`<OpResolverType.BUILTIN: 1>`
</td>
</tr><tr>
<td>
BUILTIN_REF<a id="BUILTIN_REF"></a>
</td>
<td>
`<OpResolverType.BUILTIN_REF: 2>`
</td>
</tr><tr>
<td>
BUILTIN_WITHOUT_DEFAULT_DELEGATES<a id="BUILTIN_WITHOUT_DEFAULT_DELEGATES"></a>
</td>
<td>
`<OpResolverType.BUILTIN_WITHOUT_DEFAULT_DELEGATES: 3>`
</td>
</tr>
</table>
@@ -0,0 +1,149 @@
page_type: reference
description: Debug options to set up a given QuantizationDebugger.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite.experimental.QuantizationDebugOptions" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
</div>
# tf.lite.experimental.QuantizationDebugOptions
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/tools/optimize/debugging/python/debugger.py#L56-L117">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Debug options to set up a given QuantizationDebugger.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tf.lite.experimental.QuantizationDebugOptions(
layer_debug_metrics: Optional[Mapping[str, Callable[[np.ndarray], float]]] = None,
model_debug_metrics: Optional[Mapping[str, Callable[[Sequence[np.ndarray], Sequence[np.ndarray]],
float]]] = None,
layer_direct_compare_metrics: Optional[Mapping[str, Callable[[Sequence[np.ndarray], Sequence[np.ndarray],
float, int], float]]] = None,
denylisted_ops: Optional[List[str]] = None,
denylisted_nodes: Optional[List[str]] = None,
fully_quantize: bool = False
) -> None
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/performance/quantization_debugger">Inspecting Quantization Errors with Quantization Debugger</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`layer_debug_metrics`<a id="layer_debug_metrics"></a>
</td>
<td>
a dict to specify layer debug functions
{function_name_str: function} where the function accepts result of
NumericVerify Op, which is value difference between float and
dequantized op results. The function returns single scalar value.
</td>
</tr><tr>
<td>
`model_debug_metrics`<a id="model_debug_metrics"></a>
</td>
<td>
a dict to specify model debug functions
{function_name_str: function} where the function accepts outputs from
two models, and returns single scalar value for a metric. (e.g.
accuracy, IoU)
</td>
</tr><tr>
<td>
`layer_direct_compare_metrics`<a id="layer_direct_compare_metrics"></a>
</td>
<td>
a dict to specify layer debug functions
{function_name_str: function}. The signature is different from that of
`layer_debug_metrics`, and this one gets passed (original float value,
original quantized value, scale, zero point). The function's
implementation is responsible for correctly dequantize the quantized
value to compare. Use this one when comparing diff is not enough.
(Note) quantized value is passed as int8, so cast to int32 is needed.
</td>
</tr><tr>
<td>
`denylisted_ops`<a id="denylisted_ops"></a>
</td>
<td>
a list of op names which is expected to be removed from
quantization.
</td>
</tr><tr>
<td>
`denylisted_nodes`<a id="denylisted_nodes"></a>
</td>
<td>
a list of op's output tensor names to be removed from
quantization.
</td>
</tr><tr>
<td>
`fully_quantize`<a id="fully_quantize"></a>
</td>
<td>
Bool indicating whether to fully quantize the model.
Besides model body, the input/output will be quantized as well.
Corresponding to mlir_quantize's fully_quantize parameter.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Raises</h2></th></tr>
<tr>
<td>
`ValueError`<a id="ValueError"></a>
</td>
<td>
when there are duplicate keys
</td>
</tr>
</table>
@@ -0,0 +1,302 @@
page_type: reference
description: Debugger for Quantized TensorFlow Lite debug mode models.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite.experimental.QuantizationDebugger" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="get_debug_quantized_model"/>
<meta itemprop="property" content="get_nondebug_quantized_model"/>
<meta itemprop="property" content="layer_statistics_dump"/>
<meta itemprop="property" content="run"/>
</div>
# tf.lite.experimental.QuantizationDebugger
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/tools/optimize/debugging/python/debugger.py#L120-L544">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Debugger for Quantized TensorFlow Lite debug mode models.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tf.lite.experimental.QuantizationDebugger(
quant_debug_model_path: Optional[str] = None,
quant_debug_model_content: Optional[bytes] = None,
float_model_path: Optional[str] = None,
float_model_content: Optional[bytes] = None,
debug_dataset: Optional[Callable[[], Iterable[Sequence[np.ndarray]]]] = None,
debug_options: Optional[<a href="../../../tf/lite/experimental/QuantizationDebugOptions"><code>tf.lite.experimental.QuantizationDebugOptions</code></a>] = None,
converter: Optional[TFLiteConverter] = None
) -> None
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/performance/quantization_debugger">Inspecting Quantization Errors with Quantization Debugger</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
This can run the TensorFlow Lite converted models equipped with debug ops and
collect debug information. This debugger calculates statistics from
user-defined post-processing functions as well as default ones.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`quant_debug_model_path`<a id="quant_debug_model_path"></a>
</td>
<td>
Path to the quantized debug TFLite model file.
</td>
</tr><tr>
<td>
`quant_debug_model_content`<a id="quant_debug_model_content"></a>
</td>
<td>
Content of the quantized debug TFLite model.
</td>
</tr><tr>
<td>
`float_model_path`<a id="float_model_path"></a>
</td>
<td>
Path to float TFLite model file.
</td>
</tr><tr>
<td>
`float_model_content`<a id="float_model_content"></a>
</td>
<td>
Content of the float TFLite model.
</td>
</tr><tr>
<td>
`debug_dataset`<a id="debug_dataset"></a>
</td>
<td>
a factory function that returns dataset generator which is
used to generate input samples (list of np.ndarray) for the model. The
generated elements must have same types and shape as inputs to the
model.
</td>
</tr><tr>
<td>
`debug_options`<a id="debug_options"></a>
</td>
<td>
Debug options to debug the given model.
</td>
</tr><tr>
<td>
`converter`<a id="converter"></a>
</td>
<td>
Optional, use converter instead of quantized model.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Raises</h2></th></tr>
<tr>
<td>
`ValueError`<a id="ValueError"></a>
</td>
<td>
If the debugger was unable to be created.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`options`<a id="options"></a>
</td>
<td>
</td>
</tr>
</table>
## Methods
<h3 id="get_debug_quantized_model"><code>get_debug_quantized_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/tools/optimize/debugging/python/debugger.py#L261-L273">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_debug_quantized_model() -> bytes
</code></pre>
Returns an instrumented quantized model.
Convert the quantized model with the initialized converter and
return bytes for model. The model will be instrumented with numeric
verification operations and should only be used for debugging.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
Model bytes corresponding to the model.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr>
<td>
`ValueError`
</td>
<td>
if converter is not passed to the debugger.
</td>
</tr>
</table>
<h3 id="get_nondebug_quantized_model"><code>get_nondebug_quantized_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/tools/optimize/debugging/python/debugger.py#L247-L259">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_nondebug_quantized_model() -> bytes
</code></pre>
Returns a non-instrumented quantized model.
Convert the quantized model with the initialized converter and
return bytes for nondebug model. The model will not be instrumented with
numeric verification operations.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
Model bytes corresponding to the model.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr>
<td>
`ValueError`
</td>
<td>
if converter is not passed to the debugger.
</td>
</tr>
</table>
<h3 id="layer_statistics_dump"><code>layer_statistics_dump</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/tools/optimize/debugging/python/debugger.py#L521-L544">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>layer_statistics_dump(
file: IO[str]
) -> None
</code></pre>
Dumps layer statistics into file, in csv format.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`file`
</td>
<td>
file, or file-like object to write.
</td>
</tr>
</table>
<h3 id="run"><code>run</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/tools/optimize/debugging/python/debugger.py#L326-L330">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>run() -> None
</code></pre>
Runs models and gets metrics.
@@ -0,0 +1,30 @@
page_type: reference
description: Public API for tf.lite.experimental.authoring namespace.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite.experimental.authoring" />
<meta itemprop="path" content="Stable" />
</div>
# Module: tf.lite.experimental.authoring
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Public API for tf.lite.experimental.authoring namespace.
## Functions
[`compatible(...)`](../../../tf/lite/experimental/authoring/compatible): Wraps <a href="https://www.tensorflow.org/api_docs/python/tf/function"><code>tf.function</code></a> into a callable function with TFLite compatibility checking.
@@ -0,0 +1,125 @@
page_type: reference
description: Wraps tf.function into a callable function with TFLite compatibility checking.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite.experimental.authoring.compatible" />
<meta itemprop="path" content="Stable" />
</div>
# tf.lite.experimental.authoring.compatible
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/authoring/authoring.py#L268-L306">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Wraps <a href="https://www.tensorflow.org/api_docs/python/tf/function"><code>tf.function</code></a> into a callable function with TFLite compatibility checking.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tf.lite.experimental.authoring.compatible(
target=None, converter_target_spec=None, **kwargs
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the guide</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/guide/authoring">TFLite Authoring Tool</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
#### Example:
```python
@tf.lite.experimental.authoring.compatible
@tf.function(input_signature=[
tf.TensorSpec(shape=[None], dtype=tf.float32)
])
def f(x):
return tf.cosh(x)
result = f(tf.constant([0.0]))
# COMPATIBILITY WARNING: op 'tf.Cosh' require(s) "Select TF Ops" for model
# conversion for TensorFlow Lite.
# Op: tf.Cosh
# - tensorflow/python/framework/op_def_library.py:748
# - tensorflow/python/ops/gen_math_ops.py:2458
# - <stdin>:6
```
Warning: Experimental interface, subject to change.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`target`<a id="target"></a>
</td>
<td>
A <a href="https://www.tensorflow.org/api_docs/python/tf/function"><code>tf.function</code></a> to decorate.
</td>
</tr><tr>
<td>
`converter_target_spec`<a id="converter_target_spec"></a>
</td>
<td>
target_spec of TFLite converter parameter.
</td>
</tr><tr>
<td>
`**kwargs`<a id="**kwargs"></a>
</td>
<td>
The keyword arguments of the decorator class _Compatible.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Returns</h2></th></tr>
<tr class="alt">
<td colspan="2">
A callable object of `tf.lite.experimental.authoring._Compatible`.
</td>
</tr>
</table>
@@ -0,0 +1,128 @@
page_type: reference
description: Returns loaded Delegate object.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf.lite.experimental.load_delegate" />
<meta itemprop="path" content="Stable" />
</div>
# tf.lite.experimental.load_delegate
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.11.0/tensorflow/lite/python/interpreter.py#L133-L178">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Returns loaded Delegate object.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tf.lite.experimental.load_delegate(
library, options=None
)
</code></pre>
<!-- Placeholder for "Used in" -->
#### Example usage:
```
import tensorflow as tf
try:
delegate = tf.lite.experimental.load_delegate('delegate.so')
except ValueError:
// Fallback to CPU
if delegate:
interpreter = tf.lite.Interpreter(
model_path='model.tflite',
experimental_delegates=[delegate])
else:
interpreter = tf.lite.Interpreter(model_path='model.tflite')
```
This is typically used to leverage EdgeTPU for running TensorFlow Lite models.
For more information see: <a href="https://coral.ai/docs/edgetpu/tflite-python/">https://coral.ai/docs/edgetpu/tflite-python/</a>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`library`<a id="library"></a>
</td>
<td>
Name of shared library containing the
[TfLiteDelegate](https://www.tensorflow.org/lite/performance/delegates).
</td>
</tr><tr>
<td>
`options`<a id="options"></a>
</td>
<td>
Dictionary of options that are required to load the delegate. All
keys and values in the dictionary should be convertible to str. Consult
the documentation of the specific delegate for required and legal options.
(default None)
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Returns</h2></th></tr>
<tr class="alt">
<td colspan="2">
Delegate object.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Raises</h2></th></tr>
<tr>
<td>
`ValueError`<a id="ValueError"></a>
</td>
<td>
Delegate failed to load.
</td>
</tr><tr>
<td>
`RuntimeError`<a id="RuntimeError"></a>
</td>
<td>
If delegate loading is used on unsupported platform.
</td>
</tr>
</table>
@@ -0,0 +1,94 @@
page_type: reference
description: Public APIs for TFLite Model Maker, a transfer learning library to train custom TFLite models.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__version__"/>
</div>
# Module: tflite_model_maker
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/tflmm/v0.4.2/tensorflow_examples/lite/model_maker/public/__init__.py">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Public APIs for TFLite Model Maker, a transfer learning library to train custom TFLite models.
You can install the package with
```bash
pip install tflite-model-maker
```
Typical usage of Model Maker is to create a model in a few lines of code, e.g.:
```python
# Load input data specific to an on-device ML app.
data = DataLoader.from_folder('flower_photos/')
train_data, test_data = data.split(0.9)
# Customize the TensorFlow model.
model = image_classifier.create(train_data)
# Evaluate the model.
accuracy = model.evaluate(test_data)
# Export to Tensorflow Lite model and label file in `export_dir`.
model.export(export_dir='/tmp/')
```
For more details, please refer to our guide:
<a href="https://www.tensorflow.org/lite/guide/model_maker">https://www.tensorflow.org/lite/guide/model_maker</a>
## Modules
[`audio_classifier`](./tflite_model_maker/audio_classifier) module: APIs to train an audio classification model.
[`config`](./tflite_model_maker/config) module: APIs for the config of TFLite Model Maker.
[`image_classifier`](./tflite_model_maker/image_classifier) module: APIs to train an image classification model.
[`model_spec`](./tflite_model_maker/model_spec) module: APIs for the model spec of TFLite Model Maker.
[`object_detector`](./tflite_model_maker/object_detector) module: APIs to train an object detection model.
[`question_answer`](./tflite_model_maker/question_answer) module: APIs to train a model that can answer questions based on a predefined text.
[`recommendation`](./tflite_model_maker/recommendation) module: APIs to train an on-device recommendation model.
[`searcher`](./tflite_model_maker/searcher) module: APIs to create the searcher model.
[`text_classifier`](./tflite_model_maker/text_classifier) module: APIs to train a text classification model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Other Members</h2></th></tr>
<tr>
<td>
__version__<a id="__version__"></a>
</td>
<td>
`'0.4.2'`
</td>
</tr>
</table>
@@ -0,0 +1,177 @@
# Copyright 2026 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
toc:
- title: tflite_model_maker
section:
- title: Overview
path: /lite/api_docs/python/tflite_model_maker
- title: audio_classifier
section:
- title: Overview
path: /lite/api_docs/python/tflite_model_maker/audio_classifier
- title: AudioClassifier
path: /lite/api_docs/python/tflite_model_maker/audio_classifier/AudioClassifier
- title: BrowserFftSpec
path: /lite/api_docs/python/tflite_model_maker/audio_classifier/BrowserFftSpec
- title: DataLoader
path: /lite/api_docs/python/tflite_model_maker/audio_classifier/DataLoader
- title: YamNetSpec
path: /lite/api_docs/python/tflite_model_maker/audio_classifier/YamNetSpec
- title: create
path: /lite/api_docs/python/tflite_model_maker/audio_classifier/create
- title: config
section:
- title: Overview
path: /lite/api_docs/python/tflite_model_maker/config
- title: ExportFormat
path: /lite/api_docs/python/tflite_model_maker/config/ExportFormat
- title: QuantizationConfig
path: /lite/api_docs/python/tflite_model_maker/config/QuantizationConfig
- title: image_classifier
section:
- title: Overview
path: /lite/api_docs/python/tflite_model_maker/image_classifier
- title: DataLoader
path: /lite/api_docs/python/tflite_model_maker/image_classifier/DataLoader
- title: EfficientNetLite0Spec
path: /lite/api_docs/python/tflite_model_maker/image_classifier/EfficientNetLite0Spec
- title: EfficientNetLite1Spec
path: /lite/api_docs/python/tflite_model_maker/image_classifier/EfficientNetLite1Spec
- title: EfficientNetLite2Spec
path: /lite/api_docs/python/tflite_model_maker/image_classifier/EfficientNetLite2Spec
- title: EfficientNetLite3Spec
path: /lite/api_docs/python/tflite_model_maker/image_classifier/EfficientNetLite3Spec
- title: EfficientNetLite4Spec
path: /lite/api_docs/python/tflite_model_maker/image_classifier/EfficientNetLite4Spec
- title: ImageClassifier
path: /lite/api_docs/python/tflite_model_maker/image_classifier/ImageClassifier
- title: MobileNetV2Spec
path: /lite/api_docs/python/tflite_model_maker/image_classifier/MobileNetV2Spec
- title: ModelSpec
path: /lite/api_docs/python/tflite_model_maker/image_classifier/ModelSpec
- title: Resnet50Spec
path: /lite/api_docs/python/tflite_model_maker/image_classifier/Resnet50Spec
- title: create
path: /lite/api_docs/python/tflite_model_maker/image_classifier/create
- title: model_spec
section:
- title: Overview
path: /lite/api_docs/python/tflite_model_maker/model_spec
- title: get
path: /lite/api_docs/python/tflite_model_maker/model_spec/get
- title: object_detector
section:
- title: Overview
path: /lite/api_docs/python/tflite_model_maker/object_detector
- title: DataLoader
path: /lite/api_docs/python/tflite_model_maker/object_detector/DataLoader
- title: EfficientDetLite0Spec
path: /lite/api_docs/python/tflite_model_maker/object_detector/EfficientDetLite0Spec
- title: EfficientDetLite1Spec
path: /lite/api_docs/python/tflite_model_maker/object_detector/EfficientDetLite1Spec
- title: EfficientDetLite2Spec
path: /lite/api_docs/python/tflite_model_maker/object_detector/EfficientDetLite2Spec
- title: EfficientDetLite3Spec
path: /lite/api_docs/python/tflite_model_maker/object_detector/EfficientDetLite3Spec
- title: EfficientDetLite4Spec
path: /lite/api_docs/python/tflite_model_maker/object_detector/EfficientDetLite4Spec
- title: EfficientDetSpec
path: /lite/api_docs/python/tflite_model_maker/object_detector/EfficientDetSpec
- title: ObjectDetector
path: /lite/api_docs/python/tflite_model_maker/object_detector/ObjectDetector
- title: create
path: /lite/api_docs/python/tflite_model_maker/object_detector/create
- title: question_answer
section:
- title: Overview
path: /lite/api_docs/python/tflite_model_maker/question_answer
- title: BertQaSpec
path: /lite/api_docs/python/tflite_model_maker/question_answer/BertQaSpec
- title: DataLoader
path: /lite/api_docs/python/tflite_model_maker/question_answer/DataLoader
- title: MobileBertQaSpec
path: /lite/api_docs/python/tflite_model_maker/question_answer/MobileBertQaSpec
- title: MobileBertQaSquadSpec
path: /lite/api_docs/python/tflite_model_maker/question_answer/MobileBertQaSquadSpec
- title: QuestionAnswer
path: /lite/api_docs/python/tflite_model_maker/question_answer/QuestionAnswer
- title: create
path: /lite/api_docs/python/tflite_model_maker/question_answer/create
- title: recommendation
section:
- title: Overview
path: /lite/api_docs/python/tflite_model_maker/recommendation
- title: DataLoader
path: /lite/api_docs/python/tflite_model_maker/recommendation/DataLoader
- title: ModelSpec
path: /lite/api_docs/python/tflite_model_maker/recommendation/ModelSpec
- title: Recommendation
path: /lite/api_docs/python/tflite_model_maker/recommendation/Recommendation
- title: create
path: /lite/api_docs/python/tflite_model_maker/recommendation/create
- title: spec
section:
- title: Overview
path: /lite/api_docs/python/tflite_model_maker/recommendation/spec
- title: Feature
path: /lite/api_docs/python/tflite_model_maker/recommendation/spec/Feature
- title: FeatureGroup
path: /lite/api_docs/python/tflite_model_maker/recommendation/spec/FeatureGroup
- title: InputSpec
path: /lite/api_docs/python/tflite_model_maker/recommendation/spec/InputSpec
- title: ModelHParams
path: /lite/api_docs/python/tflite_model_maker/recommendation/spec/ModelHParams
- title: searcher
section:
- title: Overview
path: /lite/api_docs/python/tflite_model_maker/searcher
- title: DataLoader
path: /lite/api_docs/python/tflite_model_maker/searcher/DataLoader
- title: ExportFormat
path: /lite/api_docs/python/tflite_model_maker/searcher/ExportFormat
- title: ImageDataLoader
path: /lite/api_docs/python/tflite_model_maker/searcher/ImageDataLoader
- title: MetadataType
path: /lite/api_docs/python/tflite_model_maker/searcher/MetadataType
- title: ScaNNOptions
path: /lite/api_docs/python/tflite_model_maker/searcher/ScaNNOptions
- title: ScoreAH
path: /lite/api_docs/python/tflite_model_maker/searcher/ScoreAH
- title: ScoreBruteForce
path: /lite/api_docs/python/tflite_model_maker/searcher/ScoreBruteForce
- title: Searcher
path: /lite/api_docs/python/tflite_model_maker/searcher/Searcher
- title: TextDataLoader
path: /lite/api_docs/python/tflite_model_maker/searcher/TextDataLoader
- title: Tree
path: /lite/api_docs/python/tflite_model_maker/searcher/Tree
- title: text_classifier
section:
- title: Overview
path: /lite/api_docs/python/tflite_model_maker/text_classifier
- title: AverageWordVecSpec
path: /lite/api_docs/python/tflite_model_maker/text_classifier/AverageWordVecSpec
- title: BertClassifierSpec
path: /lite/api_docs/python/tflite_model_maker/text_classifier/BertClassifierSpec
- title: DataLoader
path: /lite/api_docs/python/tflite_model_maker/text_classifier/DataLoader
- title: MobileBertClassifierSpec
path: /lite/api_docs/python/tflite_model_maker/text_classifier/MobileBertClassifierSpec
- title: TextClassifier
path: /lite/api_docs/python/tflite_model_maker/text_classifier/TextClassifier
- title: create
path: /lite/api_docs/python/tflite_model_maker/text_classifier/create
status: experimental
@@ -0,0 +1,81 @@
page_type: reference
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
# All symbols in TensorFlow Lite Model Maker
<!-- Insert buttons and diff -->
## Primary symbols
* <a href="../tflite_model_maker"><code>tflite_model_maker</code></a>
* <a href="../tflite_model_maker/audio_classifier"><code>tflite_model_maker.audio_classifier</code></a>
* <a href="../tflite_model_maker/audio_classifier/AudioClassifier"><code>tflite_model_maker.audio_classifier.AudioClassifier</code></a>
* <a href="../tflite_model_maker/audio_classifier/BrowserFftSpec"><code>tflite_model_maker.audio_classifier.BrowserFftSpec</code></a>
* <a href="../tflite_model_maker/audio_classifier/DataLoader"><code>tflite_model_maker.audio_classifier.DataLoader</code></a>
* <a href="../tflite_model_maker/audio_classifier/YamNetSpec"><code>tflite_model_maker.audio_classifier.YamNetSpec</code></a>
* <a href="../tflite_model_maker/audio_classifier/create"><code>tflite_model_maker.audio_classifier.create</code></a>
* <a href="../tflite_model_maker/config"><code>tflite_model_maker.config</code></a>
* <a href="../tflite_model_maker/config/ExportFormat"><code>tflite_model_maker.config.ExportFormat</code></a>
* <a href="../tflite_model_maker/config/QuantizationConfig"><code>tflite_model_maker.config.QuantizationConfig</code></a>
* <a href="../tflite_model_maker/image_classifier"><code>tflite_model_maker.image_classifier</code></a>
* <a href="../tflite_model_maker/image_classifier/DataLoader"><code>tflite_model_maker.image_classifier.DataLoader</code></a>
* <a href="../tflite_model_maker/image_classifier/EfficientNetLite0Spec"><code>tflite_model_maker.image_classifier.EfficientNetLite0Spec</code></a>
* <a href="../tflite_model_maker/image_classifier/EfficientNetLite1Spec"><code>tflite_model_maker.image_classifier.EfficientNetLite1Spec</code></a>
* <a href="../tflite_model_maker/image_classifier/EfficientNetLite2Spec"><code>tflite_model_maker.image_classifier.EfficientNetLite2Spec</code></a>
* <a href="../tflite_model_maker/image_classifier/EfficientNetLite3Spec"><code>tflite_model_maker.image_classifier.EfficientNetLite3Spec</code></a>
* <a href="../tflite_model_maker/image_classifier/EfficientNetLite4Spec"><code>tflite_model_maker.image_classifier.EfficientNetLite4Spec</code></a>
* <a href="../tflite_model_maker/image_classifier/ImageClassifier"><code>tflite_model_maker.image_classifier.ImageClassifier</code></a>
* <a href="../tflite_model_maker/image_classifier/MobileNetV2Spec"><code>tflite_model_maker.image_classifier.MobileNetV2Spec</code></a>
* <a href="../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>
* <a href="../tflite_model_maker/image_classifier/Resnet50Spec"><code>tflite_model_maker.image_classifier.Resnet50Spec</code></a>
* <a href="../tflite_model_maker/image_classifier/create"><code>tflite_model_maker.image_classifier.create</code></a>
* <a href="../tflite_model_maker/model_spec"><code>tflite_model_maker.model_spec</code></a>
* <a href="../tflite_model_maker/model_spec/get"><code>tflite_model_maker.model_spec.get</code></a>
* <a href="../tflite_model_maker/object_detector"><code>tflite_model_maker.object_detector</code></a>
* <a href="../tflite_model_maker/object_detector/DataLoader"><code>tflite_model_maker.object_detector.DataLoader</code></a>
* <a href="../tflite_model_maker/object_detector/EfficientDetLite0Spec"><code>tflite_model_maker.object_detector.EfficientDetLite0Spec</code></a>
* <a href="../tflite_model_maker/object_detector/EfficientDetLite1Spec"><code>tflite_model_maker.object_detector.EfficientDetLite1Spec</code></a>
* <a href="../tflite_model_maker/object_detector/EfficientDetLite2Spec"><code>tflite_model_maker.object_detector.EfficientDetLite2Spec</code></a>
* <a href="../tflite_model_maker/object_detector/EfficientDetLite3Spec"><code>tflite_model_maker.object_detector.EfficientDetLite3Spec</code></a>
* <a href="../tflite_model_maker/object_detector/EfficientDetLite4Spec"><code>tflite_model_maker.object_detector.EfficientDetLite4Spec</code></a>
* <a href="../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>
* <a href="../tflite_model_maker/object_detector/ObjectDetector"><code>tflite_model_maker.object_detector.ObjectDetector</code></a>
* <a href="../tflite_model_maker/object_detector/create"><code>tflite_model_maker.object_detector.create</code></a>
* <a href="../tflite_model_maker/question_answer"><code>tflite_model_maker.question_answer</code></a>
* <a href="../tflite_model_maker/question_answer/BertQaSpec"><code>tflite_model_maker.question_answer.BertQaSpec</code></a>
* <a href="../tflite_model_maker/question_answer/DataLoader"><code>tflite_model_maker.question_answer.DataLoader</code></a>
* <a href="../tflite_model_maker/question_answer/MobileBertQaSpec"><code>tflite_model_maker.question_answer.MobileBertQaSpec</code></a>
* <a href="../tflite_model_maker/question_answer/MobileBertQaSquadSpec"><code>tflite_model_maker.question_answer.MobileBertQaSquadSpec</code></a>
* <a href="../tflite_model_maker/question_answer/QuestionAnswer"><code>tflite_model_maker.question_answer.QuestionAnswer</code></a>
* <a href="../tflite_model_maker/question_answer/create"><code>tflite_model_maker.question_answer.create</code></a>
* <a href="../tflite_model_maker/recommendation"><code>tflite_model_maker.recommendation</code></a>
* <a href="../tflite_model_maker/recommendation/DataLoader"><code>tflite_model_maker.recommendation.DataLoader</code></a>
* <a href="../tflite_model_maker/recommendation/ModelSpec"><code>tflite_model_maker.recommendation.ModelSpec</code></a>
* <a href="../tflite_model_maker/recommendation/Recommendation"><code>tflite_model_maker.recommendation.Recommendation</code></a>
* <a href="../tflite_model_maker/recommendation/create"><code>tflite_model_maker.recommendation.create</code></a>
* <a href="../tflite_model_maker/recommendation/spec"><code>tflite_model_maker.recommendation.spec</code></a>
* <a href="../tflite_model_maker/recommendation/spec/Feature"><code>tflite_model_maker.recommendation.spec.Feature</code></a>
* <a href="../tflite_model_maker/recommendation/spec/FeatureGroup"><code>tflite_model_maker.recommendation.spec.FeatureGroup</code></a>
* <a href="../tflite_model_maker/recommendation/spec/InputSpec"><code>tflite_model_maker.recommendation.spec.InputSpec</code></a>
* <a href="../tflite_model_maker/recommendation/spec/ModelHParams"><code>tflite_model_maker.recommendation.spec.ModelHParams</code></a>
* <a href="../tflite_model_maker/searcher"><code>tflite_model_maker.searcher</code></a>
* <a href="../tflite_model_maker/searcher/DataLoader"><code>tflite_model_maker.searcher.DataLoader</code></a>
* <a href="../tflite_model_maker/searcher/ExportFormat"><code>tflite_model_maker.searcher.ExportFormat</code></a>
* <a href="../tflite_model_maker/searcher/ImageDataLoader"><code>tflite_model_maker.searcher.ImageDataLoader</code></a>
* <a href="../tflite_model_maker/searcher/MetadataType"><code>tflite_model_maker.searcher.MetadataType</code></a>
* <a href="../tflite_model_maker/searcher/ScaNNOptions"><code>tflite_model_maker.searcher.ScaNNOptions</code></a>
* <a href="../tflite_model_maker/searcher/ScoreAH"><code>tflite_model_maker.searcher.ScoreAH</code></a>
* <a href="../tflite_model_maker/searcher/ScoreBruteForce"><code>tflite_model_maker.searcher.ScoreBruteForce</code></a>
* <a href="../tflite_model_maker/searcher/Searcher"><code>tflite_model_maker.searcher.Searcher</code></a>
* <a href="../tflite_model_maker/searcher/TextDataLoader"><code>tflite_model_maker.searcher.TextDataLoader</code></a>
* <a href="../tflite_model_maker/searcher/Tree"><code>tflite_model_maker.searcher.Tree</code></a>
* <a href="../tflite_model_maker/text_classifier"><code>tflite_model_maker.text_classifier</code></a>
* <a href="../tflite_model_maker/text_classifier/AverageWordVecSpec"><code>tflite_model_maker.text_classifier.AverageWordVecSpec</code></a>
* <a href="../tflite_model_maker/text_classifier/BertClassifierSpec"><code>tflite_model_maker.text_classifier.BertClassifierSpec</code></a>
* <a href="../tflite_model_maker/text_classifier/DataLoader"><code>tflite_model_maker.text_classifier.DataLoader</code></a>
* <a href="../tflite_model_maker/text_classifier/MobileBertClassifierSpec"><code>tflite_model_maker.text_classifier.MobileBertClassifierSpec</code></a>
* <a href="../tflite_model_maker/text_classifier/TextClassifier"><code>tflite_model_maker.text_classifier.TextClassifier</code></a>
* <a href="../tflite_model_maker/text_classifier/create"><code>tflite_model_maker.text_classifier.create</code></a>
@@ -0,0 +1,55 @@
page_type: reference
description: APIs to train an audio classification model.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.audio_classifier" />
<meta itemprop="path" content="Stable" />
</div>
# Module: tflite_model_maker.audio_classifier
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/tflmm/v0.4.2/tensorflow_examples/lite/model_maker/public/audio_classifier/__init__.py">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
APIs to train an audio classification model.
#### Tutorial:
<a href="https://colab.research.google.com/github/googlecodelabs/odml-pathways/blob/main/audio_classification/colab/model_maker_audio_colab.ipynb">https://colab.research.google.com/github/googlecodelabs/odml-pathways/blob/main/audio_classification/colab/model_maker_audio_colab.ipynb</a>
#### Demo code:
<a href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/demo/audio_classification_demo.py">https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/demo/audio_classification_demo.py</a>
## Classes
[`class AudioClassifier`](../tflite_model_maker/audio_classifier/AudioClassifier): Audio classifier for training/inference and exporing.
[`class BrowserFftSpec`](../tflite_model_maker/audio_classifier/BrowserFftSpec): Model good at detecting speech commands, using Browser FFT spectrum.
[`class DataLoader`](../tflite_model_maker/audio_classifier/DataLoader): DataLoader for audio tasks.
[`class YamNetSpec`](../tflite_model_maker/audio_classifier/YamNetSpec): Model good at detecting environmental sounds, using YAMNet embedding.
## Functions
[`create(...)`](../tflite_model_maker/audio_classifier/create): Loads data and retrains the model.
@@ -0,0 +1,550 @@
page_type: reference
description: Audio classifier for training/inference and exporing.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.audio_classifier.AudioClassifier" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="confusion_matrix"/>
<meta itemprop="property" content="create"/>
<meta itemprop="property" content="create_model"/>
<meta itemprop="property" content="create_serving_model"/>
<meta itemprop="property" content="evaluate"/>
<meta itemprop="property" content="evaluate_tflite"/>
<meta itemprop="property" content="export"/>
<meta itemprop="property" content="predict_top_k"/>
<meta itemprop="property" content="summary"/>
<meta itemprop="property" content="train"/>
<meta itemprop="property" content="ALLOWED_EXPORT_FORMAT"/>
<meta itemprop="property" content="DEFAULT_EXPORT_FORMAT"/>
</div>
# tflite_model_maker.audio_classifier.AudioClassifier
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/audio_classifier.py#L27-L140">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Audio classifier for training/inference and exporing.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.audio_classifier.AudioClassifier(
model_spec, index_to_label, shuffle, train_whole_model
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_spec`<a id="model_spec"></a>
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`index_to_label`<a id="index_to_label"></a>
</td>
<td>
A list that map from index to label class name.
</td>
</tr><tr>
<td>
`shuffle`<a id="shuffle"></a>
</td>
<td>
Whether the data should be shuffled.
</td>
</tr><tr>
<td>
`train_whole_model`<a id="train_whole_model"></a>
</td>
<td>
If true, the Hub module is trained together with the
classification layer on top. Otherwise, only train the top
classification layer.
</td>
</tr>
</table>
## Methods
<h3 id="confusion_matrix"><code>confusion_matrix</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/audio_classifier.py#L86-L101">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>confusion_matrix(
data, batch_size=32
)
</code></pre>
<h3 id="create"><code>create</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/audio_classifier.py#L103-L140">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>create(
train_data,
model_spec,
validation_data=None,
batch_size=32,
epochs=5,
model_dir=None,
do_train=True,
train_whole_model=False
)
</code></pre>
Loads data and retrains the model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`train_data`
</td>
<td>
A instance of audio_dataloader.DataLoader class.
</td>
</tr><tr>
<td>
`model_spec`
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`validation_data`
</td>
<td>
Validation DataLoader. If None, skips validation process.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
Number of samples per training step. If `use_hub_library` is
False, it represents the base learning rate when train batch size is 256
and it's linear to the batch size.
</td>
</tr><tr>
<td>
`epochs`
</td>
<td>
Number of epochs for training.
</td>
</tr><tr>
<td>
`model_dir`
</td>
<td>
The location of the model checkpoint files.
</td>
</tr><tr>
<td>
`do_train`
</td>
<td>
Whether to run training.
</td>
</tr><tr>
<td>
`train_whole_model`
</td>
<td>
Boolean. By default, only the classification head is
trained. When True, the base model is also trained.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
An instance based on AudioClassifier.
</td>
</tr>
</table>
<h3 id="create_model"><code>create_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/audio_classifier.py#L59-L62">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_model(
num_classes, train_whole_model
)
</code></pre>
<h3 id="create_serving_model"><code>create_serving_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L170-L176">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_serving_model()
</code></pre>
Returns the underlining Keras model for serving.
<h3 id="evaluate"><code>evaluate</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/classification_model.py#L53-L65">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate(
data, batch_size=32
)
</code></pre>
Evaluates the model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`data`
</td>
<td>
Data to be evaluated.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
Number of samples per evaluation step.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
The loss value and accuracy.
</td>
</tr>
</table>
<h3 id="evaluate_tflite"><code>evaluate_tflite</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/classification_model.py#L105-L143">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate_tflite(
tflite_filepath, data, postprocess_fn=None
)
</code></pre>
Evaluates the tflite model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`tflite_filepath`
</td>
<td>
File path to the TFLite model.
</td>
</tr><tr>
<td>
`data`
</td>
<td>
Data to be evaluated.
</td>
</tr><tr>
<td>
`postprocess_fn`
</td>
<td>
Postprocessing function that will be applied to the output
of `lite_runner.run` before calculating the probabilities.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
The evaluation result of TFLite model - accuracy.
</td>
</tr>
</table>
<h3 id="export"><code>export</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L95-L168">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>export(
export_dir,
tflite_filename=&#x27;model.tflite&#x27;,
label_filename=&#x27;labels.txt&#x27;,
vocab_filename=&#x27;vocab.txt&#x27;,
saved_model_filename=&#x27;saved_model&#x27;,
tfjs_folder_name=&#x27;tfjs&#x27;,
export_format=None,
**kwargs
)
</code></pre>
Converts the retrained model based on `export_format`.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`export_dir`
</td>
<td>
The directory to save exported files.
</td>
</tr><tr>
<td>
`tflite_filename`
</td>
<td>
File name to save tflite model. The full export path is
{export_dir}/{tflite_filename}.
</td>
</tr><tr>
<td>
`label_filename`
</td>
<td>
File name to save labels. The full export path is
{export_dir}/{label_filename}.
</td>
</tr><tr>
<td>
`vocab_filename`
</td>
<td>
File name to save vocabulary. The full export path is
{export_dir}/{vocab_filename}.
</td>
</tr><tr>
<td>
`saved_model_filename`
</td>
<td>
Path to SavedModel or H5 file to save the model. The
full export path is
{export_dir}/{saved_model_filename}/{saved_model.pb|assets|variables}.
</td>
</tr><tr>
<td>
`tfjs_folder_name`
</td>
<td>
Folder name to save tfjs model. The full export path is
{export_dir}/{tfjs_folder_name}.
</td>
</tr><tr>
<td>
`export_format`
</td>
<td>
List of export format that could be saved_model, tflite,
label, vocab.
</td>
</tr><tr>
<td>
`**kwargs`
</td>
<td>
Other parameters like `quantized_config` for TFLITE model.
</td>
</tr>
</table>
<h3 id="predict_top_k"><code>predict_top_k</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/classification_model.py#L67-L95">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>predict_top_k(
data, k=1, batch_size=32
)
</code></pre>
Predicts the top-k predictions.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`data`
</td>
<td>
Data to be evaluated. Either an instance of DataLoader or just raw
data entries such TF tensor or numpy array.
</td>
</tr><tr>
<td>
`k`
</td>
<td>
Number of top results to be predicted.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
Number of samples per evaluation step.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
top k results. Each one is (label, probability).
</td>
</tr>
</table>
<h3 id="summary"><code>summary</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L65-L66">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>summary()
</code></pre>
<h3 id="train"><code>train</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/audio_classifier.py#L36-L57">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>train(
train_data, validation_data, epochs, batch_size
)
</code></pre>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
ALLOWED_EXPORT_FORMAT<a id="ALLOWED_EXPORT_FORMAT"></a>
</td>
<td>
`(<ExportFormat.LABEL: 'LABEL'>,
<ExportFormat.TFLITE: 'TFLITE'>,
<ExportFormat.SAVED_MODEL: 'SAVED_MODEL'>)`
</td>
</tr><tr>
<td>
DEFAULT_EXPORT_FORMAT<a id="DEFAULT_EXPORT_FORMAT"></a>
</td>
<td>
`<ExportFormat.TFLITE: 'TFLITE'>`
</td>
</tr>
</table>
@@ -0,0 +1,270 @@
page_type: reference
description: Model good at detecting speech commands, using Browser FFT spectrum.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.audio_classifier.BrowserFftSpec" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="create_model"/>
<meta itemprop="property" content="create_serving_model"/>
<meta itemprop="property" content="export_tflite"/>
<meta itemprop="property" content="get_default_quantization_config"/>
<meta itemprop="property" content="preprocess_ds"/>
<meta itemprop="property" content="run_classifier"/>
<meta itemprop="property" content="EXPECTED_WAVEFORM_LENGTH"/>
</div>
# tflite_model_maker.audio_classifier.BrowserFftSpec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/audio_spec.py#L216-L408">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Model good at detecting speech commands, using Browser FFT spectrum.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.audio_classifier.BrowserFftSpec(
model_dir=None, strategy=None
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/speech_recognition">Retrain a speech recognition model with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location to save the model checkpoint files.
</td>
</tr><tr>
<td>
`strategy`<a id="strategy"></a>
</td>
<td>
An instance of TF distribute strategy. If none, it will use the
default strategy (either SingleDeviceStrategy or the current scoped
strategy.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`target_sample_rate`<a id="target_sample_rate"></a>
</td>
<td>
</td>
</tr>
</table>
## Methods
<h3 id="create_model"><code>create_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/audio_spec.py#L308-L324">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_model(
num_classes, train_whole_model=False
)
</code></pre>
<h3 id="create_serving_model"><code>create_serving_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/audio_spec.py#L334-L341">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_serving_model(
training_model
)
</code></pre>
Create a model for serving.
<h3 id="export_tflite"><code>export_tflite</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/audio_spec.py#L368-L408">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>export_tflite(
model,
tflite_filepath,
with_metadata=True,
export_metadata_json_file=True,
index_to_label=None,
quantization_config=None
)
</code></pre>
Converts the retrained model to tflite format and saves it.
This method overrides the default `CustomModel._export_tflite` method, and
include the pre-processing in the exported TFLite library since support
library can't handle audio tasks yet.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`model`
</td>
<td>
An instance of the keras classification model to be exported.
</td>
</tr><tr>
<td>
`tflite_filepath`
</td>
<td>
File path to save tflite model.
</td>
</tr><tr>
<td>
`with_metadata`
</td>
<td>
Whether the output tflite model contains metadata.
</td>
</tr><tr>
<td>
`export_metadata_json_file`
</td>
<td>
Whether to export metadata in json file. If
True, export the metadata in the same directory as tflite model.Used
only if `with_metadata` is True.
</td>
</tr><tr>
<td>
`index_to_label`
</td>
<td>
A list that map from index to label class name.
</td>
</tr><tr>
<td>
`quantization_config`
</td>
<td>
Configuration for post-training quantization.
</td>
</tr>
</table>
<h3 id="get_default_quantization_config"><code>get_default_quantization_config</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/audio_spec.py#L169-L171">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_default_quantization_config()
</code></pre>
Gets the default quantization configuration.
<h3 id="preprocess_ds"><code>preprocess_ds</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/audio_spec.py#L297-L306">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>preprocess_ds(
ds, is_training=False, cache_fn=None
)
</code></pre>
Returns a preprocessed dataset.
<h3 id="run_classifier"><code>run_classifier</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/audio_spec.py#L326-L332">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>run_classifier(
model, epochs, train_ds, validation_ds, **kwargs
)
</code></pre>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
EXPECTED_WAVEFORM_LENGTH<a id="EXPECTED_WAVEFORM_LENGTH"></a>
</td>
<td>
`44032`
</td>
</tr>
</table>
@@ -0,0 +1,465 @@
page_type: reference
description: DataLoader for audio tasks.
<devsite-mathjax config="TeX-AMS-MML_SVG"></devsite-mathjax>
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.audio_classifier.DataLoader" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="__len__"/>
<meta itemprop="property" content="from_esc50"/>
<meta itemprop="property" content="from_folder"/>
<meta itemprop="property" content="gen_dataset"/>
<meta itemprop="property" content="split"/>
</div>
# tflite_model_maker.audio_classifier.DataLoader
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/audio_dataloader.py#L132-L386">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
DataLoader for audio tasks.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.audio_classifier.DataLoader(
dataset, size, index_to_label, spec, cache=False
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/speech_recognition">Retrain a speech recognition model with TensorFlow Lite Model Maker</a></li>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/audio_classification">Transfer Learning for the Audio Domain with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`dataset`<a id="dataset"></a>
</td>
<td>
A tf.data.Dataset object that contains a potentially large set of
elements, where each element is a pair of (input_data, target). The
`input_data` means the raw input data, like an image, a text etc., while
the `target` means some ground truth of the raw input data, such as the
classification label of the image etc.
</td>
</tr><tr>
<td>
`size`<a id="size"></a>
</td>
<td>
The size of the dataset. tf.data.Dataset donesn't support a function
to get the length directly since it's lazy-loaded and may be infinite.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`num_classes`<a id="num_classes"></a>
</td>
<td>
</td>
</tr><tr>
<td>
`size`<a id="size"></a>
</td>
<td>
Returns the size of the dataset.
Note that this function may return None becuase the exact size of the
dataset isn't a necessary parameter to create an instance of this class,
and tf.data.Dataset donesn't support a function to get the length directly
since it's lazy-loaded and may be infinite.
In most cases, however, when an instance of this class is created by helper
functions like 'from_folder', the size of the dataset will be preprocessed,
and this function can return an int representing the size of the dataset.
</td>
</tr>
</table>
## Methods
<h3 id="from_esc50"><code>from_esc50</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/audio_dataloader.py#L205-L260">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>from_esc50(
spec, data_path, folds=None, categories=None, shuffle=True, cache=False
)
</code></pre>
Load ESC50 style audio samples.
ESC50 file structure is expalined in <a href="https://github.com/karolpiczak/ESC-50">https://github.com/karolpiczak/ESC-50</a>
Audio files should be put in `${data_path}/audio`
Metadata file should be put in `${data_path}/meta/esc50.csv`
Note that instead of relying on the `target` field in the CSV, a new
`index_to_label` mapping is created based on the alphabet order of the
available categories.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`spec`
</td>
<td>
An instance of audio_spec.YAMNet
</td>
</tr><tr>
<td>
`data_path`
</td>
<td>
A string, location of the ESC50 dataset. It should contain at
</td>
</tr><tr>
<td>
`folds`
</td>
<td>
A integer list of selected folds. If empty, all folds will be
selected.
</td>
</tr><tr>
<td>
`categories`
</td>
<td>
A string list of selected categories. If empty, all categories
will be selected.
</td>
</tr><tr>
<td>
`shuffle`
</td>
<td>
boolean, if True, random shuffle data.
</td>
</tr><tr>
<td>
`cache`
</td>
<td>
str or boolean. When set to True, intermediate results will be
cached in ram. When set to a file path in string, intermediate results
will be cached in this file. Please note that, once file based cache is
created, changes to the input data will have no effects until the cache
file is removed or the filename is changed. More details can be found at
<a href="https://www.tensorflow.org/api_docs/python/tf/data/Dataset#cache">https://www.tensorflow.org/api_docs/python/tf/data/Dataset#cache</a>
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
An instance of AudioDataLoader containing audio samples and labels.
</td>
</tr>
</table>
<h3 id="from_folder"><code>from_folder</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/audio_dataloader.py#L150-L203">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>from_folder(
spec, data_path, categories=None, shuffle=True, cache=False
)
</code></pre>
Load audio files from a data_path.
- The root `data_path` folder contains a number of folders. The name for
each folder is the name of the audio class.
- Within each folder, there are a number of .wav files. Each .wav file
corresponds to an example. Each .wav file is mono (single-channel) and has
the typical 16 bit pulse-code modulation (PCM) encoding.
- .wav files will be resampled to `spec.target_sample_rate` then fed into
`spec.preprocess_ds` for split and other operations. Normally long wav files
will be framed into multiple clips. And wav files shorter than a certain
threshold will be ignored.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`spec`
</td>
<td>
instance of `audio_spec.BaseSpec`.
</td>
</tr><tr>
<td>
`data_path`
</td>
<td>
string, location to the audio files.
</td>
</tr><tr>
<td>
`categories`
</td>
<td>
A string list of selected categories. If empty, all categories
will be selected.
</td>
</tr><tr>
<td>
`shuffle`
</td>
<td>
boolean, if True, random shuffle data.
</td>
</tr><tr>
<td>
`cache`
</td>
<td>
str or boolean. When set to True, intermediate results will be
cached in ram. When set to a file path in string, intermediate results
will be cached in this file. Please note that, once file based cache is
created, changes to the input data will have no effects until the cache
file is removed or the filename is changed. More details can be found at
<a href="https://www.tensorflow.org/api_docs/python/tf/data/Dataset#cache">https://www.tensorflow.org/api_docs/python/tf/data/Dataset#cache</a>
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
`AudioDataLoader` containing audio spectrogram (or any data type generated
by `spec.preprocess_ds`) and labels.
</td>
</tr>
</table>
<h3 id="gen_dataset"><code>gen_dataset</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/audio_dataloader.py#L265-L386">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>gen_dataset(
batch_size=1,
is_training=False,
shuffle=False,
input_pipeline_context=None,
preprocess=None,
drop_remainder=False
)
</code></pre>
Generate a shared and batched tf.data.Dataset for training/evaluation.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`batch_size`
</td>
<td>
A integer, the returned dataset will be batched by this size.
</td>
</tr><tr>
<td>
`is_training`
</td>
<td>
A boolean, when True, the returned dataset will be optionally
shuffled. Data augmentation, if exists, will also be applied to the
returned dataset.
</td>
</tr><tr>
<td>
`shuffle`
</td>
<td>
A boolean, when True, the returned dataset will be shuffled to
create randomness during model training. Only applies when `is_training`
is set to True.
</td>
</tr><tr>
<td>
`input_pipeline_context`
</td>
<td>
A InputContext instance, used to shared dataset
among multiple workers when distribution strategy is used.
</td>
</tr><tr>
<td>
`preprocess`
</td>
<td>
Not in use.
</td>
</tr><tr>
<td>
`drop_remainder`
</td>
<td>
boolean, whether the finaly batch drops remainder.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A TF dataset ready to be consumed by Keras model.
</td>
</tr>
</table>
<h3 id="split"><code>split</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/audio_dataloader.py#L262-L263">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>split(
fraction
)
</code></pre>
Splits dataset into two sub-datasets with the given fraction.
Primarily used for splitting the data set into training and testing sets.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`fraction`
</td>
<td>
float, demonstrates the fraction of the first returned
subdataset in the original data.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
The splitted two sub datasets.
</td>
</tr>
</table>
<h3 id="__len__"><code>__len__</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/audio_dataloader.py#L141-L148">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__len__()
</code></pre>
Returns the number of audio files in the DataLoader.
Note that one audio file could be framed (mostly via a sliding window of
fixed size) into None or multiple audio clips during training and
evaluation.
@@ -0,0 +1,317 @@
page_type: reference
description: Model good at detecting environmental sounds, using YAMNet embedding.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.audio_classifier.YamNetSpec" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="create_model"/>
<meta itemprop="property" content="create_serving_model"/>
<meta itemprop="property" content="export_tflite"/>
<meta itemprop="property" content="get_default_quantization_config"/>
<meta itemprop="property" content="preprocess_ds"/>
<meta itemprop="property" content="run_classifier"/>
<meta itemprop="property" content="EMBEDDING_SIZE"/>
<meta itemprop="property" content="EXPECTED_WAVEFORM_LENGTH"/>
</div>
# tflite_model_maker.audio_classifier.YamNetSpec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/audio_spec.py#L411-L641">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Model good at detecting environmental sounds, using YAMNet embedding.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.audio_classifier.YamNetSpec(
model_dir: None = None,
strategy: None = None,
yamnet_model_handle=&#x27;https://tfhub.dev/google/yamnet/1&#x27;,
frame_length=EXPECTED_WAVEFORM_LENGTH,
frame_step=(EXPECTED_WAVEFORM_LENGTH // 2),
keep_yamnet_and_custom_heads=True
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/audio_classification">Transfer Learning for the Audio Domain with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location to save the model checkpoint files.
</td>
</tr><tr>
<td>
`strategy`<a id="strategy"></a>
</td>
<td>
An instance of TF distribute strategy. If none, it will use the
default strategy (either SingleDeviceStrategy or the current scoped
strategy.
</td>
</tr><tr>
<td>
`yamnet_model_handle`<a id="yamnet_model_handle"></a>
</td>
<td>
Path of the TFHub model for retrining.
</td>
</tr><tr>
<td>
`frame_length`<a id="frame_length"></a>
</td>
<td>
The number of samples in each audio frame. If the audio file
is shorter than `frame_length`, then the audio file will be ignored.
</td>
</tr><tr>
<td>
`frame_step`<a id="frame_step"></a>
</td>
<td>
The number of samples between two audio frames. This value
should be smaller than `frame_length`, otherwise some samples will be
ignored.
</td>
</tr><tr>
<td>
`keep_yamnet_and_custom_heads`<a id="keep_yamnet_and_custom_heads"></a>
</td>
<td>
Boolean, decides if the final TFLite model
contains both YAMNet and custom trained classification heads. When set
to False, only the trained custom head will be preserved.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`target_sample_rate`<a id="target_sample_rate"></a>
</td>
<td>
</td>
</tr>
</table>
## Methods
<h3 id="create_model"><code>create_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/audio_spec.py#L476-L485">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_model(
num_classes, train_whole_model=False
)
</code></pre>
<h3 id="create_serving_model"><code>create_serving_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/audio_spec.py#L583-L602">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_serving_model(
training_model
)
</code></pre>
Create a model for serving.
<h3 id="export_tflite"><code>export_tflite</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/audio_spec.py#L604-L641">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>export_tflite(
model,
tflite_filepath,
with_metadata=True,
export_metadata_json_file=True,
index_to_label=None,
quantization_config=None
)
</code></pre>
Converts the retrained model to tflite format and saves it.
This method overrides the default `CustomModel._export_tflite` method, and
include the spectrom extraction in the model.
The exported model has input shape (1, number of wav samples)
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`model`
</td>
<td>
An instance of the keras classification model to be exported.
</td>
</tr><tr>
<td>
`tflite_filepath`
</td>
<td>
File path to save tflite model.
</td>
</tr><tr>
<td>
`with_metadata`
</td>
<td>
Whether the output tflite model contains metadata.
</td>
</tr><tr>
<td>
`export_metadata_json_file`
</td>
<td>
Whether to export metadata in json file. If
True, export the metadata in the same directory as tflite model. Used
only if `with_metadata` is True.
</td>
</tr><tr>
<td>
`index_to_label`
</td>
<td>
A list that map from index to label class name.
</td>
</tr><tr>
<td>
`quantization_config`
</td>
<td>
Configuration for post-training quantization.
</td>
</tr>
</table>
<h3 id="get_default_quantization_config"><code>get_default_quantization_config</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/audio_spec.py#L169-L171">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_default_quantization_config()
</code></pre>
Gets the default quantization configuration.
<h3 id="preprocess_ds"><code>preprocess_ds</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/audio_spec.py#L528-L539">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>preprocess_ds(
ds, is_training=False, cache_fn=None
)
</code></pre>
Returns a preprocessed dataset.
<h3 id="run_classifier"><code>run_classifier</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/audio_spec.py#L487-L493">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>run_classifier(
model, epochs, train_ds, validation_ds, **kwargs
)
</code></pre>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
EMBEDDING_SIZE<a id="EMBEDDING_SIZE"></a>
</td>
<td>
`1024`
</td>
</tr><tr>
<td>
EXPECTED_WAVEFORM_LENGTH<a id="EXPECTED_WAVEFORM_LENGTH"></a>
</td>
<td>
`15600`
</td>
</tr>
</table>
@@ -0,0 +1,149 @@
page_type: reference
description: Loads data and retrains the model.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.audio_classifier.create" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.audio_classifier.create
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/audio_classifier.py#L103-L140">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Loads data and retrains the model.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>tflite_model_maker.audio_classifier.create(
train_data,
model_spec,
validation_data=None,
batch_size=32,
epochs=5,
model_dir=None,
do_train=True,
train_whole_model=False
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/audio_classification">Transfer Learning for the Audio Domain with TensorFlow Lite Model Maker</a></li>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/speech_recognition">Retrain a speech recognition model with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`train_data`<a id="train_data"></a>
</td>
<td>
A instance of audio_dataloader.DataLoader class.
</td>
</tr><tr>
<td>
`model_spec`<a id="model_spec"></a>
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`validation_data`<a id="validation_data"></a>
</td>
<td>
Validation DataLoader. If None, skips validation process.
</td>
</tr><tr>
<td>
`batch_size`<a id="batch_size"></a>
</td>
<td>
Number of samples per training step. If `use_hub_library` is
False, it represents the base learning rate when train batch size is 256
and it's linear to the batch size.
</td>
</tr><tr>
<td>
`epochs`<a id="epochs"></a>
</td>
<td>
Number of epochs for training.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location of the model checkpoint files.
</td>
</tr><tr>
<td>
`do_train`<a id="do_train"></a>
</td>
<td>
Whether to run training.
</td>
</tr><tr>
<td>
`train_whole_model`<a id="train_whole_model"></a>
</td>
<td>
Boolean. By default, only the classification head is
trained. When True, the base model is also trained.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Returns</h2></th></tr>
<tr class="alt">
<td colspan="2">
An instance based on AudioClassifier.
</td>
</tr>
</table>
@@ -0,0 +1,37 @@
page_type: reference
description: APIs for the config of TFLite Model Maker.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.config" />
<meta itemprop="path" content="Stable" />
</div>
# Module: tflite_model_maker.config
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/tflmm/v0.4.2/tensorflow_examples/lite/model_maker/public/config/__init__.py">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
APIs for the config of TFLite Model Maker.
## Classes
[`class ExportFormat`](../tflite_model_maker/config/ExportFormat): An enumeration.
[`class QuantizationConfig`](../tflite_model_maker/config/QuantizationConfig): Configuration for post-training quantization.
@@ -0,0 +1,82 @@
page_type: reference
description: An enumeration.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.config.ExportFormat" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="LABEL"/>
<meta itemprop="property" content="SAVED_MODEL"/>
<meta itemprop="property" content="TFJS"/>
<meta itemprop="property" content="TFLITE"/>
<meta itemprop="property" content="VOCAB"/>
</div>
# tflite_model_maker.config.ExportFormat
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/export_format.py#L24-L31">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
An enumeration.
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
LABEL<a id="LABEL"></a>
</td>
<td>
`<ExportFormat.LABEL: 'LABEL'>`
</td>
</tr><tr>
<td>
SAVED_MODEL<a id="SAVED_MODEL"></a>
</td>
<td>
`<ExportFormat.SAVED_MODEL: 'SAVED_MODEL'>`
</td>
</tr><tr>
<td>
TFJS<a id="TFJS"></a>
</td>
<td>
`<ExportFormat.TFJS: 'TFJS'>`
</td>
</tr><tr>
<td>
TFLITE<a id="TFLITE"></a>
</td>
<td>
`<ExportFormat.TFLITE: 'TFLITE'>`
</td>
</tr><tr>
<td>
VOCAB<a id="VOCAB"></a>
</td>
<td>
`<ExportFormat.VOCAB: 'VOCAB'>`
</td>
</tr>
</table>
@@ -0,0 +1,270 @@
page_type: reference
description: Configuration for post-training quantization.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.config.QuantizationConfig" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="for_dynamic"/>
<meta itemprop="property" content="for_float16"/>
<meta itemprop="property" content="for_int8"/>
<meta itemprop="property" content="get_converter_with_quantization"/>
</div>
# tflite_model_maker.config.QuantizationConfig
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/configs.py#L53-L183">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Configuration for post-training quantization.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.config.QuantizationConfig(
optimizations=None,
representative_data=None,
quantization_steps=None,
inference_input_type=None,
inference_output_type=None,
supported_ops=None,
supported_types=None,
experimental_new_quantizer=None
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/image_classification">Image classification with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
Refer to
<a href="https://www.tensorflow.org/lite/performance/post_training_quantization">https://www.tensorflow.org/lite/performance/post_training_quantization</a>
for different post-training quantization options.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`optimizations`<a id="optimizations"></a>
</td>
<td>
A list of optimizations to apply when converting the model.
If not set, use `[Optimize.DEFAULT]` by default.
</td>
</tr><tr>
<td>
`representative_data`<a id="representative_data"></a>
</td>
<td>
A DataLoader holding representative data for
post-training quantization.
</td>
</tr><tr>
<td>
`quantization_steps`<a id="quantization_steps"></a>
</td>
<td>
Number of post-training quantization calibration steps
to run.
</td>
</tr><tr>
<td>
`inference_input_type`<a id="inference_input_type"></a>
</td>
<td>
Target data type of real-number input arrays. Allows
for a different type for input arrays. Defaults to None. If set, must be
be `{tf.float32, tf.uint8, tf.int8}`.
</td>
</tr><tr>
<td>
`inference_output_type`<a id="inference_output_type"></a>
</td>
<td>
Target data type of real-number output arrays.
Allows for a different type for output arrays. Defaults to None. If set,
must be `{tf.float32, tf.uint8, tf.int8}`.
</td>
</tr><tr>
<td>
`supported_ops`<a id="supported_ops"></a>
</td>
<td>
Set of OpsSet options supported by the device. Used to Set
converter.target_spec.supported_ops.
</td>
</tr><tr>
<td>
`supported_types`<a id="supported_types"></a>
</td>
<td>
List of types for constant values on the target device.
Supported values are types exported by lite.constants. Frequently, an
optimization choice is driven by the most compact (i.e. smallest) type
in this list (default [constants.FLOAT]).
</td>
</tr><tr>
<td>
`experimental_new_quantizer`<a id="experimental_new_quantizer"></a>
</td>
<td>
Whether to enable experimental new quantizer.
</td>
</tr>
</table>
## Methods
<h3 id="for_dynamic"><code>for_dynamic</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/configs.py#L121-L124">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>for_dynamic()
</code></pre>
Creates configuration for dynamic range quantization.
<h3 id="for_float16"><code>for_float16</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/configs.py#L157-L160">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>for_float16()
</code></pre>
Creates configuration for float16 quantization.
<h3 id="for_int8"><code>for_int8</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/configs.py#L126-L155">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>for_int8(
representative_data,
quantization_steps=DEFAULT_QUANTIZATION_STEPS,
inference_input_type=tf.uint8,
inference_output_type=tf.uint8,
supported_ops=tf.lite.OpsSet.TFLITE_BUILTINS_INT8
)
</code></pre>
Creates configuration for full integer quantization.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`representative_data`
</td>
<td>
Representative data used for post-training
quantization.
</td>
</tr><tr>
<td>
`quantization_steps`
</td>
<td>
Number of post-training quantization calibration steps
to run.
</td>
</tr><tr>
<td>
`inference_input_type`
</td>
<td>
Target data type of real-number input arrays. Used
only when `is_integer_only` is True. Must be in `{tf.uint8, tf.int8}`.
</td>
</tr><tr>
<td>
`inference_output_type`
</td>
<td>
Target data type of real-number output arrays. Used
only when `is_integer_only` is True. Must be in `{tf.uint8, tf.int8}`.
</td>
</tr><tr>
<td>
`supported_ops`
</td>
<td>
Set of <a href="https://www.tensorflow.org/lite/api_docs/python/tf/lite/OpsSet"><code>tf.lite.OpsSet</code></a> options, where each option
represents a set of operators supported by the target device.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
QuantizationConfig.
</td>
</tr>
</table>
<h3 id="get_converter_with_quantization"><code>get_converter_with_quantization</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/configs.py#L162-L183">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_converter_with_quantization(
converter, **kwargs
)
</code></pre>
Gets TFLite converter with settings for quantization.
@@ -0,0 +1,62 @@
page_type: reference
description: APIs to train an image classification model.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.image_classifier" />
<meta itemprop="path" content="Stable" />
</div>
# Module: tflite_model_maker.image_classifier
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/tflmm/v0.4.2/tensorflow_examples/lite/model_maker/public/image_classifier/__init__.py">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
APIs to train an image classification model.
#### Task guide:
<a href="https://www.tensorflow.org/lite/tutorials/model_maker_image_classification">https://www.tensorflow.org/lite/tutorials/model_maker_image_classification</a>
## Classes
[`class DataLoader`](../tflite_model_maker/image_classifier/DataLoader): DataLoader for image classifier.
[`class ImageClassifier`](../tflite_model_maker/image_classifier/ImageClassifier): ImageClassifier class for inference and exporting to tflite.
[`class ModelSpec`](../tflite_model_maker/image_classifier/ModelSpec): A specification of image model.
## Functions
[`EfficientNetLite0Spec(...)`](../tflite_model_maker/image_classifier/EfficientNetLite0Spec): Creates EfficientNet-Lite0 model spec. See also: <a href="../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
[`EfficientNetLite1Spec(...)`](../tflite_model_maker/image_classifier/EfficientNetLite1Spec): Creates EfficientNet-Lite1 model spec. See also: <a href="../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
[`EfficientNetLite2Spec(...)`](../tflite_model_maker/image_classifier/EfficientNetLite2Spec): Creates EfficientNet-Lite2 model spec. See also: <a href="../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
[`EfficientNetLite3Spec(...)`](../tflite_model_maker/image_classifier/EfficientNetLite3Spec): Creates EfficientNet-Lite3 model spec. See also: <a href="../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
[`EfficientNetLite4Spec(...)`](../tflite_model_maker/image_classifier/EfficientNetLite4Spec): Creates EfficientNet-Lite4 model spec. See also: <a href="../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
[`MobileNetV2Spec(...)`](../tflite_model_maker/image_classifier/MobileNetV2Spec): Creates MobileNet v2 model spec. See also: <a href="../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
[`Resnet50Spec(...)`](../tflite_model_maker/image_classifier/Resnet50Spec): Creates ResNet 50 model spec. See also: <a href="../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
[`create(...)`](../tflite_model_maker/image_classifier/create): Loads data and retrains the model based on data for image classification.
@@ -0,0 +1,338 @@
page_type: reference
description: DataLoader for image classifier.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.image_classifier.DataLoader" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="__len__"/>
<meta itemprop="property" content="from_folder"/>
<meta itemprop="property" content="from_tfds"/>
<meta itemprop="property" content="gen_dataset"/>
<meta itemprop="property" content="split"/>
</div>
# tflite_model_maker.image_classifier.DataLoader
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/image_dataloader.py#L49-L119">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
DataLoader for image classifier.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.image_classifier.DataLoader(
dataset, size, index_to_label
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/image_classification">Image classification with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`dataset`<a id="dataset"></a>
</td>
<td>
A tf.data.Dataset object that contains a potentially large set of
elements, where each element is a pair of (input_data, target). The
`input_data` means the raw input data, like an image, a text etc., while
the `target` means some ground truth of the raw input data, such as the
classification label of the image etc.
</td>
</tr><tr>
<td>
`size`<a id="size"></a>
</td>
<td>
The size of the dataset. tf.data.Dataset donesn't support a function
to get the length directly since it's lazy-loaded and may be infinite.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`num_classes`<a id="num_classes"></a>
</td>
<td>
</td>
</tr><tr>
<td>
`size`<a id="size"></a>
</td>
<td>
Returns the size of the dataset.
Note that this function may return None becuase the exact size of the
dataset isn't a necessary parameter to create an instance of this class,
and tf.data.Dataset donesn't support a function to get the length directly
since it's lazy-loaded and may be infinite.
In most cases, however, when an instance of this class is created by helper
functions like 'from_folder', the size of the dataset will be preprocessed,
and this function can return an int representing the size of the dataset.
</td>
</tr>
</table>
## Methods
<h3 id="from_folder"><code>from_folder</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/image_dataloader.py#L53-L106">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>from_folder(
filename, shuffle=True
)
</code></pre>
Image analysis for image classification load images with labels.
Assume the image data of the same label are in the same subdirectory.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`filename`
</td>
<td>
Name of the file.
</td>
</tr><tr>
<td>
`shuffle`
</td>
<td>
boolean, if shuffle, random shuffle data.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
ImageDataset containing images and labels and other related info.
</td>
</tr>
</table>
<h3 id="from_tfds"><code>from_tfds</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/image_dataloader.py#L108-L119">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>from_tfds(
name
)
</code></pre>
Loads data from tensorflow_datasets.
<h3 id="gen_dataset"><code>gen_dataset</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py#L76-L124">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>gen_dataset(
batch_size=1,
is_training=False,
shuffle=False,
input_pipeline_context=None,
preprocess=None,
drop_remainder=False
)
</code></pre>
Generate a shared and batched tf.data.Dataset for training/evaluation.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`batch_size`
</td>
<td>
A integer, the returned dataset will be batched by this size.
</td>
</tr><tr>
<td>
`is_training`
</td>
<td>
A boolean, when True, the returned dataset will be optionally
shuffled and repeated as an endless dataset.
</td>
</tr><tr>
<td>
`shuffle`
</td>
<td>
A boolean, when True, the returned dataset will be shuffled to
create randomness during model training.
</td>
</tr><tr>
<td>
`input_pipeline_context`
</td>
<td>
A InputContext instance, used to shared dataset
among multiple workers when distribution strategy is used.
</td>
</tr><tr>
<td>
`preprocess`
</td>
<td>
A function taking three arguments in order, feature, label and
boolean is_training.
</td>
</tr><tr>
<td>
`drop_remainder`
</td>
<td>
boolean, whether the finaly batch drops remainder.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A TF dataset ready to be consumed by Keras model.
</td>
</tr>
</table>
<h3 id="split"><code>split</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py#L185-L197">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>split(
fraction
)
</code></pre>
Splits dataset into two sub-datasets with the given fraction.
Primarily used for splitting the data set into training and testing sets.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`fraction`
</td>
<td>
float, demonstrates the fraction of the first returned
subdataset in the original data.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
The splitted two sub datasets.
</td>
</tr>
</table>
<h3 id="__len__"><code>__len__</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py#L126-L130">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__len__()
</code></pre>
@@ -0,0 +1,76 @@
page_type: reference
description: Creates EfficientNet-Lite0 model spec. See also: <a href="../../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.image_classifier.EfficientNetLite0Spec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.image_classifier.EfficientNetLite0Spec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates EfficientNet-Lite0 model spec. See also: <a href="../../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.image_classifier.EfficientNetLite0Spec(
*,
uri=&#x27;https://tfhub.dev/tensorflow/efficientnet/lite0/feature-vector/2&#x27;,
compat_tf_versions=[1, 2],
input_image_shape=None,
name=&#x27;efficientnet_lite0&#x27;
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
str, URI to the pretrained model.
</td>
</tr><tr>
<td>
`compat_tf_versions`<a id="compat_tf_versions"></a>
</td>
<td>
list of int, compatible TF versions.
</td>
</tr><tr>
<td>
`input_image_shape`<a id="input_image_shape"></a>
</td>
<td>
list of int, input image shape. Default: [224, 224].
</td>
</tr><tr>
<td>
`name`<a id="name"></a>
</td>
<td>
str, model spec name.
</td>
</tr>
</table>
@@ -0,0 +1,76 @@
page_type: reference
description: Creates EfficientNet-Lite1 model spec. See also: <a href="../../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.image_classifier.EfficientNetLite1Spec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.image_classifier.EfficientNetLite1Spec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates EfficientNet-Lite1 model spec. See also: <a href="../../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.image_classifier.EfficientNetLite1Spec(
*,
uri=&#x27;https://tfhub.dev/tensorflow/efficientnet/lite1/feature-vector/2&#x27;,
compat_tf_versions=[1, 2],
input_image_shape=[240, 240],
name=&#x27;efficientnet_lite1&#x27;
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
str, URI to the pretrained model.
</td>
</tr><tr>
<td>
`compat_tf_versions`<a id="compat_tf_versions"></a>
</td>
<td>
list of int, compatible TF versions.
</td>
</tr><tr>
<td>
`input_image_shape`<a id="input_image_shape"></a>
</td>
<td>
list of int, input image shape. Default: [224, 224].
</td>
</tr><tr>
<td>
`name`<a id="name"></a>
</td>
<td>
str, model spec name.
</td>
</tr>
</table>
@@ -0,0 +1,76 @@
page_type: reference
description: Creates EfficientNet-Lite2 model spec. See also: <a href="../../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.image_classifier.EfficientNetLite2Spec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.image_classifier.EfficientNetLite2Spec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates EfficientNet-Lite2 model spec. See also: <a href="../../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.image_classifier.EfficientNetLite2Spec(
*,
uri=&#x27;https://tfhub.dev/tensorflow/efficientnet/lite2/feature-vector/2&#x27;,
compat_tf_versions=[1, 2],
input_image_shape=[260, 260],
name=&#x27;efficientnet_lite2&#x27;
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
str, URI to the pretrained model.
</td>
</tr><tr>
<td>
`compat_tf_versions`<a id="compat_tf_versions"></a>
</td>
<td>
list of int, compatible TF versions.
</td>
</tr><tr>
<td>
`input_image_shape`<a id="input_image_shape"></a>
</td>
<td>
list of int, input image shape. Default: [224, 224].
</td>
</tr><tr>
<td>
`name`<a id="name"></a>
</td>
<td>
str, model spec name.
</td>
</tr>
</table>
@@ -0,0 +1,76 @@
page_type: reference
description: Creates EfficientNet-Lite3 model spec. See also: <a href="../../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.image_classifier.EfficientNetLite3Spec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.image_classifier.EfficientNetLite3Spec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates EfficientNet-Lite3 model spec. See also: <a href="../../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.image_classifier.EfficientNetLite3Spec(
*,
uri=&#x27;https://tfhub.dev/tensorflow/efficientnet/lite3/feature-vector/2&#x27;,
compat_tf_versions=[1, 2],
input_image_shape=[280, 280],
name=&#x27;efficientnet_lite3&#x27;
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
str, URI to the pretrained model.
</td>
</tr><tr>
<td>
`compat_tf_versions`<a id="compat_tf_versions"></a>
</td>
<td>
list of int, compatible TF versions.
</td>
</tr><tr>
<td>
`input_image_shape`<a id="input_image_shape"></a>
</td>
<td>
list of int, input image shape. Default: [224, 224].
</td>
</tr><tr>
<td>
`name`<a id="name"></a>
</td>
<td>
str, model spec name.
</td>
</tr>
</table>
@@ -0,0 +1,76 @@
page_type: reference
description: Creates EfficientNet-Lite4 model spec. See also: <a href="../../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.image_classifier.EfficientNetLite4Spec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.image_classifier.EfficientNetLite4Spec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates EfficientNet-Lite4 model spec. See also: <a href="../../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.image_classifier.EfficientNetLite4Spec(
*,
uri=&#x27;https://tfhub.dev/tensorflow/efficientnet/lite4/feature-vector/2&#x27;,
compat_tf_versions=[1, 2],
input_image_shape=[300, 300],
name=&#x27;efficientnet_lite4&#x27;
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
str, URI to the pretrained model.
</td>
</tr><tr>
<td>
`compat_tf_versions`<a id="compat_tf_versions"></a>
</td>
<td>
list of int, compatible TF versions.
</td>
</tr><tr>
<td>
`input_image_shape`<a id="input_image_shape"></a>
</td>
<td>
list of int, input image shape. Default: [224, 224].
</td>
</tr><tr>
<td>
`name`<a id="name"></a>
</td>
<td>
str, model spec name.
</td>
</tr>
</table>
@@ -0,0 +1,690 @@
page_type: reference
description: ImageClassifier class for inference and exporting to tflite.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.image_classifier.ImageClassifier" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="create"/>
<meta itemprop="property" content="create_model"/>
<meta itemprop="property" content="create_serving_model"/>
<meta itemprop="property" content="evaluate"/>
<meta itemprop="property" content="evaluate_tflite"/>
<meta itemprop="property" content="export"/>
<meta itemprop="property" content="predict_top_k"/>
<meta itemprop="property" content="summary"/>
<meta itemprop="property" content="train"/>
<meta itemprop="property" content="ALLOWED_EXPORT_FORMAT"/>
<meta itemprop="property" content="DEFAULT_EXPORT_FORMAT"/>
</div>
# tflite_model_maker.image_classifier.ImageClassifier
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/image_classifier.py#L81-L344">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
ImageClassifier class for inference and exporting to tflite.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.image_classifier.ImageClassifier(
model_spec,
index_to_label,
shuffle=True,
hparams=hub_lib.get_default_hparams(),
use_augmentation=False,
representative_data=None
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_spec`<a id="model_spec"></a>
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`index_to_label`<a id="index_to_label"></a>
</td>
<td>
A list that map from index to label class name.
</td>
</tr><tr>
<td>
`shuffle`<a id="shuffle"></a>
</td>
<td>
Whether the data should be shuffled.
</td>
</tr><tr>
<td>
`hparams`<a id="hparams"></a>
</td>
<td>
A namedtuple of hyperparameters. This function expects
.dropout_rate: The fraction of the input units to drop, used in dropout
layer.
.do_fine_tuning: If true, the Hub module is trained together with the
classification layer on top.
</td>
</tr><tr>
<td>
`use_augmentation`<a id="use_augmentation"></a>
</td>
<td>
Use data augmentation for preprocessing.
</td>
</tr><tr>
<td>
`representative_data`<a id="representative_data"></a>
</td>
<td>
Representative dataset for full integer
quantization. Used when converting the keras model to the TFLite model
with full integer quantization.
</td>
</tr>
</table>
## Methods
<h3 id="create"><code>create</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/image_classifier.py#L252-L344">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>create(
train_data,
model_spec=&#x27;efficientnet_lite0&#x27;,
validation_data=None,
batch_size=None,
epochs=None,
steps_per_epoch=None,
train_whole_model=None,
dropout_rate=None,
learning_rate=None,
momentum=None,
shuffle=False,
use_augmentation=False,
use_hub_library=True,
warmup_steps=None,
model_dir=None,
do_train=True
)
</code></pre>
Loads data and retrains the model based on data for image classification.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`train_data`
</td>
<td>
Training data.
</td>
</tr><tr>
<td>
`model_spec`
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`validation_data`
</td>
<td>
Validation data. If None, skips validation process.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
Number of samples per training step. If `use_hub_library` is
False, it represents the base learning rate when train batch size is 256
and it's linear to the batch size.
</td>
</tr><tr>
<td>
`epochs`
</td>
<td>
Number of epochs for training.
</td>
</tr><tr>
<td>
`steps_per_epoch`
</td>
<td>
Integer or None. Total number of steps (batches of
samples) before declaring one epoch finished and starting the next
epoch. If `steps_per_epoch` is None, the epoch will run until the input
dataset is exhausted.
</td>
</tr><tr>
<td>
`train_whole_model`
</td>
<td>
If true, the Hub module is trained together with the
classification layer on top. Otherwise, only train the top
classification layer.
</td>
</tr><tr>
<td>
`dropout_rate`
</td>
<td>
The rate for dropout.
</td>
</tr><tr>
<td>
`learning_rate`
</td>
<td>
Base learning rate when train batch size is 256. Linear to
the batch size.
</td>
</tr><tr>
<td>
`momentum`
</td>
<td>
a Python float forwarded to the optimizer. Only used when
`use_hub_library` is True.
</td>
</tr><tr>
<td>
`shuffle`
</td>
<td>
Whether the data should be shuffled.
</td>
</tr><tr>
<td>
`use_augmentation`
</td>
<td>
Use data augmentation for preprocessing.
</td>
</tr><tr>
<td>
`use_hub_library`
</td>
<td>
Use `make_image_classifier_lib` from tensorflow hub to
retrain the model.
</td>
</tr><tr>
<td>
`warmup_steps`
</td>
<td>
Number of warmup steps for warmup schedule on learning rate.
If None, the default warmup_steps is used which is the total training
steps in two epochs. Only used when `use_hub_library` is False.
</td>
</tr><tr>
<td>
`model_dir`
</td>
<td>
The location of the model checkpoint files. Only used when
`use_hub_library` is False.
</td>
</tr><tr>
<td>
`do_train`
</td>
<td>
Whether to run training.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
An instance based on ImageClassifier.
</td>
</tr>
</table>
<h3 id="create_model"><code>create_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/image_classifier.py#L125-L138">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_model(
hparams=None, with_loss_and_metrics=False
)
</code></pre>
Creates the classifier model for retraining.
<h3 id="create_serving_model"><code>create_serving_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L170-L176">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_serving_model()
</code></pre>
Returns the underlining Keras model for serving.
<h3 id="evaluate"><code>evaluate</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/classification_model.py#L53-L65">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate(
data, batch_size=32
)
</code></pre>
Evaluates the model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`data`
</td>
<td>
Data to be evaluated.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
Number of samples per evaluation step.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
The loss value and accuracy.
</td>
</tr>
</table>
<h3 id="evaluate_tflite"><code>evaluate_tflite</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/classification_model.py#L105-L143">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate_tflite(
tflite_filepath, data, postprocess_fn=None
)
</code></pre>
Evaluates the tflite model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`tflite_filepath`
</td>
<td>
File path to the TFLite model.
</td>
</tr><tr>
<td>
`data`
</td>
<td>
Data to be evaluated.
</td>
</tr><tr>
<td>
`postprocess_fn`
</td>
<td>
Postprocessing function that will be applied to the output
of `lite_runner.run` before calculating the probabilities.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
The evaluation result of TFLite model - accuracy.
</td>
</tr>
</table>
<h3 id="export"><code>export</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L95-L168">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>export(
export_dir,
tflite_filename=&#x27;model.tflite&#x27;,
label_filename=&#x27;labels.txt&#x27;,
vocab_filename=&#x27;vocab.txt&#x27;,
saved_model_filename=&#x27;saved_model&#x27;,
tfjs_folder_name=&#x27;tfjs&#x27;,
export_format=None,
**kwargs
)
</code></pre>
Converts the retrained model based on `export_format`.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`export_dir`
</td>
<td>
The directory to save exported files.
</td>
</tr><tr>
<td>
`tflite_filename`
</td>
<td>
File name to save tflite model. The full export path is
{export_dir}/{tflite_filename}.
</td>
</tr><tr>
<td>
`label_filename`
</td>
<td>
File name to save labels. The full export path is
{export_dir}/{label_filename}.
</td>
</tr><tr>
<td>
`vocab_filename`
</td>
<td>
File name to save vocabulary. The full export path is
{export_dir}/{vocab_filename}.
</td>
</tr><tr>
<td>
`saved_model_filename`
</td>
<td>
Path to SavedModel or H5 file to save the model. The
full export path is
{export_dir}/{saved_model_filename}/{saved_model.pb|assets|variables}.
</td>
</tr><tr>
<td>
`tfjs_folder_name`
</td>
<td>
Folder name to save tfjs model. The full export path is
{export_dir}/{tfjs_folder_name}.
</td>
</tr><tr>
<td>
`export_format`
</td>
<td>
List of export format that could be saved_model, tflite,
label, vocab.
</td>
</tr><tr>
<td>
`**kwargs`
</td>
<td>
Other parameters like `quantized_config` for TFLITE model.
</td>
</tr>
</table>
<h3 id="predict_top_k"><code>predict_top_k</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/classification_model.py#L67-L95">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>predict_top_k(
data, k=1, batch_size=32
)
</code></pre>
Predicts the top-k predictions.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`data`
</td>
<td>
Data to be evaluated. Either an instance of DataLoader or just raw
data entries such TF tensor or numpy array.
</td>
</tr><tr>
<td>
`k`
</td>
<td>
Number of top results to be predicted.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
Number of samples per evaluation step.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
top k results. Each one is (label, probability).
</td>
</tr>
</table>
<h3 id="summary"><code>summary</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L65-L66">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>summary()
</code></pre>
<h3 id="train"><code>train</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/image_classifier.py#L140-L196">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>train(
train_data, validation_data=None, hparams=None, steps_per_epoch=None
)
</code></pre>
Feeds the training data for training.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`train_data`
</td>
<td>
Training data.
</td>
</tr><tr>
<td>
`validation_data`
</td>
<td>
Validation data. If None, skips validation process.
</td>
</tr><tr>
<td>
`hparams`
</td>
<td>
An instance of hub_lib.HParams or
train_image_classifier_lib.HParams. Anamedtuple of hyperparameters.
</td>
</tr><tr>
<td>
`steps_per_epoch`
</td>
<td>
Integer or None. Total number of steps (batches of
samples) before declaring one epoch finished and starting the next
epoch. If 'steps_per_epoch' is None, the epoch will run until the input
dataset is exhausted.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
The tf.keras.callbacks.History object returned by tf.keras.Model.fit*().
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
ALLOWED_EXPORT_FORMAT<a id="ALLOWED_EXPORT_FORMAT"></a>
</td>
<td>
`(<ExportFormat.TFLITE: 'TFLITE'>,
<ExportFormat.LABEL: 'LABEL'>,
<ExportFormat.SAVED_MODEL: 'SAVED_MODEL'>,
<ExportFormat.TFJS: 'TFJS'>)`
</td>
</tr><tr>
<td>
DEFAULT_EXPORT_FORMAT<a id="DEFAULT_EXPORT_FORMAT"></a>
</td>
<td>
`(<ExportFormat.TFLITE: 'TFLITE'>, <ExportFormat.LABEL: 'LABEL'>)`
</td>
</tr>
</table>
@@ -0,0 +1,76 @@
page_type: reference
description: Creates MobileNet v2 model spec. See also: <a href="../../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.image_classifier.MobileNetV2Spec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.image_classifier.MobileNetV2Spec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates MobileNet v2 model spec. See also: <a href="../../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.image_classifier.MobileNetV2Spec(
*,
uri=&#x27;https://tfhub.dev/google/tf2-preview/mobilenet_v2/feature_vector/4&#x27;,
compat_tf_versions=2,
input_image_shape=None,
name=&#x27;mobilenet_v2&#x27;
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
str, URI to the pretrained model.
</td>
</tr><tr>
<td>
`compat_tf_versions`<a id="compat_tf_versions"></a>
</td>
<td>
list of int, compatible TF versions.
</td>
</tr><tr>
<td>
`input_image_shape`<a id="input_image_shape"></a>
</td>
<td>
list of int, input image shape. Default: [224, 224].
</td>
</tr><tr>
<td>
`name`<a id="name"></a>
</td>
<td>
str, model spec name.
</td>
</tr>
</table>
@@ -0,0 +1,142 @@
page_type: reference
description: A specification of image model.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.image_classifier.ModelSpec" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="get_default_quantization_config"/>
<meta itemprop="property" content="mean_rgb"/>
<meta itemprop="property" content="stddev_rgb"/>
</div>
# tflite_model_maker.image_classifier.ModelSpec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/image_spec.py#L28-L59">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
A specification of image model.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.image_classifier.ModelSpec(
uri, compat_tf_versions=None, input_image_shape=None, name=&#x27;&#x27;
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/image_classification">Image classification with TensorFlow Lite Model Maker</a></li>
<li><a href="https://www.tensorflow.org/hub/tutorials/cropnet_on_device">Fine tuning models for plant disease detection</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
str, URI to the pretrained model.
</td>
</tr><tr>
<td>
`compat_tf_versions`<a id="compat_tf_versions"></a>
</td>
<td>
list of int, compatible TF versions.
</td>
</tr><tr>
<td>
`input_image_shape`<a id="input_image_shape"></a>
</td>
<td>
list of int, input image shape. Default: [224, 224].
</td>
</tr><tr>
<td>
`name`<a id="name"></a>
</td>
<td>
str, model spec name.
</td>
</tr>
</table>
## Methods
<h3 id="get_default_quantization_config"><code>get_default_quantization_config</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/image_spec.py#L56-L59">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_default_quantization_config(
representative_data
)
</code></pre>
Gets the default quantization configuration.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
mean_rgb<a id="mean_rgb"></a>
</td>
<td>
`[0.0]`
</td>
</tr><tr>
<td>
stddev_rgb<a id="stddev_rgb"></a>
</td>
<td>
`[255.0]`
</td>
</tr>
</table>
@@ -0,0 +1,76 @@
page_type: reference
description: Creates ResNet 50 model spec. See also: <a href="../../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.image_classifier.Resnet50Spec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.image_classifier.Resnet50Spec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates ResNet 50 model spec. See also: <a href="../../tflite_model_maker/image_classifier/ModelSpec"><code>tflite_model_maker.image_classifier.ModelSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.image_classifier.Resnet50Spec(
*,
uri=&#x27;https://tfhub.dev/google/imagenet/resnet_v2_50/feature_vector/4&#x27;,
compat_tf_versions=2,
input_image_shape=None,
name=&#x27;resnet_50&#x27;
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
str, URI to the pretrained model.
</td>
</tr><tr>
<td>
`compat_tf_versions`<a id="compat_tf_versions"></a>
</td>
<td>
list of int, compatible TF versions.
</td>
</tr><tr>
<td>
`input_image_shape`<a id="input_image_shape"></a>
</td>
<td>
list of int, input image shape. Default: [224, 224].
</td>
</tr><tr>
<td>
`name`<a id="name"></a>
</td>
<td>
str, model spec name.
</td>
</tr>
</table>
@@ -0,0 +1,223 @@
page_type: reference
description: Loads data and retrains the model based on data for image classification.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.image_classifier.create" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.image_classifier.create
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/image_classifier.py#L252-L344">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Loads data and retrains the model based on data for image classification.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>tflite_model_maker.image_classifier.create(
train_data,
model_spec=&#x27;efficientnet_lite0&#x27;,
validation_data=None,
batch_size=None,
epochs=None,
steps_per_epoch=None,
train_whole_model=None,
dropout_rate=None,
learning_rate=None,
momentum=None,
shuffle=False,
use_augmentation=False,
use_hub_library=True,
warmup_steps=None,
model_dir=None,
do_train=True
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/image_classification">Image classification with TensorFlow Lite Model Maker</a></li>
<li><a href="https://www.tensorflow.org/hub/tutorials/cropnet_on_device">Fine tuning models for plant disease detection</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`train_data`<a id="train_data"></a>
</td>
<td>
Training data.
</td>
</tr><tr>
<td>
`model_spec`<a id="model_spec"></a>
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`validation_data`<a id="validation_data"></a>
</td>
<td>
Validation data. If None, skips validation process.
</td>
</tr><tr>
<td>
`batch_size`<a id="batch_size"></a>
</td>
<td>
Number of samples per training step. If `use_hub_library` is
False, it represents the base learning rate when train batch size is 256
and it's linear to the batch size.
</td>
</tr><tr>
<td>
`epochs`<a id="epochs"></a>
</td>
<td>
Number of epochs for training.
</td>
</tr><tr>
<td>
`steps_per_epoch`<a id="steps_per_epoch"></a>
</td>
<td>
Integer or None. Total number of steps (batches of
samples) before declaring one epoch finished and starting the next
epoch. If `steps_per_epoch` is None, the epoch will run until the input
dataset is exhausted.
</td>
</tr><tr>
<td>
`train_whole_model`<a id="train_whole_model"></a>
</td>
<td>
If true, the Hub module is trained together with the
classification layer on top. Otherwise, only train the top
classification layer.
</td>
</tr><tr>
<td>
`dropout_rate`<a id="dropout_rate"></a>
</td>
<td>
The rate for dropout.
</td>
</tr><tr>
<td>
`learning_rate`<a id="learning_rate"></a>
</td>
<td>
Base learning rate when train batch size is 256. Linear to
the batch size.
</td>
</tr><tr>
<td>
`momentum`<a id="momentum"></a>
</td>
<td>
a Python float forwarded to the optimizer. Only used when
`use_hub_library` is True.
</td>
</tr><tr>
<td>
`shuffle`<a id="shuffle"></a>
</td>
<td>
Whether the data should be shuffled.
</td>
</tr><tr>
<td>
`use_augmentation`<a id="use_augmentation"></a>
</td>
<td>
Use data augmentation for preprocessing.
</td>
</tr><tr>
<td>
`use_hub_library`<a id="use_hub_library"></a>
</td>
<td>
Use `make_image_classifier_lib` from tensorflow hub to
retrain the model.
</td>
</tr><tr>
<td>
`warmup_steps`<a id="warmup_steps"></a>
</td>
<td>
Number of warmup steps for warmup schedule on learning rate.
If None, the default warmup_steps is used which is the total training
steps in two epochs. Only used when `use_hub_library` is False.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location of the model checkpoint files. Only used when
`use_hub_library` is False.
</td>
</tr><tr>
<td>
`do_train`<a id="do_train"></a>
</td>
<td>
Whether to run training.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Returns</h2></th></tr>
<tr class="alt">
<td colspan="2">
An instance based on ImageClassifier.
</td>
</tr>
</table>
@@ -0,0 +1,103 @@
page_type: reference
description: APIs for the model spec of TFLite Model Maker.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.model_spec" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="AUDIO_CLASSIFICATION_MODELS"/>
<meta itemprop="property" content="IMAGE_CLASSIFICATION_MODELS"/>
<meta itemprop="property" content="OBJECT_DETECTION_MODELS"/>
<meta itemprop="property" content="QUESTION_ANSWER_MODELS"/>
<meta itemprop="property" content="RECOMMENDATION_MODELS"/>
<meta itemprop="property" content="TEXT_CLASSIFICATION_MODELS"/>
</div>
# Module: tflite_model_maker.model_spec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/tflmm/v0.4.2/tensorflow_examples/lite/model_maker/public/model_spec/__init__.py">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
APIs for the model spec of TFLite Model Maker.
## Functions
[`get(...)`](../tflite_model_maker/model_spec/get): Gets model spec by name or instance, and init with args and kwarges.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Other Members</h2></th></tr>
<tr>
<td>
AUDIO_CLASSIFICATION_MODELS<a id="AUDIO_CLASSIFICATION_MODELS"></a>
</td>
<td>
`['audio_browser_fft', 'audio_teachable_machine', 'audio_yamnet']`
</td>
</tr><tr>
<td>
IMAGE_CLASSIFICATION_MODELS<a id="IMAGE_CLASSIFICATION_MODELS"></a>
</td>
<td>
`['efficientnet_lite0',
'efficientnet_lite1',
'efficientnet_lite2',
'efficientnet_lite3',
'efficientnet_lite4',
'mobilenet_v2',
'resnet_50']`
</td>
</tr><tr>
<td>
OBJECT_DETECTION_MODELS<a id="OBJECT_DETECTION_MODELS"></a>
</td>
<td>
`['efficientdet_lite0',
'efficientdet_lite1',
'efficientdet_lite2',
'efficientdet_lite3',
'efficientdet_lite4']`
</td>
</tr><tr>
<td>
QUESTION_ANSWER_MODELS<a id="QUESTION_ANSWER_MODELS"></a>
</td>
<td>
`['bert_qa', 'mobilebert_qa', 'mobilebert_qa_squad']`
</td>
</tr><tr>
<td>
RECOMMENDATION_MODELS<a id="RECOMMENDATION_MODELS"></a>
</td>
<td>
`['recommendation']`
</td>
</tr><tr>
<td>
TEXT_CLASSIFICATION_MODELS<a id="TEXT_CLASSIFICATION_MODELS"></a>
</td>
<td>
`['bert_classifier', 'average_word_vec', 'mobilebert_classifier']`
</td>
</tr>
</table>
@@ -0,0 +1,61 @@
page_type: reference
description: Gets model spec by name or instance, and init with args and kwarges.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.model_spec.get" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.model_spec.get
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/__init__.py#L101-L113">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Gets model spec by name or instance, and init with args and kwarges.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.model_spec.get(
spec_or_str, *args, **kwargs
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/text_classification">Text classification with TensorFlow Lite Model Maker</a></li>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/question_answer">BERT Question Answer with TensorFlow Lite Model Maker</a></li>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/image_classification">Image classification with TensorFlow Lite Model Maker</a></li>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/object_detection">Object Detection with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
@@ -0,0 +1,53 @@
page_type: reference
description: APIs to train an object detection model.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.object_detector" />
<meta itemprop="path" content="Stable" />
</div>
# Module: tflite_model_maker.object_detector
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/tflmm/v0.4.2/tensorflow_examples/lite/model_maker/public/object_detector/__init__.py">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
APIs to train an object detection model.
## Classes
[`class DataLoader`](../tflite_model_maker/object_detector/DataLoader): DataLoader for object detector.
[`class EfficientDetSpec`](../tflite_model_maker/object_detector/EfficientDetSpec): A specification of the EfficientDet model.
[`class ObjectDetector`](../tflite_model_maker/object_detector/ObjectDetector): ObjectDetector class for inference and exporting to tflite.
## Functions
[`EfficientDetLite0Spec(...)`](../tflite_model_maker/object_detector/EfficientDetLite0Spec): Creates EfficientDet-Lite0 model spec. See also: <a href="../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
[`EfficientDetLite1Spec(...)`](../tflite_model_maker/object_detector/EfficientDetLite1Spec): Creates EfficientDet-Lite1 model spec. See also: <a href="../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
[`EfficientDetLite2Spec(...)`](../tflite_model_maker/object_detector/EfficientDetLite2Spec): Creates EfficientDet-Lite2 model spec. See also: <a href="../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
[`EfficientDetLite3Spec(...)`](../tflite_model_maker/object_detector/EfficientDetLite3Spec): Creates EfficientDet-Lite3 model spec. See also: <a href="../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
[`EfficientDetLite4Spec(...)`](../tflite_model_maker/object_detector/EfficientDetLite4Spec): Creates EfficientDet-Lite4 model spec. See also: <a href="../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
[`create(...)`](../tflite_model_maker/object_detector/create): Loads data and train the model for object detection.
@@ -0,0 +1,527 @@
page_type: reference
description: DataLoader for object detector.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.object_detector.DataLoader" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="__len__"/>
<meta itemprop="property" content="from_cache"/>
<meta itemprop="property" content="from_csv"/>
<meta itemprop="property" content="from_pascal_voc"/>
<meta itemprop="property" content="gen_dataset"/>
<meta itemprop="property" content="split"/>
</div>
# tflite_model_maker.object_detector.DataLoader
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/object_detector_dataloader.py#L102-L367">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
DataLoader for object detector.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.object_detector.DataLoader(
tfrecord_file_patten, size, label_map, annotations_json_file=None
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/object_detection">Object Detection with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`tfrecord_file_patten`<a id="tfrecord_file_patten"></a>
</td>
<td>
Glob for tfrecord files. e.g. "/tmp/coco*.tfrecord".
</td>
</tr><tr>
<td>
`size`<a id="size"></a>
</td>
<td>
The size of the dataset.
</td>
</tr><tr>
<td>
`label_map`<a id="label_map"></a>
</td>
<td>
Variable shows mapping label integers ids to string label
names. 0 is the reserved key for `background` and doesn't need to be
included in label_map. Label names can't be duplicated. Supported
formats are:
1. Dict, map label integers ids to string label names, such as {1:
'person', 2: 'notperson'}. 2. List, a list of label names such as
['person', 'notperson'] which is
the same as setting label_map={1: 'person', 2: 'notperson'}.
3. String, name for certain dataset. Accepted values are: 'coco', 'voc'
and 'waymo'. 4. String, yaml filename that stores label_map.
</td>
</tr><tr>
<td>
`annotations_json_file`<a id="annotations_json_file"></a>
</td>
<td>
JSON with COCO data format containing golden
bounding boxes. Used for validation. If None, use the ground truth from
the dataloader. Refer to
https://towardsdatascience.com/coco-data-format-for-object-detection-a4c5eaf518c5
for the description of COCO data format.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`size`<a id="size"></a>
</td>
<td>
Returns the size of the dataset.
Note that this function may return None becuase the exact size of the
dataset isn't a necessary parameter to create an instance of this class,
and tf.data.Dataset donesn't support a function to get the length directly
since it's lazy-loaded and may be infinite.
In most cases, however, when an instance of this class is created by helper
functions like 'from_folder', the size of the dataset will be preprocessed,
and this function can return an int representing the size of the dataset.
</td>
</tr>
</table>
## Methods
<h3 id="from_cache"><code>from_cache</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/object_detector_dataloader.py#L307-L336">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>from_cache(
cache_prefix
)
</code></pre>
Loads the data from cache.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`cache_prefix`
</td>
<td>
The cache prefix including the cache directory and the cache
prefix filename, e.g: '/tmp/cache/train'.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
ObjectDetectorDataLoader object.
</td>
</tr>
</table>
<h3 id="from_csv"><code>from_csv</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/object_detector_dataloader.py#L224-L305">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>from_csv(
filename: str,
images_dir: Optional[str] = None,
delimiter: str = &#x27;,&#x27;,
quotechar: str = &#x27;\&#x27;&quot;,
num_shards: int = 10,
max_num_images: Optional[int] = None,
cache_dir: Optional[str] = None,
cache_prefix_filename: Optional[str] = None
) -> List[Optional[DetectorDataLoader]]
</code></pre>
Loads the data from the csv file.
The csv format is shown in
<a href="https://cloud.google.com/vision/automl/object-detection/docs/csv-format">https://cloud.google.com/vision/automl/object-detection/docs/csv-format</a> We
supports bounding box with 2 vertices for now. We support the files in the
local machine as well.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`filename`
</td>
<td>
Name of the csv file.
</td>
</tr><tr>
<td>
`images_dir`
</td>
<td>
Path to directory that store raw images. If None, the image
path in the csv file is the path to Google Cloud Storage or the absolute
path in the local machine.
</td>
</tr><tr>
<td>
`delimiter`
</td>
<td>
Character used to separate fields.
</td>
</tr><tr>
<td>
`quotechar`
</td>
<td>
Character used to quote fields containing special characters.
</td>
</tr><tr>
<td>
`num_shards`
</td>
<td>
Number of shards for output file.
</td>
</tr><tr>
<td>
`max_num_images`
</td>
<td>
Max number of imags to process.
</td>
</tr><tr>
<td>
`cache_dir`
</td>
<td>
The cache directory to save TFRecord, metadata and json file.
When cache_dir is None, a temporary folder will be created and will not
be removed automatically after training which makes it can be used
later.
</td>
</tr><tr>
<td>
`cache_prefix_filename`
</td>
<td>
The cache prefix filename. If None, will
automatically generate it based on `filename`.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
train_data, validation_data, test_data which are ObjectDetectorDataLoader
objects. Can be None if without such data.
</td>
</tr>
</table>
<h3 id="from_pascal_voc"><code>from_pascal_voc</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/object_detector_dataloader.py#L137-L222">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>from_pascal_voc(
images_dir: str,
annotations_dir: str,
label_map: Union[List[str], Dict[int, str], str],
annotation_filenames: Optional[Collection[str]] = None,
ignore_difficult_instances: bool = False,
num_shards: int = 100,
max_num_images: Optional[int] = None,
cache_dir: Optional[str] = None,
cache_prefix_filename: Optional[str] = None
) -> DetectorDataLoader
</code></pre>
Loads from dataset with PASCAL VOC format.
Refer to
<a href="https://towardsdatascience.com/coco-data-format-for-object-detection-a4c5eaf518c5">https://towardsdatascience.com/coco-data-format-for-object-detection-a4c5eaf518c5</a>
for the description of PASCAL VOC data format.
LabelImg Tool (<a href="https://github.com/tzutalin/labelImg">https://github.com/tzutalin/labelImg</a>) can annotate the image
and save annotations as XML files in PASCAL VOC data format.
Annotations are in the folder: `annotations_dir`.
Raw images are in the foloder: `images_dir`.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`images_dir`
</td>
<td>
Path to directory that store raw images.
</td>
</tr><tr>
<td>
`annotations_dir`
</td>
<td>
Path to the annotations directory.
</td>
</tr><tr>
<td>
`label_map`
</td>
<td>
Variable shows mapping label integers ids to string label
names. 0 is the reserved key for `background`. Label names can't be
duplicated. Supported format: 1. Dict, map label integers ids to string
label names, e.g.
{1: 'person', 2: 'notperson'}. 2. List, a list of label names. e.g.
['person', 'notperson'] which is
the same as setting label_map={1: 'person', 2: 'notperson'}.
3. String, name for certain dataset. Accepted values are: 'coco', 'voc'
and 'waymo'. 4. String, yaml filename that stores label_map.
</td>
</tr><tr>
<td>
`annotation_filenames`
</td>
<td>
Collection of annotation filenames (strings) to be
loaded. For instance, if there're 3 annotation files [0.xml, 1.xml,
2.xml] in `annotations_dir`, setting annotation_filenames=['0', '1']
makes this method only load [0.xml, 1.xml].
</td>
</tr><tr>
<td>
`ignore_difficult_instances`
</td>
<td>
Whether to ignore difficult instances.
`difficult` can be set inside `object` item in the annotation xml file.
</td>
</tr><tr>
<td>
`num_shards`
</td>
<td>
Number of shards for output file.
</td>
</tr><tr>
<td>
`max_num_images`
</td>
<td>
Max number of imags to process.
</td>
</tr><tr>
<td>
`cache_dir`
</td>
<td>
The cache directory to save TFRecord, metadata and json file.
When cache_dir is not set, a temporary folder will be created and will
not be removed automatically after training which makes it can be used
later.
</td>
</tr><tr>
<td>
`cache_prefix_filename`
</td>
<td>
The cache prefix filename. If not set, will
automatically generate it based on `image_dir`, `annotations_dir` and
`annotation_filenames`.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
ObjectDetectorDataLoader object.
</td>
</tr>
</table>
<h3 id="gen_dataset"><code>gen_dataset</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/object_detector_dataloader.py#L338-L362">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>gen_dataset(
model_spec, batch_size=None, is_training=False, use_fake_data=False
)
</code></pre>
Generate a batched tf.data.Dataset for training/evaluation.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`model_spec`
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
A integer, the returned dataset will be batched by this size.
</td>
</tr><tr>
<td>
`is_training`
</td>
<td>
A boolean, when True, the returned dataset will be optionally
shuffled and repeated as an endless dataset.
</td>
</tr><tr>
<td>
`use_fake_data`
</td>
<td>
Use fake input.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A TF dataset ready to be consumed by Keras model.
</td>
</tr>
</table>
<h3 id="split"><code>split</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/object_detector_dataloader.py#L364-L367">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>split(
fraction
)
</code></pre>
This function isn't implemented for the object detection task.
<h3 id="__len__"><code>__len__</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py#L126-L130">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__len__()
</code></pre>
@@ -0,0 +1,212 @@
page_type: reference
description: Creates EfficientDet-Lite0 model spec. See also: <a href="../../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.object_detector.EfficientDetLite0Spec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.object_detector.EfficientDetLite0Spec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates EfficientDet-Lite0 model spec. See also: <a href="../../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.object_detector.EfficientDetLite0Spec(
*,
model_name=&#x27;efficientdet-lite0&#x27;,
uri=&#x27;https://tfhub.dev/tensorflow/efficientdet/lite0/feature-vector/1&#x27;,
hparams=&#x27;&#x27;,
model_dir=None,
epochs=50,
batch_size=64,
steps_per_execution=1,
moving_average_decay=0,
var_freeze_expr=&#x27;(efficientnet|fpn_cells|resample_p6)&#x27;,
tflite_max_detections=25,
strategy=None,
tpu=None,
gcp_project=None,
tpu_zone=None,
use_xla=False,
profile=False,
debug=False,
tf_random_seed=111111,
verbose=0
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_name`<a id="model_name"></a>
</td>
<td>
Model name.
</td>
</tr><tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
TF-Hub path/url to EfficientDet module.
</td>
</tr><tr>
<td>
`hparams`<a id="hparams"></a>
</td>
<td>
Hyperparameters used to overwrite default configuration. Can be
1) Dict, contains parameter names and values; 2) String, Comma separated
k=v pairs of hyperparameters; 3) String, yaml filename which's a module
containing attributes to use as hyperparameters.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location to save the model checkpoint files.
</td>
</tr><tr>
<td>
`epochs`<a id="epochs"></a>
</td>
<td>
Default training epochs.
</td>
</tr><tr>
<td>
`batch_size`<a id="batch_size"></a>
</td>
<td>
Training & Evaluation batch size.
</td>
</tr><tr>
<td>
`steps_per_execution`<a id="steps_per_execution"></a>
</td>
<td>
Number of steps per training execution.
</td>
</tr><tr>
<td>
`moving_average_decay`<a id="moving_average_decay"></a>
</td>
<td>
Float. The decay to use for maintaining moving
averages of the trained parameters.
</td>
</tr><tr>
<td>
`var_freeze_expr`<a id="var_freeze_expr"></a>
</td>
<td>
Expression to freeze variables.
</td>
</tr><tr>
<td>
`tflite_max_detections`<a id="tflite_max_detections"></a>
</td>
<td>
The max number of output detections in the TFLite
model.
</td>
</tr><tr>
<td>
`strategy`<a id="strategy"></a>
</td>
<td>
A string specifying which distribution strategy to use.
Accepted values are 'tpu', 'gpus', None. tpu' means to use TPUStrategy.
'gpus' mean to use MirroredStrategy for multi-gpus. If None, use TF
default with OneDeviceStrategy.
</td>
</tr><tr>
<td>
`tpu`<a id="tpu"></a>
</td>
<td>
The Cloud TPU to use for training. This should be either the name
used when creating the Cloud TPU, or a grpc://ip.address.of.tpu:8470
url.
</td>
</tr><tr>
<td>
`gcp_project`<a id="gcp_project"></a>
</td>
<td>
Project name for the Cloud TPU-enabled project. If not
specified, we will attempt to automatically detect the GCE project from
metadata.
</td>
</tr><tr>
<td>
`tpu_zone`<a id="tpu_zone"></a>
</td>
<td>
GCE zone where the Cloud TPU is located in. If not specified, we
will attempt to automatically detect the GCE project from metadata.
</td>
</tr><tr>
<td>
`use_xla`<a id="use_xla"></a>
</td>
<td>
Use XLA even if strategy is not tpu. If strategy is tpu, always
use XLA, and this flag has no effect.
</td>
</tr><tr>
<td>
`profile`<a id="profile"></a>
</td>
<td>
Enable profile mode.
</td>
</tr><tr>
<td>
`debug`<a id="debug"></a>
</td>
<td>
Enable debug mode.
</td>
</tr><tr>
<td>
`tf_random_seed`<a id="tf_random_seed"></a>
</td>
<td>
Fixed random seed for deterministic execution across runs
for debugging.
</td>
</tr><tr>
<td>
`verbose`<a id="verbose"></a>
</td>
<td>
verbosity mode for <a href="https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/ModelCheckpoint"><code>tf.keras.callbacks.ModelCheckpoint</code></a>, 0 or 1.
</td>
</tr>
</table>
@@ -0,0 +1,212 @@
page_type: reference
description: Creates EfficientDet-Lite1 model spec. See also: <a href="../../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.object_detector.EfficientDetLite1Spec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.object_detector.EfficientDetLite1Spec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates EfficientDet-Lite1 model spec. See also: <a href="../../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.object_detector.EfficientDetLite1Spec(
*,
model_name=&#x27;efficientdet-lite1&#x27;,
uri=&#x27;https://tfhub.dev/tensorflow/efficientdet/lite1/feature-vector/1&#x27;,
hparams=&#x27;&#x27;,
model_dir=None,
epochs=50,
batch_size=64,
steps_per_execution=1,
moving_average_decay=0,
var_freeze_expr=&#x27;(efficientnet|fpn_cells|resample_p6)&#x27;,
tflite_max_detections=25,
strategy=None,
tpu=None,
gcp_project=None,
tpu_zone=None,
use_xla=False,
profile=False,
debug=False,
tf_random_seed=111111,
verbose=0
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_name`<a id="model_name"></a>
</td>
<td>
Model name.
</td>
</tr><tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
TF-Hub path/url to EfficientDet module.
</td>
</tr><tr>
<td>
`hparams`<a id="hparams"></a>
</td>
<td>
Hyperparameters used to overwrite default configuration. Can be
1) Dict, contains parameter names and values; 2) String, Comma separated
k=v pairs of hyperparameters; 3) String, yaml filename which's a module
containing attributes to use as hyperparameters.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location to save the model checkpoint files.
</td>
</tr><tr>
<td>
`epochs`<a id="epochs"></a>
</td>
<td>
Default training epochs.
</td>
</tr><tr>
<td>
`batch_size`<a id="batch_size"></a>
</td>
<td>
Training & Evaluation batch size.
</td>
</tr><tr>
<td>
`steps_per_execution`<a id="steps_per_execution"></a>
</td>
<td>
Number of steps per training execution.
</td>
</tr><tr>
<td>
`moving_average_decay`<a id="moving_average_decay"></a>
</td>
<td>
Float. The decay to use for maintaining moving
averages of the trained parameters.
</td>
</tr><tr>
<td>
`var_freeze_expr`<a id="var_freeze_expr"></a>
</td>
<td>
Expression to freeze variables.
</td>
</tr><tr>
<td>
`tflite_max_detections`<a id="tflite_max_detections"></a>
</td>
<td>
The max number of output detections in the TFLite
model.
</td>
</tr><tr>
<td>
`strategy`<a id="strategy"></a>
</td>
<td>
A string specifying which distribution strategy to use.
Accepted values are 'tpu', 'gpus', None. tpu' means to use TPUStrategy.
'gpus' mean to use MirroredStrategy for multi-gpus. If None, use TF
default with OneDeviceStrategy.
</td>
</tr><tr>
<td>
`tpu`<a id="tpu"></a>
</td>
<td>
The Cloud TPU to use for training. This should be either the name
used when creating the Cloud TPU, or a grpc://ip.address.of.tpu:8470
url.
</td>
</tr><tr>
<td>
`gcp_project`<a id="gcp_project"></a>
</td>
<td>
Project name for the Cloud TPU-enabled project. If not
specified, we will attempt to automatically detect the GCE project from
metadata.
</td>
</tr><tr>
<td>
`tpu_zone`<a id="tpu_zone"></a>
</td>
<td>
GCE zone where the Cloud TPU is located in. If not specified, we
will attempt to automatically detect the GCE project from metadata.
</td>
</tr><tr>
<td>
`use_xla`<a id="use_xla"></a>
</td>
<td>
Use XLA even if strategy is not tpu. If strategy is tpu, always
use XLA, and this flag has no effect.
</td>
</tr><tr>
<td>
`profile`<a id="profile"></a>
</td>
<td>
Enable profile mode.
</td>
</tr><tr>
<td>
`debug`<a id="debug"></a>
</td>
<td>
Enable debug mode.
</td>
</tr><tr>
<td>
`tf_random_seed`<a id="tf_random_seed"></a>
</td>
<td>
Fixed random seed for deterministic execution across runs
for debugging.
</td>
</tr><tr>
<td>
`verbose`<a id="verbose"></a>
</td>
<td>
verbosity mode for <a href="https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/ModelCheckpoint"><code>tf.keras.callbacks.ModelCheckpoint</code></a>, 0 or 1.
</td>
</tr>
</table>
@@ -0,0 +1,212 @@
page_type: reference
description: Creates EfficientDet-Lite2 model spec. See also: <a href="../../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.object_detector.EfficientDetLite2Spec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.object_detector.EfficientDetLite2Spec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates EfficientDet-Lite2 model spec. See also: <a href="../../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.object_detector.EfficientDetLite2Spec(
*,
model_name=&#x27;efficientdet-lite2&#x27;,
uri=&#x27;https://tfhub.dev/tensorflow/efficientdet/lite2/feature-vector/1&#x27;,
hparams=&#x27;&#x27;,
model_dir=None,
epochs=50,
batch_size=64,
steps_per_execution=1,
moving_average_decay=0,
var_freeze_expr=&#x27;(efficientnet|fpn_cells|resample_p6)&#x27;,
tflite_max_detections=25,
strategy=None,
tpu=None,
gcp_project=None,
tpu_zone=None,
use_xla=False,
profile=False,
debug=False,
tf_random_seed=111111,
verbose=0
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_name`<a id="model_name"></a>
</td>
<td>
Model name.
</td>
</tr><tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
TF-Hub path/url to EfficientDet module.
</td>
</tr><tr>
<td>
`hparams`<a id="hparams"></a>
</td>
<td>
Hyperparameters used to overwrite default configuration. Can be
1) Dict, contains parameter names and values; 2) String, Comma separated
k=v pairs of hyperparameters; 3) String, yaml filename which's a module
containing attributes to use as hyperparameters.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location to save the model checkpoint files.
</td>
</tr><tr>
<td>
`epochs`<a id="epochs"></a>
</td>
<td>
Default training epochs.
</td>
</tr><tr>
<td>
`batch_size`<a id="batch_size"></a>
</td>
<td>
Training & Evaluation batch size.
</td>
</tr><tr>
<td>
`steps_per_execution`<a id="steps_per_execution"></a>
</td>
<td>
Number of steps per training execution.
</td>
</tr><tr>
<td>
`moving_average_decay`<a id="moving_average_decay"></a>
</td>
<td>
Float. The decay to use for maintaining moving
averages of the trained parameters.
</td>
</tr><tr>
<td>
`var_freeze_expr`<a id="var_freeze_expr"></a>
</td>
<td>
Expression to freeze variables.
</td>
</tr><tr>
<td>
`tflite_max_detections`<a id="tflite_max_detections"></a>
</td>
<td>
The max number of output detections in the TFLite
model.
</td>
</tr><tr>
<td>
`strategy`<a id="strategy"></a>
</td>
<td>
A string specifying which distribution strategy to use.
Accepted values are 'tpu', 'gpus', None. tpu' means to use TPUStrategy.
'gpus' mean to use MirroredStrategy for multi-gpus. If None, use TF
default with OneDeviceStrategy.
</td>
</tr><tr>
<td>
`tpu`<a id="tpu"></a>
</td>
<td>
The Cloud TPU to use for training. This should be either the name
used when creating the Cloud TPU, or a grpc://ip.address.of.tpu:8470
url.
</td>
</tr><tr>
<td>
`gcp_project`<a id="gcp_project"></a>
</td>
<td>
Project name for the Cloud TPU-enabled project. If not
specified, we will attempt to automatically detect the GCE project from
metadata.
</td>
</tr><tr>
<td>
`tpu_zone`<a id="tpu_zone"></a>
</td>
<td>
GCE zone where the Cloud TPU is located in. If not specified, we
will attempt to automatically detect the GCE project from metadata.
</td>
</tr><tr>
<td>
`use_xla`<a id="use_xla"></a>
</td>
<td>
Use XLA even if strategy is not tpu. If strategy is tpu, always
use XLA, and this flag has no effect.
</td>
</tr><tr>
<td>
`profile`<a id="profile"></a>
</td>
<td>
Enable profile mode.
</td>
</tr><tr>
<td>
`debug`<a id="debug"></a>
</td>
<td>
Enable debug mode.
</td>
</tr><tr>
<td>
`tf_random_seed`<a id="tf_random_seed"></a>
</td>
<td>
Fixed random seed for deterministic execution across runs
for debugging.
</td>
</tr><tr>
<td>
`verbose`<a id="verbose"></a>
</td>
<td>
verbosity mode for <a href="https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/ModelCheckpoint"><code>tf.keras.callbacks.ModelCheckpoint</code></a>, 0 or 1.
</td>
</tr>
</table>
@@ -0,0 +1,212 @@
page_type: reference
description: Creates EfficientDet-Lite3 model spec. See also: <a href="../../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.object_detector.EfficientDetLite3Spec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.object_detector.EfficientDetLite3Spec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates EfficientDet-Lite3 model spec. See also: <a href="../../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.object_detector.EfficientDetLite3Spec(
*,
model_name=&#x27;efficientdet-lite3&#x27;,
uri=&#x27;https://tfhub.dev/tensorflow/efficientdet/lite3/feature-vector/1&#x27;,
hparams=&#x27;&#x27;,
model_dir=None,
epochs=50,
batch_size=64,
steps_per_execution=1,
moving_average_decay=0,
var_freeze_expr=&#x27;(efficientnet|fpn_cells|resample_p6)&#x27;,
tflite_max_detections=25,
strategy=None,
tpu=None,
gcp_project=None,
tpu_zone=None,
use_xla=False,
profile=False,
debug=False,
tf_random_seed=111111,
verbose=0
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_name`<a id="model_name"></a>
</td>
<td>
Model name.
</td>
</tr><tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
TF-Hub path/url to EfficientDet module.
</td>
</tr><tr>
<td>
`hparams`<a id="hparams"></a>
</td>
<td>
Hyperparameters used to overwrite default configuration. Can be
1) Dict, contains parameter names and values; 2) String, Comma separated
k=v pairs of hyperparameters; 3) String, yaml filename which's a module
containing attributes to use as hyperparameters.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location to save the model checkpoint files.
</td>
</tr><tr>
<td>
`epochs`<a id="epochs"></a>
</td>
<td>
Default training epochs.
</td>
</tr><tr>
<td>
`batch_size`<a id="batch_size"></a>
</td>
<td>
Training & Evaluation batch size.
</td>
</tr><tr>
<td>
`steps_per_execution`<a id="steps_per_execution"></a>
</td>
<td>
Number of steps per training execution.
</td>
</tr><tr>
<td>
`moving_average_decay`<a id="moving_average_decay"></a>
</td>
<td>
Float. The decay to use for maintaining moving
averages of the trained parameters.
</td>
</tr><tr>
<td>
`var_freeze_expr`<a id="var_freeze_expr"></a>
</td>
<td>
Expression to freeze variables.
</td>
</tr><tr>
<td>
`tflite_max_detections`<a id="tflite_max_detections"></a>
</td>
<td>
The max number of output detections in the TFLite
model.
</td>
</tr><tr>
<td>
`strategy`<a id="strategy"></a>
</td>
<td>
A string specifying which distribution strategy to use.
Accepted values are 'tpu', 'gpus', None. tpu' means to use TPUStrategy.
'gpus' mean to use MirroredStrategy for multi-gpus. If None, use TF
default with OneDeviceStrategy.
</td>
</tr><tr>
<td>
`tpu`<a id="tpu"></a>
</td>
<td>
The Cloud TPU to use for training. This should be either the name
used when creating the Cloud TPU, or a grpc://ip.address.of.tpu:8470
url.
</td>
</tr><tr>
<td>
`gcp_project`<a id="gcp_project"></a>
</td>
<td>
Project name for the Cloud TPU-enabled project. If not
specified, we will attempt to automatically detect the GCE project from
metadata.
</td>
</tr><tr>
<td>
`tpu_zone`<a id="tpu_zone"></a>
</td>
<td>
GCE zone where the Cloud TPU is located in. If not specified, we
will attempt to automatically detect the GCE project from metadata.
</td>
</tr><tr>
<td>
`use_xla`<a id="use_xla"></a>
</td>
<td>
Use XLA even if strategy is not tpu. If strategy is tpu, always
use XLA, and this flag has no effect.
</td>
</tr><tr>
<td>
`profile`<a id="profile"></a>
</td>
<td>
Enable profile mode.
</td>
</tr><tr>
<td>
`debug`<a id="debug"></a>
</td>
<td>
Enable debug mode.
</td>
</tr><tr>
<td>
`tf_random_seed`<a id="tf_random_seed"></a>
</td>
<td>
Fixed random seed for deterministic execution across runs
for debugging.
</td>
</tr><tr>
<td>
`verbose`<a id="verbose"></a>
</td>
<td>
verbosity mode for <a href="https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/ModelCheckpoint"><code>tf.keras.callbacks.ModelCheckpoint</code></a>, 0 or 1.
</td>
</tr>
</table>
@@ -0,0 +1,212 @@
page_type: reference
description: Creates EfficientDet-Lite4 model spec. See also: <a href="../../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.object_detector.EfficientDetLite4Spec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.object_detector.EfficientDetLite4Spec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates EfficientDet-Lite4 model spec. See also: <a href="../../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.object_detector.EfficientDetLite4Spec(
*,
model_name=&#x27;efficientdet-lite4&#x27;,
uri=&#x27;https://tfhub.dev/tensorflow/efficientdet/lite4/feature-vector/2&#x27;,
hparams=&#x27;&#x27;,
model_dir=None,
epochs=50,
batch_size=64,
steps_per_execution=1,
moving_average_decay=0,
var_freeze_expr=&#x27;(efficientnet|fpn_cells|resample_p6)&#x27;,
tflite_max_detections=25,
strategy=None,
tpu=None,
gcp_project=None,
tpu_zone=None,
use_xla=False,
profile=False,
debug=False,
tf_random_seed=111111,
verbose=0
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_name`<a id="model_name"></a>
</td>
<td>
Model name.
</td>
</tr><tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
TF-Hub path/url to EfficientDet module.
</td>
</tr><tr>
<td>
`hparams`<a id="hparams"></a>
</td>
<td>
Hyperparameters used to overwrite default configuration. Can be
1) Dict, contains parameter names and values; 2) String, Comma separated
k=v pairs of hyperparameters; 3) String, yaml filename which's a module
containing attributes to use as hyperparameters.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location to save the model checkpoint files.
</td>
</tr><tr>
<td>
`epochs`<a id="epochs"></a>
</td>
<td>
Default training epochs.
</td>
</tr><tr>
<td>
`batch_size`<a id="batch_size"></a>
</td>
<td>
Training & Evaluation batch size.
</td>
</tr><tr>
<td>
`steps_per_execution`<a id="steps_per_execution"></a>
</td>
<td>
Number of steps per training execution.
</td>
</tr><tr>
<td>
`moving_average_decay`<a id="moving_average_decay"></a>
</td>
<td>
Float. The decay to use for maintaining moving
averages of the trained parameters.
</td>
</tr><tr>
<td>
`var_freeze_expr`<a id="var_freeze_expr"></a>
</td>
<td>
Expression to freeze variables.
</td>
</tr><tr>
<td>
`tflite_max_detections`<a id="tflite_max_detections"></a>
</td>
<td>
The max number of output detections in the TFLite
model.
</td>
</tr><tr>
<td>
`strategy`<a id="strategy"></a>
</td>
<td>
A string specifying which distribution strategy to use.
Accepted values are 'tpu', 'gpus', None. tpu' means to use TPUStrategy.
'gpus' mean to use MirroredStrategy for multi-gpus. If None, use TF
default with OneDeviceStrategy.
</td>
</tr><tr>
<td>
`tpu`<a id="tpu"></a>
</td>
<td>
The Cloud TPU to use for training. This should be either the name
used when creating the Cloud TPU, or a grpc://ip.address.of.tpu:8470
url.
</td>
</tr><tr>
<td>
`gcp_project`<a id="gcp_project"></a>
</td>
<td>
Project name for the Cloud TPU-enabled project. If not
specified, we will attempt to automatically detect the GCE project from
metadata.
</td>
</tr><tr>
<td>
`tpu_zone`<a id="tpu_zone"></a>
</td>
<td>
GCE zone where the Cloud TPU is located in. If not specified, we
will attempt to automatically detect the GCE project from metadata.
</td>
</tr><tr>
<td>
`use_xla`<a id="use_xla"></a>
</td>
<td>
Use XLA even if strategy is not tpu. If strategy is tpu, always
use XLA, and this flag has no effect.
</td>
</tr><tr>
<td>
`profile`<a id="profile"></a>
</td>
<td>
Enable profile mode.
</td>
</tr><tr>
<td>
`debug`<a id="debug"></a>
</td>
<td>
Enable debug mode.
</td>
</tr><tr>
<td>
`tf_random_seed`<a id="tf_random_seed"></a>
</td>
<td>
Fixed random seed for deterministic execution across runs
for debugging.
</td>
</tr><tr>
<td>
`verbose`<a id="verbose"></a>
</td>
<td>
verbosity mode for <a href="https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/ModelCheckpoint"><code>tf.keras.callbacks.ModelCheckpoint</code></a>, 0 or 1.
</td>
</tr>
</table>
@@ -0,0 +1,592 @@
page_type: reference
description: A specification of the EfficientDet model.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.object_detector.EfficientDetSpec" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="create_model"/>
<meta itemprop="property" content="evaluate"/>
<meta itemprop="property" content="evaluate_tflite"/>
<meta itemprop="property" content="export_saved_model"/>
<meta itemprop="property" content="export_tflite"/>
<meta itemprop="property" content="get_default_quantization_config"/>
<meta itemprop="property" content="train"/>
<meta itemprop="property" content="compat_tf_versions"/>
</div>
# tflite_model_maker.object_detector.EfficientDetSpec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/object_detector_spec.py#L109-L513">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
A specification of the EfficientDet model.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.object_detector.EfficientDetSpec(
model_name: str,
uri: str,
hparams: str = &#x27;&#x27;,
model_dir: Optional[str] = None,
epochs: int = 50,
batch_size: int = 64,
steps_per_execution: int = 1,
moving_average_decay: int = 0,
var_freeze_expr: str = &#x27;(efficientnet|fpn_cells|resample_p6)&#x27;,
tflite_max_detections: int = 25,
strategy: Optional[str] = None,
tpu: Optional[str] = None,
gcp_project: Optional[str] = None,
tpu_zone: Optional[str] = None,
use_xla: bool = False,
profile: bool = False,
debug: bool = False,
tf_random_seed: int = 111111,
verbose: int = 0
) -> None
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_name`<a id="model_name"></a>
</td>
<td>
Model name.
</td>
</tr><tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
TF-Hub path/url to EfficientDet module.
</td>
</tr><tr>
<td>
`hparams`<a id="hparams"></a>
</td>
<td>
Hyperparameters used to overwrite default configuration. Can be
1) Dict, contains parameter names and values; 2) String, Comma separated
k=v pairs of hyperparameters; 3) String, yaml filename which's a module
containing attributes to use as hyperparameters.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location to save the model checkpoint files.
</td>
</tr><tr>
<td>
`epochs`<a id="epochs"></a>
</td>
<td>
Default training epochs.
</td>
</tr><tr>
<td>
`batch_size`<a id="batch_size"></a>
</td>
<td>
Training & Evaluation batch size.
</td>
</tr><tr>
<td>
`steps_per_execution`<a id="steps_per_execution"></a>
</td>
<td>
Number of steps per training execution.
</td>
</tr><tr>
<td>
`moving_average_decay`<a id="moving_average_decay"></a>
</td>
<td>
Float. The decay to use for maintaining moving
averages of the trained parameters.
</td>
</tr><tr>
<td>
`var_freeze_expr`<a id="var_freeze_expr"></a>
</td>
<td>
Expression to freeze variables.
</td>
</tr><tr>
<td>
`tflite_max_detections`<a id="tflite_max_detections"></a>
</td>
<td>
The max number of output detections in the TFLite
model.
</td>
</tr><tr>
<td>
`strategy`<a id="strategy"></a>
</td>
<td>
A string specifying which distribution strategy to use.
Accepted values are 'tpu', 'gpus', None. tpu' means to use TPUStrategy.
'gpus' mean to use MirroredStrategy for multi-gpus. If None, use TF
default with OneDeviceStrategy.
</td>
</tr><tr>
<td>
`tpu`<a id="tpu"></a>
</td>
<td>
The Cloud TPU to use for training. This should be either the name
used when creating the Cloud TPU, or a grpc://ip.address.of.tpu:8470
url.
</td>
</tr><tr>
<td>
`gcp_project`<a id="gcp_project"></a>
</td>
<td>
Project name for the Cloud TPU-enabled project. If not
specified, we will attempt to automatically detect the GCE project from
metadata.
</td>
</tr><tr>
<td>
`tpu_zone`<a id="tpu_zone"></a>
</td>
<td>
GCE zone where the Cloud TPU is located in. If not specified, we
will attempt to automatically detect the GCE project from metadata.
</td>
</tr><tr>
<td>
`use_xla`<a id="use_xla"></a>
</td>
<td>
Use XLA even if strategy is not tpu. If strategy is tpu, always
use XLA, and this flag has no effect.
</td>
</tr><tr>
<td>
`profile`<a id="profile"></a>
</td>
<td>
Enable profile mode.
</td>
</tr><tr>
<td>
`debug`<a id="debug"></a>
</td>
<td>
Enable debug mode.
</td>
</tr><tr>
<td>
`tf_random_seed`<a id="tf_random_seed"></a>
</td>
<td>
Fixed random seed for deterministic execution across runs
for debugging.
</td>
</tr><tr>
<td>
`verbose`<a id="verbose"></a>
</td>
<td>
verbosity mode for <a href="https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/ModelCheckpoint"><code>tf.keras.callbacks.ModelCheckpoint</code></a>, 0 or 1.
</td>
</tr>
</table>
## Methods
<h3 id="create_model"><code>create_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/object_detector_spec.py#L235-L238">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_model() -> tf.keras.Model
</code></pre>
Creates the EfficientDet model.
<h3 id="evaluate"><code>evaluate</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/object_detector_spec.py#L303-L346">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate(
model: tf.keras.Model,
dataset: tf.data.Dataset,
steps: int,
json_file: Optional[str] = None
) -> Dict[str, float]
</code></pre>
Evaluate the EfficientDet keras model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`model`
</td>
<td>
The keras model to be evaluated.
</td>
</tr><tr>
<td>
`dataset`
</td>
<td>
tf.data.Dataset used for evaluation.
</td>
</tr><tr>
<td>
`steps`
</td>
<td>
Number of steps to evaluate the model.
</td>
</tr><tr>
<td>
`json_file`
</td>
<td>
JSON with COCO data format containing golden bounding boxes.
Used for validation. If None, use the ground truth from the dataloader.
Refer to
<a href="https://towardsdatascience.com/coco-data-format-for-object-detection-a4c5eaf518c5">https://towardsdatascience.com/coco-data-format-for-object-detection-a4c5eaf518c5</a>
for the description of COCO data format.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A dict contains AP metrics.
</td>
</tr>
</table>
<h3 id="evaluate_tflite"><code>evaluate_tflite</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/object_detector_spec.py#L348-L401">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate_tflite(
tflite_filepath: str,
dataset: tf.data.Dataset,
steps: int,
json_file: Optional[str] = None
) -> Dict[str, float]
</code></pre>
Evaluate the EfficientDet TFLite model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`tflite_filepath`
</td>
<td>
File path to the TFLite model.
</td>
</tr><tr>
<td>
`dataset`
</td>
<td>
tf.data.Dataset used for evaluation.
</td>
</tr><tr>
<td>
`steps`
</td>
<td>
Number of steps to evaluate the model.
</td>
</tr><tr>
<td>
`json_file`
</td>
<td>
JSON with COCO data format containing golden bounding boxes.
Used for validation. If None, use the ground truth from the dataloader.
Refer to
<a href="https://towardsdatascience.com/coco-data-format-for-object-detection-a4c5eaf518c5">https://towardsdatascience.com/coco-data-format-for-object-detection-a4c5eaf518c5</a>
for the description of COCO data format.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A dict contains AP metrics.
</td>
</tr>
</table>
<h3 id="export_saved_model"><code>export_saved_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/object_detector_spec.py#L403-L446">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>export_saved_model(
model: tf.keras.Model,
saved_model_dir: str,
batch_size: Optional[int] = None,
pre_mode: Optional[str] = &#x27;infer&#x27;,
post_mode: Optional[str] = &#x27;global&#x27;
) -> None
</code></pre>
Saves the model to Tensorflow SavedModel.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`model`
</td>
<td>
The EfficientDetNet model used for training which doesn't have pre
and post processing.
</td>
</tr><tr>
<td>
`saved_model_dir`
</td>
<td>
Folder path for saved model.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
Batch size to be saved in saved_model.
</td>
</tr><tr>
<td>
`pre_mode`
</td>
<td>
Pre-processing Mode in ExportModel, must be {None, 'infer'}.
</td>
</tr><tr>
<td>
`post_mode`
</td>
<td>
Post-processing Mode in ExportModel, must be {None, 'global',
'per_class', 'tflite'}.
</td>
</tr>
</table>
<h3 id="export_tflite"><code>export_tflite</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/object_detector_spec.py#L466-L513">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>export_tflite(
model: tf.keras.Model,
tflite_filepath: str,
quantization_config: Optional[<a href="../../tflite_model_maker/config/QuantizationConfig"><code>tflite_model_maker.config.QuantizationConfig</code></a>] = None
) -> None
</code></pre>
Converts the retrained model to tflite format and saves it.
The exported TFLite model has the following inputs & outputs:
One input:
image: a float32 tensor of shape[1, height, width, 3] containing the
normalized input image. `self.config.image_size` is [height, width].
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Four Outputs</th></tr>
<tr>
<td>
`detection_boxes`
</td>
<td>
a float32 tensor of shape [1, num_boxes, 4] with box
locations.
</td>
</tr><tr>
<td>
`detection_classes`
</td>
<td>
a float32 tensor of shape [1, num_boxes] with class
indices.
</td>
</tr><tr>
<td>
`detection_scores`
</td>
<td>
a float32 tensor of shape [1, num_boxes] with class
scores.
</td>
</tr><tr>
<td>
`num_boxes`
</td>
<td>
a float32 tensor of size 1 containing the number of detected
boxes.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`model`
</td>
<td>
The EfficientDetNet model used for training which doesn't have pre
and post processing.
</td>
</tr><tr>
<td>
`tflite_filepath`
</td>
<td>
File path to save tflite model.
</td>
</tr><tr>
<td>
`quantization_config`
</td>
<td>
Configuration for post-training quantization.
</td>
</tr>
</table>
<h3 id="get_default_quantization_config"><code>get_default_quantization_config</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/object_detector_spec.py#L448-L464">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_default_quantization_config(
representative_data: <a href="../../tflite_model_maker/object_detector/DataLoader"><code>tflite_model_maker.object_detector.DataLoader</code></a>
) -> <a href="../../tflite_model_maker/config/QuantizationConfig"><code>tflite_model_maker.config.QuantizationConfig</code></a>
</code></pre>
Gets the default quantization configuration.
<h3 id="train"><code>train</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/object_detector_spec.py#L240-L272">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>train(
model: tf.keras.Model,
train_dataset: tf.data.Dataset,
steps_per_epoch: int,
val_dataset: Optional[tf.data.Dataset],
validation_steps: int,
epochs: Optional[int] = None,
batch_size: Optional[int] = None,
val_json_file: Optional[str] = None
) -> tf.keras.Model
</code></pre>
Run EfficientDet training.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
compat_tf_versions<a id="compat_tf_versions"></a>
</td>
<td>
`[2]`
</td>
</tr>
</table>
@@ -0,0 +1,384 @@
page_type: reference
description: ObjectDetector class for inference and exporting to tflite.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.object_detector.ObjectDetector" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="create"/>
<meta itemprop="property" content="create_model"/>
<meta itemprop="property" content="create_serving_model"/>
<meta itemprop="property" content="evaluate"/>
<meta itemprop="property" content="evaluate_tflite"/>
<meta itemprop="property" content="export"/>
<meta itemprop="property" content="summary"/>
<meta itemprop="property" content="train"/>
<meta itemprop="property" content="ALLOWED_EXPORT_FORMAT"/>
<meta itemprop="property" content="DEFAULT_EXPORT_FORMAT"/>
</div>
# tflite_model_maker.object_detector.ObjectDetector
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/object_detector.py#L37-L264">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
ObjectDetector class for inference and exporting to tflite.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.object_detector.ObjectDetector(
model_spec: <a href="../../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>,
label_map: Dict[int, str],
representative_data: Optional[<a href="../../tflite_model_maker/object_detector/DataLoader"><code>tflite_model_maker.object_detector.DataLoader</code></a>] = None
) -> None
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_spec`<a id="model_spec"></a>
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`label_map`<a id="label_map"></a>
</td>
<td>
Dict, map label integer ids to string label names such as {1:
'person', 2: 'notperson'}. 0 is the reserved key for `background` and
doesn't need to be included in `label_map`. Label names can't be
duplicated.
</td>
</tr><tr>
<td>
`representative_data`<a id="representative_data"></a>
</td>
<td>
Representative dataset for full integer
quantization. Used when converting the keras model to the TFLite model
with full interger quantization.
</td>
</tr>
</table>
## Methods
<h3 id="create"><code>create</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/object_detector.py#L219-L264">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>create(
train_data: <a href="../../tflite_model_maker/object_detector/DataLoader"><code>tflite_model_maker.object_detector.DataLoader</code></a>,
model_spec: <a href="../../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>,
validation_data: Optional[<a href="../../tflite_model_maker/object_detector/DataLoader"><code>tflite_model_maker.object_detector.DataLoader</code></a>] = None,
epochs: Optional[<a href="../../tflite_model_maker/object_detector/DataLoader"><code>tflite_model_maker.object_detector.DataLoader</code></a>] = None,
batch_size: Optional[int] = None,
train_whole_model: bool = False,
do_train: bool = True
) -> T
</code></pre>
Loads data and train the model for object detection.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`train_data`
</td>
<td>
Training data.
</td>
</tr><tr>
<td>
`model_spec`
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`validation_data`
</td>
<td>
Validation data. If None, skips validation process.
</td>
</tr><tr>
<td>
`epochs`
</td>
<td>
Number of epochs for training.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
Batch size for training.
</td>
</tr><tr>
<td>
`train_whole_model`
</td>
<td>
Boolean, False by default. If true, train the whole
model. Otherwise, only train the layers that are not match
`model_spec.config.var_freeze_expr`.
</td>
</tr><tr>
<td>
`do_train`
</td>
<td>
Whether to run training.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
An instance based on ObjectDetector.
</td>
</tr>
</table>
<h3 id="create_model"><code>create_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/object_detector.py#L73-L75">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_model() -> tf.keras.Model
</code></pre>
<h3 id="create_serving_model"><code>create_serving_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L170-L176">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_serving_model()
</code></pre>
Returns the underlining Keras model for serving.
<h3 id="evaluate"><code>evaluate</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/object_detector.py#L127-L148">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate(
data: <a href="../../tflite_model_maker/object_detector/DataLoader"><code>tflite_model_maker.object_detector.DataLoader</code></a>,
batch_size: Optional[int] = None
) -> Dict[str, float]
</code></pre>
Evaluates the model.
<h3 id="evaluate_tflite"><code>evaluate_tflite</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/object_detector.py#L150-L156">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate_tflite(
tflite_filepath: str,
data: <a href="../../tflite_model_maker/object_detector/DataLoader"><code>tflite_model_maker.object_detector.DataLoader</code></a>
) -> Dict[str, float]
</code></pre>
Evaluate the TFLite model.
<h3 id="export"><code>export</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L95-L168">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>export(
export_dir,
tflite_filename=&#x27;model.tflite&#x27;,
label_filename=&#x27;labels.txt&#x27;,
vocab_filename=&#x27;vocab.txt&#x27;,
saved_model_filename=&#x27;saved_model&#x27;,
tfjs_folder_name=&#x27;tfjs&#x27;,
export_format=None,
**kwargs
)
</code></pre>
Converts the retrained model based on `export_format`.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`export_dir`
</td>
<td>
The directory to save exported files.
</td>
</tr><tr>
<td>
`tflite_filename`
</td>
<td>
File name to save tflite model. The full export path is
{export_dir}/{tflite_filename}.
</td>
</tr><tr>
<td>
`label_filename`
</td>
<td>
File name to save labels. The full export path is
{export_dir}/{label_filename}.
</td>
</tr><tr>
<td>
`vocab_filename`
</td>
<td>
File name to save vocabulary. The full export path is
{export_dir}/{vocab_filename}.
</td>
</tr><tr>
<td>
`saved_model_filename`
</td>
<td>
Path to SavedModel or H5 file to save the model. The
full export path is
{export_dir}/{saved_model_filename}/{saved_model.pb|assets|variables}.
</td>
</tr><tr>
<td>
`tfjs_folder_name`
</td>
<td>
Folder name to save tfjs model. The full export path is
{export_dir}/{tfjs_folder_name}.
</td>
</tr><tr>
<td>
`export_format`
</td>
<td>
List of export format that could be saved_model, tflite,
label, vocab.
</td>
</tr><tr>
<td>
`**kwargs`
</td>
<td>
Other parameters like `quantized_config` for TFLITE model.
</td>
</tr>
</table>
<h3 id="summary"><code>summary</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L65-L66">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>summary()
</code></pre>
<h3 id="train"><code>train</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/object_detector.py#L92-L125">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>train(
train_data: <a href="../../tflite_model_maker/object_detector/DataLoader"><code>tflite_model_maker.object_detector.DataLoader</code></a>,
validation_data: Optional[<a href="../../tflite_model_maker/object_detector/DataLoader"><code>tflite_model_maker.object_detector.DataLoader</code></a>] = None,
epochs: Optional[int] = None,
batch_size: Optional[int] = None
) -> tf.keras.Model
</code></pre>
Feeds the training data for training.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
ALLOWED_EXPORT_FORMAT<a id="ALLOWED_EXPORT_FORMAT"></a>
</td>
<td>
`(<ExportFormat.TFLITE: 'TFLITE'>,
<ExportFormat.SAVED_MODEL: 'SAVED_MODEL'>,
<ExportFormat.LABEL: 'LABEL'>)`
</td>
</tr><tr>
<td>
DEFAULT_EXPORT_FORMAT<a id="DEFAULT_EXPORT_FORMAT"></a>
</td>
<td>
`<ExportFormat.TFLITE: 'TFLITE'>`
</td>
</tr>
</table>
@@ -0,0 +1,139 @@
page_type: reference
description: Loads data and train the model for object detection.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.object_detector.create" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.object_detector.create
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/object_detector.py#L219-L264">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Loads data and train the model for object detection.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>tflite_model_maker.object_detector.create(
train_data: <a href="../../tflite_model_maker/object_detector/DataLoader"><code>tflite_model_maker.object_detector.DataLoader</code></a>,
model_spec: <a href="../../tflite_model_maker/object_detector/EfficientDetSpec"><code>tflite_model_maker.object_detector.EfficientDetSpec</code></a>,
validation_data: Optional[<a href="../../tflite_model_maker/object_detector/DataLoader"><code>tflite_model_maker.object_detector.DataLoader</code></a>] = None,
epochs: Optional[<a href="../../tflite_model_maker/object_detector/DataLoader"><code>tflite_model_maker.object_detector.DataLoader</code></a>] = None,
batch_size: Optional[int] = None,
train_whole_model: bool = False,
do_train: bool = True
) -> T
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/object_detection">Object Detection with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`train_data`<a id="train_data"></a>
</td>
<td>
Training data.
</td>
</tr><tr>
<td>
`model_spec`<a id="model_spec"></a>
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`validation_data`<a id="validation_data"></a>
</td>
<td>
Validation data. If None, skips validation process.
</td>
</tr><tr>
<td>
`epochs`<a id="epochs"></a>
</td>
<td>
Number of epochs for training.
</td>
</tr><tr>
<td>
`batch_size`<a id="batch_size"></a>
</td>
<td>
Batch size for training.
</td>
</tr><tr>
<td>
`train_whole_model`<a id="train_whole_model"></a>
</td>
<td>
Boolean, False by default. If true, train the whole
model. Otherwise, only train the layers that are not match
`model_spec.config.var_freeze_expr`.
</td>
</tr><tr>
<td>
`do_train`<a id="do_train"></a>
</td>
<td>
Whether to run training.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Returns</h2></th></tr>
<tr class="alt">
<td colspan="2">
An instance based on ObjectDetector.
</td>
</tr>
</table>
@@ -0,0 +1,52 @@
page_type: reference
description: APIs to train a model that can answer questions based on a predefined text.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.question_answer" />
<meta itemprop="path" content="Stable" />
</div>
# Module: tflite_model_maker.question_answer
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/tflmm/v0.4.2/tensorflow_examples/lite/model_maker/public/question_answer/__init__.py">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
APIs to train a model that can answer questions based on a predefined text.
#### Task guide:
<a href="https://www.tensorflow.org/lite/tutorials/model_maker_question_answer">https://www.tensorflow.org/lite/tutorials/model_maker_question_answer</a>
## Classes
[`class BertQaSpec`](../tflite_model_maker/question_answer/BertQaSpec): A specification of BERT model for question answering.
[`class DataLoader`](../tflite_model_maker/question_answer/DataLoader): DataLoader for question answering.
[`class QuestionAnswer`](../tflite_model_maker/question_answer/QuestionAnswer): QuestionAnswer class for inference and exporting to tflite.
## Functions
[`MobileBertQaSpec(...)`](../tflite_model_maker/question_answer/MobileBertQaSpec): Creates MobileBert model spec for the question answer task. See also: <a href="../tflite_model_maker/question_answer/BertQaSpec"><code>tflite_model_maker.question_answer.BertQaSpec</code></a>.
[`MobileBertQaSquadSpec(...)`](../tflite_model_maker/question_answer/MobileBertQaSquadSpec): Creates MobileBert model spec that's already retrained on SQuAD1.1 for the question answer task. See also: <a href="../tflite_model_maker/question_answer/BertQaSpec"><code>tflite_model_maker.question_answer.BertQaSpec</code></a>.
[`create(...)`](../tflite_model_maker/question_answer/create): Loads data and train the model for question answer.
@@ -0,0 +1,629 @@
page_type: reference
description: A specification of BERT model for question answering.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.question_answer.BertQaSpec" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="build"/>
<meta itemprop="property" content="convert_examples_to_features"/>
<meta itemprop="property" content="create_model"/>
<meta itemprop="property" content="evaluate"/>
<meta itemprop="property" content="get_config"/>
<meta itemprop="property" content="get_default_quantization_config"/>
<meta itemprop="property" content="get_name_to_features"/>
<meta itemprop="property" content="predict"/>
<meta itemprop="property" content="predict_tflite"/>
<meta itemprop="property" content="reorder_input_details"/>
<meta itemprop="property" content="reorder_output_details"/>
<meta itemprop="property" content="save_vocab"/>
<meta itemprop="property" content="select_data_from_record"/>
<meta itemprop="property" content="train"/>
<meta itemprop="property" content="compat_tf_versions"/>
<meta itemprop="property" content="convert_from_saved_model_tf2"/>
<meta itemprop="property" content="need_gen_vocab"/>
</div>
# tflite_model_maker.question_answer.BertQaSpec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L754-L1083">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
A specification of BERT model for question answering.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.question_answer.BertQaSpec(
uri=&#x27;https://tfhub.dev/tensorflow/bert_en_uncased_L-12_H-768_A-12/1&#x27;,
model_dir=None,
seq_len=384,
query_len=64,
doc_stride=128,
dropout_rate=0.1,
initializer_range=0.02,
learning_rate=8e-05,
distribution_strategy=&#x27;mirrored&#x27;,
num_gpus=-1,
tpu=&#x27;&#x27;,
trainable=True,
predict_batch_size=8,
do_lower_case=True,
is_tf2=True,
tflite_input_name=None,
tflite_output_name=None,
init_from_squad_model=False,
default_batch_size=16,
name=&#x27;Bert&#x27;
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
TF-Hub path/url to Bert module.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location of the model checkpoint files.
</td>
</tr><tr>
<td>
`seq_len`<a id="seq_len"></a>
</td>
<td>
Length of the sequence to feed into the model.
</td>
</tr><tr>
<td>
`query_len`<a id="query_len"></a>
</td>
<td>
Length of the query to feed into the model.
</td>
</tr><tr>
<td>
`doc_stride`<a id="doc_stride"></a>
</td>
<td>
The stride when we do a sliding window approach to take chunks
of the documents.
</td>
</tr><tr>
<td>
`dropout_rate`<a id="dropout_rate"></a>
</td>
<td>
The rate for dropout.
</td>
</tr><tr>
<td>
`initializer_range`<a id="initializer_range"></a>
</td>
<td>
The stdev of the truncated_normal_initializer for
initializing all weight matrices.
</td>
</tr><tr>
<td>
`learning_rate`<a id="learning_rate"></a>
</td>
<td>
The initial learning rate for Adam.
</td>
</tr><tr>
<td>
`distribution_strategy`<a id="distribution_strategy"></a>
</td>
<td>
A string specifying which distribution strategy to
use. Accepted values are 'off', 'one_device', 'mirrored',
'parameter_server', 'multi_worker_mirrored', and 'tpu' -- case
insensitive. 'off' means not to use Distribution Strategy; 'tpu' means
to use TPUStrategy using `tpu_address`.
</td>
</tr><tr>
<td>
`num_gpus`<a id="num_gpus"></a>
</td>
<td>
How many GPUs to use at each worker with the
DistributionStrategies API. The default is -1, which means utilize all
available GPUs.
</td>
</tr><tr>
<td>
`tpu`<a id="tpu"></a>
</td>
<td>
TPU address to connect to.
</td>
</tr><tr>
<td>
`trainable`<a id="trainable"></a>
</td>
<td>
boolean, whether pretrain layer is trainable.
</td>
</tr><tr>
<td>
`predict_batch_size`<a id="predict_batch_size"></a>
</td>
<td>
Batch size for prediction.
</td>
</tr><tr>
<td>
`do_lower_case`<a id="do_lower_case"></a>
</td>
<td>
boolean, whether to lower case the input text. Should be
True for uncased models and False for cased models.
</td>
</tr><tr>
<td>
`is_tf2`<a id="is_tf2"></a>
</td>
<td>
boolean, whether the hub module is in TensorFlow 2.x format.
</td>
</tr><tr>
<td>
`tflite_input_name`<a id="tflite_input_name"></a>
</td>
<td>
Dict, input names for the TFLite model.
</td>
</tr><tr>
<td>
`tflite_output_name`<a id="tflite_output_name"></a>
</td>
<td>
Dict, output names for the TFLite model.
</td>
</tr><tr>
<td>
`init_from_squad_model`<a id="init_from_squad_model"></a>
</td>
<td>
boolean, whether to initialize from the model that
is already retrained on Squad 1.1.
</td>
</tr><tr>
<td>
`default_batch_size`<a id="default_batch_size"></a>
</td>
<td>
Default batch size for training.
</td>
</tr><tr>
<td>
`name`<a id="name"></a>
</td>
<td>
Name of the object.
</td>
</tr>
</table>
## Methods
<h3 id="build"><code>build</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L438-L445">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>build()
</code></pre>
Builds the class. Used for lazy initialization.
<h3 id="convert_examples_to_features"><code>convert_examples_to_features</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L871-L885">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>convert_examples_to_features(
examples, is_training, output_fn, batch_size
)
</code></pre>
Converts examples to features and write them into TFRecord file.
<h3 id="create_model"><code>create_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L887-L899">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_model()
</code></pre>
Creates the model for qa task.
<h3 id="evaluate"><code>evaluate</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L1016-L1083">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate(
model,
tflite_filepath,
dataset,
num_steps,
eval_examples,
eval_features,
predict_file,
version_2_with_negative,
max_answer_length,
null_score_diff_threshold,
verbose_logging,
output_dir
)
</code></pre>
Evaluate QA model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`model`
</td>
<td>
The keras model to be evaluated.
</td>
</tr><tr>
<td>
`tflite_filepath`
</td>
<td>
File path to the TFLite model.
</td>
</tr><tr>
<td>
`dataset`
</td>
<td>
tf.data.Dataset used for evaluation.
</td>
</tr><tr>
<td>
`num_steps`
</td>
<td>
Number of steps to evaluate the model.
</td>
</tr><tr>
<td>
`eval_examples`
</td>
<td>
List of `squad_lib.SquadExample` for evaluation data.
</td>
</tr><tr>
<td>
`eval_features`
</td>
<td>
List of `squad_lib.InputFeatures` for evaluation data.
</td>
</tr><tr>
<td>
`predict_file`
</td>
<td>
The input predict file.
</td>
</tr><tr>
<td>
`version_2_with_negative`
</td>
<td>
Whether the input predict file is SQuAD 2.0
format.
</td>
</tr><tr>
<td>
`max_answer_length`
</td>
<td>
The maximum length of an answer that can be generated.
This is needed because the start and end predictions are not conditioned
on one another.
</td>
</tr><tr>
<td>
`null_score_diff_threshold`
</td>
<td>
If null_score - best_non_null is greater than
the threshold, predict null. This is only used for SQuAD v2.
</td>
</tr><tr>
<td>
`verbose_logging`
</td>
<td>
If true, all of the warnings related to data processing
will be printed. A number of warnings are expected for a normal SQuAD
evaluation.
</td>
</tr><tr>
<td>
`output_dir`
</td>
<td>
The output directory to save output to json files:
predictions.json, nbest_predictions.json, null_odds.json. If None, skip
saving to json files.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A dict contains two metrics: Exact match rate and F1 score.
</td>
</tr>
</table>
<h3 id="get_config"><code>get_config</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L861-L869">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_config()
</code></pre>
Gets the configuration.
<h3 id="get_default_quantization_config"><code>get_default_quantization_config</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L420-L424">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_default_quantization_config()
</code></pre>
Gets the default quantization configuration.
<h3 id="get_name_to_features"><code>get_name_to_features</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L831-L845">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_name_to_features(
is_training
)
</code></pre>
Gets the dictionary describing the features.
<h3 id="predict"><code>predict</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L982-L984">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>predict(
model, dataset, num_steps
)
</code></pre>
Predicts the dataset for `model`.
<h3 id="predict_tflite"><code>predict_tflite</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L996-L1014">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>predict_tflite(
tflite_filepath, dataset
)
</code></pre>
Predicts the dataset for TFLite model in `tflite_filepath`.
<h3 id="reorder_input_details"><code>reorder_input_details</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L426-L436">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>reorder_input_details(
tflite_input_details
)
</code></pre>
Reorders the tflite input details to map the order of keras model.
<h3 id="reorder_output_details"><code>reorder_output_details</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L986-L994">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>reorder_output_details(
tflite_output_details
)
</code></pre>
Reorders the tflite output details to map the order of keras model.
<h3 id="save_vocab"><code>save_vocab</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L447-L452">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>save_vocab(
vocab_filename
)
</code></pre>
Prints the file path to the vocabulary.
<h3 id="select_data_from_record"><code>select_data_from_record</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L847-L859">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>select_data_from_record(
record
)
</code></pre>
Dispatches records to features and labels.
<h3 id="train"><code>train</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L901-L946">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>train(
train_ds, epochs, steps_per_epoch, **kwargs
)
</code></pre>
Run bert QA training.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`train_ds`
</td>
<td>
tf.data.Dataset, training data to be fed in
tf.keras.Model.fit().
</td>
</tr><tr>
<td>
`epochs`
</td>
<td>
Integer, training epochs.
</td>
</tr><tr>
<td>
`steps_per_epoch`
</td>
<td>
Integer or None. Total number of steps (batches of
samples) before declaring one epoch finished and starting the next
epoch. If `steps_per_epoch` is None, the epoch will run until the input
dataset is exhausted.
</td>
</tr><tr>
<td>
`**kwargs`
</td>
<td>
Other parameters used in the tf.keras.Model.fit().
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
tf.keras.Model, the keras model that's already trained.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
compat_tf_versions<a id="compat_tf_versions"></a>
</td>
<td>
`[2]`
</td>
</tr><tr>
<td>
convert_from_saved_model_tf2<a id="convert_from_saved_model_tf2"></a>
</td>
<td>
`True`
</td>
</tr><tr>
<td>
need_gen_vocab<a id="need_gen_vocab"></a>
</td>
<td>
`False`
</td>
</tr>
</table>
@@ -0,0 +1,341 @@
page_type: reference
description: DataLoader for question answering.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.question_answer.DataLoader" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="__len__"/>
<meta itemprop="property" content="from_squad"/>
<meta itemprop="property" content="gen_dataset"/>
<meta itemprop="property" content="split"/>
</div>
# tflite_model_maker.question_answer.DataLoader
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/text_dataloader.py#L292-L393">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
DataLoader for question answering.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.question_answer.DataLoader(
dataset, size, version_2_with_negative, examples, features, squad_file
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/question_answer">BERT Question Answer with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`dataset`<a id="dataset"></a>
</td>
<td>
A tf.data.Dataset object that contains a potentially large set of
elements, where each element is a pair of (input_data, target). The
`input_data` means the raw input data, like an image, a text etc., while
the `target` means some ground truth of the raw input data, such as the
classification label of the image etc.
</td>
</tr><tr>
<td>
`size`<a id="size"></a>
</td>
<td>
The size of the dataset. tf.data.Dataset donesn't support a function
to get the length directly since it's lazy-loaded and may be infinite.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`size`<a id="size"></a>
</td>
<td>
Returns the size of the dataset.
Note that this function may return None becuase the exact size of the
dataset isn't a necessary parameter to create an instance of this class,
and tf.data.Dataset donesn't support a function to get the length directly
since it's lazy-loaded and may be infinite.
In most cases, however, when an instance of this class is created by helper
functions like 'from_folder', the size of the dataset will be preprocessed,
and this function can return an int representing the size of the dataset.
</td>
</tr>
</table>
## Methods
<h3 id="from_squad"><code>from_squad</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/text_dataloader.py#L304-L350">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>from_squad(
filename,
model_spec,
is_training=True,
version_2_with_negative=False,
cache_dir=None
)
</code></pre>
Loads data in SQuAD format and preproecess text according to `model_spec`.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`filename`
</td>
<td>
Name of the file.
</td>
</tr><tr>
<td>
`model_spec`
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`is_training`
</td>
<td>
Whether the loaded data is for training or not.
</td>
</tr><tr>
<td>
`version_2_with_negative`
</td>
<td>
Whether it's SQuAD 2.0 format.
</td>
</tr><tr>
<td>
`cache_dir`
</td>
<td>
The cache directory to save preprocessed data. If None,
generates a temporary directory to cache preprocessed data.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
QuestionAnswerDataLoader object.
</td>
</tr>
</table>
<h3 id="gen_dataset"><code>gen_dataset</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py#L76-L124">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>gen_dataset(
batch_size=1,
is_training=False,
shuffle=False,
input_pipeline_context=None,
preprocess=None,
drop_remainder=False
)
</code></pre>
Generate a shared and batched tf.data.Dataset for training/evaluation.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`batch_size`
</td>
<td>
A integer, the returned dataset will be batched by this size.
</td>
</tr><tr>
<td>
`is_training`
</td>
<td>
A boolean, when True, the returned dataset will be optionally
shuffled and repeated as an endless dataset.
</td>
</tr><tr>
<td>
`shuffle`
</td>
<td>
A boolean, when True, the returned dataset will be shuffled to
create randomness during model training.
</td>
</tr><tr>
<td>
`input_pipeline_context`
</td>
<td>
A InputContext instance, used to shared dataset
among multiple workers when distribution strategy is used.
</td>
</tr><tr>
<td>
`preprocess`
</td>
<td>
A function taking three arguments in order, feature, label and
boolean is_training.
</td>
</tr><tr>
<td>
`drop_remainder`
</td>
<td>
boolean, whether the finaly batch drops remainder.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A TF dataset ready to be consumed by Keras model.
</td>
</tr>
</table>
<h3 id="split"><code>split</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py#L132-L144">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>split(
fraction
)
</code></pre>
Splits dataset into two sub-datasets with the given fraction.
Primarily used for splitting the data set into training and testing sets.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`fraction`
</td>
<td>
float, demonstrates the fraction of the first returned
subdataset in the original data.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
The splitted two sub datasets.
</td>
</tr>
</table>
<h3 id="__len__"><code>__len__</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py#L126-L130">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__len__()
</code></pre>
@@ -0,0 +1,214 @@
page_type: reference
description: Creates MobileBert model spec for the question answer task. See also: <a href="../../tflite_model_maker/question_answer/BertQaSpec"><code>tflite_model_maker.question_answer.BertQaSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.question_answer.MobileBertQaSpec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.question_answer.MobileBertQaSpec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates MobileBert model spec for the question answer task. See also: <a href="../../tflite_model_maker/question_answer/BertQaSpec"><code>tflite_model_maker.question_answer.BertQaSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.question_answer.MobileBertQaSpec(
*,
uri=&#x27;https://tfhub.dev/google/mobilebert/uncased_L-24_H-128_B-512_A-4_F-4_OPT/1&#x27;,
model_dir=None,
seq_len=384,
query_len=64,
doc_stride=128,
dropout_rate=0.1,
initializer_range=0.02,
learning_rate=4e-05,
distribution_strategy=&#x27;off&#x27;,
num_gpus=-1,
tpu=&#x27;&#x27;,
trainable=True,
predict_batch_size=8,
do_lower_case=True,
is_tf2=False,
tflite_input_name=None,
tflite_output_name=None,
init_from_squad_model=False,
default_batch_size=32,
name=&#x27;MobileBert&#x27;
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
TF-Hub path/url to Bert module.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location of the model checkpoint files.
</td>
</tr><tr>
<td>
`seq_len`<a id="seq_len"></a>
</td>
<td>
Length of the sequence to feed into the model.
</td>
</tr><tr>
<td>
`query_len`<a id="query_len"></a>
</td>
<td>
Length of the query to feed into the model.
</td>
</tr><tr>
<td>
`doc_stride`<a id="doc_stride"></a>
</td>
<td>
The stride when we do a sliding window approach to take chunks
of the documents.
</td>
</tr><tr>
<td>
`dropout_rate`<a id="dropout_rate"></a>
</td>
<td>
The rate for dropout.
</td>
</tr><tr>
<td>
`initializer_range`<a id="initializer_range"></a>
</td>
<td>
The stdev of the truncated_normal_initializer for
initializing all weight matrices.
</td>
</tr><tr>
<td>
`learning_rate`<a id="learning_rate"></a>
</td>
<td>
The initial learning rate for Adam.
</td>
</tr><tr>
<td>
`distribution_strategy`<a id="distribution_strategy"></a>
</td>
<td>
A string specifying which distribution strategy to
use. Accepted values are 'off', 'one_device', 'mirrored',
'parameter_server', 'multi_worker_mirrored', and 'tpu' -- case
insensitive. 'off' means not to use Distribution Strategy; 'tpu' means
to use TPUStrategy using `tpu_address`.
</td>
</tr><tr>
<td>
`num_gpus`<a id="num_gpus"></a>
</td>
<td>
How many GPUs to use at each worker with the
DistributionStrategies API. The default is -1, which means utilize all
available GPUs.
</td>
</tr><tr>
<td>
`tpu`<a id="tpu"></a>
</td>
<td>
TPU address to connect to.
</td>
</tr><tr>
<td>
`trainable`<a id="trainable"></a>
</td>
<td>
boolean, whether pretrain layer is trainable.
</td>
</tr><tr>
<td>
`predict_batch_size`<a id="predict_batch_size"></a>
</td>
<td>
Batch size for prediction.
</td>
</tr><tr>
<td>
`do_lower_case`<a id="do_lower_case"></a>
</td>
<td>
boolean, whether to lower case the input text. Should be
True for uncased models and False for cased models.
</td>
</tr><tr>
<td>
`is_tf2`<a id="is_tf2"></a>
</td>
<td>
boolean, whether the hub module is in TensorFlow 2.x format.
</td>
</tr><tr>
<td>
`tflite_input_name`<a id="tflite_input_name"></a>
</td>
<td>
Dict, input names for the TFLite model.
</td>
</tr><tr>
<td>
`tflite_output_name`<a id="tflite_output_name"></a>
</td>
<td>
Dict, output names for the TFLite model.
</td>
</tr><tr>
<td>
`init_from_squad_model`<a id="init_from_squad_model"></a>
</td>
<td>
boolean, whether to initialize from the model that
is already retrained on Squad 1.1.
</td>
</tr><tr>
<td>
`default_batch_size`<a id="default_batch_size"></a>
</td>
<td>
Default batch size for training.
</td>
</tr><tr>
<td>
`name`<a id="name"></a>
</td>
<td>
Name of the object.
</td>
</tr>
</table>
@@ -0,0 +1,214 @@
page_type: reference
description: Creates MobileBert model spec that's already retrained on SQuAD1.1 for the question answer task. See also: <a href="../../tflite_model_maker/question_answer/BertQaSpec"><code>tflite_model_maker.question_answer.BertQaSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.question_answer.MobileBertQaSquadSpec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.question_answer.MobileBertQaSquadSpec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates MobileBert model spec that's already retrained on SQuAD1.1 for the question answer task. See also: <a href="../../tflite_model_maker/question_answer/BertQaSpec"><code>tflite_model_maker.question_answer.BertQaSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.question_answer.MobileBertQaSquadSpec(
*,
uri=&#x27;https://tfhub.dev/google/mobilebert/uncased_L-24_H-128_B-512_A-4_F-4_OPT/squadv1/1&#x27;,
model_dir=None,
seq_len=384,
query_len=64,
doc_stride=128,
dropout_rate=0.1,
initializer_range=0.02,
learning_rate=4e-05,
distribution_strategy=&#x27;off&#x27;,
num_gpus=-1,
tpu=&#x27;&#x27;,
trainable=True,
predict_batch_size=8,
do_lower_case=True,
is_tf2=False,
tflite_input_name=None,
tflite_output_name=None,
init_from_squad_model=True,
default_batch_size=32,
name=&#x27;MobileBert&#x27;
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
TF-Hub path/url to Bert module.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location of the model checkpoint files.
</td>
</tr><tr>
<td>
`seq_len`<a id="seq_len"></a>
</td>
<td>
Length of the sequence to feed into the model.
</td>
</tr><tr>
<td>
`query_len`<a id="query_len"></a>
</td>
<td>
Length of the query to feed into the model.
</td>
</tr><tr>
<td>
`doc_stride`<a id="doc_stride"></a>
</td>
<td>
The stride when we do a sliding window approach to take chunks
of the documents.
</td>
</tr><tr>
<td>
`dropout_rate`<a id="dropout_rate"></a>
</td>
<td>
The rate for dropout.
</td>
</tr><tr>
<td>
`initializer_range`<a id="initializer_range"></a>
</td>
<td>
The stdev of the truncated_normal_initializer for
initializing all weight matrices.
</td>
</tr><tr>
<td>
`learning_rate`<a id="learning_rate"></a>
</td>
<td>
The initial learning rate for Adam.
</td>
</tr><tr>
<td>
`distribution_strategy`<a id="distribution_strategy"></a>
</td>
<td>
A string specifying which distribution strategy to
use. Accepted values are 'off', 'one_device', 'mirrored',
'parameter_server', 'multi_worker_mirrored', and 'tpu' -- case
insensitive. 'off' means not to use Distribution Strategy; 'tpu' means
to use TPUStrategy using `tpu_address`.
</td>
</tr><tr>
<td>
`num_gpus`<a id="num_gpus"></a>
</td>
<td>
How many GPUs to use at each worker with the
DistributionStrategies API. The default is -1, which means utilize all
available GPUs.
</td>
</tr><tr>
<td>
`tpu`<a id="tpu"></a>
</td>
<td>
TPU address to connect to.
</td>
</tr><tr>
<td>
`trainable`<a id="trainable"></a>
</td>
<td>
boolean, whether pretrain layer is trainable.
</td>
</tr><tr>
<td>
`predict_batch_size`<a id="predict_batch_size"></a>
</td>
<td>
Batch size for prediction.
</td>
</tr><tr>
<td>
`do_lower_case`<a id="do_lower_case"></a>
</td>
<td>
boolean, whether to lower case the input text. Should be
True for uncased models and False for cased models.
</td>
</tr><tr>
<td>
`is_tf2`<a id="is_tf2"></a>
</td>
<td>
boolean, whether the hub module is in TensorFlow 2.x format.
</td>
</tr><tr>
<td>
`tflite_input_name`<a id="tflite_input_name"></a>
</td>
<td>
Dict, input names for the TFLite model.
</td>
</tr><tr>
<td>
`tflite_output_name`<a id="tflite_output_name"></a>
</td>
<td>
Dict, output names for the TFLite model.
</td>
</tr><tr>
<td>
`init_from_squad_model`<a id="init_from_squad_model"></a>
</td>
<td>
boolean, whether to initialize from the model that
is already retrained on Squad 1.1.
</td>
</tr><tr>
<td>
`default_batch_size`<a id="default_batch_size"></a>
</td>
<td>
Default batch size for training.
</td>
</tr><tr>
<td>
`name`<a id="name"></a>
</td>
<td>
Name of the object.
</td>
</tr>
</table>
@@ -0,0 +1,514 @@
page_type: reference
description: QuestionAnswer class for inference and exporting to tflite.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.question_answer.QuestionAnswer" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="create"/>
<meta itemprop="property" content="create_model"/>
<meta itemprop="property" content="create_serving_model"/>
<meta itemprop="property" content="evaluate"/>
<meta itemprop="property" content="evaluate_tflite"/>
<meta itemprop="property" content="export"/>
<meta itemprop="property" content="summary"/>
<meta itemprop="property" content="train"/>
<meta itemprop="property" content="ALLOWED_EXPORT_FORMAT"/>
<meta itemprop="property" content="DEFAULT_EXPORT_FORMAT"/>
</div>
# tflite_model_maker.question_answer.QuestionAnswer
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/question_answer.py#L51-L232">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
QuestionAnswer class for inference and exporting to tflite.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.question_answer.QuestionAnswer(
model_spec, shuffle
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_spec`<a id="model_spec"></a>
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`shuffle`<a id="shuffle"></a>
</td>
<td>
Whether the training data should be shuffled.
</td>
</tr>
</table>
## Methods
<h3 id="create"><code>create</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/question_answer.py#L193-L232">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>create(
train_data,
model_spec,
batch_size=None,
epochs=2,
steps_per_epoch=None,
shuffle=False,
do_train=True
)
</code></pre>
Loads data and train the model for question answer.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`train_data`
</td>
<td>
Training data.
</td>
</tr><tr>
<td>
`model_spec`
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
Batch size for training.
</td>
</tr><tr>
<td>
`epochs`
</td>
<td>
Number of epochs for training.
</td>
</tr><tr>
<td>
`steps_per_epoch`
</td>
<td>
Integer or None. Total number of steps (batches of
samples) before declaring one epoch finished and starting the next
epoch. If `steps_per_epoch` is None, the epoch will run until the input
dataset is exhausted.
</td>
</tr><tr>
<td>
`shuffle`
</td>
<td>
Whether the data should be shuffled.
</td>
</tr><tr>
<td>
`do_train`
</td>
<td>
Whether to run training.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
An instance based on QuestionAnswer.
</td>
</tr>
</table>
<h3 id="create_model"><code>create_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/question_answer.py#L84-L85">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_model()
</code></pre>
<h3 id="create_serving_model"><code>create_serving_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L170-L176">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_serving_model()
</code></pre>
Returns the underlining Keras model for serving.
<h3 id="evaluate"><code>evaluate</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/question_answer.py#L87-L118">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate(
data,
max_answer_length=30,
null_score_diff_threshold=0.0,
verbose_logging=False,
output_dir=None
)
</code></pre>
Evaluate the model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`data`
</td>
<td>
Data to be evaluated.
</td>
</tr><tr>
<td>
`max_answer_length`
</td>
<td>
The maximum length of an answer that can be generated.
This is needed because the start and end predictions are not conditioned
on one another.
</td>
</tr><tr>
<td>
`null_score_diff_threshold`
</td>
<td>
If null_score - best_non_null is greater than
the threshold, predict null. This is only used for SQuAD v2.
</td>
</tr><tr>
<td>
`verbose_logging`
</td>
<td>
If true, all of the warnings related to data processing
will be printed. A number of warnings are expected for a normal SQuAD
evaluation.
</td>
</tr><tr>
<td>
`output_dir`
</td>
<td>
The output directory to save output to json files:
predictions.json, nbest_predictions.json, null_odds.json. If None, skip
saving to json files.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A dict contains two metrics: Exact match rate and F1 score.
</td>
</tr>
</table>
<h3 id="evaluate_tflite"><code>evaluate_tflite</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/question_answer.py#L120-L151">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate_tflite(
tflite_filepath,
data,
max_answer_length=30,
null_score_diff_threshold=0.0,
verbose_logging=False,
output_dir=None
)
</code></pre>
Evaluate the model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`tflite_filepath`
</td>
<td>
File path to the TFLite model.
</td>
</tr><tr>
<td>
`data`
</td>
<td>
Data to be evaluated.
</td>
</tr><tr>
<td>
`max_answer_length`
</td>
<td>
The maximum length of an answer that can be generated.
This is needed because the start and end predictions are not conditioned
on one another.
</td>
</tr><tr>
<td>
`null_score_diff_threshold`
</td>
<td>
If null_score - best_non_null is greater than
the threshold, predict null. This is only used for SQuAD v2.
</td>
</tr><tr>
<td>
`verbose_logging`
</td>
<td>
If true, all of the warnings related to data processing
will be printed. A number of warnings are expected for a normal SQuAD
evaluation.
</td>
</tr><tr>
<td>
`output_dir`
</td>
<td>
The output directory to save output to json files:
predictions.json, nbest_predictions.json, null_odds.json. If None, skip
saving to json files.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A dict contains two metrics: Exact match rate and F1 score.
</td>
</tr>
</table>
<h3 id="export"><code>export</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L95-L168">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>export(
export_dir,
tflite_filename=&#x27;model.tflite&#x27;,
label_filename=&#x27;labels.txt&#x27;,
vocab_filename=&#x27;vocab.txt&#x27;,
saved_model_filename=&#x27;saved_model&#x27;,
tfjs_folder_name=&#x27;tfjs&#x27;,
export_format=None,
**kwargs
)
</code></pre>
Converts the retrained model based on `export_format`.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`export_dir`
</td>
<td>
The directory to save exported files.
</td>
</tr><tr>
<td>
`tflite_filename`
</td>
<td>
File name to save tflite model. The full export path is
{export_dir}/{tflite_filename}.
</td>
</tr><tr>
<td>
`label_filename`
</td>
<td>
File name to save labels. The full export path is
{export_dir}/{label_filename}.
</td>
</tr><tr>
<td>
`vocab_filename`
</td>
<td>
File name to save vocabulary. The full export path is
{export_dir}/{vocab_filename}.
</td>
</tr><tr>
<td>
`saved_model_filename`
</td>
<td>
Path to SavedModel or H5 file to save the model. The
full export path is
{export_dir}/{saved_model_filename}/{saved_model.pb|assets|variables}.
</td>
</tr><tr>
<td>
`tfjs_folder_name`
</td>
<td>
Folder name to save tfjs model. The full export path is
{export_dir}/{tfjs_folder_name}.
</td>
</tr><tr>
<td>
`export_format`
</td>
<td>
List of export format that could be saved_model, tflite,
label, vocab.
</td>
</tr><tr>
<td>
`**kwargs`
</td>
<td>
Other parameters like `quantized_config` for TFLITE model.
</td>
</tr>
</table>
<h3 id="summary"><code>summary</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L65-L66">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>summary()
</code></pre>
<h3 id="train"><code>train</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/question_answer.py#L59-L82">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>train(
train_data, epochs=None, batch_size=None, steps_per_epoch=None
)
</code></pre>
Feeds the training data for training.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
ALLOWED_EXPORT_FORMAT<a id="ALLOWED_EXPORT_FORMAT"></a>
</td>
<td>
`(<ExportFormat.TFLITE: 'TFLITE'>,
<ExportFormat.VOCAB: 'VOCAB'>,
<ExportFormat.SAVED_MODEL: 'SAVED_MODEL'>)`
</td>
</tr><tr>
<td>
DEFAULT_EXPORT_FORMAT<a id="DEFAULT_EXPORT_FORMAT"></a>
</td>
<td>
`(<ExportFormat.TFLITE: 'TFLITE'>, <ExportFormat.VOCAB: 'VOCAB'>)`
</td>
</tr>
</table>
@@ -0,0 +1,140 @@
page_type: reference
description: Loads data and train the model for question answer.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.question_answer.create" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.question_answer.create
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/question_answer.py#L193-L232">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Loads data and train the model for question answer.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>tflite_model_maker.question_answer.create(
train_data,
model_spec,
batch_size=None,
epochs=2,
steps_per_epoch=None,
shuffle=False,
do_train=True
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/question_answer">BERT Question Answer with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`train_data`<a id="train_data"></a>
</td>
<td>
Training data.
</td>
</tr><tr>
<td>
`model_spec`<a id="model_spec"></a>
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`batch_size`<a id="batch_size"></a>
</td>
<td>
Batch size for training.
</td>
</tr><tr>
<td>
`epochs`<a id="epochs"></a>
</td>
<td>
Number of epochs for training.
</td>
</tr><tr>
<td>
`steps_per_epoch`<a id="steps_per_epoch"></a>
</td>
<td>
Integer or None. Total number of steps (batches of
samples) before declaring one epoch finished and starting the next
epoch. If `steps_per_epoch` is None, the epoch will run until the input
dataset is exhausted.
</td>
</tr><tr>
<td>
`shuffle`<a id="shuffle"></a>
</td>
<td>
Whether the data should be shuffled.
</td>
</tr><tr>
<td>
`do_train`<a id="do_train"></a>
</td>
<td>
Whether to run training.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Returns</h2></th></tr>
<tr class="alt">
<td colspan="2">
An instance based on QuestionAnswer.
</td>
</tr>
</table>
@@ -0,0 +1,52 @@
page_type: reference
description: APIs to train an on-device recommendation model.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.recommendation" />
<meta itemprop="path" content="Stable" />
</div>
# Module: tflite_model_maker.recommendation
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/tflmm/v0.4.2/tensorflow_examples/lite/model_maker/public/recommendation/__init__.py">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
APIs to train an on-device recommendation model.
#### Demo code:
<a href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/demo/recommendation_demo.py">https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/demo/recommendation_demo.py</a>
## Modules
[`spec`](../tflite_model_maker/recommendation/spec) module: APIs for recommendation specifications.
## Classes
[`class DataLoader`](../tflite_model_maker/recommendation/DataLoader): Recommendation data loader.
[`class ModelSpec`](../tflite_model_maker/recommendation/ModelSpec): Recommendation model spec.
[`class Recommendation`](../tflite_model_maker/recommendation/Recommendation): Recommendation task class.
## Functions
[`create(...)`](../tflite_model_maker/recommendation/create): Loads data and train the model for recommendation.
@@ -0,0 +1,595 @@
page_type: reference
description: Recommendation data loader.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.recommendation.DataLoader" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="__len__"/>
<meta itemprop="property" content="download_and_extract_movielens"/>
<meta itemprop="property" content="from_movielens"/>
<meta itemprop="property" content="gen_dataset"/>
<meta itemprop="property" content="generate_movielens_dataset"/>
<meta itemprop="property" content="get_num_classes"/>
<meta itemprop="property" content="load_vocab"/>
<meta itemprop="property" content="split"/>
</div>
# tflite_model_maker.recommendation.DataLoader
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/recommendation_dataloader.py#L32-L298">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Recommendation data loader.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.recommendation.DataLoader(
dataset, size, vocab
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`dataset`<a id="dataset"></a>
</td>
<td>
tf.data.Dataset for recommendation.
</td>
</tr><tr>
<td>
`size`<a id="size"></a>
</td>
<td>
int, dataset size.
</td>
</tr><tr>
<td>
`vocab`<a id="vocab"></a>
</td>
<td>
list of dict, each vocab item is described above.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`size`<a id="size"></a>
</td>
<td>
Returns the size of the dataset.
Note that this function may return None becuase the exact size of the
dataset isn't a necessary parameter to create an instance of this class,
and tf.data.Dataset donesn't support a function to get the length directly
since it's lazy-loaded and may be infinite.
In most cases, however, when an instance of this class is created by helper
functions like 'from_folder', the size of the dataset will be preprocessed,
and this function can return an int representing the size of the dataset.
</td>
</tr>
</table>
## Methods
<h3 id="download_and_extract_movielens"><code>download_and_extract_movielens</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/recommendation_dataloader.py#L141-L144">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>download_and_extract_movielens(
download_dir
)
</code></pre>
Downloads and extracts movielens dataset, then returns extracted dir.
<h3 id="from_movielens"><code>from_movielens</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/recommendation_dataloader.py#L225-L298">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>from_movielens(
data_dir,
data_tag,
input_spec: <a href="../../tflite_model_maker/recommendation/spec/InputSpec"><code>tflite_model_maker.recommendation.spec.InputSpec</code></a>,
generated_examples_dir=None,
min_timeline_length=3,
max_context_length=10,
max_context_movie_genre_length=10,
min_rating=None,
train_data_fraction=0.9,
build_vocabs=True,
train_filename=&#x27;train_movielens_1m.tfrecord&#x27;,
test_filename=&#x27;test_movielens_1m.tfrecord&#x27;,
vocab_filename=&#x27;movie_vocab.json&#x27;,
meta_filename=&#x27;meta.json&#x27;
)
</code></pre>
Generates data loader from movielens dataset.
The method downloads and prepares dataset, then generates for train/eval.
For `movielens` data format, see:
- function `_generate_fake_data` in `recommendation_testutil.py`
- Or, zip file: <a href="http://files.grouplens.org/datasets/movielens/ml-1m.zip">http://files.grouplens.org/datasets/movielens/ml-1m.zip</a>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`data_dir`
</td>
<td>
str, path to dataset containing (unzipped) text data.
</td>
</tr><tr>
<td>
`data_tag`
</td>
<td>
str, specify dataset in {'train', 'test'}.
</td>
</tr><tr>
<td>
`input_spec`
</td>
<td>
InputSpec, specify data format for input and embedding.
</td>
</tr><tr>
<td>
`generated_examples_dir`
</td>
<td>
str, path to generate preprocessed examples.
(default: same as data_dir)
</td>
</tr><tr>
<td>
`min_timeline_length`
</td>
<td>
int, min timeline length to split train/eval set.
</td>
</tr><tr>
<td>
`max_context_length`
</td>
<td>
int, max context length as one input.
</td>
</tr><tr>
<td>
`max_context_movie_genre_length`
</td>
<td>
int, max context length of movie genre as
one input.
</td>
</tr><tr>
<td>
`min_rating`
</td>
<td>
int or None, include examples with min rating.
</td>
</tr><tr>
<td>
`train_data_fraction`
</td>
<td>
float, percentage of training data [0.0, 1.0].
</td>
</tr><tr>
<td>
`build_vocabs`
</td>
<td>
boolean, whether to build vocabs.
</td>
</tr><tr>
<td>
`train_filename`
</td>
<td>
str, generated file name for training data.
</td>
</tr><tr>
<td>
`test_filename`
</td>
<td>
str, generated file name for test data.
</td>
</tr><tr>
<td>
`vocab_filename`
</td>
<td>
str, generated file name for vocab data.
</td>
</tr><tr>
<td>
`meta_filename`
</td>
<td>
str, generated file name for meta data.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
Data Loader.
</td>
</tr>
</table>
<h3 id="gen_dataset"><code>gen_dataset</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/recommendation_dataloader.py#L62-L85">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>gen_dataset(
batch_size=1,
is_training=False,
shuffle=False,
input_pipeline_context=None,
preprocess=None,
drop_remainder=True,
total_steps=None
)
</code></pre>
Generates dataset, and overwrites default drop_remainder = True.
<h3 id="generate_movielens_dataset"><code>generate_movielens_dataset</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/recommendation_dataloader.py#L146-L208">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>generate_movielens_dataset(
data_dir,
generated_examples_dir=None,
train_filename=&#x27;train_movielens_1m.tfrecord&#x27;,
test_filename=&#x27;test_movielens_1m.tfrecord&#x27;,
vocab_filename=&#x27;movie_vocab.json&#x27;,
meta_filename=&#x27;meta.json&#x27;,
min_timeline_length=3,
max_context_length=10,
max_context_movie_genre_length=10,
min_rating=None,
train_data_fraction=0.9,
build_vocabs=True
)
</code></pre>
Generate movielens dataset, and returns a dict contains meta.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`data_dir`
</td>
<td>
str, path to dataset containing (unzipped) text data.
</td>
</tr><tr>
<td>
`generated_examples_dir`
</td>
<td>
str, path to generate preprocessed examples.
(default: same as data_dir)
</td>
</tr><tr>
<td>
`train_filename`
</td>
<td>
str, generated file name for training data.
</td>
</tr><tr>
<td>
`test_filename`
</td>
<td>
str, generated file name for test data.
</td>
</tr><tr>
<td>
`vocab_filename`
</td>
<td>
str, generated file name for vocab data.
</td>
</tr><tr>
<td>
`meta_filename`
</td>
<td>
str, generated file name for meta data.
</td>
</tr><tr>
<td>
`min_timeline_length`
</td>
<td>
int, min timeline length to split train/eval set.
</td>
</tr><tr>
<td>
`max_context_length`
</td>
<td>
int, max context length as one input.
</td>
</tr><tr>
<td>
`max_context_movie_genre_length`
</td>
<td>
int, max context length of movie genre as
one input.
</td>
</tr><tr>
<td>
`min_rating`
</td>
<td>
int or None, include examples with min rating.
</td>
</tr><tr>
<td>
`train_data_fraction`
</td>
<td>
float, percentage of training data [0.0, 1.0].
</td>
</tr><tr>
<td>
`build_vocabs`
</td>
<td>
boolean, whether to build vocabs.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
Dict, metadata for the movielens dataset. Containing keys:
`train_file`, `train_size`, `test_file`, `test_size`, vocab_file`,
`vocab_size`, etc.
</td>
</tr>
</table>
<h3 id="get_num_classes"><code>get_num_classes</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/recommendation_dataloader.py#L210-L223">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>get_num_classes(
meta
) -> int
</code></pre>
Gets number of classes.
0 is reserved. Number of classes is Max Id + 1, e.g., if Max Id = 100,
then classes are [0, 100], that is 101 classes in total.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`meta`
</td>
<td>
dict, containing meta['vocab_max_id'].
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
Number of classes.
</td>
</tr>
</table>
<h3 id="load_vocab"><code>load_vocab</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/recommendation_dataloader.py#L90-L122">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>load_vocab(
vocab_file
) -> collections.OrderedDict
</code></pre>
Loads vocab from file.
The vocab file should be json format of: a list of list[size=4], where the 4
elements are ordered as:
[id=int, title=str, genres=str joined with '|', count=int]
It is generated when preparing movielens dataset.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`vocab_file`
</td>
<td>
str, path to vocab file.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr>
<td>
`vocab`
</td>
<td>
an OrderedDict maps id to item. Each item represents a movie
{
'id': int,
'title': str,
'genres': list[str],
'count': int,
}
</td>
</tr>
</table>
<h3 id="split"><code>split</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/recommendation_dataloader.py#L87-L88">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>split(
fraction
)
</code></pre>
Splits dataset into two sub-datasets with the given fraction.
Primarily used for splitting the data set into training and testing sets.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`fraction`
</td>
<td>
float, demonstrates the fraction of the first returned
subdataset in the original data.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
The splitted two sub datasets.
</td>
</tr>
</table>
<h3 id="__len__"><code>__len__</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py#L126-L130">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__len__()
</code></pre>
@@ -0,0 +1,126 @@
page_type: reference
description: Recommendation model spec.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.recommendation.ModelSpec" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="create_model"/>
<meta itemprop="property" content="get_default_quantization_config"/>
<meta itemprop="property" content="compat_tf_versions"/>
</div>
# tflite_model_maker.recommendation.ModelSpec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/recommendation_spec.py#L23-L50">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Recommendation model spec.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.recommendation.ModelSpec(
input_spec: <a href="../../tflite_model_maker/recommendation/spec/InputSpec"><code>tflite_model_maker.recommendation.spec.InputSpec</code></a>,
model_hparams: <a href="../../tflite_model_maker/recommendation/spec/ModelHParams"><code>tflite_model_maker.recommendation.spec.ModelHParams</code></a>
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`input_spec`<a id="input_spec"></a>
</td>
<td>
InputSpec, specify data format for input and embedding.
</td>
</tr><tr>
<td>
`model_hparams`<a id="model_hparams"></a>
</td>
<td>
ModelHParams, specify hparams for model achitecture.
</td>
</tr>
</table>
## Methods
<h3 id="create_model"><code>create_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/recommendation_spec.py#L40-L46">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_model()
</code></pre>
Creates recommendation model based on params.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
Keras model.
</td>
</tr>
</table>
<h3 id="get_default_quantization_config"><code>get_default_quantization_config</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/recommendation_spec.py#L48-L50">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_default_quantization_config()
</code></pre>
Gets the default quantization configuration.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
compat_tf_versions<a id="compat_tf_versions"></a>
</td>
<td>
`[2]`
</td>
</tr>
</table>
@@ -0,0 +1,627 @@
page_type: reference
description: Recommendation task class.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.recommendation.Recommendation" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="create"/>
<meta itemprop="property" content="create_model"/>
<meta itemprop="property" content="create_serving_model"/>
<meta itemprop="property" content="evaluate"/>
<meta itemprop="property" content="evaluate_tflite"/>
<meta itemprop="property" content="export"/>
<meta itemprop="property" content="summary"/>
<meta itemprop="property" content="train"/>
<meta itemprop="property" content="ALLOWED_EXPORT_FORMAT"/>
<meta itemprop="property" content="DEFAULT_EXPORT_FORMAT"/>
<meta itemprop="property" content="OOV_ID"/>
</div>
# tflite_model_maker.recommendation.Recommendation
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/recommendation.py#L34-L265">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Recommendation task class.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.recommendation.Recommendation(
model_spec,
model_dir,
shuffle=True,
learning_rate=0.1,
gradient_clip_norm=1.0
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_spec`<a id="model_spec"></a>
</td>
<td>
recommendation model spec.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
str, path to export model checkpoints and summaries.
</td>
</tr><tr>
<td>
`shuffle`<a id="shuffle"></a>
</td>
<td>
boolean, whether the training data should be shuffled.
</td>
</tr><tr>
<td>
`learning_rate`<a id="learning_rate"></a>
</td>
<td>
float, learning rate.
</td>
</tr><tr>
<td>
`gradient_clip_norm`<a id="gradient_clip_norm"></a>
</td>
<td>
float, clip threshold (<= 0 meaning no clip).
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`input_spec`<a id="input_spec"></a>
</td>
<td>
</td>
</tr><tr>
<td>
`model_hparams`<a id="model_hparams"></a>
</td>
<td>
</td>
</tr>
</table>
## Methods
<h3 id="create"><code>create</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/recommendation.py#L213-L265">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>create(
train_data,
model_spec: <a href="../../tflite_model_maker/recommendation/ModelSpec"><code>tflite_model_maker.recommendation.ModelSpec</code></a>,
model_dir: str = None,
validation_data=None,
batch_size: int = 16,
steps_per_epoch: int = 10000,
epochs: int = 1,
learning_rate: float = 0.1,
gradient_clip_norm: float = 1.0,
shuffle: bool = True,
do_train: bool = True
)
</code></pre>
Loads data and train the model for recommendation.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`train_data`
</td>
<td>
Training data.
</td>
</tr><tr>
<td>
`model_spec`
</td>
<td>
ModelSpec, Specification for the model.
</td>
</tr><tr>
<td>
`model_dir`
</td>
<td>
str, path to export model checkpoints and summaries.
</td>
</tr><tr>
<td>
`validation_data`
</td>
<td>
Validation data.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
Batch size for training.
</td>
</tr><tr>
<td>
`steps_per_epoch`
</td>
<td>
int, Number of step per epoch.
</td>
</tr><tr>
<td>
`epochs`
</td>
<td>
int, Number of epochs for training.
</td>
</tr><tr>
<td>
`learning_rate`
</td>
<td>
float, learning rate.
</td>
</tr><tr>
<td>
`gradient_clip_norm`
</td>
<td>
float, clip threshold (<= 0 meaning no clip).
</td>
</tr><tr>
<td>
`shuffle`
</td>
<td>
boolean, whether the training data should be shuffled.
</td>
</tr><tr>
<td>
`do_train`
</td>
<td>
boolean, whether to run training.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
An instance based on Recommendation.
</td>
</tr>
</table>
<h3 id="create_model"><code>create_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/recommendation.py#L76-L88">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_model(
do_train=True
)
</code></pre>
Creates a model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`do_train`
</td>
<td>
boolean. Whether to train the model.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
Keras model.
</td>
</tr>
</table>
<h3 id="create_serving_model"><code>create_serving_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L170-L176">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_serving_model()
</code></pre>
Returns the underlining Keras model for serving.
<h3 id="evaluate"><code>evaluate</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/recommendation.py#L127-L141">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate(
data, batch_size=10
)
</code></pre>
Evaluate the model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`data`
</td>
<td>
Evaluation data.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
int, batch size for evaluation.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
History from model.evaluate().
</td>
</tr>
</table>
<h3 id="evaluate_tflite"><code>evaluate_tflite</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/recommendation.py#L173-L211">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate_tflite(
tflite_filepath, data
)
</code></pre>
Evaluates the tflite model.
The data is padded to required length, and multiple metrics are evaluated.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`tflite_filepath`
</td>
<td>
File path to the TFLite model.
</td>
</tr><tr>
<td>
`data`
</td>
<td>
Data to be evaluated.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
Dict of (metric, value), evaluation result of TFLite model.
</td>
</tr>
</table>
<h3 id="export"><code>export</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L95-L168">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>export(
export_dir,
tflite_filename=&#x27;model.tflite&#x27;,
label_filename=&#x27;labels.txt&#x27;,
vocab_filename=&#x27;vocab.txt&#x27;,
saved_model_filename=&#x27;saved_model&#x27;,
tfjs_folder_name=&#x27;tfjs&#x27;,
export_format=None,
**kwargs
)
</code></pre>
Converts the retrained model based on `export_format`.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`export_dir`
</td>
<td>
The directory to save exported files.
</td>
</tr><tr>
<td>
`tflite_filename`
</td>
<td>
File name to save tflite model. The full export path is
{export_dir}/{tflite_filename}.
</td>
</tr><tr>
<td>
`label_filename`
</td>
<td>
File name to save labels. The full export path is
{export_dir}/{label_filename}.
</td>
</tr><tr>
<td>
`vocab_filename`
</td>
<td>
File name to save vocabulary. The full export path is
{export_dir}/{vocab_filename}.
</td>
</tr><tr>
<td>
`saved_model_filename`
</td>
<td>
Path to SavedModel or H5 file to save the model. The
full export path is
{export_dir}/{saved_model_filename}/{saved_model.pb|assets|variables}.
</td>
</tr><tr>
<td>
`tfjs_folder_name`
</td>
<td>
Folder name to save tfjs model. The full export path is
{export_dir}/{tfjs_folder_name}.
</td>
</tr><tr>
<td>
`export_format`
</td>
<td>
List of export format that could be saved_model, tflite,
label, vocab.
</td>
</tr><tr>
<td>
`**kwargs`
</td>
<td>
Other parameters like `quantized_config` for TFLITE model.
</td>
</tr>
</table>
<h3 id="summary"><code>summary</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L65-L66">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>summary()
</code></pre>
<h3 id="train"><code>train</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/recommendation.py#L90-L125">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>train(
train_data,
validation_data=None,
batch_size=16,
steps_per_epoch=100,
epochs=1
)
</code></pre>
Feeds the training data for training.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`train_data`
</td>
<td>
Training dataset.
</td>
</tr><tr>
<td>
`validation_data`
</td>
<td>
Validation data. If None, skips validation process.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
int, the batch size.
</td>
</tr><tr>
<td>
`steps_per_epoch`
</td>
<td>
int, the step of each epoch.
</td>
</tr><tr>
<td>
`epochs`
</td>
<td>
int, number of epochs.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
History from model.fit().
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
ALLOWED_EXPORT_FORMAT<a id="ALLOWED_EXPORT_FORMAT"></a>
</td>
<td>
`(<ExportFormat.LABEL: 'LABEL'>,
<ExportFormat.TFLITE: 'TFLITE'>,
<ExportFormat.SAVED_MODEL: 'SAVED_MODEL'>)`
</td>
</tr><tr>
<td>
DEFAULT_EXPORT_FORMAT<a id="DEFAULT_EXPORT_FORMAT"></a>
</td>
<td>
`(<ExportFormat.TFLITE: 'TFLITE'>,)`
</td>
</tr><tr>
<td>
OOV_ID<a id="OOV_ID"></a>
</td>
<td>
`0`
</td>
</tr>
</table>
@@ -0,0 +1,151 @@
page_type: reference
description: Loads data and train the model for recommendation.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.recommendation.create" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.recommendation.create
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/recommendation.py#L213-L265">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Loads data and train the model for recommendation.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>tflite_model_maker.recommendation.create(
train_data,
model_spec: <a href="../../tflite_model_maker/recommendation/ModelSpec"><code>tflite_model_maker.recommendation.ModelSpec</code></a>,
model_dir: str = None,
validation_data=None,
batch_size: int = 16,
steps_per_epoch: int = 10000,
epochs: int = 1,
learning_rate: float = 0.1,
gradient_clip_norm: float = 1.0,
shuffle: bool = True,
do_train: bool = True
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`train_data`<a id="train_data"></a>
</td>
<td>
Training data.
</td>
</tr><tr>
<td>
`model_spec`<a id="model_spec"></a>
</td>
<td>
ModelSpec, Specification for the model.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
str, path to export model checkpoints and summaries.
</td>
</tr><tr>
<td>
`validation_data`<a id="validation_data"></a>
</td>
<td>
Validation data.
</td>
</tr><tr>
<td>
`batch_size`<a id="batch_size"></a>
</td>
<td>
Batch size for training.
</td>
</tr><tr>
<td>
`steps_per_epoch`<a id="steps_per_epoch"></a>
</td>
<td>
int, Number of step per epoch.
</td>
</tr><tr>
<td>
`epochs`<a id="epochs"></a>
</td>
<td>
int, Number of epochs for training.
</td>
</tr><tr>
<td>
`learning_rate`<a id="learning_rate"></a>
</td>
<td>
float, learning rate.
</td>
</tr><tr>
<td>
`gradient_clip_norm`<a id="gradient_clip_norm"></a>
</td>
<td>
float, clip threshold (<= 0 meaning no clip).
</td>
</tr><tr>
<td>
`shuffle`<a id="shuffle"></a>
</td>
<td>
boolean, whether the training data should be shuffled.
</td>
</tr><tr>
<td>
`do_train`<a id="do_train"></a>
</td>
<td>
boolean, whether to run training.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Returns</h2></th></tr>
<tr class="alt">
<td colspan="2">
An instance based on Recommendation.
</td>
</tr>
</table>
@@ -0,0 +1,119 @@
page_type: reference
description: APIs for recommendation specifications.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.recommendation.spec" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="EncoderType"/>
<meta itemprop="property" content="FeatureType"/>
</div>
# Module: tflite_model_maker.recommendation.spec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/tflmm/v0.4.2/tensorflow_examples/lite/model_maker/public/recommendation/spec/__init__.py">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
APIs for recommendation specifications.
#### Example:
```python
input_spec = recommendation.spec.InputSpec(
activity_feature_groups=[
# Group #1: defines how features are grouped in the first Group.
dict(
features=[
# First feature.
dict(
feature_name='context_movie_id', # Feature name
feature_type='INT', # Feature type
vocab_size=3953, # ID size (number of IDs)
embedding_dim=8, # Projected feature embedding dim
feature_length=10, # History length of 10.
),
# Maybe more features...
],
encoder_type='CNN', # CNN encoder (e.g. CNN, LSTM, BOW)
),
# Maybe more groups...
],
label_feature=dict(
feature_name='label_movie_id', # Label feature name
feature_type='INT', # Label type
vocab_size=3953, # Label size (number of classes)
embedding_dim=8, # label embedding demension
feature_length=1, # Exactly 1 label
),
)
model_hparams = recommendation.spec.ModelHParams(
hidden_layer_dims=[32, 32], # Hidden layers dimension.
eval_top_k=[1, 5], # Eval top 1 and top 5.
conv_num_filter_ratios=[2, 4], # For CNN encoder, conv filter mutipler.
conv_kernel_size=16, # For CNN encoder, base kernel size.
lstm_num_units=16, # For LSTM/RNN, num units.
num_predictions=10, # Number of output predictions. Select top 10.
)
spec = recommendation.ModelSpec(
input_spec=input_spec, model_hparams=model_hparams)
# Or:
spec = model_spec.get(
'recommendation', input_spec=input_spec, model_hparams=model_hparams)
```
## Classes
[`class Feature`](../../tflite_model_maker/recommendation/spec/Feature): A ProtocolMessage
[`class FeatureGroup`](../../tflite_model_maker/recommendation/spec/FeatureGroup): A ProtocolMessage
[`class InputSpec`](../../tflite_model_maker/recommendation/spec/InputSpec): A ProtocolMessage
[`class ModelHParams`](../../tflite_model_maker/recommendation/spec/ModelHParams): Class to hold parameters for model architecture configuration.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Other Members</h2></th></tr>
<tr>
<td>
EncoderType<a id="EncoderType"></a>
</td>
<td>
Instance of `google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper`
EncoderType Enum (valid: BOW, CNN, LSTM).
</td>
</tr><tr>
<td>
FeatureType<a id="FeatureType"></a>
</td>
<td>
Instance of `google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper`
FeatureType Enum (valid: STRING, INT, FLOAT).
</td>
</tr>
</table>
@@ -0,0 +1,79 @@
page_type: reference
description: A ProtocolMessage
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.recommendation.spec.Feature" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.recommendation.spec.Feature
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
A ProtocolMessage
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`embedding_dim`<a id="embedding_dim"></a>
</td>
<td>
`int64 embedding_dim`
</td>
</tr><tr>
<td>
`feature_length`<a id="feature_length"></a>
</td>
<td>
`int64 feature_length`
</td>
</tr><tr>
<td>
`feature_name`<a id="feature_name"></a>
</td>
<td>
`string feature_name`
</td>
</tr><tr>
<td>
`feature_type`<a id="feature_type"></a>
</td>
<td>
`FeatureType feature_type`
</td>
</tr><tr>
<td>
`vocab_name`<a id="vocab_name"></a>
</td>
<td>
`string vocab_name`
</td>
</tr><tr>
<td>
`vocab_size`<a id="vocab_size"></a>
</td>
<td>
`int64 vocab_size`
</td>
</tr>
</table>
@@ -0,0 +1,51 @@
page_type: reference
description: A ProtocolMessage
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.recommendation.spec.FeatureGroup" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.recommendation.spec.FeatureGroup
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
A ProtocolMessage
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`encoder_type`<a id="encoder_type"></a>
</td>
<td>
`EncoderType encoder_type`
</td>
</tr><tr>
<td>
`features`<a id="features"></a>
</td>
<td>
`repeated Feature features`
</td>
</tr>
</table>
@@ -0,0 +1,58 @@
page_type: reference
description: A ProtocolMessage
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.recommendation.spec.InputSpec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.recommendation.spec.InputSpec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
A ProtocolMessage
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`activity_feature_groups`<a id="activity_feature_groups"></a>
</td>
<td>
`repeated FeatureGroup activity_feature_groups`
</td>
</tr><tr>
<td>
`global_feature_groups`<a id="global_feature_groups"></a>
</td>
<td>
`repeated FeatureGroup global_feature_groups`
</td>
</tr><tr>
<td>
`label_feature`<a id="label_feature"></a>
</td>
<td>
`Feature label_feature`
</td>
</tr>
</table>
@@ -0,0 +1,174 @@
page_type: reference
description: Class to hold parameters for model architecture configuration.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.recommendation.spec.ModelHParams" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__eq__"/>
<meta itemprop="property" content="__ge__"/>
<meta itemprop="property" content="__gt__"/>
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="__le__"/>
<meta itemprop="property" content="__lt__"/>
<meta itemprop="property" content="__ne__"/>
</div>
# tflite_model_maker.recommendation.spec.ModelHParams
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/third_party/recommendation/ml/configs/model_config.py#L19-L37">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Class to hold parameters for model architecture configuration.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.recommendation.spec.ModelHParams(
hidden_layer_dims,
eval_top_k,
conv_num_filter_ratios,
conv_kernel_size,
lstm_num_units,
num_predictions=attr_dict[&#x27;num_predictions&#x27;].default
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`hidden_layer_dims`<a id="hidden_layer_dims"></a>
</td>
<td>
List of hidden layer dimensions.
</td>
</tr><tr>
<td>
`eval_top_k`<a id="eval_top_k"></a>
</td>
<td>
Top k to evaluate.
</td>
</tr><tr>
<td>
`conv_num_filter_ratios`<a id="conv_num_filter_ratios"></a>
</td>
<td>
Number of filter ratios for the Conv1D layer.
</td>
</tr><tr>
<td>
`conv_kernel_size`<a id="conv_kernel_size"></a>
</td>
<td>
Size of the Conv1D layer kernel size.
</td>
</tr><tr>
<td>
`lstm_num_units`<a id="lstm_num_units"></a>
</td>
<td>
Number of units for the LSTM layer.
</td>
</tr><tr>
<td>
`num_predictions`<a id="num_predictions"></a>
</td>
<td>
Number of predictions to return with serving mode, which
has default value 10.
</td>
</tr>
</table>
## Methods
<h3 id="__eq__"><code>__eq__</code></h3>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__eq__(
other
)
</code></pre>
Method generated by attrs for class ModelConfig.
<h3 id="__ge__"><code>__ge__</code></h3>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__ge__(
other
)
</code></pre>
Method generated by attrs for class ModelConfig.
<h3 id="__gt__"><code>__gt__</code></h3>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__gt__(
other
)
</code></pre>
Method generated by attrs for class ModelConfig.
<h3 id="__le__"><code>__le__</code></h3>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__le__(
other
)
</code></pre>
Method generated by attrs for class ModelConfig.
<h3 id="__lt__"><code>__lt__</code></h3>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__lt__(
other
)
</code></pre>
Method generated by attrs for class ModelConfig.
<h3 id="__ne__"><code>__ne__</code></h3>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__ne__(
other
)
</code></pre>
Method generated by attrs for class ModelConfig.
@@ -0,0 +1,58 @@
page_type: reference
description: APIs to create the searcher model.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.searcher" />
<meta itemprop="path" content="Stable" />
</div>
# Module: tflite_model_maker.searcher
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/tflmm/v0.4.2/tensorflow_examples/lite/model_maker/public/searcher/__init__.py">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
APIs to create the searcher model.
#### Task guide:
<a href="https://www.tensorflow.org/lite/tutorials/model_maker_text_searcher">https://www.tensorflow.org/lite/tutorials/model_maker_text_searcher</a>
## Classes
[`class DataLoader`](../tflite_model_maker/searcher/DataLoader): Base DataLoader class for Searcher task.
[`class ExportFormat`](../tflite_model_maker/searcher/ExportFormat): An enumeration.
[`class ImageDataLoader`](../tflite_model_maker/searcher/ImageDataLoader): DataLoader class for Image Searcher Task.
[`class MetadataType`](../tflite_model_maker/searcher/MetadataType): An enumeration.
[`class ScaNNOptions`](../tflite_model_maker/searcher/ScaNNOptions): Options to build ScaNN.
[`class ScoreAH`](../tflite_model_maker/searcher/ScoreAH): Product Quantization (PQ) based in-partition scoring configuration.
[`class ScoreBruteForce`](../tflite_model_maker/searcher/ScoreBruteForce): Bruce force in-partition scoring configuration.
[`class Searcher`](../tflite_model_maker/searcher/Searcher): Creates the similarity search model with ScaNN.
[`class TextDataLoader`](../tflite_model_maker/searcher/TextDataLoader): DataLoader class for Text Searcher.
[`class Tree`](../tflite_model_maker/searcher/Tree): K-Means partitioning tree configuration.
@@ -0,0 +1,158 @@
page_type: reference
description: Base DataLoader class for Searcher task.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.searcher.DataLoader" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="__len__"/>
<meta itemprop="property" content="append"/>
</div>
# tflite_model_maker.searcher.DataLoader
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/searcher_dataloader.py#L22-L106">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Base DataLoader class for Searcher task.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.searcher.DataLoader(
embedder_path: Optional[str] = None,
dataset: Optional[np.ndarray] = None,
metadata: Optional[List[AnyStr]] = None
) -> None
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`embedder_path`<a id="embedder_path"></a>
</td>
<td>
Path to the TFLite Embedder model file.
</td>
</tr><tr>
<td>
`dataset`<a id="dataset"></a>
</td>
<td>
Embedding dataset used to build on-device ScaNN index file. The
dataset shape should be (dataset_size, embedding_dim). If None,
`dataset` will be generated from raw input data later.
</td>
</tr><tr>
<td>
`metadata`<a id="metadata"></a>
</td>
<td>
The metadata for each data in the dataset. The length of
`metadata` should be same as `dataset` and passed in the same order as
`dataset`. If `dataset` is set, `metadata` should be set as well.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`dataset`<a id="dataset"></a>
</td>
<td>
Gets the dataset.
Due to performance consideration, we don't return a copy, but the returned
`self._dataset` should never be changed.
</td>
</tr><tr>
<td>
`embedder_path`<a id="embedder_path"></a>
</td>
<td>
Gets the path to the TFLite Embedder model file.
</td>
</tr><tr>
<td>
`metadata`<a id="metadata"></a>
</td>
<td>
Gets the metadata.
</td>
</tr>
</table>
## Methods
<h3 id="append"><code>append</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/searcher_dataloader.py#L92-L106">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>append(
data_loader: 'DataLoader'
) -> None
</code></pre>
Appends the dataset.
Don't check if embedders from the two data loader are the same in this
function. Users are responsible to keep the embedder identical.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`data_loader`
</td>
<td>
The data loader in which the data will be appended.
</td>
</tr>
</table>
<h3 id="__len__"><code>__len__</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/searcher_dataloader.py#L60-L61">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__len__()
</code></pre>
@@ -0,0 +1,58 @@
page_type: reference
description: An enumeration.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.searcher.ExportFormat" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="SCANN_INDEX_FILE"/>
<meta itemprop="property" content="TFLITE"/>
</div>
# tflite_model_maker.searcher.ExportFormat
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/searcher.py#L38-L42">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
An enumeration.
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
SCANN_INDEX_FILE<a id="SCANN_INDEX_FILE"></a>
</td>
<td>
`<ExportFormat.SCANN_INDEX_FILE: 'SCANN_INDEX_FILE'>`
</td>
</tr><tr>
<td>
TFLITE<a id="TFLITE"></a>
</td>
<td>
`<ExportFormat.TFLITE: 'TFLITE'>`
</td>
</tr>
</table>
@@ -0,0 +1,266 @@
page_type: reference
description: DataLoader class for Image Searcher Task.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.searcher.ImageDataLoader" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="__len__"/>
<meta itemprop="property" content="append"/>
<meta itemprop="property" content="create"/>
<meta itemprop="property" content="load_from_folder"/>
</div>
# tflite_model_maker.searcher.ImageDataLoader
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/image_searcher_dataloader.py#L33-L155">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
DataLoader class for Image Searcher Task.
Inherits From: [`DataLoader`](../../tflite_model_maker/searcher/DataLoader)
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.searcher.ImageDataLoader(
embedder: image_embedder.ImageEmbedder,
metadata_type: <a href="../../tflite_model_maker/searcher/MetadataType"><code>tflite_model_maker.searcher.MetadataType</code></a> = <a href="../../tflite_model_maker/searcher/MetadataType#FROM_FILE_NAME"><code>tflite_model_maker.searcher.MetadataType.FROM_FILE_NAME</code></a>
) -> None
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`embedder`<a id="embedder"></a>
</td>
<td>
Embedder to generate embedding from raw input image.
</td>
</tr><tr>
<td>
`metadata_type`<a id="metadata_type"></a>
</td>
<td>
Type of MetadataLoader to load metadata for each input
data. By default, load the file name as metadata for each input data.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`dataset`<a id="dataset"></a>
</td>
<td>
Gets the dataset.
Due to performance consideration, we don't return a copy, but the returned
`self._dataset` should never be changed.
</td>
</tr><tr>
<td>
`embedder_path`<a id="embedder_path"></a>
</td>
<td>
Gets the path to the TFLite Embedder model file.
</td>
</tr><tr>
<td>
`metadata`<a id="metadata"></a>
</td>
<td>
Gets the metadata.
</td>
</tr>
</table>
## Methods
<h3 id="append"><code>append</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/searcher_dataloader.py#L92-L106">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>append(
data_loader: 'DataLoader'
) -> None
</code></pre>
Appends the dataset.
Don't check if embedders from the two data loader are the same in this
function. Users are responsible to keep the embedder identical.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`data_loader`
</td>
<td>
The data loader in which the data will be appended.
</td>
</tr>
</table>
<h3 id="create"><code>create</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/image_searcher_dataloader.py#L60-L92">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>create(
image_embedder_path: str,
metadata_type: <a href="../../tflite_model_maker/searcher/MetadataType"><code>tflite_model_maker.searcher.MetadataType</code></a> = <a href="../../tflite_model_maker/searcher/MetadataType#FROM_FILE_NAME"><code>tflite_model_maker.searcher.MetadataType.FROM_FILE_NAME</code></a>,
l2_normalize: bool = False
) -> 'DataLoader'
</code></pre>
Creates DataLoader for the Image Searcher task.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`image_embedder_path`
</td>
<td>
Path to the ".tflite" image embedder model.
</td>
</tr><tr>
<td>
`metadata_type`
</td>
<td>
Type of MetadataLoader to load metadata for each input
image based on image path. By default, load the file name as metadata
for each input image.
</td>
</tr><tr>
<td>
`l2_normalize`
</td>
<td>
Whether to normalize the returned feature vector with L2
norm. Use this option only if the model does not already contain a
native L2_NORMALIZATION TF Lite Op. In most cases, this is already the
case and L2 norm is thus achieved through TF Lite inference.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
DataLoader object created for the Image Searcher task.
</td>
</tr>
</table>
<h3 id="load_from_folder"><code>load_from_folder</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/image_searcher_dataloader.py#L94-L155">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>load_from_folder(
path: str, mode: str = &#x27;r&#x27;
) -> None
</code></pre>
Loads image data from folder.
Users can load images from different folders one by one. For instance,
```
# Creates data_loader instance.
data_loader = image_searcher_dataloader.DataLoader.create(tflite_path)
# Loads images, first from `image_path1` and secondly from `image_path2`.
data_loader.load_from_folder(image_path1)
data_loader.load_from_folder(image_path2)
```
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`path`
</td>
<td>
image directory to be loaded.
</td>
</tr><tr>
<td>
`mode`
</td>
<td>
mode in which the file is opened, Used when metadata_type is
FROM_DAT_FILE. Only 'r' and 'rb' are supported. 'r' means opening for
reading, 'rb' means opening for reading binary.
</td>
</tr>
</table>
<h3 id="__len__"><code>__len__</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/searcher_dataloader.py#L60-L61">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__len__()
</code></pre>
@@ -0,0 +1,58 @@
page_type: reference
description: An enumeration.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.searcher.MetadataType" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="FROM_DAT_FILE"/>
<meta itemprop="property" content="FROM_FILE_NAME"/>
</div>
# tflite_model_maker.searcher.MetadataType
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/metadata_loader.py#L24-L28">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
An enumeration.
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
FROM_DAT_FILE<a id="FROM_DAT_FILE"></a>
</td>
<td>
`<MetadataType.FROM_DAT_FILE: 2>`
</td>
</tr><tr>
<td>
FROM_FILE_NAME<a id="FROM_FILE_NAME"></a>
</td>
<td>
`<MetadataType.FROM_FILE_NAME: 1>`
</td>
</tr>
</table>
@@ -0,0 +1,162 @@
page_type: reference
description: Options to build ScaNN.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.searcher.ScaNNOptions" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__eq__"/>
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="score_ah"/>
<meta itemprop="property" content="score_brute_force"/>
<meta itemprop="property" content="tree"/>
</div>
# tflite_model_maker.searcher.ScaNNOptions
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/searcher.py#L131-L156">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Options to build ScaNN.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.searcher.ScaNNOptions(
distance_measure: str,
tree: Optional[<a href="../../tflite_model_maker/searcher/Tree"><code>tflite_model_maker.searcher.Tree</code></a>] = None,
score_ah: Optional[<a href="../../tflite_model_maker/searcher/ScoreAH"><code>tflite_model_maker.searcher.ScoreAH</code></a>] = None,
score_brute_force: Optional[<a href="../../tflite_model_maker/searcher/ScoreBruteForce"><code>tflite_model_maker.searcher.ScoreBruteForce</code></a>] = None
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/text_searcher">Text Searcher with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
ScaNN
(<a href="https://ai.googleblog.com/2020/07/announcing-scann-efficient-vector.html">https://ai.googleblog.com/2020/07/announcing-scann-efficient-vector.html</a>) is
a highly efficient and scalable vector nearest neighbor retrieval
library from Google Research. We use ScaNN to build the on-device search
index, and do on-device retrieval with a simplified implementation.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`distance_measure`<a id="distance_measure"></a>
</td>
<td>
How to compute the distance. Allowed values are
'dot_product' and 'squared_l2'. Please note that when distance is
'dot_product', we actually compute the negative dot product between query
and database vectors, to preserve the notion that "smaller is closer".
</td>
</tr><tr>
<td>
`tree`<a id="tree"></a>
</td>
<td>
Configure partitioning. If not set, no partitioning is performed.
</td>
</tr><tr>
<td>
`score_ah`<a id="score_ah"></a>
</td>
<td>
Configure asymmetric hashing. Must defined this or
`score_brute_force`.
</td>
</tr><tr>
<td>
`score_brute_force`<a id="score_brute_force"></a>
</td>
<td>
Configure bruce force. Must defined this or `score_ah`.
</td>
</tr>
</table>
## Methods
<h3 id="__eq__"><code>__eq__</code></h3>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__eq__(
other
)
</code></pre>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
score_ah<a id="score_ah"></a>
</td>
<td>
`None`
</td>
</tr><tr>
<td>
score_brute_force<a id="score_brute_force"></a>
</td>
<td>
`None`
</td>
</tr><tr>
<td>
tree<a id="tree"></a>
</td>
<td>
`None`
</td>
</tr>
</table>
@@ -0,0 +1,169 @@
page_type: reference
description: Product Quantization (PQ) based in-partition scoring configuration.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.searcher.ScoreAH" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__eq__"/>
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="anisotropic_quantization_threshold"/>
<meta itemprop="property" content="training_iterations"/>
<meta itemprop="property" content="training_sample_size"/>
</div>
# tflite_model_maker.searcher.ScoreAH
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/searcher.py#L85-L118">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Product Quantization (PQ) based in-partition scoring configuration.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.searcher.ScoreAH(
dimensions_per_block: int,
anisotropic_quantization_threshold: float = float(&#x27;nan&#x27;),
training_sample_size: int = 100000,
training_iterations: int = 10
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/text_searcher">Text Searcher with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
In ScaNN we use PQ to compress the database embeddings, but not the query
embedding. We called it Asymmetric Hashing. See
<a href="https://research.google/pubs/pub41694/">https://research.google/pubs/pub41694/</a>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`dimensions_per_block`<a id="dimensions_per_block"></a>
</td>
<td>
How many dimensions in each PQ block. If the embedding
vector dimensionality is a multiple of this value, there will be
`number_of_dimensions / dimensions_per_block` PQ blocks. Otherwise, the
last block will be the remainder. For example, if a vector has 12
dimensions, and `dimensions_per_block` is 2, then there will be 6
2-dimension blocks. However, if the vector has 13 dimensions and
`dimensions_per_block` is still 2, there will be 6 2-dimension blocks and
one 1-dimension block.
</td>
</tr><tr>
<td>
`anisotropic_quantization_threshold`<a id="anisotropic_quantization_threshold"></a>
</td>
<td>
If this value is set, we will penalize
the quantization error that's parallel to the original vector differently
than the orthogonal error. A generally recommended value for this
parameter would be 0.2. For more details, please look at ScaNN's 2020 ICML
paper https://arxiv.org/abs/1908.10396 and the Google AI Blog post
https://ai.googleblog.com/2020/07/announcing-scann-efficient-vector.html
</td>
</tr><tr>
<td>
`training_sample_size`<a id="training_sample_size"></a>
</td>
<td>
How many database points to sample for training the
K-Means for PQ centers. A good starting value would be 100k or the whole
dataset if it's smaller than that.
</td>
</tr><tr>
<td>
`training_iterations`<a id="training_iterations"></a>
</td>
<td>
How many iterations to run K-Means for PQ.
</td>
</tr>
</table>
## Methods
<h3 id="__eq__"><code>__eq__</code></h3>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__eq__(
other
)
</code></pre>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
anisotropic_quantization_threshold<a id="anisotropic_quantization_threshold"></a>
</td>
<td>
`nan`
</td>
</tr><tr>
<td>
training_iterations<a id="training_iterations"></a>
</td>
<td>
`10`
</td>
</tr><tr>
<td>
training_sample_size<a id="training_sample_size"></a>
</td>
<td>
`100000`
</td>
</tr>
</table>
@@ -0,0 +1,52 @@
page_type: reference
description: Bruce force in-partition scoring configuration.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.searcher.ScoreBruteForce" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__eq__"/>
<meta itemprop="property" content="__init__"/>
</div>
# tflite_model_maker.searcher.ScoreBruteForce
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/searcher.py#L121-L128">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Bruce force in-partition scoring configuration.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.searcher.ScoreBruteForce()
</code></pre>
<!-- Placeholder for "Used in" -->
There'll be no compression or quantization applied to the database
embeddings or query embeddings.
## Methods
<h3 id="__eq__"><code>__eq__</code></h3>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__eq__(
other
)
</code></pre>
@@ -0,0 +1,280 @@
page_type: reference
description: Creates the similarity search model with ScaNN.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.searcher.Searcher" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="create_from_data"/>
<meta itemprop="property" content="create_from_server_scann"/>
<meta itemprop="property" content="export"/>
</div>
# tflite_model_maker.searcher.Searcher
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/searcher.py#L159-L355">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Creates the similarity search model with ScaNN.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.searcher.Searcher(
serialized_scann_path: str,
metadata: List[AnyStr],
embedder_path: Optional[str] = None
) -> None
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/text_searcher">Text Searcher with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`serialized_scann_path`<a id="serialized_scann_path"></a>
</td>
<td>
Path to the dir that contains the ScaNN's
artifacts.
</td>
</tr><tr>
<td>
`metadata`<a id="metadata"></a>
</td>
<td>
The metadata for each of the embeddings in the database. Passed
in the same order as the embeddings in ScaNN.
</td>
</tr><tr>
<td>
`embedder_path`<a id="embedder_path"></a>
</td>
<td>
Path to the TFLite Embedder model file.
</td>
</tr>
</table>
## Methods
<h3 id="create_from_data"><code>create_from_data</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/searcher.py#L200-L245">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>create_from_data(
data: <a href="../../tflite_model_maker/searcher/DataLoader"><code>tflite_model_maker.searcher.DataLoader</code></a>,
scann_options: <a href="../../tflite_model_maker/searcher/ScaNNOptions"><code>tflite_model_maker.searcher.ScaNNOptions</code></a>,
cache_dir: Optional[str] = None
) -> 'Searcher'
</code></pre>
"Creates the instance from data.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`data`
</td>
<td>
Data used to create scann.
</td>
</tr><tr>
<td>
`scann_options`
</td>
<td>
Options to build the ScaNN index file.
</td>
</tr><tr>
<td>
`cache_dir`
</td>
<td>
The cache directory to save serialized ScaNN and/or the tflite
model. When cache_dir is not set, a temporary folder will be created and
will **not** be removed automatically which makes it can be used later.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A Searcher instance.
</td>
</tr>
</table>
<h3 id="create_from_server_scann"><code>create_from_server_scann</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/searcher.py#L180-L198">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>create_from_server_scann(
serialized_scann_path: str,
metadata: List[AnyStr],
embedder_path: Optional[str] = None
) -> 'Searcher'
</code></pre>
Creates the instance from the serialized serving scann directory.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`serialized_scann_path`
</td>
<td>
Path to the dir that contains the ScaNN's
artifacts.
</td>
</tr><tr>
<td>
`metadata`
</td>
<td>
The metadata for each of the embeddings in the database. Passed
in the same order as the embeddings in ScaNN.
</td>
</tr><tr>
<td>
`embedder_path`
</td>
<td>
Path to the TFLite Embedder model file.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A Searcher instance.
</td>
</tr>
</table>
<h3 id="export"><code>export</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/searcher.py#L247-L355">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>export(
export_format: <a href="../../tflite_model_maker/searcher/ExportFormat"><code>tflite_model_maker.searcher.ExportFormat</code></a>,
export_filename: str,
userinfo: AnyStr,
compression: bool = True
)
</code></pre>
Export the searcher model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`export_format`
</td>
<td>
Export format that could be tflite or on-device ScaNN index
file, must be <a href="../../tflite_model_maker/audio_classifier/AudioClassifier#DEFAULT_EXPORT_FORMAT"><code>ExportFormat.TFLITE</code></a> or <a href="../../tflite_model_maker/searcher/ExportFormat#SCANN_INDEX_FILE"><code>ExportFormat.SCANN_INDEX_FILE</code></a>.
</td>
</tr><tr>
<td>
`export_filename`
</td>
<td>
File name to save the exported file. The exported file
can be TFLite model or on-device ScaNN index file.
</td>
</tr><tr>
<td>
`userinfo`
</td>
<td>
A special field in the index file that can be an arbitrary
string supplied by the user.
</td>
</tr><tr>
<td>
`compression`
</td>
<td>
Whether to snappy compress the index file.
</td>
</tr>
</table>
@@ -0,0 +1,291 @@
page_type: reference
description: DataLoader class for Text Searcher.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.searcher.TextDataLoader" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="__len__"/>
<meta itemprop="property" content="append"/>
<meta itemprop="property" content="create"/>
<meta itemprop="property" content="load_from_csv"/>
</div>
# tflite_model_maker.searcher.TextDataLoader
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/text_searcher_dataloader.py#L30-L125">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
DataLoader class for Text Searcher.
Inherits From: [`DataLoader`](../../tflite_model_maker/searcher/DataLoader)
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.searcher.TextDataLoader(
embedder: text_embedder.TextEmbedder
) -> None
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/text_searcher">Text Searcher with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`embedder`<a id="embedder"></a>
</td>
<td>
Embedder to generate embedding from raw input image.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`dataset`<a id="dataset"></a>
</td>
<td>
Gets the dataset.
Due to performance consideration, we don't return a copy, but the returned
`self._dataset` should never be changed.
</td>
</tr><tr>
<td>
`embedder_path`<a id="embedder_path"></a>
</td>
<td>
Gets the path to the TFLite Embedder model file.
</td>
</tr><tr>
<td>
`metadata`<a id="metadata"></a>
</td>
<td>
Gets the metadata.
</td>
</tr>
</table>
## Methods
<h3 id="append"><code>append</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/searcher_dataloader.py#L92-L106">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>append(
data_loader: 'DataLoader'
) -> None
</code></pre>
Appends the dataset.
Don't check if embedders from the two data loader are the same in this
function. Users are responsible to keep the embedder identical.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`data_loader`
</td>
<td>
The data loader in which the data will be appended.
</td>
</tr>
</table>
<h3 id="create"><code>create</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/text_searcher_dataloader.py#L43-L69">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>create(
text_embedder_path: str, l2_normalize: bool = False
) -> 'DataLoader'
</code></pre>
Creates DataLoader for the Text Searcher task.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`text_embedder_path`
</td>
<td>
Path to the ".tflite" text embedder model. case and L2
norm is thus achieved through TF Lite inference.
</td>
</tr><tr>
<td>
`l2_normalize`
</td>
<td>
Whether to normalize the returned feature vector with L2
norm. Use this option only if the model does not already contain a
native L2_NORMALIZATION TF Lite Op. In most cases, this is already the
case and L2 norm is thus achieved through TF Lite inference.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
DataLoader object created for the Text Searcher task.
</td>
</tr>
</table>
<h3 id="load_from_csv"><code>load_from_csv</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/text_searcher_dataloader.py#L71-L125">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>load_from_csv(
path: str,
text_column: str,
metadata_column: str,
delimiter: str = &#x27;,&#x27;,
quotechar: str = &#x27;\&#x27;&quot;
) -> None
</code></pre>
Loads text data from csv file that includes a "header" line with titles.
Users can load text from different csv files one by one. For instance,
```
# Creates data_loader instance.
data_loader = text_searcher_dataloader.DataLoader.create(tflite_path)
# Loads text, first from `text_path1` and secondly from `text_path2`.
data_loader.load_from_csv(
text_path1, text_column='text', metadata_column='metadata')
data_loader.load_from_csv(
text_path2, text_column='text', metadata_column='metadata')
```
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`path`
</td>
<td>
Text csv file path to be loaded.
</td>
</tr><tr>
<td>
`text_column`
</td>
<td>
Column name for input text.
</td>
</tr><tr>
<td>
`metadata_column`
</td>
<td>
Column name for user metadata associated with each input
text.
</td>
</tr><tr>
<td>
`delimiter`
</td>
<td>
Character used to separate fields.
</td>
</tr><tr>
<td>
`quotechar`
</td>
<td>
Character used to quote fields containing special characters.
</td>
</tr>
</table>
<h3 id="__len__"><code>__len__</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/searcher_dataloader.py#L60-L61">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__len__()
</code></pre>
@@ -0,0 +1,222 @@
page_type: reference
description: K-Means partitioning tree configuration.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.searcher.Tree" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__eq__"/>
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="min_partition_size"/>
<meta itemprop="property" content="quantize_centroids"/>
<meta itemprop="property" content="random_init"/>
<meta itemprop="property" content="spherical"/>
<meta itemprop="property" content="training_iterations"/>
<meta itemprop="property" content="training_sample_size"/>
</div>
# tflite_model_maker.searcher.Tree
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/searcher.py#L45-L82">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
K-Means partitioning tree configuration.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.searcher.Tree(
num_leaves: int,
num_leaves_to_search: int,
training_sample_size: int = 100000,
min_partition_size: int = 50,
training_iterations: int = 12,
spherical: bool = False,
quantize_centroids: bool = False,
random_init: bool = True
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/text_searcher">Text Searcher with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
In ScaNN, we use single layer K-Means tree to partition the database (index)
as a way to reduce search space.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`num_leaves`<a id="num_leaves"></a>
</td>
<td>
How many leaves (partitions) to have on the K-Means tree. In
general, a good starting point would be the square root of the database
size.
</td>
</tr><tr>
<td>
`num_leaves_to_search`<a id="num_leaves_to_search"></a>
</td>
<td>
During inference ScaNN will compare the query vector
against all the partition centroids and select the closest
`num_leaves_to_search` ones to search in. The more leaves to search, the
better the retrieval quality, and higher computational cost.
</td>
</tr><tr>
<td>
`training_sample_size`<a id="training_sample_size"></a>
</td>
<td>
How many database embeddings to sample for the K-Means
training. Generally, you want to use a large enough sample of the database
to train K-Means so that it's representative enough. However, large sample
can also lead to longer training time. A good starting value would be
100k, or the whole dataset if it's smaller than that.
</td>
</tr><tr>
<td>
`min_partition_size`<a id="min_partition_size"></a>
</td>
<td>
Smallest allowable cluster size. Any clusters smaller
than this will be removed, and its data points will be merged with other
clusters. Recommended to be 1/10 of average cluster size (size of database
divided by `num_leaves`)
</td>
</tr><tr>
<td>
`training_iterations`<a id="training_iterations"></a>
</td>
<td>
How many itrations to train K-Means.
</td>
</tr><tr>
<td>
`spherical`<a id="spherical"></a>
</td>
<td>
If true, L2 normalize the K-Means centroids.
</td>
</tr><tr>
<td>
`quantize_centroids`<a id="quantize_centroids"></a>
</td>
<td>
If true, quantize centroids to int8.
</td>
</tr><tr>
<td>
`random_init`<a id="random_init"></a>
</td>
<td>
If true, use random init. Otherwise use K-Means++.
</td>
</tr>
</table>
## Methods
<h3 id="__eq__"><code>__eq__</code></h3>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__eq__(
other
)
</code></pre>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
min_partition_size<a id="min_partition_size"></a>
</td>
<td>
`50`
</td>
</tr><tr>
<td>
quantize_centroids<a id="quantize_centroids"></a>
</td>
<td>
`False`
</td>
</tr><tr>
<td>
random_init<a id="random_init"></a>
</td>
<td>
`True`
</td>
</tr><tr>
<td>
spherical<a id="spherical"></a>
</td>
<td>
`False`
</td>
</tr><tr>
<td>
training_iterations<a id="training_iterations"></a>
</td>
<td>
`12`
</td>
</tr><tr>
<td>
training_sample_size<a id="training_sample_size"></a>
</td>
<td>
`100000`
</td>
</tr>
</table>
@@ -0,0 +1,52 @@
page_type: reference
description: APIs to train a text classification model.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.text_classifier" />
<meta itemprop="path" content="Stable" />
</div>
# Module: tflite_model_maker.text_classifier
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/tflmm/v0.4.2/tensorflow_examples/lite/model_maker/public/text_classifier/__init__.py">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
APIs to train a text classification model.
#### Task guide:
<a href="https://www.tensorflow.org/lite/tutorials/model_maker_text_classification">https://www.tensorflow.org/lite/tutorials/model_maker_text_classification</a>
## Classes
[`class AverageWordVecSpec`](../tflite_model_maker/text_classifier/AverageWordVecSpec): A specification of averaging word vector model.
[`class BertClassifierSpec`](../tflite_model_maker/text_classifier/BertClassifierSpec): A specification of BERT model for text classification.
[`class DataLoader`](../tflite_model_maker/text_classifier/DataLoader): DataLoader for text classifier.
[`class TextClassifier`](../tflite_model_maker/text_classifier/TextClassifier): TextClassifier class for inference and exporting to tflite.
## Functions
[`MobileBertClassifierSpec(...)`](../tflite_model_maker/text_classifier/MobileBertClassifierSpec): Creates MobileBert model spec for the text classification task. See also: <a href="../tflite_model_maker/text_classifier/BertClassifierSpec"><code>tflite_model_maker.text_classifier.BertClassifierSpec</code></a>.
[`create(...)`](../tflite_model_maker/text_classifier/create): Loads data and train the model for test classification.
@@ -0,0 +1,359 @@
page_type: reference
description: A specification of averaging word vector model.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.text_classifier.AverageWordVecSpec" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="convert_examples_to_features"/>
<meta itemprop="property" content="create_model"/>
<meta itemprop="property" content="gen_vocab"/>
<meta itemprop="property" content="get_config"/>
<meta itemprop="property" content="get_default_quantization_config"/>
<meta itemprop="property" content="get_name_to_features"/>
<meta itemprop="property" content="load_vocab"/>
<meta itemprop="property" content="preprocess"/>
<meta itemprop="property" content="run_classifier"/>
<meta itemprop="property" content="save_vocab"/>
<meta itemprop="property" content="select_data_from_record"/>
<meta itemprop="property" content="PAD"/>
<meta itemprop="property" content="START"/>
<meta itemprop="property" content="UNKNOWN"/>
<meta itemprop="property" content="compat_tf_versions"/>
<meta itemprop="property" content="convert_from_saved_model_tf2"/>
<meta itemprop="property" content="need_gen_vocab"/>
</div>
# tflite_model_maker.text_classifier.AverageWordVecSpec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L55-L255">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
A specification of averaging word vector model.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.text_classifier.AverageWordVecSpec(
num_words=10000,
seq_len=256,
wordvec_dim=16,
lowercase=True,
dropout_rate=0.2,
name=&#x27;AverageWordVec&#x27;,
default_training_epochs=2,
default_batch_size=32,
model_dir=None,
index_to_label=None
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/text_classification">Text classification with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`num_words`<a id="num_words"></a>
</td>
<td>
Number of words to generate the vocabulary from data.
</td>
</tr><tr>
<td>
`seq_len`<a id="seq_len"></a>
</td>
<td>
Length of the sequence to feed into the model.
</td>
</tr><tr>
<td>
`wordvec_dim`<a id="wordvec_dim"></a>
</td>
<td>
Dimension of the word embedding.
</td>
</tr><tr>
<td>
`lowercase`<a id="lowercase"></a>
</td>
<td>
Whether to convert all uppercase character to lowercase during
preprocessing.
</td>
</tr><tr>
<td>
`dropout_rate`<a id="dropout_rate"></a>
</td>
<td>
The rate for dropout.
</td>
</tr><tr>
<td>
`name`<a id="name"></a>
</td>
<td>
Name of the object.
</td>
</tr><tr>
<td>
`default_training_epochs`<a id="default_training_epochs"></a>
</td>
<td>
Default training epochs for training.
</td>
</tr><tr>
<td>
`default_batch_size`<a id="default_batch_size"></a>
</td>
<td>
Default batch size for training.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location of the model checkpoint files.
</td>
</tr><tr>
<td>
`index_to_label`<a id="index_to_label"></a>
</td>
<td>
List of labels in the training data. e.g. ['neg', 'pos'].
</td>
</tr>
</table>
## Methods
<h3 id="convert_examples_to_features"><code>convert_examples_to_features</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L120-L135">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>convert_examples_to_features(
examples, tfrecord_file, label_names
)
</code></pre>
Converts examples to features and write them into TFRecord file.
<h3 id="create_model"><code>create_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L137-L159">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_model(
num_classes, optimizer=&#x27;rmsprop&#x27;, with_loss_and_metrics=True
)
</code></pre>
Creates the keras model.
<h3 id="gen_vocab"><code>gen_vocab</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L181-L195">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>gen_vocab(
examples
)
</code></pre>
Generates vocabulary list in `examples` with maximum `num_words` words.
<h3 id="get_config"><code>get_config</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L244-L251">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_config()
</code></pre>
Gets the configuration.
<h3 id="get_default_quantization_config"><code>get_default_quantization_config</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L253-L255">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_default_quantization_config()
</code></pre>
Gets the default quantization configuration.
<h3 id="get_name_to_features"><code>get_name_to_features</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L106-L112">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_name_to_features()
</code></pre>
Gets the dictionary describing the features.
<h3 id="load_vocab"><code>load_vocab</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L234-L242">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>load_vocab(
vocab_filename
)
</code></pre>
Loads vocabulary from `vocab_filename`.
<h3 id="preprocess"><code>preprocess</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L197-L216">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>preprocess(
raw_text
)
</code></pre>
Preprocess the text for text classification.
<h3 id="run_classifier"><code>run_classifier</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L161-L179">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>run_classifier(
train_ds, validation_ds, epochs, steps_per_epoch, num_classes, **kwargs
)
</code></pre>
Creates classifier and runs the classifier training.
<h3 id="save_vocab"><code>save_vocab</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L226-L232">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>save_vocab(
vocab_filename
)
</code></pre>
Saves the vocabulary in `vocab_filename`.
<h3 id="select_data_from_record"><code>select_data_from_record</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L114-L118">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>select_data_from_record(
record
)
</code></pre>
Dispatches records to features and labels.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
PAD<a id="PAD"></a>
</td>
<td>
`'<PAD>'`
</td>
</tr><tr>
<td>
START<a id="START"></a>
</td>
<td>
`'<START>'`
</td>
</tr><tr>
<td>
UNKNOWN<a id="UNKNOWN"></a>
</td>
<td>
`'<UNKNOWN>'`
</td>
</tr><tr>
<td>
compat_tf_versions<a id="compat_tf_versions"></a>
</td>
<td>
`[2]`
</td>
</tr><tr>
<td>
convert_from_saved_model_tf2<a id="convert_from_saved_model_tf2"></a>
</td>
<td>
`False`
</td>
</tr><tr>
<td>
need_gen_vocab<a id="need_gen_vocab"></a>
</td>
<td>
`True`
</td>
</tr>
</table>
@@ -0,0 +1,427 @@
page_type: reference
description: A specification of BERT model for text classification.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.text_classifier.BertClassifierSpec" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="build"/>
<meta itemprop="property" content="convert_examples_to_features"/>
<meta itemprop="property" content="create_model"/>
<meta itemprop="property" content="get_config"/>
<meta itemprop="property" content="get_default_quantization_config"/>
<meta itemprop="property" content="get_name_to_features"/>
<meta itemprop="property" content="reorder_input_details"/>
<meta itemprop="property" content="run_classifier"/>
<meta itemprop="property" content="save_vocab"/>
<meta itemprop="property" content="select_data_from_record"/>
<meta itemprop="property" content="compat_tf_versions"/>
<meta itemprop="property" content="convert_from_saved_model_tf2"/>
<meta itemprop="property" content="need_gen_vocab"/>
</div>
# tflite_model_maker.text_classifier.BertClassifierSpec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L455-L626">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
A specification of BERT model for text classification.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.text_classifier.BertClassifierSpec(
uri=&#x27;https://tfhub.dev/tensorflow/bert_en_uncased_L-12_H-768_A-12/1&#x27;,
model_dir=None,
seq_len=128,
dropout_rate=0.1,
initializer_range=0.02,
learning_rate=3e-05,
distribution_strategy=&#x27;mirrored&#x27;,
num_gpus=-1,
tpu=&#x27;&#x27;,
trainable=True,
do_lower_case=True,
is_tf2=True,
name=&#x27;Bert&#x27;,
tflite_input_name=None,
default_batch_size=32,
index_to_label=None
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
TF-Hub path/url to Bert module.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location of the model checkpoint files.
</td>
</tr><tr>
<td>
`seq_len`<a id="seq_len"></a>
</td>
<td>
Length of the sequence to feed into the model.
</td>
</tr><tr>
<td>
`dropout_rate`<a id="dropout_rate"></a>
</td>
<td>
The rate for dropout.
</td>
</tr><tr>
<td>
`initializer_range`<a id="initializer_range"></a>
</td>
<td>
The stdev of the truncated_normal_initializer for
initializing all weight matrices.
</td>
</tr><tr>
<td>
`learning_rate`<a id="learning_rate"></a>
</td>
<td>
The initial learning rate for Adam.
</td>
</tr><tr>
<td>
`distribution_strategy`<a id="distribution_strategy"></a>
</td>
<td>
A string specifying which distribution strategy to
use. Accepted values are 'off', 'one_device', 'mirrored',
'parameter_server', 'multi_worker_mirrored', and 'tpu' -- case
insensitive. 'off' means not to use Distribution Strategy; 'tpu' means
to use TPUStrategy using `tpu_address`.
</td>
</tr><tr>
<td>
`num_gpus`<a id="num_gpus"></a>
</td>
<td>
How many GPUs to use at each worker with the
DistributionStrategies API. The default is -1, which means utilize all
available GPUs.
</td>
</tr><tr>
<td>
`tpu`<a id="tpu"></a>
</td>
<td>
TPU address to connect to.
</td>
</tr><tr>
<td>
`trainable`<a id="trainable"></a>
</td>
<td>
boolean, whether pretrain layer is trainable.
</td>
</tr><tr>
<td>
`do_lower_case`<a id="do_lower_case"></a>
</td>
<td>
boolean, whether to lower case the input text. Should be
True for uncased models and False for cased models.
</td>
</tr><tr>
<td>
`is_tf2`<a id="is_tf2"></a>
</td>
<td>
boolean, whether the hub module is in TensorFlow 2.x format.
</td>
</tr><tr>
<td>
`name`<a id="name"></a>
</td>
<td>
The name of the object.
</td>
</tr><tr>
<td>
`tflite_input_name`<a id="tflite_input_name"></a>
</td>
<td>
Dict, input names for the TFLite model.
</td>
</tr><tr>
<td>
`default_batch_size`<a id="default_batch_size"></a>
</td>
<td>
Default batch size for training.
</td>
</tr><tr>
<td>
`index_to_label`<a id="index_to_label"></a>
</td>
<td>
List of labels in the training data. e.g. ['neg', 'pos'].
</td>
</tr>
</table>
## Methods
<h3 id="build"><code>build</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L438-L445">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>build()
</code></pre>
Builds the class. Used for lazy initialization.
<h3 id="convert_examples_to_features"><code>convert_examples_to_features</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L544-L549">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>convert_examples_to_features(
examples, tfrecord_file, label_names
)
</code></pre>
Converts examples to features and write them into TFRecord file.
<h3 id="create_model"><code>create_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L551-L577">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_model(
num_classes, optimizer=&#x27;adam&#x27;, with_loss_and_metrics=True
)
</code></pre>
Creates the keras model.
<h3 id="get_config"><code>get_config</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L623-L626">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_config()
</code></pre>
Gets the configuration.
<h3 id="get_default_quantization_config"><code>get_default_quantization_config</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L420-L424">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_default_quantization_config()
</code></pre>
Gets the default quantization configuration.
<h3 id="get_name_to_features"><code>get_name_to_features</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L523-L532">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_name_to_features()
</code></pre>
Gets the dictionary describing the features.
<h3 id="reorder_input_details"><code>reorder_input_details</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L426-L436">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>reorder_input_details(
tflite_input_details
)
</code></pre>
Reorders the tflite input details to map the order of keras model.
<h3 id="run_classifier"><code>run_classifier</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L579-L621">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>run_classifier(
train_ds, validation_ds, epochs, steps_per_epoch, num_classes, **kwargs
)
</code></pre>
Creates classifier and runs the classifier training.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`train_ds`
</td>
<td>
tf.data.Dataset, training data to be fed in
tf.keras.Model.fit().
</td>
</tr><tr>
<td>
`validation_ds`
</td>
<td>
tf.data.Dataset, validation data to be fed in
tf.keras.Model.fit().
</td>
</tr><tr>
<td>
`epochs`
</td>
<td>
Integer, training epochs.
</td>
</tr><tr>
<td>
`steps_per_epoch`
</td>
<td>
Integer or None. Total number of steps (batches of
samples) before declaring one epoch finished and starting the next
epoch. If `steps_per_epoch` is None, the epoch will run until the input
dataset is exhausted.
</td>
</tr><tr>
<td>
`num_classes`
</td>
<td>
Interger, number of classes.
</td>
</tr><tr>
<td>
`**kwargs`
</td>
<td>
Other parameters used in the tf.keras.Model.fit().
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
tf.keras.Model, the keras model that's already trained.
</td>
</tr>
</table>
<h3 id="save_vocab"><code>save_vocab</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L447-L452">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>save_vocab(
vocab_filename
)
</code></pre>
Prints the file path to the vocabulary.
<h3 id="select_data_from_record"><code>select_data_from_record</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/model_spec/text_spec.py#L534-L542">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>select_data_from_record(
record
)
</code></pre>
Dispatches records to features and labels.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
compat_tf_versions<a id="compat_tf_versions"></a>
</td>
<td>
`[2]`
</td>
</tr><tr>
<td>
convert_from_saved_model_tf2<a id="convert_from_saved_model_tf2"></a>
</td>
<td>
`True`
</td>
</tr><tr>
<td>
need_gen_vocab<a id="need_gen_vocab"></a>
</td>
<td>
`False`
</td>
</tr>
</table>
@@ -0,0 +1,480 @@
page_type: reference
description: DataLoader for text classifier.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.text_classifier.DataLoader" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="__len__"/>
<meta itemprop="property" content="from_csv"/>
<meta itemprop="property" content="from_folder"/>
<meta itemprop="property" content="gen_dataset"/>
<meta itemprop="property" content="split"/>
</div>
# tflite_model_maker.text_classifier.DataLoader
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/text_dataloader.py#L83-L289">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
DataLoader for text classifier.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.text_classifier.DataLoader(
dataset, size, index_to_label
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://www.tensorflow.org/lite/models/modify/model_maker/text_classification">Text classification with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`dataset`<a id="dataset"></a>
</td>
<td>
A tf.data.Dataset object that contains a potentially large set of
elements, where each element is a pair of (input_data, target). The
`input_data` means the raw input data, like an image, a text etc., while
the `target` means some ground truth of the raw input data, such as the
classification label of the image etc.
</td>
</tr><tr>
<td>
`size`<a id="size"></a>
</td>
<td>
The size of the dataset. tf.data.Dataset donesn't support a function
to get the length directly since it's lazy-loaded and may be infinite.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>
<tr>
<td>
`num_classes`<a id="num_classes"></a>
</td>
<td>
</td>
</tr><tr>
<td>
`size`<a id="size"></a>
</td>
<td>
Returns the size of the dataset.
Note that this function may return None becuase the exact size of the
dataset isn't a necessary parameter to create an instance of this class,
and tf.data.Dataset donesn't support a function to get the length directly
since it's lazy-loaded and may be infinite.
In most cases, however, when an instance of this class is created by helper
functions like 'from_folder', the size of the dataset will be preprocessed,
and this function can return an int representing the size of the dataset.
</td>
</tr>
</table>
## Methods
<h3 id="from_csv"><code>from_csv</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/text_dataloader.py#L165-L236">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>from_csv(
filename,
text_column,
label_column,
fieldnames=None,
model_spec=&#x27;average_word_vec&#x27;,
is_training=True,
delimiter=&#x27;,&#x27;,
quotechar=&#x27;\&#x27;&quot;,
shuffle=False,
cache_dir=None
)
</code></pre>
Loads text with labels from the csv file and preproecess text according to `model_spec`.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`filename`
</td>
<td>
Name of the file.
</td>
</tr><tr>
<td>
`text_column`
</td>
<td>
String, Column name for input text.
</td>
</tr><tr>
<td>
`label_column`
</td>
<td>
String, Column name for labels.
</td>
</tr><tr>
<td>
`fieldnames`
</td>
<td>
A sequence, used in csv.DictReader. If fieldnames is omitted,
the values in the first row of file f will be used as the fieldnames.
</td>
</tr><tr>
<td>
`model_spec`
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`is_training`
</td>
<td>
Whether the loaded data is for training or not.
</td>
</tr><tr>
<td>
`delimiter`
</td>
<td>
Character used to separate fields.
</td>
</tr><tr>
<td>
`quotechar`
</td>
<td>
Character used to quote fields containing special characters.
</td>
</tr><tr>
<td>
`shuffle`
</td>
<td>
boolean, if shuffle, random shuffle data.
</td>
</tr><tr>
<td>
`cache_dir`
</td>
<td>
The cache directory to save preprocessed data. If None,
generates a temporary directory to cache preprocessed data.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
TextDataset containing text, labels and other related info.
</td>
</tr>
</table>
<h3 id="from_folder"><code>from_folder</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/text_dataloader.py#L87-L163">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>from_folder(
filename,
model_spec=&#x27;average_word_vec&#x27;,
is_training=True,
class_labels=None,
shuffle=True,
cache_dir=None
)
</code></pre>
Loads text with labels and preproecess text according to `model_spec`.
Assume the text data of the same label are in the same subdirectory. each
file is one text.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`filename`
</td>
<td>
Name of the file.
</td>
</tr><tr>
<td>
`model_spec`
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`is_training`
</td>
<td>
Whether the loaded data is for training or not.
</td>
</tr><tr>
<td>
`class_labels`
</td>
<td>
Class labels that should be considered. Name of the
subdirectory not in `class_labels` will be ignored. If None, all the
subdirectories will be considered.
</td>
</tr><tr>
<td>
`shuffle`
</td>
<td>
boolean, if shuffle, random shuffle data.
</td>
</tr><tr>
<td>
`cache_dir`
</td>
<td>
The cache directory to save preprocessed data. If None,
generates a temporary directory to cache preprocessed data.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
TextDataset containing text, labels and other related info.
</td>
</tr>
</table>
<h3 id="gen_dataset"><code>gen_dataset</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py#L76-L124">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>gen_dataset(
batch_size=1,
is_training=False,
shuffle=False,
input_pipeline_context=None,
preprocess=None,
drop_remainder=False
)
</code></pre>
Generate a shared and batched tf.data.Dataset for training/evaluation.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`batch_size`
</td>
<td>
A integer, the returned dataset will be batched by this size.
</td>
</tr><tr>
<td>
`is_training`
</td>
<td>
A boolean, when True, the returned dataset will be optionally
shuffled and repeated as an endless dataset.
</td>
</tr><tr>
<td>
`shuffle`
</td>
<td>
A boolean, when True, the returned dataset will be shuffled to
create randomness during model training.
</td>
</tr><tr>
<td>
`input_pipeline_context`
</td>
<td>
A InputContext instance, used to shared dataset
among multiple workers when distribution strategy is used.
</td>
</tr><tr>
<td>
`preprocess`
</td>
<td>
A function taking three arguments in order, feature, label and
boolean is_training.
</td>
</tr><tr>
<td>
`drop_remainder`
</td>
<td>
boolean, whether the finaly batch drops remainder.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A TF dataset ready to be consumed by Keras model.
</td>
</tr>
</table>
<h3 id="split"><code>split</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py#L185-L197">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>split(
fraction
)
</code></pre>
Splits dataset into two sub-datasets with the given fraction.
Primarily used for splitting the data set into training and testing sets.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`fraction`
</td>
<td>
float, demonstrates the fraction of the first returned
subdataset in the original data.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
The splitted two sub datasets.
</td>
</tr>
</table>
<h3 id="__len__"><code>__len__</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/data_util/dataloader.py#L126-L130">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__len__()
</code></pre>
@@ -0,0 +1,180 @@
page_type: reference
description: Creates MobileBert model spec for the text classification task. See also: <a href="../../tflite_model_maker/text_classifier/BertClassifierSpec"><code>tflite_model_maker.text_classifier.BertClassifierSpec</code></a>.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.text_classifier.MobileBertClassifierSpec" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.text_classifier.MobileBertClassifierSpec
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
Creates MobileBert model spec for the text classification task. See also: <a href="../../tflite_model_maker/text_classifier/BertClassifierSpec"><code>tflite_model_maker.text_classifier.BertClassifierSpec</code></a>.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.text_classifier.MobileBertClassifierSpec(
*,
uri=&#x27;https://tfhub.dev/google/mobilebert/uncased_L-24_H-128_B-512_A-4_F-4_OPT/1&#x27;,
model_dir=None,
seq_len=128,
dropout_rate=0.1,
initializer_range=0.02,
learning_rate=3e-05,
distribution_strategy=&#x27;off&#x27;,
num_gpus=-1,
tpu=&#x27;&#x27;,
trainable=True,
do_lower_case=True,
is_tf2=False,
name=&#x27;MobileBert&#x27;,
tflite_input_name=None,
default_batch_size=48,
index_to_label=None
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`uri`<a id="uri"></a>
</td>
<td>
TF-Hub path/url to Bert module.
</td>
</tr><tr>
<td>
`model_dir`<a id="model_dir"></a>
</td>
<td>
The location of the model checkpoint files.
</td>
</tr><tr>
<td>
`seq_len`<a id="seq_len"></a>
</td>
<td>
Length of the sequence to feed into the model.
</td>
</tr><tr>
<td>
`dropout_rate`<a id="dropout_rate"></a>
</td>
<td>
The rate for dropout.
</td>
</tr><tr>
<td>
`initializer_range`<a id="initializer_range"></a>
</td>
<td>
The stdev of the truncated_normal_initializer for
initializing all weight matrices.
</td>
</tr><tr>
<td>
`learning_rate`<a id="learning_rate"></a>
</td>
<td>
The initial learning rate for Adam.
</td>
</tr><tr>
<td>
`distribution_strategy`<a id="distribution_strategy"></a>
</td>
<td>
A string specifying which distribution strategy to
use. Accepted values are 'off', 'one_device', 'mirrored',
'parameter_server', 'multi_worker_mirrored', and 'tpu' -- case
insensitive. 'off' means not to use Distribution Strategy; 'tpu' means
to use TPUStrategy using `tpu_address`.
</td>
</tr><tr>
<td>
`num_gpus`<a id="num_gpus"></a>
</td>
<td>
How many GPUs to use at each worker with the
DistributionStrategies API. The default is -1, which means utilize all
available GPUs.
</td>
</tr><tr>
<td>
`tpu`<a id="tpu"></a>
</td>
<td>
TPU address to connect to.
</td>
</tr><tr>
<td>
`trainable`<a id="trainable"></a>
</td>
<td>
boolean, whether pretrain layer is trainable.
</td>
</tr><tr>
<td>
`do_lower_case`<a id="do_lower_case"></a>
</td>
<td>
boolean, whether to lower case the input text. Should be
True for uncased models and False for cased models.
</td>
</tr><tr>
<td>
`is_tf2`<a id="is_tf2"></a>
</td>
<td>
boolean, whether the hub module is in TensorFlow 2.x format.
</td>
</tr><tr>
<td>
`name`<a id="name"></a>
</td>
<td>
The name of the object.
</td>
</tr><tr>
<td>
`tflite_input_name`<a id="tflite_input_name"></a>
</td>
<td>
Dict, input names for the TFLite model.
</td>
</tr><tr>
<td>
`default_batch_size`<a id="default_batch_size"></a>
</td>
<td>
Default batch size for training.
</td>
</tr><tr>
<td>
`index_to_label`<a id="index_to_label"></a>
</td>
<td>
List of labels in the training data. e.g. ['neg', 'pos'].
</td>
</tr>
</table>
@@ -0,0 +1,535 @@
page_type: reference
description: TextClassifier class for inference and exporting to tflite.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.text_classifier.TextClassifier" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="create"/>
<meta itemprop="property" content="create_model"/>
<meta itemprop="property" content="create_serving_model"/>
<meta itemprop="property" content="evaluate"/>
<meta itemprop="property" content="evaluate_tflite"/>
<meta itemprop="property" content="export"/>
<meta itemprop="property" content="predict_top_k"/>
<meta itemprop="property" content="summary"/>
<meta itemprop="property" content="train"/>
<meta itemprop="property" content="ALLOWED_EXPORT_FORMAT"/>
<meta itemprop="property" content="DEFAULT_EXPORT_FORMAT"/>
</div>
# tflite_model_maker.text_classifier.TextClassifier
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/text_classifier.py#L57-L220">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
TextClassifier class for inference and exporting to tflite.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_model_maker.text_classifier.TextClassifier(
model_spec, index_to_label, shuffle=True
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_spec`<a id="model_spec"></a>
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`index_to_label`<a id="index_to_label"></a>
</td>
<td>
A list that map from index to label class name.
</td>
</tr><tr>
<td>
`shuffle`<a id="shuffle"></a>
</td>
<td>
Whether the data should be shuffled.
</td>
</tr>
</table>
## Methods
<h3 id="create"><code>create</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/text_classifier.py#L177-L220">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>create(
train_data,
model_spec=&#x27;average_word_vec&#x27;,
validation_data=None,
batch_size=None,
epochs=3,
steps_per_epoch=None,
shuffle=False,
do_train=True
)
</code></pre>
Loads data and train the model for test classification.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`train_data`
</td>
<td>
Training data.
</td>
</tr><tr>
<td>
`model_spec`
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`validation_data`
</td>
<td>
Validation data. If None, skips validation process.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
Batch size for training.
</td>
</tr><tr>
<td>
`epochs`
</td>
<td>
Number of epochs for training.
</td>
</tr><tr>
<td>
`steps_per_epoch`
</td>
<td>
Integer or None. Total number of steps (batches of
samples) before declaring one epoch finished and starting the next
epoch. If `steps_per_epoch` is None, the epoch will run until the input
dataset is exhausted.
</td>
</tr><tr>
<td>
`shuffle`
</td>
<td>
Whether the data should be shuffled.
</td>
</tr><tr>
<td>
`do_train`
</td>
<td>
Whether to run training.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
An instance based on TextClassifier.
</td>
</tr>
</table>
<h3 id="create_model"><code>create_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/text_classifier.py#L84-L86">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_model(
with_loss_and_metrics=True
)
</code></pre>
<h3 id="create_serving_model"><code>create_serving_model</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L170-L176">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>create_serving_model()
</code></pre>
Returns the underlining Keras model for serving.
<h3 id="evaluate"><code>evaluate</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/classification_model.py#L53-L65">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate(
data, batch_size=32
)
</code></pre>
Evaluates the model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`data`
</td>
<td>
Data to be evaluated.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
Number of samples per evaluation step.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
The loss value and accuracy.
</td>
</tr>
</table>
<h3 id="evaluate_tflite"><code>evaluate_tflite</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/classification_model.py#L105-L143">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>evaluate_tflite(
tflite_filepath, data, postprocess_fn=None
)
</code></pre>
Evaluates the tflite model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`tflite_filepath`
</td>
<td>
File path to the TFLite model.
</td>
</tr><tr>
<td>
`data`
</td>
<td>
Data to be evaluated.
</td>
</tr><tr>
<td>
`postprocess_fn`
</td>
<td>
Postprocessing function that will be applied to the output
of `lite_runner.run` before calculating the probabilities.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
The evaluation result of TFLite model - accuracy.
</td>
</tr>
</table>
<h3 id="export"><code>export</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L95-L168">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>export(
export_dir,
tflite_filename=&#x27;model.tflite&#x27;,
label_filename=&#x27;labels.txt&#x27;,
vocab_filename=&#x27;vocab.txt&#x27;,
saved_model_filename=&#x27;saved_model&#x27;,
tfjs_folder_name=&#x27;tfjs&#x27;,
export_format=None,
**kwargs
)
</code></pre>
Converts the retrained model based on `export_format`.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`export_dir`
</td>
<td>
The directory to save exported files.
</td>
</tr><tr>
<td>
`tflite_filename`
</td>
<td>
File name to save tflite model. The full export path is
{export_dir}/{tflite_filename}.
</td>
</tr><tr>
<td>
`label_filename`
</td>
<td>
File name to save labels. The full export path is
{export_dir}/{label_filename}.
</td>
</tr><tr>
<td>
`vocab_filename`
</td>
<td>
File name to save vocabulary. The full export path is
{export_dir}/{vocab_filename}.
</td>
</tr><tr>
<td>
`saved_model_filename`
</td>
<td>
Path to SavedModel or H5 file to save the model. The
full export path is
{export_dir}/{saved_model_filename}/{saved_model.pb|assets|variables}.
</td>
</tr><tr>
<td>
`tfjs_folder_name`
</td>
<td>
Folder name to save tfjs model. The full export path is
{export_dir}/{tfjs_folder_name}.
</td>
</tr><tr>
<td>
`export_format`
</td>
<td>
List of export format that could be saved_model, tflite,
label, vocab.
</td>
</tr><tr>
<td>
`**kwargs`
</td>
<td>
Other parameters like `quantized_config` for TFLITE model.
</td>
</tr>
</table>
<h3 id="predict_top_k"><code>predict_top_k</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/classification_model.py#L67-L95">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>predict_top_k(
data, k=1, batch_size=32
)
</code></pre>
Predicts the top-k predictions.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`data`
</td>
<td>
Data to be evaluated. Either an instance of DataLoader or just raw
data entries such TF tensor or numpy array.
</td>
</tr><tr>
<td>
`k`
</td>
<td>
Number of top results to be predicted.
</td>
</tr><tr>
<td>
`batch_size`
</td>
<td>
Number of samples per evaluation step.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
top k results. Each one is (label, probability).
</td>
</tr>
</table>
<h3 id="summary"><code>summary</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/custom_model.py#L65-L66">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>summary()
</code></pre>
<h3 id="train"><code>train</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/text_classifier.py#L88-L120">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>train(
train_data,
validation_data=None,
epochs=None,
batch_size=None,
steps_per_epoch=None
)
</code></pre>
Feeds the training data for training.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
ALLOWED_EXPORT_FORMAT<a id="ALLOWED_EXPORT_FORMAT"></a>
</td>
<td>
`(<ExportFormat.TFLITE: 'TFLITE'>,
<ExportFormat.LABEL: 'LABEL'>,
<ExportFormat.VOCAB: 'VOCAB'>,
<ExportFormat.SAVED_MODEL: 'SAVED_MODEL'>,
<ExportFormat.TFJS: 'TFJS'>)`
</td>
</tr><tr>
<td>
DEFAULT_EXPORT_FORMAT<a id="DEFAULT_EXPORT_FORMAT"></a>
</td>
<td>
`(<ExportFormat.TFLITE: 'TFLITE'>,
<ExportFormat.LABEL: 'LABEL'>,
<ExportFormat.VOCAB: 'VOCAB'>)`
</td>
</tr>
</table>
@@ -0,0 +1,144 @@
page_type: reference
description: Loads data and train the model for test classification.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_model_maker.text_classifier.create" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_model_maker.text_classifier.create
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/core/task/text_classifier.py#L177-L220">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Loads data and train the model for test classification.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>tflite_model_maker.text_classifier.create(
train_data,
model_spec=&#x27;average_word_vec&#x27;,
validation_data=None,
batch_size=None,
epochs=3,
steps_per_epoch=None,
shuffle=False,
do_train=True
)
</code></pre>
<h3>Used in the notebooks</h3>
<table class="vertical-rules">
<thead>
<tr>
<th>Used in the tutorials</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li><a href="https://ai.google.dev/edge/litert/libraries/modify/text_classification">Text classification with TensorFlow Lite Model Maker</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`train_data`<a id="train_data"></a>
</td>
<td>
Training data.
</td>
</tr><tr>
<td>
`model_spec`<a id="model_spec"></a>
</td>
<td>
Specification for the model.
</td>
</tr><tr>
<td>
`validation_data`<a id="validation_data"></a>
</td>
<td>
Validation data. If None, skips validation process.
</td>
</tr><tr>
<td>
`batch_size`<a id="batch_size"></a>
</td>
<td>
Batch size for training.
</td>
</tr><tr>
<td>
`epochs`<a id="epochs"></a>
</td>
<td>
Number of epochs for training.
</td>
</tr><tr>
<td>
`steps_per_epoch`<a id="steps_per_epoch"></a>
</td>
<td>
Integer or None. Total number of steps (batches of
samples) before declaring one epoch finished and starting the next
epoch. If `steps_per_epoch` is None, the epoch will run until the input
dataset is exhausted.
</td>
</tr><tr>
<td>
`shuffle`<a id="shuffle"></a>
</td>
<td>
Whether the data should be shuffled.
</td>
</tr><tr>
<td>
`do_train`<a id="do_train"></a>
</td>
<td>
Whether to run training.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Returns</h2></th></tr>
<tr class="alt">
<td colspan="2">
An instance based on TextClassifier.
</td>
</tr>
</table>
@@ -0,0 +1,54 @@
page_type: reference
description: The TensorFlow Lite Support Library.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_support" />
<meta itemprop="path" content="Stable" />
</div>
# Module: tflite_support
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
</table>
The TensorFlow Lite Support Library.
Install the pip package:
```
pip install tflite-support
```
This package provides two major features:
* Metadata writers: add metadata to TensorFlow Lite models.
* Task Library: run TensorFlow Lite models of major machine learning tasks.
To learn more about metadata, flatbuffers and TensorFlow Lite models, check out
the [metadata section](https://www.tensorflow.org/lite/convert/metadata) of the
TensorFlow Lite guide.
To learn more about Task Library, check out the
[documentation](https://www.tensorflow.org/lite/inference_with_metadata/task_library/overview)
on the TensorFlow Lite website.
## Modules
[`metadata`](./tflite_support/metadata) module: TensorFlow Lite metadata tools.
[`metadata_schema_py_generated`](./tflite_support/metadata_schema_py_generated) module
[`metadata_writers`](./tflite_support/metadata_writers) module: TF Lite Metadata Writer API.
[`task`](./tflite_support/task) module: The TensorFlow Lite Task Library.
@@ -0,0 +1,896 @@
# Copyright 2026 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
redirects:
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/AssociatedFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/AssociatedFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/BertInputTensorsMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertInputTensorsMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/BertTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/CategoryTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/CategoryTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/ClassificationTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ClassificationTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/GeneralMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/GeneralMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/InputAudioTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputAudioTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/InputImageTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputImageTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/InputTextTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputTextTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/LabelFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/LabelFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/RegexTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/RegexTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/ScoreCalibrationMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/SentencePieceTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/TensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/TensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_info/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/AssociatedFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/AssociatedFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/BertInputTensorsMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertInputTensorsMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/BertTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/CategoryTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/CategoryTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/ClassificationTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ClassificationTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/GeneralMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/GeneralMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/InputAudioTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputAudioTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/InputImageTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputImageTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/InputTextTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputTextTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/LabelFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/LabelFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/RegexTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/RegexTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/ScoreCalibrationMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/SentencePieceTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/TensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/TensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/metadata_info/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/AssociatedFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/AssociatedFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/BertInputTensorsMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertInputTensorsMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/BertTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/CategoryTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/CategoryTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/ClassificationTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ClassificationTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/GeneralMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/GeneralMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/InputAudioTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputAudioTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/InputImageTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputImageTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/InputTextTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputTextTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/LabelFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/LabelFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/RegexTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/RegexTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/ScoreCalibrationMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/SentencePieceTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/TensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/TensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_info/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer
to: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/MetadataWriter
to: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/MetadataWriter
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/AssociatedFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/AssociatedFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/BertInputTensorsMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertInputTensorsMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/BertTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/CategoryTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/CategoryTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/ClassificationTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ClassificationTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/GeneralMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/GeneralMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/InputAudioTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputAudioTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/InputImageTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputImageTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/InputTextTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputTextTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/LabelFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/LabelFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/RegexTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/RegexTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/ScoreCalibrationMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/SentencePieceTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/TensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/TensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/metadata_info/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/metadata_writer/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/AssociatedFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/AssociatedFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/BertInputTensorsMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertInputTensorsMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/BertTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/CategoryTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/CategoryTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/ClassificationTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ClassificationTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/GeneralMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/GeneralMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/InputAudioTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputAudioTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/InputImageTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputImageTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/InputTextTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputTextTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/LabelFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/LabelFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/RegexTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/RegexTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/ScoreCalibrationMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/SentencePieceTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/TensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/TensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_info/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer
to: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/MetadataWriter
to: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/MetadataWriter
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/AssociatedFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/AssociatedFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/BertInputTensorsMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertInputTensorsMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/BertTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/CategoryTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/CategoryTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/ClassificationTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ClassificationTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/GeneralMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/GeneralMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/InputAudioTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputAudioTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/InputImageTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputImageTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/InputTextTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputTextTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/LabelFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/LabelFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/RegexTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/RegexTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/ScoreCalibrationMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/SentencePieceTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/TensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/TensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/metadata_info/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/metadata_writer/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/AssociatedFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/AssociatedFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/BertInputTensorsMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertInputTensorsMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/BertTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/CategoryTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/CategoryTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/ClassificationTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ClassificationTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/GeneralMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/GeneralMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/InputAudioTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputAudioTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/InputImageTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputImageTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/InputTextTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputTextTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/LabelFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/LabelFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/RegexTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/RegexTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/ScoreCalibrationMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/SentencePieceTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/TensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/TensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_info/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer
to: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/MetadataWriter
to: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/MetadataWriter
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/AssociatedFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/AssociatedFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/BertInputTensorsMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertInputTensorsMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/BertTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/CategoryTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/CategoryTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/ClassificationTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ClassificationTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/GeneralMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/GeneralMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/InputAudioTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputAudioTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/InputImageTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputImageTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/InputTextTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputTextTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/LabelFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/LabelFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/RegexTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/RegexTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/ScoreCalibrationMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/SentencePieceTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/TensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/TensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/metadata_info/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/metadata_writer/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/AssociatedFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/AssociatedFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/BertInputTensorsMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertInputTensorsMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/BertTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/CategoryTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/CategoryTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/ClassificationTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ClassificationTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/GeneralMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/GeneralMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/InputAudioTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputAudioTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/InputImageTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputImageTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/InputTextTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputTextTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/LabelFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/LabelFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/RegexTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/RegexTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/ScoreCalibrationMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/SentencePieceTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/TensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/TensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_info/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer
to: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/MetadataWriter
to: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/MetadataWriter
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/AssociatedFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/AssociatedFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/BertInputTensorsMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertInputTensorsMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/BertTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/CategoryTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/CategoryTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/ClassificationTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ClassificationTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/GeneralMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/GeneralMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/InputAudioTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputAudioTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/InputImageTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputImageTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/InputTextTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputTextTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/LabelFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/LabelFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/RegexTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/RegexTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/ScoreCalibrationMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/SentencePieceTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/TensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/TensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/metadata_info/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/metadata_writer/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/AssociatedFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/AssociatedFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/BertInputTensorsMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertInputTensorsMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/BertTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/CategoryTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/CategoryTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/ClassificationTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ClassificationTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/GeneralMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/GeneralMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/InputAudioTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputAudioTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/InputImageTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputImageTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/InputTextTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputTextTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/LabelFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/LabelFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/RegexTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/RegexTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/ScoreCalibrationMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/SentencePieceTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/TensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/TensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_info/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer
to: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/MetadataWriter
to: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/MetadataWriter
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/AssociatedFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/AssociatedFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/BertInputTensorsMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertInputTensorsMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/BertTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/CategoryTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/CategoryTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/ClassificationTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ClassificationTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/GeneralMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/GeneralMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/InputAudioTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputAudioTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/InputImageTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputImageTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/InputTextTensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputTextTensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/LabelFileMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/LabelFileMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/RegexTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/RegexTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/ScoreCalibrationMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/SentencePieceTokenizerMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/TensorMd
to: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/TensorMd
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/metadata_info/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/metadata_writer/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/writer_utils
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/writer_utils/compute_flat_size
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/writer_utils/get_input_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/writer_utils/get_input_tensor_shape
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/writer_utils/get_input_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/writer_utils/get_output_tensor_names
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/writer_utils/get_output_tensor_types
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/writer_utils/get_tokenizer_associated_files
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/writer_utils/load_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
- from: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/writer_utils/save_file
to: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
@@ -0,0 +1,644 @@
# Copyright 2026 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
toc:
- section:
- path: /lite/api_docs/python/tflite_support
title: Overview
- section:
- path: /lite/api_docs/python/tflite_support/metadata
title: Overview
- path: /lite/api_docs/python/tflite_support/metadata/MetadataDisplayer
title: MetadataDisplayer
- path: /lite/api_docs/python/tflite_support/metadata/MetadataPopulator
title: MetadataPopulator
- path: /lite/api_docs/python/tflite_support/metadata/convert_to_json
title: convert_to_json
- path: /lite/api_docs/python/tflite_support/metadata/get_metadata_buffer
title: get_metadata_buffer
- path: /lite/api_docs/python/tflite_support/metadata/get_path_to_datafile
title: get_path_to_datafile
title: metadata
- section:
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated
title: Overview
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AssociatedFile
title: AssociatedFile
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AssociatedFileAddDescription
title: AssociatedFileAddDescription
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AssociatedFileAddLocale
title: AssociatedFileAddLocale
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AssociatedFileAddName
title: AssociatedFileAddName
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AssociatedFileAddType
title: AssociatedFileAddType
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AssociatedFileAddVersion
title: AssociatedFileAddVersion
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AssociatedFileEnd
title: AssociatedFileEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AssociatedFileStart
title: AssociatedFileStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AssociatedFileT
title: AssociatedFileT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AssociatedFileType
title: AssociatedFileType
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AudioProperties
title: AudioProperties
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AudioPropertiesAddChannels
title: AudioPropertiesAddChannels
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AudioPropertiesAddSampleRate
title: AudioPropertiesAddSampleRate
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AudioPropertiesEnd
title: AudioPropertiesEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AudioPropertiesStart
title: AudioPropertiesStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/AudioPropertiesT
title: AudioPropertiesT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BertTokenizerOptions
title: BertTokenizerOptions
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BertTokenizerOptionsAddVocabFile
title: BertTokenizerOptionsAddVocabFile
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BertTokenizerOptionsEnd
title: BertTokenizerOptionsEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BertTokenizerOptionsStart
title: BertTokenizerOptionsStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BertTokenizerOptionsStartVocabFileVector
title: BertTokenizerOptionsStartVocabFileVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BertTokenizerOptionsT
title: BertTokenizerOptionsT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BoundingBoxProperties
title: BoundingBoxProperties
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesAddCoordinateType
title: BoundingBoxPropertiesAddCoordinateType
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesAddIndex
title: BoundingBoxPropertiesAddIndex
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesAddType
title: BoundingBoxPropertiesAddType
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesEnd
title: BoundingBoxPropertiesEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesStart
title: BoundingBoxPropertiesStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesStartIndexVector
title: BoundingBoxPropertiesStartIndexVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesT
title: BoundingBoxPropertiesT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/BoundingBoxType
title: BoundingBoxType
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ColorSpaceType
title: ColorSpaceType
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/Content
title: Content
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ContentAddContentProperties
title: ContentAddContentProperties
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ContentAddContentPropertiesType
title: ContentAddContentPropertiesType
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ContentAddRange
title: ContentAddRange
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ContentEnd
title: ContentEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ContentProperties
title: ContentProperties
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ContentPropertiesCreator
title: ContentPropertiesCreator
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ContentStart
title: ContentStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ContentT
title: ContentT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/CoordinateType
title: CoordinateType
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/CustomMetadata
title: CustomMetadata
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/CustomMetadataAddData
title: CustomMetadataAddData
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/CustomMetadataAddName
title: CustomMetadataAddName
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/CustomMetadataEnd
title: CustomMetadataEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/CustomMetadataStart
title: CustomMetadataStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/CustomMetadataStartDataVector
title: CustomMetadataStartDataVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/CustomMetadataT
title: CustomMetadataT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/FeatureProperties
title: FeatureProperties
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/FeaturePropertiesEnd
title: FeaturePropertiesEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/FeaturePropertiesStart
title: FeaturePropertiesStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/FeaturePropertiesT
title: FeaturePropertiesT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ImageProperties
title: ImageProperties
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ImagePropertiesAddColorSpace
title: ImagePropertiesAddColorSpace
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ImagePropertiesAddDefaultSize
title: ImagePropertiesAddDefaultSize
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ImagePropertiesEnd
title: ImagePropertiesEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ImagePropertiesStart
title: ImagePropertiesStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ImagePropertiesT
title: ImagePropertiesT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ImageSize
title: ImageSize
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ImageSizeAddHeight
title: ImageSizeAddHeight
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ImageSizeAddWidth
title: ImageSizeAddWidth
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ImageSizeEnd
title: ImageSizeEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ImageSizeStart
title: ImageSizeStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ImageSizeT
title: ImageSizeT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ModelMetadata
title: ModelMetadata
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ModelMetadataAddAssociatedFiles
title: ModelMetadataAddAssociatedFiles
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ModelMetadataAddAuthor
title: ModelMetadataAddAuthor
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ModelMetadataAddDescription
title: ModelMetadataAddDescription
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ModelMetadataAddLicense
title: ModelMetadataAddLicense
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ModelMetadataAddMinParserVersion
title: ModelMetadataAddMinParserVersion
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ModelMetadataAddName
title: ModelMetadataAddName
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ModelMetadataAddSubgraphMetadata
title: ModelMetadataAddSubgraphMetadata
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ModelMetadataAddVersion
title: ModelMetadataAddVersion
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ModelMetadataEnd
title: ModelMetadataEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ModelMetadataStart
title: ModelMetadataStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ModelMetadataStartAssociatedFilesVector
title: ModelMetadataStartAssociatedFilesVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ModelMetadataStartSubgraphMetadataVector
title: ModelMetadataStartSubgraphMetadataVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ModelMetadataT
title: ModelMetadataT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/NormalizationOptions
title: NormalizationOptions
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/NormalizationOptionsAddMean
title: NormalizationOptionsAddMean
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/NormalizationOptionsAddStd
title: NormalizationOptionsAddStd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/NormalizationOptionsEnd
title: NormalizationOptionsEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/NormalizationOptionsStart
title: NormalizationOptionsStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/NormalizationOptionsStartMeanVector
title: NormalizationOptionsStartMeanVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/NormalizationOptionsStartStdVector
title: NormalizationOptionsStartStdVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/NormalizationOptionsT
title: NormalizationOptionsT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ProcessUnit
title: ProcessUnit
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ProcessUnitAddOptions
title: ProcessUnitAddOptions
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ProcessUnitAddOptionsType
title: ProcessUnitAddOptionsType
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ProcessUnitEnd
title: ProcessUnitEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ProcessUnitOptions
title: ProcessUnitOptions
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ProcessUnitOptionsCreator
title: ProcessUnitOptionsCreator
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ProcessUnitStart
title: ProcessUnitStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ProcessUnitT
title: ProcessUnitT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/RegexTokenizerOptions
title: RegexTokenizerOptions
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsAddDelimRegexPattern
title: RegexTokenizerOptionsAddDelimRegexPattern
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsAddVocabFile
title: RegexTokenizerOptionsAddVocabFile
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsEnd
title: RegexTokenizerOptionsEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsStart
title: RegexTokenizerOptionsStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsStartVocabFileVector
title: RegexTokenizerOptionsStartVocabFileVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsT
title: RegexTokenizerOptionsT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ScoreCalibrationOptions
title: ScoreCalibrationOptions
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsAddDefaultScore
title: ScoreCalibrationOptionsAddDefaultScore
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsAddScoreTransformation
title: ScoreCalibrationOptionsAddScoreTransformation
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsEnd
title: ScoreCalibrationOptionsEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsStart
title: ScoreCalibrationOptionsStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsT
title: ScoreCalibrationOptionsT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ScoreThresholdingOptions
title: ScoreThresholdingOptions
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ScoreThresholdingOptionsAddGlobalScoreThreshold
title: ScoreThresholdingOptionsAddGlobalScoreThreshold
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ScoreThresholdingOptionsEnd
title: ScoreThresholdingOptionsEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ScoreThresholdingOptionsStart
title: ScoreThresholdingOptionsStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ScoreThresholdingOptionsT
title: ScoreThresholdingOptionsT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ScoreTransformationType
title: ScoreTransformationType
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptions
title: SentencePieceTokenizerOptions
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsAddSentencePieceModel
title: SentencePieceTokenizerOptionsAddSentencePieceModel
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsAddVocabFile
title: SentencePieceTokenizerOptionsAddVocabFile
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsEnd
title: SentencePieceTokenizerOptionsEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsStart
title: SentencePieceTokenizerOptionsStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsStartSentencePieceModelVector
title: SentencePieceTokenizerOptionsStartSentencePieceModelVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsStartVocabFileVector
title: SentencePieceTokenizerOptionsStartVocabFileVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsT
title: SentencePieceTokenizerOptionsT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/Stats
title: Stats
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/StatsAddMax
title: StatsAddMax
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/StatsAddMin
title: StatsAddMin
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/StatsEnd
title: StatsEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/StatsStart
title: StatsStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/StatsStartMaxVector
title: StatsStartMaxVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/StatsStartMinVector
title: StatsStartMinVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/StatsT
title: StatsT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadata
title: SubGraphMetadata
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataAddAssociatedFiles
title: SubGraphMetadataAddAssociatedFiles
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataAddCustomMetadata
title: SubGraphMetadataAddCustomMetadata
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataAddDescription
title: SubGraphMetadataAddDescription
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataAddInputProcessUnits
title: SubGraphMetadataAddInputProcessUnits
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataAddInputTensorGroups
title: SubGraphMetadataAddInputTensorGroups
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataAddInputTensorMetadata
title: SubGraphMetadataAddInputTensorMetadata
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataAddName
title: SubGraphMetadataAddName
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataAddOutputProcessUnits
title: SubGraphMetadataAddOutputProcessUnits
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataAddOutputTensorGroups
title: SubGraphMetadataAddOutputTensorGroups
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataAddOutputTensorMetadata
title: SubGraphMetadataAddOutputTensorMetadata
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataEnd
title: SubGraphMetadataEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataStart
title: SubGraphMetadataStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataStartAssociatedFilesVector
title: SubGraphMetadataStartAssociatedFilesVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataStartCustomMetadataVector
title: SubGraphMetadataStartCustomMetadataVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataStartInputProcessUnitsVector
title: SubGraphMetadataStartInputProcessUnitsVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataStartInputTensorGroupsVector
title: SubGraphMetadataStartInputTensorGroupsVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataStartInputTensorMetadataVector
title: SubGraphMetadataStartInputTensorMetadataVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataStartOutputProcessUnitsVector
title: SubGraphMetadataStartOutputProcessUnitsVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataStartOutputTensorGroupsVector
title: SubGraphMetadataStartOutputTensorGroupsVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataStartOutputTensorMetadataVector
title: SubGraphMetadataStartOutputTensorMetadataVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/SubGraphMetadataT
title: SubGraphMetadataT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorGroup
title: TensorGroup
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorGroupAddName
title: TensorGroupAddName
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorGroupAddTensorNames
title: TensorGroupAddTensorNames
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorGroupEnd
title: TensorGroupEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorGroupStart
title: TensorGroupStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorGroupStartTensorNamesVector
title: TensorGroupStartTensorNamesVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorGroupT
title: TensorGroupT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorMetadata
title: TensorMetadata
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorMetadataAddAssociatedFiles
title: TensorMetadataAddAssociatedFiles
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorMetadataAddContent
title: TensorMetadataAddContent
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorMetadataAddDescription
title: TensorMetadataAddDescription
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorMetadataAddDimensionNames
title: TensorMetadataAddDimensionNames
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorMetadataAddName
title: TensorMetadataAddName
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorMetadataAddProcessUnits
title: TensorMetadataAddProcessUnits
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorMetadataAddStats
title: TensorMetadataAddStats
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorMetadataEnd
title: TensorMetadataEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorMetadataStart
title: TensorMetadataStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorMetadataStartAssociatedFilesVector
title: TensorMetadataStartAssociatedFilesVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorMetadataStartDimensionNamesVector
title: TensorMetadataStartDimensionNamesVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorMetadataStartProcessUnitsVector
title: TensorMetadataStartProcessUnitsVector
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/TensorMetadataT
title: TensorMetadataT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ValueRange
title: ValueRange
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ValueRangeAddMax
title: ValueRangeAddMax
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ValueRangeAddMin
title: ValueRangeAddMin
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ValueRangeEnd
title: ValueRangeEnd
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ValueRangeStart
title: ValueRangeStart
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/ValueRangeT
title: ValueRangeT
- path: /lite/api_docs/python/tflite_support/metadata_schema_py_generated/import_numpy
title: import_numpy
title: metadata_schema_py_generated
- section:
- path: /lite/api_docs/python/tflite_support/metadata_writers
title: Overview
- section:
- path: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier
title: Overview
- path: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/MetadataWriter
title: MetadataWriter
- section:
- path: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer
title: Overview
- path: /lite/api_docs/python/tflite_support/metadata_writers/audio_classifier/metadata_writer/MetadataWriter
title: MetadataWriter
title: metadata_writer
title: audio_classifier
- section:
- path: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier
title: Overview
- path: /lite/api_docs/python/tflite_support/metadata_writers/bert_nl_classifier/MetadataWriter
title: MetadataWriter
title: bert_nl_classifier
- section:
- path: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier
title: Overview
- path: /lite/api_docs/python/tflite_support/metadata_writers/image_classifier/MetadataWriter
title: MetadataWriter
title: image_classifier
- section:
- path: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter
title: Overview
- path: /lite/api_docs/python/tflite_support/metadata_writers/image_segmenter/MetadataWriter
title: MetadataWriter
title: image_segmenter
- section:
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info
title: Overview
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/AssociatedFileMd
title: AssociatedFileMd
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertInputTensorsMd
title: BertInputTensorsMd
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/BertTokenizerMd
title: BertTokenizerMd
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/CategoryTensorMd
title: CategoryTensorMd
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ClassificationTensorMd
title: ClassificationTensorMd
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/GeneralMd
title: GeneralMd
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputAudioTensorMd
title: InputAudioTensorMd
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputImageTensorMd
title: InputImageTensorMd
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/InputTextTensorMd
title: InputTextTensorMd
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/LabelFileMd
title: LabelFileMd
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/RegexTokenizerMd
title: RegexTokenizerMd
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd
title: ScoreCalibrationMd
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd
title: SentencePieceTokenizerMd
- path: /lite/api_docs/python/tflite_support/metadata_writers/metadata_info/TensorMd
title: TensorMd
title: metadata_info
- section:
- path: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier
title: Overview
- path: /lite/api_docs/python/tflite_support/metadata_writers/nl_classifier/MetadataWriter
title: MetadataWriter
title: nl_classifier
- section:
- path: /lite/api_docs/python/tflite_support/metadata_writers/object_detector
title: Overview
- path: /lite/api_docs/python/tflite_support/metadata_writers/object_detector/MetadataWriter
title: MetadataWriter
title: object_detector
- section:
- path: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils
title: Overview
- path: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/compute_flat_size
title: compute_flat_size
- path: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_names
title: get_input_tensor_names
- path: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_shape
title: get_input_tensor_shape
- path: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_input_tensor_types
title: get_input_tensor_types
- path: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_names
title: get_output_tensor_names
- path: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_output_tensor_types
title: get_output_tensor_types
- path: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files
title: get_tokenizer_associated_files
- path: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/load_file
title: load_file
- path: /lite/api_docs/python/tflite_support/metadata_writers/writer_utils/save_file
title: save_file
title: writer_utils
title: metadata_writers
- section:
- path: /lite/api_docs/python/tflite_support/task
title: Overview
- section:
- path: /lite/api_docs/python/tflite_support/task/audio
title: Overview
- path: /lite/api_docs/python/tflite_support/task/audio/AudioClassifier
title: AudioClassifier
- path: /lite/api_docs/python/tflite_support/task/audio/AudioClassifierOptions
title: AudioClassifierOptions
- path: /lite/api_docs/python/tflite_support/task/audio/AudioEmbedder
title: AudioEmbedder
- path: /lite/api_docs/python/tflite_support/task/audio/AudioEmbedderOptions
title: AudioEmbedderOptions
- path: /lite/api_docs/python/tflite_support/task/audio/AudioFormat
title: AudioFormat
- path: /lite/api_docs/python/tflite_support/task/audio/AudioRecord
title: AudioRecord
- path: /lite/api_docs/python/tflite_support/task/audio/TensorAudio
title: TensorAudio
title: audio
- section:
- path: /lite/api_docs/python/tflite_support/task/core
title: Overview
- path: /lite/api_docs/python/tflite_support/task/core/BaseOptions
title: BaseOptions
title: core
- section:
- path: /lite/api_docs/python/tflite_support/task/processor
title: Overview
- path: /lite/api_docs/python/tflite_support/task/processor/BertCluAnnotationOptions
title: BertCluAnnotationOptions
- path: /lite/api_docs/python/tflite_support/task/processor/BoundingBox
title: BoundingBox
- path: /lite/api_docs/python/tflite_support/task/processor/CategoricalSlot
title: CategoricalSlot
- path: /lite/api_docs/python/tflite_support/task/processor/Category
title: Category
- path: /lite/api_docs/python/tflite_support/task/processor/ClassificationOptions
title: ClassificationOptions
- path: /lite/api_docs/python/tflite_support/task/processor/ClassificationResult
title: ClassificationResult
- path: /lite/api_docs/python/tflite_support/task/processor/Classifications
title: Classifications
- path: /lite/api_docs/python/tflite_support/task/processor/CluRequest
title: CluRequest
- path: /lite/api_docs/python/tflite_support/task/processor/CluResponse
title: CluResponse
- path: /lite/api_docs/python/tflite_support/task/processor/ColoredLabel
title: ColoredLabel
- path: /lite/api_docs/python/tflite_support/task/processor/ConfidenceMask
title: ConfidenceMask
- path: /lite/api_docs/python/tflite_support/task/processor/Detection
title: Detection
- path: /lite/api_docs/python/tflite_support/task/processor/DetectionOptions
title: DetectionOptions
- path: /lite/api_docs/python/tflite_support/task/processor/DetectionResult
title: DetectionResult
- path: /lite/api_docs/python/tflite_support/task/processor/Embedding
title: Embedding
- path: /lite/api_docs/python/tflite_support/task/processor/EmbeddingOptions
title: EmbeddingOptions
- path: /lite/api_docs/python/tflite_support/task/processor/EmbeddingResult
title: EmbeddingResult
- path: /lite/api_docs/python/tflite_support/task/processor/FeatureVector
title: FeatureVector
- path: /lite/api_docs/python/tflite_support/task/processor/Mention
title: Mention
- path: /lite/api_docs/python/tflite_support/task/processor/MentionedSlot
title: MentionedSlot
- path: /lite/api_docs/python/tflite_support/task/processor/NearestNeighbor
title: NearestNeighbor
- path: /lite/api_docs/python/tflite_support/task/processor/OutputType
title: OutputType
- path: /lite/api_docs/python/tflite_support/task/processor/Pos
title: Pos
- path: /lite/api_docs/python/tflite_support/task/processor/QaAnswer
title: QaAnswer
- path: /lite/api_docs/python/tflite_support/task/processor/QuestionAnswererResult
title: QuestionAnswererResult
- path: /lite/api_docs/python/tflite_support/task/processor/SearchOptions
title: SearchOptions
- path: /lite/api_docs/python/tflite_support/task/processor/SearchResult
title: SearchResult
- path: /lite/api_docs/python/tflite_support/task/processor/Segmentation
title: Segmentation
- path: /lite/api_docs/python/tflite_support/task/processor/SegmentationOptions
title: SegmentationOptions
- path: /lite/api_docs/python/tflite_support/task/processor/SegmentationResult
title: SegmentationResult
title: processor
- section:
- path: /lite/api_docs/python/tflite_support/task/text
title: Overview
- path: /lite/api_docs/python/tflite_support/task/text/BertCluAnnotator
title: BertCluAnnotator
- path: /lite/api_docs/python/tflite_support/task/text/BertCluAnnotatorOptions
title: BertCluAnnotatorOptions
- path: /lite/api_docs/python/tflite_support/task/text/BertNLClassifier
title: BertNLClassifier
- path: /lite/api_docs/python/tflite_support/task/text/BertNLClassifierOptions
title: BertNLClassifierOptions
- path: /lite/api_docs/python/tflite_support/task/text/BertQuestionAnswerer
title: BertQuestionAnswerer
- path: /lite/api_docs/python/tflite_support/task/text/BertQuestionAnswererOptions
title: BertQuestionAnswererOptions
- path: /lite/api_docs/python/tflite_support/task/text/NLClassifier
title: NLClassifier
- path: /lite/api_docs/python/tflite_support/task/text/NLClassifierOptions
title: NLClassifierOptions
- path: /lite/api_docs/python/tflite_support/task/text/TextEmbedder
title: TextEmbedder
- path: /lite/api_docs/python/tflite_support/task/text/TextEmbedderOptions
title: TextEmbedderOptions
- path: /lite/api_docs/python/tflite_support/task/text/TextSearcher
title: TextSearcher
- path: /lite/api_docs/python/tflite_support/task/text/TextSearcherOptions
title: TextSearcherOptions
title: text
- section:
- path: /lite/api_docs/python/tflite_support/task/vision
title: Overview
- path: /lite/api_docs/python/tflite_support/task/vision/ImageClassifier
title: ImageClassifier
- path: /lite/api_docs/python/tflite_support/task/vision/ImageClassifierOptions
title: ImageClassifierOptions
- path: /lite/api_docs/python/tflite_support/task/vision/ImageEmbedder
title: ImageEmbedder
- path: /lite/api_docs/python/tflite_support/task/vision/ImageEmbedderOptions
title: ImageEmbedderOptions
- path: /lite/api_docs/python/tflite_support/task/vision/ImageSearcher
title: ImageSearcher
- path: /lite/api_docs/python/tflite_support/task/vision/ImageSearcherOptions
title: ImageSearcherOptions
- path: /lite/api_docs/python/tflite_support/task/vision/ImageSegmenter
title: ImageSegmenter
- path: /lite/api_docs/python/tflite_support/task/vision/ImageSegmenterOptions
title: ImageSegmenterOptions
- path: /lite/api_docs/python/tflite_support/task/vision/ObjectDetector
title: ObjectDetector
- path: /lite/api_docs/python/tflite_support/task/vision/ObjectDetectorOptions
title: ObjectDetectorOptions
- path: /lite/api_docs/python/tflite_support/task/vision/TensorImage
title: TensorImage
title: vision
title: task
title: tflite_support
@@ -0,0 +1,747 @@
page_type: reference
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
# All symbols in TensorFlow Lite Support
<!-- Insert buttons and diff -->
## Primary symbols
* <a href="../tflite_support"><code>tflite_support</code></a>
* <a href="../tflite_support/metadata"><code>tflite_support.metadata</code></a>
* <a href="../tflite_support/metadata/MetadataDisplayer"><code>tflite_support.metadata.MetadataDisplayer</code></a>
* <a href="../tflite_support/metadata/MetadataPopulator"><code>tflite_support.metadata.MetadataPopulator</code></a>
* <a href="../tflite_support/metadata/convert_to_json"><code>tflite_support.metadata.convert_to_json</code></a>
* <a href="../tflite_support/metadata/get_metadata_buffer"><code>tflite_support.metadata.get_metadata_buffer</code></a>
* <a href="../tflite_support/metadata/get_path_to_datafile"><code>tflite_support.metadata.get_path_to_datafile</code></a>
* <a href="../tflite_support/metadata_schema_py_generated"><code>tflite_support.metadata_schema_py_generated</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AssociatedFile"><code>tflite_support.metadata_schema_py_generated.AssociatedFile</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AssociatedFileAddDescription"><code>tflite_support.metadata_schema_py_generated.AssociatedFileAddDescription</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AssociatedFileAddLocale"><code>tflite_support.metadata_schema_py_generated.AssociatedFileAddLocale</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AssociatedFileAddName"><code>tflite_support.metadata_schema_py_generated.AssociatedFileAddName</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AssociatedFileAddType"><code>tflite_support.metadata_schema_py_generated.AssociatedFileAddType</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AssociatedFileAddVersion"><code>tflite_support.metadata_schema_py_generated.AssociatedFileAddVersion</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AssociatedFileEnd"><code>tflite_support.metadata_schema_py_generated.AssociatedFileEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AssociatedFileStart"><code>tflite_support.metadata_schema_py_generated.AssociatedFileStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AssociatedFileT"><code>tflite_support.metadata_schema_py_generated.AssociatedFileT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AssociatedFileType"><code>tflite_support.metadata_schema_py_generated.AssociatedFileType</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AudioProperties"><code>tflite_support.metadata_schema_py_generated.AudioProperties</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AudioPropertiesAddChannels"><code>tflite_support.metadata_schema_py_generated.AudioPropertiesAddChannels</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AudioPropertiesAddSampleRate"><code>tflite_support.metadata_schema_py_generated.AudioPropertiesAddSampleRate</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AudioPropertiesEnd"><code>tflite_support.metadata_schema_py_generated.AudioPropertiesEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AudioPropertiesStart"><code>tflite_support.metadata_schema_py_generated.AudioPropertiesStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/AudioPropertiesT"><code>tflite_support.metadata_schema_py_generated.AudioPropertiesT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BertTokenizerOptions"><code>tflite_support.metadata_schema_py_generated.BertTokenizerOptions</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BertTokenizerOptionsAddVocabFile"><code>tflite_support.metadata_schema_py_generated.BertTokenizerOptionsAddVocabFile</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BertTokenizerOptionsEnd"><code>tflite_support.metadata_schema_py_generated.BertTokenizerOptionsEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BertTokenizerOptionsStart"><code>tflite_support.metadata_schema_py_generated.BertTokenizerOptionsStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BertTokenizerOptionsStartVocabFileVector"><code>tflite_support.metadata_schema_py_generated.BertTokenizerOptionsStartVocabFileVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BertTokenizerOptionsT"><code>tflite_support.metadata_schema_py_generated.BertTokenizerOptionsT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BoundingBoxProperties"><code>tflite_support.metadata_schema_py_generated.BoundingBoxProperties</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesAddCoordinateType"><code>tflite_support.metadata_schema_py_generated.BoundingBoxPropertiesAddCoordinateType</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesAddIndex"><code>tflite_support.metadata_schema_py_generated.BoundingBoxPropertiesAddIndex</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesAddType"><code>tflite_support.metadata_schema_py_generated.BoundingBoxPropertiesAddType</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesEnd"><code>tflite_support.metadata_schema_py_generated.BoundingBoxPropertiesEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesStart"><code>tflite_support.metadata_schema_py_generated.BoundingBoxPropertiesStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesStartIndexVector"><code>tflite_support.metadata_schema_py_generated.BoundingBoxPropertiesStartIndexVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesT"><code>tflite_support.metadata_schema_py_generated.BoundingBoxPropertiesT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/BoundingBoxType"><code>tflite_support.metadata_schema_py_generated.BoundingBoxType</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ColorSpaceType"><code>tflite_support.metadata_schema_py_generated.ColorSpaceType</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/Content"><code>tflite_support.metadata_schema_py_generated.Content</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ContentAddContentProperties"><code>tflite_support.metadata_schema_py_generated.ContentAddContentProperties</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ContentAddContentPropertiesType"><code>tflite_support.metadata_schema_py_generated.ContentAddContentPropertiesType</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ContentAddRange"><code>tflite_support.metadata_schema_py_generated.ContentAddRange</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ContentEnd"><code>tflite_support.metadata_schema_py_generated.ContentEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ContentProperties"><code>tflite_support.metadata_schema_py_generated.ContentProperties</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ContentPropertiesCreator"><code>tflite_support.metadata_schema_py_generated.ContentPropertiesCreator</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ContentStart"><code>tflite_support.metadata_schema_py_generated.ContentStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ContentT"><code>tflite_support.metadata_schema_py_generated.ContentT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/CoordinateType"><code>tflite_support.metadata_schema_py_generated.CoordinateType</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/CustomMetadata"><code>tflite_support.metadata_schema_py_generated.CustomMetadata</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/CustomMetadataAddData"><code>tflite_support.metadata_schema_py_generated.CustomMetadataAddData</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/CustomMetadataAddName"><code>tflite_support.metadata_schema_py_generated.CustomMetadataAddName</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/CustomMetadataEnd"><code>tflite_support.metadata_schema_py_generated.CustomMetadataEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/CustomMetadataStart"><code>tflite_support.metadata_schema_py_generated.CustomMetadataStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/CustomMetadataStartDataVector"><code>tflite_support.metadata_schema_py_generated.CustomMetadataStartDataVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/CustomMetadataT"><code>tflite_support.metadata_schema_py_generated.CustomMetadataT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/FeatureProperties"><code>tflite_support.metadata_schema_py_generated.FeatureProperties</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/FeaturePropertiesEnd"><code>tflite_support.metadata_schema_py_generated.FeaturePropertiesEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/FeaturePropertiesStart"><code>tflite_support.metadata_schema_py_generated.FeaturePropertiesStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/FeaturePropertiesT"><code>tflite_support.metadata_schema_py_generated.FeaturePropertiesT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ImageProperties"><code>tflite_support.metadata_schema_py_generated.ImageProperties</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ImagePropertiesAddColorSpace"><code>tflite_support.metadata_schema_py_generated.ImagePropertiesAddColorSpace</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ImagePropertiesAddDefaultSize"><code>tflite_support.metadata_schema_py_generated.ImagePropertiesAddDefaultSize</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ImagePropertiesEnd"><code>tflite_support.metadata_schema_py_generated.ImagePropertiesEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ImagePropertiesStart"><code>tflite_support.metadata_schema_py_generated.ImagePropertiesStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ImagePropertiesT"><code>tflite_support.metadata_schema_py_generated.ImagePropertiesT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ImageSize"><code>tflite_support.metadata_schema_py_generated.ImageSize</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ImageSizeAddHeight"><code>tflite_support.metadata_schema_py_generated.ImageSizeAddHeight</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ImageSizeAddWidth"><code>tflite_support.metadata_schema_py_generated.ImageSizeAddWidth</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ImageSizeEnd"><code>tflite_support.metadata_schema_py_generated.ImageSizeEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ImageSizeStart"><code>tflite_support.metadata_schema_py_generated.ImageSizeStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ImageSizeT"><code>tflite_support.metadata_schema_py_generated.ImageSizeT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ModelMetadata"><code>tflite_support.metadata_schema_py_generated.ModelMetadata</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ModelMetadataAddAssociatedFiles"><code>tflite_support.metadata_schema_py_generated.ModelMetadataAddAssociatedFiles</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ModelMetadataAddAuthor"><code>tflite_support.metadata_schema_py_generated.ModelMetadataAddAuthor</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ModelMetadataAddDescription"><code>tflite_support.metadata_schema_py_generated.ModelMetadataAddDescription</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ModelMetadataAddLicense"><code>tflite_support.metadata_schema_py_generated.ModelMetadataAddLicense</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ModelMetadataAddMinParserVersion"><code>tflite_support.metadata_schema_py_generated.ModelMetadataAddMinParserVersion</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ModelMetadataAddName"><code>tflite_support.metadata_schema_py_generated.ModelMetadataAddName</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ModelMetadataAddSubgraphMetadata"><code>tflite_support.metadata_schema_py_generated.ModelMetadataAddSubgraphMetadata</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ModelMetadataAddVersion"><code>tflite_support.metadata_schema_py_generated.ModelMetadataAddVersion</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ModelMetadataEnd"><code>tflite_support.metadata_schema_py_generated.ModelMetadataEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ModelMetadataStart"><code>tflite_support.metadata_schema_py_generated.ModelMetadataStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ModelMetadataStartAssociatedFilesVector"><code>tflite_support.metadata_schema_py_generated.ModelMetadataStartAssociatedFilesVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ModelMetadataStartSubgraphMetadataVector"><code>tflite_support.metadata_schema_py_generated.ModelMetadataStartSubgraphMetadataVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ModelMetadataT"><code>tflite_support.metadata_schema_py_generated.ModelMetadataT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/NormalizationOptions"><code>tflite_support.metadata_schema_py_generated.NormalizationOptions</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/NormalizationOptionsAddMean"><code>tflite_support.metadata_schema_py_generated.NormalizationOptionsAddMean</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/NormalizationOptionsAddStd"><code>tflite_support.metadata_schema_py_generated.NormalizationOptionsAddStd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/NormalizationOptionsEnd"><code>tflite_support.metadata_schema_py_generated.NormalizationOptionsEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/NormalizationOptionsStart"><code>tflite_support.metadata_schema_py_generated.NormalizationOptionsStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/NormalizationOptionsStartMeanVector"><code>tflite_support.metadata_schema_py_generated.NormalizationOptionsStartMeanVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/NormalizationOptionsStartStdVector"><code>tflite_support.metadata_schema_py_generated.NormalizationOptionsStartStdVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/NormalizationOptionsT"><code>tflite_support.metadata_schema_py_generated.NormalizationOptionsT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ProcessUnit"><code>tflite_support.metadata_schema_py_generated.ProcessUnit</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ProcessUnitAddOptions"><code>tflite_support.metadata_schema_py_generated.ProcessUnitAddOptions</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ProcessUnitAddOptionsType"><code>tflite_support.metadata_schema_py_generated.ProcessUnitAddOptionsType</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ProcessUnitEnd"><code>tflite_support.metadata_schema_py_generated.ProcessUnitEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ProcessUnitOptions"><code>tflite_support.metadata_schema_py_generated.ProcessUnitOptions</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ProcessUnitOptionsCreator"><code>tflite_support.metadata_schema_py_generated.ProcessUnitOptionsCreator</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ProcessUnitStart"><code>tflite_support.metadata_schema_py_generated.ProcessUnitStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ProcessUnitT"><code>tflite_support.metadata_schema_py_generated.ProcessUnitT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/RegexTokenizerOptions"><code>tflite_support.metadata_schema_py_generated.RegexTokenizerOptions</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsAddDelimRegexPattern"><code>tflite_support.metadata_schema_py_generated.RegexTokenizerOptionsAddDelimRegexPattern</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsAddVocabFile"><code>tflite_support.metadata_schema_py_generated.RegexTokenizerOptionsAddVocabFile</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsEnd"><code>tflite_support.metadata_schema_py_generated.RegexTokenizerOptionsEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsStart"><code>tflite_support.metadata_schema_py_generated.RegexTokenizerOptionsStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsStartVocabFileVector"><code>tflite_support.metadata_schema_py_generated.RegexTokenizerOptionsStartVocabFileVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsT"><code>tflite_support.metadata_schema_py_generated.RegexTokenizerOptionsT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ScoreCalibrationOptions"><code>tflite_support.metadata_schema_py_generated.ScoreCalibrationOptions</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsAddDefaultScore"><code>tflite_support.metadata_schema_py_generated.ScoreCalibrationOptionsAddDefaultScore</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsAddScoreTransformation"><code>tflite_support.metadata_schema_py_generated.ScoreCalibrationOptionsAddScoreTransformation</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsEnd"><code>tflite_support.metadata_schema_py_generated.ScoreCalibrationOptionsEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsStart"><code>tflite_support.metadata_schema_py_generated.ScoreCalibrationOptionsStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsT"><code>tflite_support.metadata_schema_py_generated.ScoreCalibrationOptionsT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ScoreThresholdingOptions"><code>tflite_support.metadata_schema_py_generated.ScoreThresholdingOptions</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ScoreThresholdingOptionsAddGlobalScoreThreshold"><code>tflite_support.metadata_schema_py_generated.ScoreThresholdingOptionsAddGlobalScoreThreshold</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ScoreThresholdingOptionsEnd"><code>tflite_support.metadata_schema_py_generated.ScoreThresholdingOptionsEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ScoreThresholdingOptionsStart"><code>tflite_support.metadata_schema_py_generated.ScoreThresholdingOptionsStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ScoreThresholdingOptionsT"><code>tflite_support.metadata_schema_py_generated.ScoreThresholdingOptionsT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ScoreTransformationType"><code>tflite_support.metadata_schema_py_generated.ScoreTransformationType</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptions"><code>tflite_support.metadata_schema_py_generated.SentencePieceTokenizerOptions</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsAddSentencePieceModel"><code>tflite_support.metadata_schema_py_generated.SentencePieceTokenizerOptionsAddSentencePieceModel</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsAddVocabFile"><code>tflite_support.metadata_schema_py_generated.SentencePieceTokenizerOptionsAddVocabFile</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsEnd"><code>tflite_support.metadata_schema_py_generated.SentencePieceTokenizerOptionsEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsStart"><code>tflite_support.metadata_schema_py_generated.SentencePieceTokenizerOptionsStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsStartSentencePieceModelVector"><code>tflite_support.metadata_schema_py_generated.SentencePieceTokenizerOptionsStartSentencePieceModelVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsStartVocabFileVector"><code>tflite_support.metadata_schema_py_generated.SentencePieceTokenizerOptionsStartVocabFileVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsT"><code>tflite_support.metadata_schema_py_generated.SentencePieceTokenizerOptionsT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/Stats"><code>tflite_support.metadata_schema_py_generated.Stats</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/StatsAddMax"><code>tflite_support.metadata_schema_py_generated.StatsAddMax</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/StatsAddMin"><code>tflite_support.metadata_schema_py_generated.StatsAddMin</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/StatsEnd"><code>tflite_support.metadata_schema_py_generated.StatsEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/StatsStart"><code>tflite_support.metadata_schema_py_generated.StatsStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/StatsStartMaxVector"><code>tflite_support.metadata_schema_py_generated.StatsStartMaxVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/StatsStartMinVector"><code>tflite_support.metadata_schema_py_generated.StatsStartMinVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/StatsT"><code>tflite_support.metadata_schema_py_generated.StatsT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadata"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadata</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddAssociatedFiles"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataAddAssociatedFiles</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddCustomMetadata"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataAddCustomMetadata</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddDescription"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataAddDescription</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddInputProcessUnits"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataAddInputProcessUnits</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddInputTensorGroups"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataAddInputTensorGroups</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddInputTensorMetadata"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataAddInputTensorMetadata</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddName"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataAddName</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddOutputProcessUnits"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataAddOutputProcessUnits</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddOutputTensorGroups"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataAddOutputTensorGroups</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddOutputTensorMetadata"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataAddOutputTensorMetadata</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataEnd"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataStart"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartAssociatedFilesVector"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataStartAssociatedFilesVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartCustomMetadataVector"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataStartCustomMetadataVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartInputProcessUnitsVector"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataStartInputProcessUnitsVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartInputTensorGroupsVector"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataStartInputTensorGroupsVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartInputTensorMetadataVector"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataStartInputTensorMetadataVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartOutputProcessUnitsVector"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataStartOutputProcessUnitsVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartOutputTensorGroupsVector"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataStartOutputTensorGroupsVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartOutputTensorMetadataVector"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataStartOutputTensorMetadataVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/SubGraphMetadataT"><code>tflite_support.metadata_schema_py_generated.SubGraphMetadataT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorGroup"><code>tflite_support.metadata_schema_py_generated.TensorGroup</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorGroupAddName"><code>tflite_support.metadata_schema_py_generated.TensorGroupAddName</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorGroupAddTensorNames"><code>tflite_support.metadata_schema_py_generated.TensorGroupAddTensorNames</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorGroupEnd"><code>tflite_support.metadata_schema_py_generated.TensorGroupEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorGroupStart"><code>tflite_support.metadata_schema_py_generated.TensorGroupStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorGroupStartTensorNamesVector"><code>tflite_support.metadata_schema_py_generated.TensorGroupStartTensorNamesVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorGroupT"><code>tflite_support.metadata_schema_py_generated.TensorGroupT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorMetadata"><code>tflite_support.metadata_schema_py_generated.TensorMetadata</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorMetadataAddAssociatedFiles"><code>tflite_support.metadata_schema_py_generated.TensorMetadataAddAssociatedFiles</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorMetadataAddContent"><code>tflite_support.metadata_schema_py_generated.TensorMetadataAddContent</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorMetadataAddDescription"><code>tflite_support.metadata_schema_py_generated.TensorMetadataAddDescription</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorMetadataAddDimensionNames"><code>tflite_support.metadata_schema_py_generated.TensorMetadataAddDimensionNames</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorMetadataAddName"><code>tflite_support.metadata_schema_py_generated.TensorMetadataAddName</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorMetadataAddProcessUnits"><code>tflite_support.metadata_schema_py_generated.TensorMetadataAddProcessUnits</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorMetadataAddStats"><code>tflite_support.metadata_schema_py_generated.TensorMetadataAddStats</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorMetadataEnd"><code>tflite_support.metadata_schema_py_generated.TensorMetadataEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorMetadataStart"><code>tflite_support.metadata_schema_py_generated.TensorMetadataStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorMetadataStartAssociatedFilesVector"><code>tflite_support.metadata_schema_py_generated.TensorMetadataStartAssociatedFilesVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorMetadataStartDimensionNamesVector"><code>tflite_support.metadata_schema_py_generated.TensorMetadataStartDimensionNamesVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorMetadataStartProcessUnitsVector"><code>tflite_support.metadata_schema_py_generated.TensorMetadataStartProcessUnitsVector</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/TensorMetadataT"><code>tflite_support.metadata_schema_py_generated.TensorMetadataT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ValueRange"><code>tflite_support.metadata_schema_py_generated.ValueRange</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ValueRangeAddMax"><code>tflite_support.metadata_schema_py_generated.ValueRangeAddMax</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ValueRangeAddMin"><code>tflite_support.metadata_schema_py_generated.ValueRangeAddMin</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ValueRangeEnd"><code>tflite_support.metadata_schema_py_generated.ValueRangeEnd</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ValueRangeStart"><code>tflite_support.metadata_schema_py_generated.ValueRangeStart</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/ValueRangeT"><code>tflite_support.metadata_schema_py_generated.ValueRangeT</code></a>
* <a href="../tflite_support/metadata_schema_py_generated/import_numpy"><code>tflite_support.metadata_schema_py_generated.import_numpy</code></a>
* <a href="../tflite_support/metadata_writers"><code>tflite_support.metadata_writers</code></a>
* <a href="../tflite_support/metadata_writers/audio_classifier"><code>tflite_support.metadata_writers.audio_classifier</code></a>
* <a href="../tflite_support/metadata_writers/audio_classifier/MetadataWriter"><code>tflite_support.metadata_writers.audio_classifier.MetadataWriter</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info"><code>tflite_support.metadata_writers.audio_classifier.metadata_info</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/AssociatedFileMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.AssociatedFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertInputTensorsMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.BertInputTensorsMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertTokenizerMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.BertTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/CategoryTensorMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.CategoryTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ClassificationTensorMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.ClassificationTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/GeneralMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.GeneralMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputAudioTensorMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.InputAudioTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputImageTensorMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.InputImageTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputTextTensorMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.InputTextTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/LabelFileMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.LabelFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/RegexTokenizerMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.RegexTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.ScoreCalibrationMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.SentencePieceTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/TensorMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.TensorMd</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.audio_classifier.metadata_info.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/audio_classifier/metadata_writer"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer</code></a>
* <a href="../tflite_support/metadata_writers/audio_classifier/metadata_writer/MetadataWriter"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.MetadataWriter</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/AssociatedFileMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.AssociatedFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertInputTensorsMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.BertInputTensorsMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertTokenizerMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.BertTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/CategoryTensorMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.CategoryTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ClassificationTensorMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.ClassificationTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/GeneralMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.GeneralMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputAudioTensorMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.InputAudioTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputImageTensorMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.InputImageTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputTextTensorMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.InputTextTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/LabelFileMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.LabelFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/RegexTokenizerMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.RegexTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.ScoreCalibrationMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.SentencePieceTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/TensorMd"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.TensorMd</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.metadata_info.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.audio_classifier.metadata_writer.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.audio_classifier.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.audio_classifier.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.audio_classifier.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.audio_classifier.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.audio_classifier.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.audio_classifier.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.audio_classifier.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.audio_classifier.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.audio_classifier.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.audio_classifier.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/bert_nl_classifier"><code>tflite_support.metadata_writers.bert_nl_classifier</code></a>
* <a href="../tflite_support/metadata_writers/bert_nl_classifier/MetadataWriter"><code>tflite_support.metadata_writers.bert_nl_classifier.MetadataWriter</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/AssociatedFileMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.AssociatedFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertInputTensorsMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.BertInputTensorsMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertTokenizerMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.BertTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/CategoryTensorMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.CategoryTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ClassificationTensorMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.ClassificationTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/GeneralMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.GeneralMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputAudioTensorMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.InputAudioTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputImageTensorMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.InputImageTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputTextTensorMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.InputTextTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/LabelFileMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.LabelFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/RegexTokenizerMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.RegexTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.ScoreCalibrationMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.SentencePieceTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/TensorMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.TensorMd</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_info.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/audio_classifier/metadata_writer"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer</code></a>
* <a href="../tflite_support/metadata_writers/audio_classifier/metadata_writer/MetadataWriter"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.MetadataWriter</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/AssociatedFileMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.AssociatedFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertInputTensorsMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.BertInputTensorsMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertTokenizerMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.BertTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/CategoryTensorMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.CategoryTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ClassificationTensorMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.ClassificationTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/GeneralMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.GeneralMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputAudioTensorMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.InputAudioTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputImageTensorMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.InputImageTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputTextTensorMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.InputTextTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/LabelFileMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.LabelFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/RegexTokenizerMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.RegexTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.ScoreCalibrationMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.SentencePieceTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/TensorMd"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.TensorMd</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.metadata_info.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.bert_nl_classifier.metadata_writer.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.bert_nl_classifier.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.bert_nl_classifier.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.bert_nl_classifier.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.bert_nl_classifier.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.bert_nl_classifier.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.bert_nl_classifier.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.bert_nl_classifier.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.bert_nl_classifier.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.bert_nl_classifier.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.bert_nl_classifier.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/image_classifier"><code>tflite_support.metadata_writers.image_classifier</code></a>
* <a href="../tflite_support/metadata_writers/image_classifier/MetadataWriter"><code>tflite_support.metadata_writers.image_classifier.MetadataWriter</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info"><code>tflite_support.metadata_writers.image_classifier.metadata_info</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/AssociatedFileMd"><code>tflite_support.metadata_writers.image_classifier.metadata_info.AssociatedFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertInputTensorsMd"><code>tflite_support.metadata_writers.image_classifier.metadata_info.BertInputTensorsMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertTokenizerMd"><code>tflite_support.metadata_writers.image_classifier.metadata_info.BertTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/CategoryTensorMd"><code>tflite_support.metadata_writers.image_classifier.metadata_info.CategoryTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ClassificationTensorMd"><code>tflite_support.metadata_writers.image_classifier.metadata_info.ClassificationTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/GeneralMd"><code>tflite_support.metadata_writers.image_classifier.metadata_info.GeneralMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputAudioTensorMd"><code>tflite_support.metadata_writers.image_classifier.metadata_info.InputAudioTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputImageTensorMd"><code>tflite_support.metadata_writers.image_classifier.metadata_info.InputImageTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputTextTensorMd"><code>tflite_support.metadata_writers.image_classifier.metadata_info.InputTextTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/LabelFileMd"><code>tflite_support.metadata_writers.image_classifier.metadata_info.LabelFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/RegexTokenizerMd"><code>tflite_support.metadata_writers.image_classifier.metadata_info.RegexTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd"><code>tflite_support.metadata_writers.image_classifier.metadata_info.ScoreCalibrationMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd"><code>tflite_support.metadata_writers.image_classifier.metadata_info.SentencePieceTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/TensorMd"><code>tflite_support.metadata_writers.image_classifier.metadata_info.TensorMd</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.image_classifier.metadata_info.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.image_classifier.metadata_info.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.image_classifier.metadata_info.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.image_classifier.metadata_info.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.image_classifier.metadata_info.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.image_classifier.metadata_info.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.image_classifier.metadata_info.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.image_classifier.metadata_info.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.image_classifier.metadata_info.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.image_classifier.metadata_info.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/audio_classifier/metadata_writer"><code>tflite_support.metadata_writers.image_classifier.metadata_writer</code></a>
* <a href="../tflite_support/metadata_writers/audio_classifier/metadata_writer/MetadataWriter"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.MetadataWriter</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/AssociatedFileMd"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.AssociatedFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertInputTensorsMd"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.BertInputTensorsMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertTokenizerMd"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.BertTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/CategoryTensorMd"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.CategoryTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ClassificationTensorMd"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.ClassificationTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/GeneralMd"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.GeneralMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputAudioTensorMd"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.InputAudioTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputImageTensorMd"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.InputImageTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputTextTensorMd"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.InputTextTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/LabelFileMd"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.LabelFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/RegexTokenizerMd"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.RegexTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.ScoreCalibrationMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.SentencePieceTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/TensorMd"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.TensorMd</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.metadata_info.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.image_classifier.metadata_writer.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.image_classifier.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.image_classifier.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.image_classifier.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.image_classifier.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.image_classifier.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.image_classifier.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.image_classifier.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.image_classifier.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.image_classifier.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.image_classifier.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/image_segmenter"><code>tflite_support.metadata_writers.image_segmenter</code></a>
* <a href="../tflite_support/metadata_writers/image_segmenter/MetadataWriter"><code>tflite_support.metadata_writers.image_segmenter.MetadataWriter</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info"><code>tflite_support.metadata_writers.image_segmenter.metadata_info</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/AssociatedFileMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.AssociatedFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertInputTensorsMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.BertInputTensorsMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertTokenizerMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.BertTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/CategoryTensorMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.CategoryTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ClassificationTensorMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.ClassificationTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/GeneralMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.GeneralMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputAudioTensorMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.InputAudioTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputImageTensorMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.InputImageTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputTextTensorMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.InputTextTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/LabelFileMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.LabelFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/RegexTokenizerMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.RegexTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.ScoreCalibrationMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.SentencePieceTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/TensorMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.TensorMd</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.image_segmenter.metadata_info.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/audio_classifier/metadata_writer"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer</code></a>
* <a href="../tflite_support/metadata_writers/audio_classifier/metadata_writer/MetadataWriter"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.MetadataWriter</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/AssociatedFileMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.AssociatedFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertInputTensorsMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.BertInputTensorsMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertTokenizerMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.BertTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/CategoryTensorMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.CategoryTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ClassificationTensorMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.ClassificationTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/GeneralMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.GeneralMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputAudioTensorMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.InputAudioTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputImageTensorMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.InputImageTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputTextTensorMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.InputTextTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/LabelFileMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.LabelFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/RegexTokenizerMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.RegexTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.ScoreCalibrationMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.SentencePieceTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/TensorMd"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.TensorMd</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.metadata_info.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.image_segmenter.metadata_writer.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.image_segmenter.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.image_segmenter.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.image_segmenter.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.image_segmenter.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.image_segmenter.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.image_segmenter.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.image_segmenter.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.image_segmenter.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.image_segmenter.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.image_segmenter.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info"><code>tflite_support.metadata_writers.metadata_info</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/AssociatedFileMd"><code>tflite_support.metadata_writers.metadata_info.AssociatedFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertInputTensorsMd"><code>tflite_support.metadata_writers.metadata_info.BertInputTensorsMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertTokenizerMd"><code>tflite_support.metadata_writers.metadata_info.BertTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/CategoryTensorMd"><code>tflite_support.metadata_writers.metadata_info.CategoryTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ClassificationTensorMd"><code>tflite_support.metadata_writers.metadata_info.ClassificationTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/GeneralMd"><code>tflite_support.metadata_writers.metadata_info.GeneralMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputAudioTensorMd"><code>tflite_support.metadata_writers.metadata_info.InputAudioTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputImageTensorMd"><code>tflite_support.metadata_writers.metadata_info.InputImageTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputTextTensorMd"><code>tflite_support.metadata_writers.metadata_info.InputTextTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/LabelFileMd"><code>tflite_support.metadata_writers.metadata_info.LabelFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/RegexTokenizerMd"><code>tflite_support.metadata_writers.metadata_info.RegexTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd"><code>tflite_support.metadata_writers.metadata_info.ScoreCalibrationMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd"><code>tflite_support.metadata_writers.metadata_info.SentencePieceTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/TensorMd"><code>tflite_support.metadata_writers.metadata_info.TensorMd</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.metadata_info.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.metadata_info.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.metadata_info.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.metadata_info.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.metadata_info.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.metadata_info.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.metadata_info.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.metadata_info.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.metadata_info.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.metadata_info.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/nl_classifier"><code>tflite_support.metadata_writers.nl_classifier</code></a>
* <a href="../tflite_support/metadata_writers/nl_classifier/MetadataWriter"><code>tflite_support.metadata_writers.nl_classifier.MetadataWriter</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info"><code>tflite_support.metadata_writers.nl_classifier.metadata_info</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/AssociatedFileMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.AssociatedFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertInputTensorsMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.BertInputTensorsMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertTokenizerMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.BertTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/CategoryTensorMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.CategoryTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ClassificationTensorMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.ClassificationTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/GeneralMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.GeneralMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputAudioTensorMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.InputAudioTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputImageTensorMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.InputImageTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputTextTensorMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.InputTextTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/LabelFileMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.LabelFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/RegexTokenizerMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.RegexTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.ScoreCalibrationMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.SentencePieceTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/TensorMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.TensorMd</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.nl_classifier.metadata_info.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/audio_classifier/metadata_writer"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer</code></a>
* <a href="../tflite_support/metadata_writers/audio_classifier/metadata_writer/MetadataWriter"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.MetadataWriter</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/AssociatedFileMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.AssociatedFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertInputTensorsMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.BertInputTensorsMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertTokenizerMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.BertTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/CategoryTensorMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.CategoryTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ClassificationTensorMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.ClassificationTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/GeneralMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.GeneralMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputAudioTensorMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.InputAudioTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputImageTensorMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.InputImageTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputTextTensorMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.InputTextTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/LabelFileMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.LabelFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/RegexTokenizerMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.RegexTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.ScoreCalibrationMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.SentencePieceTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/TensorMd"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.TensorMd</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.metadata_info.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.nl_classifier.metadata_writer.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.nl_classifier.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.nl_classifier.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.nl_classifier.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.nl_classifier.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.nl_classifier.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.nl_classifier.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.nl_classifier.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.nl_classifier.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.nl_classifier.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.nl_classifier.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/object_detector"><code>tflite_support.metadata_writers.object_detector</code></a>
* <a href="../tflite_support/metadata_writers/object_detector/MetadataWriter"><code>tflite_support.metadata_writers.object_detector.MetadataWriter</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info"><code>tflite_support.metadata_writers.object_detector.metadata_info</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/AssociatedFileMd"><code>tflite_support.metadata_writers.object_detector.metadata_info.AssociatedFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertInputTensorsMd"><code>tflite_support.metadata_writers.object_detector.metadata_info.BertInputTensorsMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertTokenizerMd"><code>tflite_support.metadata_writers.object_detector.metadata_info.BertTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/CategoryTensorMd"><code>tflite_support.metadata_writers.object_detector.metadata_info.CategoryTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ClassificationTensorMd"><code>tflite_support.metadata_writers.object_detector.metadata_info.ClassificationTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/GeneralMd"><code>tflite_support.metadata_writers.object_detector.metadata_info.GeneralMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputAudioTensorMd"><code>tflite_support.metadata_writers.object_detector.metadata_info.InputAudioTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputImageTensorMd"><code>tflite_support.metadata_writers.object_detector.metadata_info.InputImageTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputTextTensorMd"><code>tflite_support.metadata_writers.object_detector.metadata_info.InputTextTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/LabelFileMd"><code>tflite_support.metadata_writers.object_detector.metadata_info.LabelFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/RegexTokenizerMd"><code>tflite_support.metadata_writers.object_detector.metadata_info.RegexTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd"><code>tflite_support.metadata_writers.object_detector.metadata_info.ScoreCalibrationMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd"><code>tflite_support.metadata_writers.object_detector.metadata_info.SentencePieceTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/TensorMd"><code>tflite_support.metadata_writers.object_detector.metadata_info.TensorMd</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.object_detector.metadata_info.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.object_detector.metadata_info.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.object_detector.metadata_info.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.object_detector.metadata_info.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.object_detector.metadata_info.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.object_detector.metadata_info.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.object_detector.metadata_info.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.object_detector.metadata_info.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.object_detector.metadata_info.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.object_detector.metadata_info.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/audio_classifier/metadata_writer"><code>tflite_support.metadata_writers.object_detector.metadata_writer</code></a>
* <a href="../tflite_support/metadata_writers/audio_classifier/metadata_writer/MetadataWriter"><code>tflite_support.metadata_writers.object_detector.metadata_writer.MetadataWriter</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/AssociatedFileMd"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.AssociatedFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertInputTensorsMd"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.BertInputTensorsMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/BertTokenizerMd"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.BertTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/CategoryTensorMd"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.CategoryTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ClassificationTensorMd"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.ClassificationTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/GeneralMd"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.GeneralMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputAudioTensorMd"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.InputAudioTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputImageTensorMd"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.InputImageTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/InputTextTensorMd"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.InputTextTensorMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/LabelFileMd"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.LabelFileMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/RegexTokenizerMd"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.RegexTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/ScoreCalibrationMd"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.ScoreCalibrationMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/SentencePieceTokenizerMd"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.SentencePieceTokenizerMd</code></a>
* <a href="../tflite_support/metadata_writers/metadata_info/TensorMd"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.TensorMd</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.object_detector.metadata_writer.metadata_info.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.object_detector.metadata_writer.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.object_detector.metadata_writer.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.object_detector.metadata_writer.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.object_detector.metadata_writer.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.object_detector.metadata_writer.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.object_detector.metadata_writer.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.object_detector.metadata_writer.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.object_detector.metadata_writer.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.object_detector.metadata_writer.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.object_detector.metadata_writer.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.object_detector.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.object_detector.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.object_detector.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.object_detector.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.object_detector.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.object_detector.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.object_detector.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.object_detector.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.object_detector.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.object_detector.writer_utils.save_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils"><code>tflite_support.metadata_writers.writer_utils</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/compute_flat_size"><code>tflite_support.metadata_writers.writer_utils.compute_flat_size</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_names"><code>tflite_support.metadata_writers.writer_utils.get_input_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_shape"><code>tflite_support.metadata_writers.writer_utils.get_input_tensor_shape</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_input_tensor_types"><code>tflite_support.metadata_writers.writer_utils.get_input_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_names"><code>tflite_support.metadata_writers.writer_utils.get_output_tensor_names</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_output_tensor_types"><code>tflite_support.metadata_writers.writer_utils.get_output_tensor_types</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/get_tokenizer_associated_files"><code>tflite_support.metadata_writers.writer_utils.get_tokenizer_associated_files</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/load_file"><code>tflite_support.metadata_writers.writer_utils.load_file</code></a>
* <a href="../tflite_support/metadata_writers/writer_utils/save_file"><code>tflite_support.metadata_writers.writer_utils.save_file</code></a>
* <a href="../tflite_support/task"><code>tflite_support.task</code></a>
* <a href="../tflite_support/task/audio"><code>tflite_support.task.audio</code></a>
* <a href="../tflite_support/task/audio/AudioClassifier"><code>tflite_support.task.audio.AudioClassifier</code></a>
* <a href="../tflite_support/task/audio/AudioClassifierOptions"><code>tflite_support.task.audio.AudioClassifierOptions</code></a>
* <a href="../tflite_support/task/audio/AudioEmbedder"><code>tflite_support.task.audio.AudioEmbedder</code></a>
* <a href="../tflite_support/task/audio/AudioEmbedderOptions"><code>tflite_support.task.audio.AudioEmbedderOptions</code></a>
* <a href="../tflite_support/task/audio/AudioFormat"><code>tflite_support.task.audio.AudioFormat</code></a>
* <a href="../tflite_support/task/audio/AudioRecord"><code>tflite_support.task.audio.AudioRecord</code></a>
* <a href="../tflite_support/task/audio/TensorAudio"><code>tflite_support.task.audio.TensorAudio</code></a>
* <a href="../tflite_support/task/core"><code>tflite_support.task.core</code></a>
* <a href="../tflite_support/task/core/BaseOptions"><code>tflite_support.task.core.BaseOptions</code></a>
* <a href="../tflite_support/task/processor"><code>tflite_support.task.processor</code></a>
* <a href="../tflite_support/task/processor/BertCluAnnotationOptions"><code>tflite_support.task.processor.BertCluAnnotationOptions</code></a>
* <a href="../tflite_support/task/processor/BoundingBox"><code>tflite_support.task.processor.BoundingBox</code></a>
* <a href="../tflite_support/task/processor/CategoricalSlot"><code>tflite_support.task.processor.CategoricalSlot</code></a>
* <a href="../tflite_support/task/processor/Category"><code>tflite_support.task.processor.Category</code></a>
* <a href="../tflite_support/task/processor/ClassificationOptions"><code>tflite_support.task.processor.ClassificationOptions</code></a>
* <a href="../tflite_support/task/processor/ClassificationResult"><code>tflite_support.task.processor.ClassificationResult</code></a>
* <a href="../tflite_support/task/processor/Classifications"><code>tflite_support.task.processor.Classifications</code></a>
* <a href="../tflite_support/task/processor/CluRequest"><code>tflite_support.task.processor.CluRequest</code></a>
* <a href="../tflite_support/task/processor/CluResponse"><code>tflite_support.task.processor.CluResponse</code></a>
* <a href="../tflite_support/task/processor/ColoredLabel"><code>tflite_support.task.processor.ColoredLabel</code></a>
* <a href="../tflite_support/task/processor/ConfidenceMask"><code>tflite_support.task.processor.ConfidenceMask</code></a>
* <a href="../tflite_support/task/processor/Detection"><code>tflite_support.task.processor.Detection</code></a>
* <a href="../tflite_support/task/processor/DetectionOptions"><code>tflite_support.task.processor.DetectionOptions</code></a>
* <a href="../tflite_support/task/processor/DetectionResult"><code>tflite_support.task.processor.DetectionResult</code></a>
* <a href="../tflite_support/task/processor/Embedding"><code>tflite_support.task.processor.Embedding</code></a>
* <a href="../tflite_support/task/processor/EmbeddingOptions"><code>tflite_support.task.processor.EmbeddingOptions</code></a>
* <a href="../tflite_support/task/processor/EmbeddingResult"><code>tflite_support.task.processor.EmbeddingResult</code></a>
* <a href="../tflite_support/task/processor/FeatureVector"><code>tflite_support.task.processor.FeatureVector</code></a>
* <a href="../tflite_support/task/processor/Mention"><code>tflite_support.task.processor.Mention</code></a>
* <a href="../tflite_support/task/processor/MentionedSlot"><code>tflite_support.task.processor.MentionedSlot</code></a>
* <a href="../tflite_support/task/processor/NearestNeighbor"><code>tflite_support.task.processor.NearestNeighbor</code></a>
* <a href="../tflite_support/task/processor/OutputType"><code>tflite_support.task.processor.OutputType</code></a>
* <a href="../tflite_support/task/processor/Pos"><code>tflite_support.task.processor.Pos</code></a>
* <a href="../tflite_support/task/processor/QaAnswer"><code>tflite_support.task.processor.QaAnswer</code></a>
* <a href="../tflite_support/task/processor/QuestionAnswererResult"><code>tflite_support.task.processor.QuestionAnswererResult</code></a>
* <a href="../tflite_support/task/processor/SearchOptions"><code>tflite_support.task.processor.SearchOptions</code></a>
* <a href="../tflite_support/task/processor/SearchResult"><code>tflite_support.task.processor.SearchResult</code></a>
* <a href="../tflite_support/task/processor/Segmentation"><code>tflite_support.task.processor.Segmentation</code></a>
* <a href="../tflite_support/task/processor/SegmentationOptions"><code>tflite_support.task.processor.SegmentationOptions</code></a>
* <a href="../tflite_support/task/processor/SegmentationResult"><code>tflite_support.task.processor.SegmentationResult</code></a>
* <a href="../tflite_support/task/text"><code>tflite_support.task.text</code></a>
* <a href="../tflite_support/task/text/BertCluAnnotator"><code>tflite_support.task.text.BertCluAnnotator</code></a>
* <a href="../tflite_support/task/text/BertCluAnnotatorOptions"><code>tflite_support.task.text.BertCluAnnotatorOptions</code></a>
* <a href="../tflite_support/task/text/BertNLClassifier"><code>tflite_support.task.text.BertNLClassifier</code></a>
* <a href="../tflite_support/task/text/BertNLClassifierOptions"><code>tflite_support.task.text.BertNLClassifierOptions</code></a>
* <a href="../tflite_support/task/text/BertQuestionAnswerer"><code>tflite_support.task.text.BertQuestionAnswerer</code></a>
* <a href="../tflite_support/task/text/BertQuestionAnswererOptions"><code>tflite_support.task.text.BertQuestionAnswererOptions</code></a>
* <a href="../tflite_support/task/text/NLClassifier"><code>tflite_support.task.text.NLClassifier</code></a>
* <a href="../tflite_support/task/text/NLClassifierOptions"><code>tflite_support.task.text.NLClassifierOptions</code></a>
* <a href="../tflite_support/task/text/TextEmbedder"><code>tflite_support.task.text.TextEmbedder</code></a>
* <a href="../tflite_support/task/text/TextEmbedderOptions"><code>tflite_support.task.text.TextEmbedderOptions</code></a>
* <a href="../tflite_support/task/text/TextSearcher"><code>tflite_support.task.text.TextSearcher</code></a>
* <a href="../tflite_support/task/text/TextSearcherOptions"><code>tflite_support.task.text.TextSearcherOptions</code></a>
* <a href="../tflite_support/task/vision"><code>tflite_support.task.vision</code></a>
* <a href="../tflite_support/task/vision/ImageClassifier"><code>tflite_support.task.vision.ImageClassifier</code></a>
* <a href="../tflite_support/task/vision/ImageClassifierOptions"><code>tflite_support.task.vision.ImageClassifierOptions</code></a>
* <a href="../tflite_support/task/vision/ImageEmbedder"><code>tflite_support.task.vision.ImageEmbedder</code></a>
* <a href="../tflite_support/task/vision/ImageEmbedderOptions"><code>tflite_support.task.vision.ImageEmbedderOptions</code></a>
* <a href="../tflite_support/task/vision/ImageSearcher"><code>tflite_support.task.vision.ImageSearcher</code></a>
* <a href="../tflite_support/task/vision/ImageSearcherOptions"><code>tflite_support.task.vision.ImageSearcherOptions</code></a>
* <a href="../tflite_support/task/vision/ImageSegmenter"><code>tflite_support.task.vision.ImageSegmenter</code></a>
* <a href="../tflite_support/task/vision/ImageSegmenterOptions"><code>tflite_support.task.vision.ImageSegmenterOptions</code></a>
* <a href="../tflite_support/task/vision/ObjectDetector"><code>tflite_support.task.vision.ObjectDetector</code></a>
* <a href="../tflite_support/task/vision/ObjectDetectorOptions"><code>tflite_support.task.vision.ObjectDetectorOptions</code></a>
* <a href="../tflite_support/task/vision/TensorImage"><code>tflite_support.task.vision.TensorImage</code></a>
@@ -0,0 +1,45 @@
page_type: reference
description: TensorFlow Lite metadata tools.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_support.metadata" />
<meta itemprop="path" content="Stable" />
</div>
# Module: tflite_support.metadata
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
TensorFlow Lite metadata tools.
## Classes
[`class MetadataDisplayer`](../tflite_support/metadata/MetadataDisplayer): Displays metadata and associated file info in human-readable format.
[`class MetadataPopulator`](../tflite_support/metadata/MetadataPopulator): Packs metadata and associated files into TensorFlow Lite model file.
## Functions
[`convert_to_json(...)`](../tflite_support/metadata/convert_to_json): Converts the metadata into a json string.
[`get_metadata_buffer(...)`](../tflite_support/metadata/get_metadata_buffer): Returns the metadata in the model file as a buffer.
[`get_path_to_datafile(...)`](../tflite_support/metadata/get_path_to_datafile): Gets the path to the specified file in the data dependencies.
@@ -0,0 +1,300 @@
page_type: reference
description: Displays metadata and associated file info in human-readable format.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_support.metadata.MetadataDisplayer" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="get_associated_file_buffer"/>
<meta itemprop="property" content="get_metadata_buffer"/>
<meta itemprop="property" content="get_metadata_json"/>
<meta itemprop="property" content="get_packed_associated_file_list"/>
<meta itemprop="property" content="with_model_buffer"/>
<meta itemprop="property" content="with_model_file"/>
</div>
# tflite_support.metadata.MetadataDisplayer
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L686-L789">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Displays metadata and associated file info in human-readable format.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_support.metadata.MetadataDisplayer(
model_buffer, metadata_buffer, associated_file_list
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_buffer`<a id="model_buffer"></a>
</td>
<td>
valid buffer of the model file.
</td>
</tr><tr>
<td>
`metadata_buffer`<a id="metadata_buffer"></a>
</td>
<td>
valid buffer of the metadata file.
</td>
</tr><tr>
<td>
`associated_file_list`<a id="associated_file_list"></a>
</td>
<td>
list of associate files in the model file.
</td>
</tr>
</table>
## Methods
<h3 id="get_associated_file_buffer"><code>get_associated_file_buffer</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L739-L756">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_associated_file_buffer(
filename
)
</code></pre>
Get the specified associated file content in bytearray.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`filename`
</td>
<td>
name of the file to be extracted.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
The file content in bytearray.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr>
<td>
`ValueError`
</td>
<td>
if the file does not exist in the model.
</td>
</tr>
</table>
<h3 id="get_metadata_buffer"><code>get_metadata_buffer</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L758-L760">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_metadata_buffer()
</code></pre>
Get the metadata buffer in bytearray out from the model.
<h3 id="get_metadata_json"><code>get_metadata_json</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L762-L764">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_metadata_json()
</code></pre>
Converts the metadata into a json string.
<h3 id="get_packed_associated_file_list"><code>get_packed_associated_file_list</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L766-L772">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_packed_associated_file_list()
</code></pre>
Returns a list of associated files that are packed in the model.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A name list of associated files.
</td>
</tr>
</table>
<h3 id="with_model_buffer"><code>with_model_buffer</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L721-L737">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>with_model_buffer(
model_buffer
)
</code></pre>
Creates a MetadataDisplayer object for a file buffer.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`model_buffer`
</td>
<td>
TensorFlow Lite model buffer in bytearray.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
MetadataDisplayer object.
</td>
</tr>
</table>
<h3 id="with_model_file"><code>with_model_file</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L703-L719">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>with_model_file(
model_file
)
</code></pre>
Creates a MetadataDisplayer object for the model file.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`model_file`
</td>
<td>
valid path to a TensorFlow Lite model file.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
MetadataDisplayer object.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr>
<td>
`IOError`
</td>
<td>
File not found.
</td>
</tr><tr>
<td>
`ValueError`
</td>
<td>
The model does not have metadata.
</td>
</tr>
</table>
@@ -0,0 +1,673 @@
page_type: reference
description: Packs metadata and associated files into TensorFlow Lite model file.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_support.metadata.MetadataPopulator" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="__init__"/>
<meta itemprop="property" content="get_model_buffer"/>
<meta itemprop="property" content="get_packed_associated_file_list"/>
<meta itemprop="property" content="get_recorded_associated_file_list"/>
<meta itemprop="property" content="load_associated_file_buffers"/>
<meta itemprop="property" content="load_associated_files"/>
<meta itemprop="property" content="load_metadata_and_associated_files"/>
<meta itemprop="property" content="load_metadata_buffer"/>
<meta itemprop="property" content="load_metadata_file"/>
<meta itemprop="property" content="populate"/>
<meta itemprop="property" content="with_model_buffer"/>
<meta itemprop="property" content="with_model_file"/>
<meta itemprop="property" content="METADATA_FIELD_NAME"/>
<meta itemprop="property" content="METADATA_FILE_IDENTIFIER"/>
<meta itemprop="property" content="TFLITE_FILE_IDENTIFIER"/>
</div>
# tflite_support.metadata.MetadataPopulator
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L99-L642">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Packs metadata and associated files into TensorFlow Lite model file.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_support.metadata.MetadataPopulator(
model_file
)
</code></pre>
<!-- Placeholder for "Used in" -->
MetadataPopulator can be used to populate metadata and model associated files
into a model file or a model buffer (in bytearray). It can also help to
inspect list of files that have been packed into the model or are supposed to
be packed into the model.
The metadata file (or buffer) should be generated based on the metadata
schema:
third_party/tensorflow/lite/schema/metadata_schema.fbs
#### Example usage:
Populate matadata and label file into an image classifier model.
First, based on metadata_schema.fbs, generate the metadata for this image
classifer model using Flatbuffers API. Attach the label file onto the ouput
tensor (the tensor of probabilities) in the metadata.
Then, pack the metadata and label file into the model as follows.
```python
# Populating a metadata file (or a metadta buffer) and associated files to
a model file:
populator = MetadataPopulator.with_model_file(model_file)
# For metadata buffer (bytearray read from the metadata file), use:
# populator.load_metadata_buffer(metadata_buf)
populator.load_metadata_file(metadata_file)
populator.load_associated_files([label.txt])
# For associated file buffer (bytearray read from the file), use:
# populator.load_associated_file_buffers({"label.txt": b"file content"})
populator.populate()
# Populating a metadata file (or a metadta buffer) and associated files to
a model buffer:
populator = MetadataPopulator.with_model_buffer(model_buf)
populator.load_metadata_file(metadata_file)
populator.load_associated_files([label.txt])
populator.populate()
# Writing the updated model buffer into a file.
updated_model_buf = populator.get_model_buffer()
with open("updated_model.tflite", "wb") as f:
f.write(updated_model_buf)
# Transferring metadata and associated files from another TFLite model:
populator = MetadataPopulator.with_model_buffer(model_buf)
populator_dst.load_metadata_and_associated_files(src_model_buf)
populator_dst.populate()
updated_model_buf = populator.get_model_buffer()
with open("updated_model.tflite", "wb") as f:
f.write(updated_model_buf)
```
Note that existing metadata buffer (if applied) will be overridden by the new
metadata buffer.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_file`<a id="model_file"></a>
</td>
<td>
valid path to a TensorFlow Lite model file.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Raises</h2></th></tr>
<tr>
<td>
`IOError`<a id="IOError"></a>
</td>
<td>
File not found.
</td>
</tr><tr>
<td>
`ValueError`<a id="ValueError"></a>
</td>
<td>
the model does not have the expected flatbuffer identifer.
</td>
</tr>
</table>
## Methods
<h3 id="get_model_buffer"><code>get_model_buffer</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L214-L221">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_model_buffer()
</code></pre>
Gets the buffer of the model with packed metadata and associated files.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
Model buffer (in bytearray).
</td>
</tr>
</table>
<h3 id="get_packed_associated_file_list"><code>get_packed_associated_file_list</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L223-L233">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_packed_associated_file_list()
</code></pre>
Gets a list of associated files packed to the model file.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
List of packed associated files.
</td>
</tr>
</table>
<h3 id="get_recorded_associated_file_list"><code>get_recorded_associated_file_list</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L235-L254">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_recorded_associated_file_list()
</code></pre>
Gets a list of associated files recorded in metadata of the model file.
Associated files may be attached to a model, a subgraph, or an input/output
tensor.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
List of recorded associated files.
</td>
</tr>
</table>
<h3 id="load_associated_file_buffers"><code>load_associated_file_buffers</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L256-L268">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>load_associated_file_buffers(
associated_files
)
</code></pre>
Loads the associated file buffers (in bytearray) to be populated.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`associated_files`
</td>
<td>
a dictionary of associated file names and corresponding
file buffers, such as {"file.txt": b"file content"}. If pass in file
paths for the file name, only the basename will be populated.
</td>
</tr>
</table>
<h3 id="load_associated_files"><code>load_associated_files</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L270-L283">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>load_associated_files(
associated_files
)
</code></pre>
Loads associated files that to be concatenated after the model file.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`associated_files`
</td>
<td>
list of file paths.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr>
<td>
`IOError`
</td>
<td>
File not found.
</td>
</tr>
</table>
<h3 id="load_metadata_and_associated_files"><code>load_metadata_and_associated_files</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L343-L359">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>load_metadata_and_associated_files(
src_model_buf
)
</code></pre>
Loads the metadata and associated files from another model buffer.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`src_model_buf`
</td>
<td>
source model buffer (in bytearray) with metadata and
associated files.
</td>
</tr>
</table>
<h3 id="load_metadata_buffer"><code>load_metadata_buffer</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L285-L321">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>load_metadata_buffer(
metadata_buf
)
</code></pre>
Loads the metadata buffer (in bytearray) to be populated.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`metadata_buf`
</td>
<td>
metadata buffer (in bytearray) to be populated.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr>
<td>
`ValueError`
</td>
<td>
The metadata to be populated is empty.
</td>
</tr><tr>
<td>
`ValueError`
</td>
<td>
The metadata does not have the expected flatbuffer identifer.
</td>
</tr><tr>
<td>
`ValueError`
</td>
<td>
Cannot get minimum metadata parser version.
</td>
</tr><tr>
<td>
`ValueError`
</td>
<td>
The number of SubgraphMetadata is not 1.
</td>
</tr><tr>
<td>
`ValueError`
</td>
<td>
The number of input/output tensors does not match the number
of input/output tensor metadata.
</td>
</tr>
</table>
<h3 id="load_metadata_file"><code>load_metadata_file</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L323-L341">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>load_metadata_file(
metadata_file
)
</code></pre>
Loads the metadata file to be populated.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`metadata_file`
</td>
<td>
path to the metadata file to be populated.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr>
<td>
`IOError`
</td>
<td>
File not found.
</td>
</tr><tr>
<td>
`ValueError`
</td>
<td>
The metadata to be populated is empty.
</td>
</tr><tr>
<td>
`ValueError`
</td>
<td>
The metadata does not have the expected flatbuffer identifer.
</td>
</tr><tr>
<td>
`ValueError`
</td>
<td>
Cannot get minimum metadata parser version.
</td>
</tr><tr>
<td>
`ValueError`
</td>
<td>
The number of SubgraphMetadata is not 1.
</td>
</tr><tr>
<td>
`ValueError`
</td>
<td>
The number of input/output tensors does not match the number
of input/output tensor metadata.
</td>
</tr>
</table>
<h3 id="populate"><code>populate</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L361-L365">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>populate()
</code></pre>
Populates loaded metadata and associated files into the model file.
<h3 id="with_model_buffer"><code>with_model_buffer</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L199-L212">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>with_model_buffer(
model_buf
)
</code></pre>
Creates a MetadataPopulator object that populates data to a model buffer.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`model_buf`
</td>
<td>
TensorFlow Lite model buffer in bytearray.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A MetadataPopulator(_MetadataPopulatorWithBuffer) object.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr>
<td>
`ValueError`
</td>
<td>
the model does not have the expected flatbuffer identifer.
</td>
</tr>
</table>
<h3 id="with_model_file"><code>with_model_file</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L181-L195">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>with_model_file(
model_file
)
</code></pre>
Creates a MetadataPopulator object that populates data to a model file.
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
<tr>
<td>
`model_file`
</td>
<td>
valid path to a TensorFlow Lite model file.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
MetadataPopulator object.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Raises</th></tr>
<tr>
<td>
`IOError`
</td>
<td>
File not found.
</td>
</tr><tr>
<td>
`ValueError`
</td>
<td>
the model does not have the expected flatbuffer identifer.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Class Variables</h2></th></tr>
<tr>
<td>
METADATA_FIELD_NAME<a id="METADATA_FIELD_NAME"></a>
</td>
<td>
`'TFLITE_METADATA'`
</td>
</tr><tr>
<td>
METADATA_FILE_IDENTIFIER<a id="METADATA_FILE_IDENTIFIER"></a>
</td>
<td>
`b'M001'`
</td>
</tr><tr>
<td>
TFLITE_FILE_IDENTIFIER<a id="TFLITE_FILE_IDENTIFIER"></a>
</td>
<td>
`b'TFL3'`
</td>
</tr>
</table>
@@ -0,0 +1,87 @@
page_type: reference
description: Converts the metadata into a json string.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_support.metadata.convert_to_json" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_support.metadata.convert_to_json
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L794-L814">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Converts the metadata into a json string.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_support.metadata.convert_to_json(
metadata_buffer
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`metadata_buffer`<a id="metadata_buffer"></a>
</td>
<td>
valid metadata buffer in bytes.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Returns</h2></th></tr>
<tr class="alt">
<td colspan="2">
Metadata in JSON format.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Raises</h2></th></tr>
<tr>
<td>
`ValueError`<a id="ValueError"></a>
</td>
<td>
error occured when parsing the metadata schema file.
</td>
</tr>
</table>
@@ -0,0 +1,70 @@
page_type: reference
description: Returns the metadata in the model file as a buffer.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_support.metadata.get_metadata_buffer" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_support.metadata.get_metadata_buffer
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L846-L865">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Returns the metadata in the model file as a buffer.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_support.metadata.get_metadata_buffer(
model_buf
)
</code></pre>
<!-- Placeholder for "Used in" -->
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`model_buf`<a id="model_buf"></a>
</td>
<td>
valid buffer of the model file.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Returns</h2></th></tr>
<tr class="alt">
<td colspan="2">
Metadata buffer. Returns `None` if the model does not have metadata.
</td>
</tr>
</table>
@@ -0,0 +1,75 @@
page_type: reference
description: Gets the path to the specified file in the data dependencies.
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_support.metadata.get_path_to_datafile" />
<meta itemprop="path" content="Stable" />
</div>
# tflite_support.metadata.get_path_to_datafile
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/python/metadata.py#L75-L91">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
Gets the path to the specified file in the data dependencies.
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>tflite_support.metadata.get_path_to_datafile(
path
)
</code></pre>
<!-- Placeholder for "Used in" -->
The path is relative to the file calling the function.
It's a simple replacement of
"tensorflow.python.platform.resource_loader.get_path_to_datafile".
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>
<tr>
<td>
`path`<a id="path"></a>
</td>
<td>
a string resource path relative to the calling file.
</td>
</tr>
</table>
<!-- Tabular view -->
<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Returns</h2></th></tr>
<tr class="alt">
<td colspan="2">
The path to the specified file present in the data attribute of py_test
or py_binary.
</td>
</tr>
</table>
@@ -0,0 +1,393 @@
page_type: reference
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_support.metadata_schema_py_generated" />
<meta itemprop="path" content="Stable" />
</div>
# Module: tflite_support.metadata_schema_py_generated
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/metadata_schema_py_generated.py">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
## Classes
[`class AssociatedFile`](../tflite_support/metadata_schema_py_generated/AssociatedFile)
[`class AssociatedFileT`](../tflite_support/metadata_schema_py_generated/AssociatedFileT)
[`class AssociatedFileType`](../tflite_support/metadata_schema_py_generated/AssociatedFileType)
[`class AudioProperties`](../tflite_support/metadata_schema_py_generated/AudioProperties)
[`class AudioPropertiesT`](../tflite_support/metadata_schema_py_generated/AudioPropertiesT)
[`class BertTokenizerOptions`](../tflite_support/metadata_schema_py_generated/BertTokenizerOptions)
[`class BertTokenizerOptionsT`](../tflite_support/metadata_schema_py_generated/BertTokenizerOptionsT)
[`class BoundingBoxProperties`](../tflite_support/metadata_schema_py_generated/BoundingBoxProperties)
[`class BoundingBoxPropertiesT`](../tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesT)
[`class BoundingBoxType`](../tflite_support/metadata_schema_py_generated/BoundingBoxType)
[`class ColorSpaceType`](../tflite_support/metadata_schema_py_generated/ColorSpaceType)
[`class Content`](../tflite_support/metadata_schema_py_generated/Content)
[`class ContentProperties`](../tflite_support/metadata_schema_py_generated/ContentProperties)
[`class ContentT`](../tflite_support/metadata_schema_py_generated/ContentT)
[`class CoordinateType`](../tflite_support/metadata_schema_py_generated/CoordinateType)
[`class CustomMetadata`](../tflite_support/metadata_schema_py_generated/CustomMetadata)
[`class CustomMetadataT`](../tflite_support/metadata_schema_py_generated/CustomMetadataT)
[`class FeatureProperties`](../tflite_support/metadata_schema_py_generated/FeatureProperties)
[`class FeaturePropertiesT`](../tflite_support/metadata_schema_py_generated/FeaturePropertiesT)
[`class ImageProperties`](../tflite_support/metadata_schema_py_generated/ImageProperties)
[`class ImagePropertiesT`](../tflite_support/metadata_schema_py_generated/ImagePropertiesT)
[`class ImageSize`](../tflite_support/metadata_schema_py_generated/ImageSize)
[`class ImageSizeT`](../tflite_support/metadata_schema_py_generated/ImageSizeT)
[`class ModelMetadata`](../tflite_support/metadata_schema_py_generated/ModelMetadata)
[`class ModelMetadataT`](../tflite_support/metadata_schema_py_generated/ModelMetadataT)
[`class NormalizationOptions`](../tflite_support/metadata_schema_py_generated/NormalizationOptions)
[`class NormalizationOptionsT`](../tflite_support/metadata_schema_py_generated/NormalizationOptionsT)
[`class ProcessUnit`](../tflite_support/metadata_schema_py_generated/ProcessUnit)
[`class ProcessUnitOptions`](../tflite_support/metadata_schema_py_generated/ProcessUnitOptions)
[`class ProcessUnitT`](../tflite_support/metadata_schema_py_generated/ProcessUnitT)
[`class RegexTokenizerOptions`](../tflite_support/metadata_schema_py_generated/RegexTokenizerOptions)
[`class RegexTokenizerOptionsT`](../tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsT)
[`class ScoreCalibrationOptions`](../tflite_support/metadata_schema_py_generated/ScoreCalibrationOptions)
[`class ScoreCalibrationOptionsT`](../tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsT)
[`class ScoreThresholdingOptions`](../tflite_support/metadata_schema_py_generated/ScoreThresholdingOptions)
[`class ScoreThresholdingOptionsT`](../tflite_support/metadata_schema_py_generated/ScoreThresholdingOptionsT)
[`class ScoreTransformationType`](../tflite_support/metadata_schema_py_generated/ScoreTransformationType)
[`class SentencePieceTokenizerOptions`](../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptions)
[`class SentencePieceTokenizerOptionsT`](../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsT)
[`class Stats`](../tflite_support/metadata_schema_py_generated/Stats)
[`class StatsT`](../tflite_support/metadata_schema_py_generated/StatsT)
[`class SubGraphMetadata`](../tflite_support/metadata_schema_py_generated/SubGraphMetadata)
[`class SubGraphMetadataT`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataT)
[`class TensorGroup`](../tflite_support/metadata_schema_py_generated/TensorGroup)
[`class TensorGroupT`](../tflite_support/metadata_schema_py_generated/TensorGroupT)
[`class TensorMetadata`](../tflite_support/metadata_schema_py_generated/TensorMetadata)
[`class TensorMetadataT`](../tflite_support/metadata_schema_py_generated/TensorMetadataT)
[`class ValueRange`](../tflite_support/metadata_schema_py_generated/ValueRange)
[`class ValueRangeT`](../tflite_support/metadata_schema_py_generated/ValueRangeT)
## Functions
[`AssociatedFileAddDescription(...)`](../tflite_support/metadata_schema_py_generated/AssociatedFileAddDescription)
[`AssociatedFileAddLocale(...)`](../tflite_support/metadata_schema_py_generated/AssociatedFileAddLocale)
[`AssociatedFileAddName(...)`](../tflite_support/metadata_schema_py_generated/AssociatedFileAddName)
[`AssociatedFileAddType(...)`](../tflite_support/metadata_schema_py_generated/AssociatedFileAddType)
[`AssociatedFileAddVersion(...)`](../tflite_support/metadata_schema_py_generated/AssociatedFileAddVersion)
[`AssociatedFileEnd(...)`](../tflite_support/metadata_schema_py_generated/AssociatedFileEnd)
[`AssociatedFileStart(...)`](../tflite_support/metadata_schema_py_generated/AssociatedFileStart)
[`AudioPropertiesAddChannels(...)`](../tflite_support/metadata_schema_py_generated/AudioPropertiesAddChannels)
[`AudioPropertiesAddSampleRate(...)`](../tflite_support/metadata_schema_py_generated/AudioPropertiesAddSampleRate)
[`AudioPropertiesEnd(...)`](../tflite_support/metadata_schema_py_generated/AudioPropertiesEnd)
[`AudioPropertiesStart(...)`](../tflite_support/metadata_schema_py_generated/AudioPropertiesStart)
[`BertTokenizerOptionsAddVocabFile(...)`](../tflite_support/metadata_schema_py_generated/BertTokenizerOptionsAddVocabFile)
[`BertTokenizerOptionsEnd(...)`](../tflite_support/metadata_schema_py_generated/BertTokenizerOptionsEnd)
[`BertTokenizerOptionsStart(...)`](../tflite_support/metadata_schema_py_generated/BertTokenizerOptionsStart)
[`BertTokenizerOptionsStartVocabFileVector(...)`](../tflite_support/metadata_schema_py_generated/BertTokenizerOptionsStartVocabFileVector)
[`BoundingBoxPropertiesAddCoordinateType(...)`](../tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesAddCoordinateType)
[`BoundingBoxPropertiesAddIndex(...)`](../tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesAddIndex)
[`BoundingBoxPropertiesAddType(...)`](../tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesAddType)
[`BoundingBoxPropertiesEnd(...)`](../tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesEnd)
[`BoundingBoxPropertiesStart(...)`](../tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesStart)
[`BoundingBoxPropertiesStartIndexVector(...)`](../tflite_support/metadata_schema_py_generated/BoundingBoxPropertiesStartIndexVector)
[`ContentAddContentProperties(...)`](../tflite_support/metadata_schema_py_generated/ContentAddContentProperties)
[`ContentAddContentPropertiesType(...)`](../tflite_support/metadata_schema_py_generated/ContentAddContentPropertiesType)
[`ContentAddRange(...)`](../tflite_support/metadata_schema_py_generated/ContentAddRange)
[`ContentEnd(...)`](../tflite_support/metadata_schema_py_generated/ContentEnd)
[`ContentPropertiesCreator(...)`](../tflite_support/metadata_schema_py_generated/ContentPropertiesCreator)
[`ContentStart(...)`](../tflite_support/metadata_schema_py_generated/ContentStart)
[`CustomMetadataAddData(...)`](../tflite_support/metadata_schema_py_generated/CustomMetadataAddData)
[`CustomMetadataAddName(...)`](../tflite_support/metadata_schema_py_generated/CustomMetadataAddName)
[`CustomMetadataEnd(...)`](../tflite_support/metadata_schema_py_generated/CustomMetadataEnd)
[`CustomMetadataStart(...)`](../tflite_support/metadata_schema_py_generated/CustomMetadataStart)
[`CustomMetadataStartDataVector(...)`](../tflite_support/metadata_schema_py_generated/CustomMetadataStartDataVector)
[`FeaturePropertiesEnd(...)`](../tflite_support/metadata_schema_py_generated/FeaturePropertiesEnd)
[`FeaturePropertiesStart(...)`](../tflite_support/metadata_schema_py_generated/FeaturePropertiesStart)
[`ImagePropertiesAddColorSpace(...)`](../tflite_support/metadata_schema_py_generated/ImagePropertiesAddColorSpace)
[`ImagePropertiesAddDefaultSize(...)`](../tflite_support/metadata_schema_py_generated/ImagePropertiesAddDefaultSize)
[`ImagePropertiesEnd(...)`](../tflite_support/metadata_schema_py_generated/ImagePropertiesEnd)
[`ImagePropertiesStart(...)`](../tflite_support/metadata_schema_py_generated/ImagePropertiesStart)
[`ImageSizeAddHeight(...)`](../tflite_support/metadata_schema_py_generated/ImageSizeAddHeight)
[`ImageSizeAddWidth(...)`](../tflite_support/metadata_schema_py_generated/ImageSizeAddWidth)
[`ImageSizeEnd(...)`](../tflite_support/metadata_schema_py_generated/ImageSizeEnd)
[`ImageSizeStart(...)`](../tflite_support/metadata_schema_py_generated/ImageSizeStart)
[`ModelMetadataAddAssociatedFiles(...)`](../tflite_support/metadata_schema_py_generated/ModelMetadataAddAssociatedFiles)
[`ModelMetadataAddAuthor(...)`](../tflite_support/metadata_schema_py_generated/ModelMetadataAddAuthor)
[`ModelMetadataAddDescription(...)`](../tflite_support/metadata_schema_py_generated/ModelMetadataAddDescription)
[`ModelMetadataAddLicense(...)`](../tflite_support/metadata_schema_py_generated/ModelMetadataAddLicense)
[`ModelMetadataAddMinParserVersion(...)`](../tflite_support/metadata_schema_py_generated/ModelMetadataAddMinParserVersion)
[`ModelMetadataAddName(...)`](../tflite_support/metadata_schema_py_generated/ModelMetadataAddName)
[`ModelMetadataAddSubgraphMetadata(...)`](../tflite_support/metadata_schema_py_generated/ModelMetadataAddSubgraphMetadata)
[`ModelMetadataAddVersion(...)`](../tflite_support/metadata_schema_py_generated/ModelMetadataAddVersion)
[`ModelMetadataEnd(...)`](../tflite_support/metadata_schema_py_generated/ModelMetadataEnd)
[`ModelMetadataStart(...)`](../tflite_support/metadata_schema_py_generated/ModelMetadataStart)
[`ModelMetadataStartAssociatedFilesVector(...)`](../tflite_support/metadata_schema_py_generated/ModelMetadataStartAssociatedFilesVector)
[`ModelMetadataStartSubgraphMetadataVector(...)`](../tflite_support/metadata_schema_py_generated/ModelMetadataStartSubgraphMetadataVector)
[`NormalizationOptionsAddMean(...)`](../tflite_support/metadata_schema_py_generated/NormalizationOptionsAddMean)
[`NormalizationOptionsAddStd(...)`](../tflite_support/metadata_schema_py_generated/NormalizationOptionsAddStd)
[`NormalizationOptionsEnd(...)`](../tflite_support/metadata_schema_py_generated/NormalizationOptionsEnd)
[`NormalizationOptionsStart(...)`](../tflite_support/metadata_schema_py_generated/NormalizationOptionsStart)
[`NormalizationOptionsStartMeanVector(...)`](../tflite_support/metadata_schema_py_generated/NormalizationOptionsStartMeanVector)
[`NormalizationOptionsStartStdVector(...)`](../tflite_support/metadata_schema_py_generated/NormalizationOptionsStartStdVector)
[`ProcessUnitAddOptions(...)`](../tflite_support/metadata_schema_py_generated/ProcessUnitAddOptions)
[`ProcessUnitAddOptionsType(...)`](../tflite_support/metadata_schema_py_generated/ProcessUnitAddOptionsType)
[`ProcessUnitEnd(...)`](../tflite_support/metadata_schema_py_generated/ProcessUnitEnd)
[`ProcessUnitOptionsCreator(...)`](../tflite_support/metadata_schema_py_generated/ProcessUnitOptionsCreator)
[`ProcessUnitStart(...)`](../tflite_support/metadata_schema_py_generated/ProcessUnitStart)
[`RegexTokenizerOptionsAddDelimRegexPattern(...)`](../tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsAddDelimRegexPattern)
[`RegexTokenizerOptionsAddVocabFile(...)`](../tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsAddVocabFile)
[`RegexTokenizerOptionsEnd(...)`](../tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsEnd)
[`RegexTokenizerOptionsStart(...)`](../tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsStart)
[`RegexTokenizerOptionsStartVocabFileVector(...)`](../tflite_support/metadata_schema_py_generated/RegexTokenizerOptionsStartVocabFileVector)
[`ScoreCalibrationOptionsAddDefaultScore(...)`](../tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsAddDefaultScore)
[`ScoreCalibrationOptionsAddScoreTransformation(...)`](../tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsAddScoreTransformation)
[`ScoreCalibrationOptionsEnd(...)`](../tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsEnd)
[`ScoreCalibrationOptionsStart(...)`](../tflite_support/metadata_schema_py_generated/ScoreCalibrationOptionsStart)
[`ScoreThresholdingOptionsAddGlobalScoreThreshold(...)`](../tflite_support/metadata_schema_py_generated/ScoreThresholdingOptionsAddGlobalScoreThreshold)
[`ScoreThresholdingOptionsEnd(...)`](../tflite_support/metadata_schema_py_generated/ScoreThresholdingOptionsEnd)
[`ScoreThresholdingOptionsStart(...)`](../tflite_support/metadata_schema_py_generated/ScoreThresholdingOptionsStart)
[`SentencePieceTokenizerOptionsAddSentencePieceModel(...)`](../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsAddSentencePieceModel)
[`SentencePieceTokenizerOptionsAddVocabFile(...)`](../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsAddVocabFile)
[`SentencePieceTokenizerOptionsEnd(...)`](../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsEnd)
[`SentencePieceTokenizerOptionsStart(...)`](../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsStart)
[`SentencePieceTokenizerOptionsStartSentencePieceModelVector(...)`](../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsStartSentencePieceModelVector)
[`SentencePieceTokenizerOptionsStartVocabFileVector(...)`](../tflite_support/metadata_schema_py_generated/SentencePieceTokenizerOptionsStartVocabFileVector)
[`StatsAddMax(...)`](../tflite_support/metadata_schema_py_generated/StatsAddMax)
[`StatsAddMin(...)`](../tflite_support/metadata_schema_py_generated/StatsAddMin)
[`StatsEnd(...)`](../tflite_support/metadata_schema_py_generated/StatsEnd)
[`StatsStart(...)`](../tflite_support/metadata_schema_py_generated/StatsStart)
[`StatsStartMaxVector(...)`](../tflite_support/metadata_schema_py_generated/StatsStartMaxVector)
[`StatsStartMinVector(...)`](../tflite_support/metadata_schema_py_generated/StatsStartMinVector)
[`SubGraphMetadataAddAssociatedFiles(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddAssociatedFiles)
[`SubGraphMetadataAddCustomMetadata(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddCustomMetadata)
[`SubGraphMetadataAddDescription(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddDescription)
[`SubGraphMetadataAddInputProcessUnits(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddInputProcessUnits)
[`SubGraphMetadataAddInputTensorGroups(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddInputTensorGroups)
[`SubGraphMetadataAddInputTensorMetadata(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddInputTensorMetadata)
[`SubGraphMetadataAddName(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddName)
[`SubGraphMetadataAddOutputProcessUnits(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddOutputProcessUnits)
[`SubGraphMetadataAddOutputTensorGroups(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddOutputTensorGroups)
[`SubGraphMetadataAddOutputTensorMetadata(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataAddOutputTensorMetadata)
[`SubGraphMetadataEnd(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataEnd)
[`SubGraphMetadataStart(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataStart)
[`SubGraphMetadataStartAssociatedFilesVector(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartAssociatedFilesVector)
[`SubGraphMetadataStartCustomMetadataVector(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartCustomMetadataVector)
[`SubGraphMetadataStartInputProcessUnitsVector(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartInputProcessUnitsVector)
[`SubGraphMetadataStartInputTensorGroupsVector(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartInputTensorGroupsVector)
[`SubGraphMetadataStartInputTensorMetadataVector(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartInputTensorMetadataVector)
[`SubGraphMetadataStartOutputProcessUnitsVector(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartOutputProcessUnitsVector)
[`SubGraphMetadataStartOutputTensorGroupsVector(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartOutputTensorGroupsVector)
[`SubGraphMetadataStartOutputTensorMetadataVector(...)`](../tflite_support/metadata_schema_py_generated/SubGraphMetadataStartOutputTensorMetadataVector)
[`TensorGroupAddName(...)`](../tflite_support/metadata_schema_py_generated/TensorGroupAddName)
[`TensorGroupAddTensorNames(...)`](../tflite_support/metadata_schema_py_generated/TensorGroupAddTensorNames)
[`TensorGroupEnd(...)`](../tflite_support/metadata_schema_py_generated/TensorGroupEnd)
[`TensorGroupStart(...)`](../tflite_support/metadata_schema_py_generated/TensorGroupStart)
[`TensorGroupStartTensorNamesVector(...)`](../tflite_support/metadata_schema_py_generated/TensorGroupStartTensorNamesVector)
[`TensorMetadataAddAssociatedFiles(...)`](../tflite_support/metadata_schema_py_generated/TensorMetadataAddAssociatedFiles)
[`TensorMetadataAddContent(...)`](../tflite_support/metadata_schema_py_generated/TensorMetadataAddContent)
[`TensorMetadataAddDescription(...)`](../tflite_support/metadata_schema_py_generated/TensorMetadataAddDescription)
[`TensorMetadataAddDimensionNames(...)`](../tflite_support/metadata_schema_py_generated/TensorMetadataAddDimensionNames)
[`TensorMetadataAddName(...)`](../tflite_support/metadata_schema_py_generated/TensorMetadataAddName)
[`TensorMetadataAddProcessUnits(...)`](../tflite_support/metadata_schema_py_generated/TensorMetadataAddProcessUnits)
[`TensorMetadataAddStats(...)`](../tflite_support/metadata_schema_py_generated/TensorMetadataAddStats)
[`TensorMetadataEnd(...)`](../tflite_support/metadata_schema_py_generated/TensorMetadataEnd)
[`TensorMetadataStart(...)`](../tflite_support/metadata_schema_py_generated/TensorMetadataStart)
[`TensorMetadataStartAssociatedFilesVector(...)`](../tflite_support/metadata_schema_py_generated/TensorMetadataStartAssociatedFilesVector)
[`TensorMetadataStartDimensionNamesVector(...)`](../tflite_support/metadata_schema_py_generated/TensorMetadataStartDimensionNamesVector)
[`TensorMetadataStartProcessUnitsVector(...)`](../tflite_support/metadata_schema_py_generated/TensorMetadataStartProcessUnitsVector)
[`ValueRangeAddMax(...)`](../tflite_support/metadata_schema_py_generated/ValueRangeAddMax)
[`ValueRangeAddMin(...)`](../tflite_support/metadata_schema_py_generated/ValueRangeAddMin)
[`ValueRangeEnd(...)`](../tflite_support/metadata_schema_py_generated/ValueRangeEnd)
[`ValueRangeStart(...)`](../tflite_support/metadata_schema_py_generated/ValueRangeStart)
[`import_numpy(...)`](../tflite_support/metadata_schema_py_generated/import_numpy): Returns the numpy module if it exists on the system, otherwise returns None.
@@ -0,0 +1,148 @@
page_type: reference
<link rel="stylesheet" href="/site-assets/css/style.css">
<!-- DO NOT EDIT! Automatically generated file. -->
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tflite_support.metadata_schema_py_generated.AssociatedFile" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="AssociatedFileBufferHasIdentifier"/>
<meta itemprop="property" content="Description"/>
<meta itemprop="property" content="GetRootAs"/>
<meta itemprop="property" content="GetRootAsAssociatedFile"/>
<meta itemprop="property" content="Init"/>
<meta itemprop="property" content="Locale"/>
<meta itemprop="property" content="Name"/>
<meta itemprop="property" content="Type"/>
<meta itemprop="property" content="Version"/>
</div>
# tflite_support.metadata_schema_py_generated.AssociatedFile
<!-- Insert buttons and diff -->
<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/metadata_schema_py_generated.py#L94-L149">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>
<!-- Placeholder for "Used in" -->
## Methods
<h3 id="AssociatedFileBufferHasIdentifier"><code>AssociatedFileBufferHasIdentifier</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/metadata_schema_py_generated.py#L108-L110">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>AssociatedFileBufferHasIdentifier(
buf, offset, size_prefixed=False
)
</code></pre>
<h3 id="Description"><code>Description</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/metadata_schema_py_generated.py#L124-L128">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>Description()
</code></pre>
<h3 id="GetRootAs"><code>GetRootAs</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/metadata_schema_py_generated.py#L97-L102">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>GetRootAs(
buf, offset=0
)
</code></pre>
<h3 id="GetRootAsAssociatedFile"><code>GetRootAsAssociatedFile</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/metadata_schema_py_generated.py#L104-L107">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@classmethod</code>
<code>GetRootAsAssociatedFile(
buf, offset=0
)
</code></pre>
This method is deprecated. Please switch to GetRootAs.
<h3 id="Init"><code>Init</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/metadata_schema_py_generated.py#L113-L114">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>Init(
buf, pos
)
</code></pre>
<h3 id="Locale"><code>Locale</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/metadata_schema_py_generated.py#L138-L142">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>Locale()
</code></pre>
<h3 id="Name"><code>Name</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/metadata_schema_py_generated.py#L117-L121">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>Name()
</code></pre>
<h3 id="Type"><code>Type</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/metadata_schema_py_generated.py#L131-L135">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>Type()
</code></pre>
<h3 id="Version"><code>Version</code></h3>
<a target="_blank" class="external" href="https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/metadata/metadata_schema_py_generated.py#L145-L149">View source</a>
<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>Version()
</code></pre>

Some files were not shown because too many files have changed in this diff Show More