From 23910c191f29c8ea060b0d24671fccb356ed6600 Mon Sep 17 00:00:00 2001 From: Khanh LeViet Date: Tue, 16 Jun 2020 13:48:29 -0700 Subject: [PATCH] Recommend Netron for TF Lite model visualization PiperOrigin-RevId: 316750470 Change-Id: Id794ed7b2a8405cf5821fb106e8861d8aacef22f --- tensorflow/lite/g3doc/guide/faq.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tensorflow/lite/g3doc/guide/faq.md b/tensorflow/lite/g3doc/guide/faq.md index 197fc2d4a8f..491e3252635 100644 --- a/tensorflow/lite/g3doc/guide/faq.md +++ b/tensorflow/lite/g3doc/guide/faq.md @@ -45,30 +45,37 @@ or file a [new one](https://github.com/tensorflow/tensorflow/issues). #### How do I determine the inputs/outputs for GraphDef protocol buffer? -The easiest way to inspect a graph from a `.pb` file is to use the +The easiest way to inspect a graph from a `.pb` file is to use +[Netron](https://github.com/lutzroeder/netron), an open-source viewer for +machine learning models. + +If Netron cannot open the graph, you can try the [summarize_graph](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/graph_transforms/README.md#inspecting-graphs) tool. -If that approach yields an error, you can visualize the GraphDef with +If the summarize_graph tool yields an error, you can visualize the GraphDef with [TensorBoard](https://www.tensorflow.org/guide/summaries_and_tensorboard) and look for the inputs and outputs in the graph. To visualize a `.pb` file, use the [`import_pb_to_tensorboard.py`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/import_pb_to_tensorboard.py) script like below: -```sh +```shell python import_pb_to_tensorboard.py --model_dir --log_dir ``` #### How do I inspect a `.tflite` file? -TensorFlow Lite models can be visualized using the +[Netron](https://github.com/lutzroeder/netron) is the easiest way to visualize a +TensorFlow Lite model. + +If Netron cannot open your TensorFlow Lite model, you can try the [visualize.py](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/tools/visualize.py) script in our repository. * [Clone the TensorFlow repository](https://www.tensorflow.org/install/source) * Run the `visualize.py` script with bazel: -```sh +```shell bazel run //tensorflow/lite/tools:visualize model.tflite visualized_model.html ```