Package: litten
LittenLitten is a python package to visualize sequential Tensorflow(keras) neural network model architectures, Get layers summary in details, visualize conv layers filters and featurmaps.InstallationTo install latest version from PyPi$pipinstalllittenHow to use it?Create your neural network archticturesmodel=keras.models.Sequential([keras.layers.Conv2D(filters=32,kernel_size=3,input_shape=[150,150,3]),...keras.layers.Dense(units=2,activation='softmax')])# or using functional APIinput=keras.Input(shape=(28,28,1),name="img")...output=keras.layers.Dense(units=2,activation='softmax')(x)model=keras.Model(input,output,name="Model")Import LayersSummary, ModelVisualizer and create objectsfromlittenimportLayersSummary,ModelVisualizerTo get Layers Summariessummary=LayersSummary()summary.show_layers_summaries(model)Output:=================================================================================================================
Layer 1: InputLayer     | Attributes
----------------------------------------
built                   :  True
sparse                  :  False
ragged                  :  False
batch_size              :  None
is_placeholder          :  True
=================================================================================================================
Layer 2: Conv2D         | Attributes
----------------------------------------
rank                    :  2
filters                 :  16
groups                  :  1
kernel_size             :  (3, 3)
strides                 :  (1, 1)
padding                 :  valid
data_format             :  channels_last
dilation_rate           :  (1, 1)
activation              :  <function relu at 0x7f6b7038fee0>
use_bias                :  True
kernel_initializer      :  <keras.initializers.initializers_v2.GlorotUniform object at 0x7f6aee189610>
bias_initializer        :  <keras.initializers.initializers_v2.Zeros object at 0x7f6aee189af0>
kernel_regularizer      :  None
bias_regularizer        :  None
kernel_constraint       :  None
bias_constraint         :  None
built                   :  True
=================================================================================================================
....To visualize model architectureModelVisualizer.visualize_model(
    show_names=False,
    show_properties=False,
    show_connectors=False,
    pallete='default'
)Example 1vis=ModelVisualizer(model)vis.visualize_model()Example 2vis.visualize_model(show_names=True)Example 3vis.visualize_model(show_names=True,show_connectors=True)Exampel 4vis.visualize_model(show_names=True,show_connectors=True,show_properties=True)Example 5
You can choose one from these palettesdefault,red,green,blue,yellow,brown,purple,grayvis.visualize_model(show_names=True,show_connectors=True,palette=<palette>)To visualize Conv filtersModelVisualizer.visualize_filters(
        cmap = 'gray'   # matplotlib cmaps
    )Examplevis=ModelVisualizer(model)vis.visualize_filters('Blues')To visualize Features mapModelVisualizer.visualize_featuremap(
    input_image,
    cmap = 'gray'   # matplotlib cmaps
)Examplevis=ModelVisualizer(model)vis.visualize_featuremap(input_image,'Blues')Contributing tolittenTo contribute to litten, follow these steps:Fork this repository.Create a branch:git checkout -b <branch_name>.Make your changes and commit them:git commit -m '<commit_message>'Push to the original branch:git push origin <project_name>/<location>Create the pull request.Alternatively see the GitHub documentation oncreating a pull request.LicenseOpen source licensed under the MIT license (seeLICENSEfile for details).ToolsPythonPILMatplotlibpytest