Skip to main content

tf2show

Install

pip install tf2show

Example

import tensorflow as tf
from tf2show import tf2show

model = tf.keras.applications.ResNet50()
tf2show(model)	# show model structure
tf2show(model,"model.xlsx")    # save model structure as excel file

Description

tf2show prints tensorflow2's keras model pretty.

Below is the result of summary function provided in tensorflow2.

It's not pretty. In addition, some output has been omitted.

Model: "mobilenet_1.00_256"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
input_1 (InputLayer)         [(None, 256, 256, 3)]     0         
_________________________________________________________________
conv1_pad (ZeroPadding2D)    (None, 257, 257, 3)       0         
_________________________________________________________________
conv1 (Conv2D)               (None, 128, 128, 32)      864       
_________________________________________________________________
conv1_bn (BatchNormalization (None, 128, 128, 32)      128       
_________________________________________________________________
conv1_relu (ReLU)            (None, 128, 128, 32)      0         
_________________________________________________________________
conv_dw_1 (DepthwiseConv2D)  (None, 128, 128, 32)      288       
_________________________________________________________________
.
.
.
_________________________________________________________________
reshape_2 (Reshape)          (None, 1000)              0         
_________________________________________________________________
predictions (Activation)     (None, 1000)              0         
=================================================================
Total params: 4,253,864
Trainable params: 4,231,976
Non-trainable params: 21,888
_________________________________________________________________

Below is the output using tf2show.

It's pretty. All names are printed.

----------------------------------------------------------------------------------------------------
| LAYER                  | NAME                     | C    | H   | W    | INPUTS                   |
----------------------------------------------------------------------------------------------------
| InputLayer             | input_1                  | 3    | 256 | 256  | input_1:0                |
| ZeroPadding2D          | conv1_pad                | 3    | 257 | 257  | input_1:0                |
| Conv2D                 | conv1                    | 32   | 128 | 128  | conv1_pad                |
| BatchNormalization     | conv1_bn                 | 32   | 128 | 128  | conv1                    |
| ReLU                   | conv1_relu               | 32   | 128 | 128  | conv1_bn                 |
| DepthwiseConv2D        | conv_dw_1                | 32   | 128 | 128  | conv1_relu               |
| BatchNormalization     | conv_dw_1_bn             | 32   | 128 | 128  | conv_dw_1                |
| ReLU                   | conv_dw_1_relu           | 32   | 128 | 128  | conv_dw_1_bn             |
| Conv2D                 | conv_pw_1                | 64   | 128 | 128  | conv_dw_1_relu           |
| BatchNormalization     | conv_pw_1_bn             | 64   | 128 | 128  | conv_pw_1                |
| ReLU                   | conv_pw_1_relu           | 64   | 128 | 128  | conv_pw_1_bn             |
| ZeroPadding2D          | conv_pad_2               | 64   | 129 | 129  | conv_pw_1_relu           |
| DepthwiseConv2D        | conv_dw_2                | 64   | 64  | 64   | conv_pad_2               |
.
.
.
| Reshape                | reshape_2                |      |     | 1000 | conv_preds               |
| Activation             | predictions              |      |     | 1000 | reshape_2                |
----------------------------------------------------------------------------------------------------

It also supports saving to Excel.

This function can be useful when analyzing models.

Get a quick view of the hardware resources required for deep learning.

import tf2show
tf2show.hw4show()

Linux

CPU: Intel(R) Xeon(R) CPU @ 2.00GHz 2C/4T
RAM: 15.64 GB
GPU: Tesla P100-PCIE-16GB, 15.9 GB

Windows

CPU: Intel(R) Core(TM) i7-6950X CPU @ 3.00GHz 10C/20T
RAM: 32.00 GB
GPU: GeForce RTX 2080 Ti, 11.0 GB

Metadata

Release files for tf2show 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tf2show 0.0.5
File Size Uploaded
tf2show-0.0.5.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tf2show 0.0.5
File Interpreter ABI Platform
tf2show-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / tf2show-0.0.5.tar.gz

Download URL tf2show-0.0.5.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
818a512a44913abe80288bab8cf1557850b9e8abb79b4744f5c2c9c2888824e7
BLAKE2b-256 checksum
How to use checksums
598fb10e340bca80023195b4b3ba472a50485d8e779001e59baa70a8fb40930d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release files / tf2show-0.0.5-py3-none-any.whl

Download URL tf2show-0.0.5-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a07a8c61135f2d7d3dc5fdb30d9f761d1aa06b8237c8e0a72550d32d0e3f4bb0
BLAKE2b-256 checksum
How to use checksums
605cd0a39821efb26d49ea762b10de3a745f96ecd821ebf4ab562522e34ec3b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page