Recommend Netron for TF Lite model visualization
PiperOrigin-RevId: 316750470 Change-Id: Id794ed7b2a8405cf5821fb106e8861d8aacef22f
This commit is contained in:
parent
8cf2895fcc
commit
23910c191f
|
@ -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?
|
#### 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)
|
[summarize_graph](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/graph_transforms/README.md#inspecting-graphs)
|
||||||
tool.
|
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
|
[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
|
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)
|
[`import_pb_to_tensorboard.py`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/import_pb_to_tensorboard.py)
|
||||||
script like below:
|
script like below:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
python import_pb_to_tensorboard.py --model_dir <model path> --log_dir <log dir path>
|
python import_pb_to_tensorboard.py --model_dir <model path> --log_dir <log dir path>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### How do I inspect a `.tflite` file?
|
#### 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)
|
[visualize.py](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/tools/visualize.py)
|
||||||
script in our repository.
|
script in our repository.
|
||||||
|
|
||||||
* [Clone the TensorFlow repository](https://www.tensorflow.org/install/source)
|
* [Clone the TensorFlow repository](https://www.tensorflow.org/install/source)
|
||||||
* Run the `visualize.py` script with bazel:
|
* Run the `visualize.py` script with bazel:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
bazel run //tensorflow/lite/tools:visualize model.tflite visualized_model.html
|
bazel run //tensorflow/lite/tools:visualize model.tflite visualized_model.html
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue