tensorflow/lite/g3doc/api_docs/python/tflite_support/metadata/MetadataDisplayer.md
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>View source on GitHub
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><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>