{"id":49650878,"url":"https://github.com/swajayresources/layerviz","last_synced_at":"2026-05-06T04:33:00.540Z","repository":{"id":244863965,"uuid":"816501425","full_name":"swajayresources/LayerViz","owner":"swajayresources","description":"A Python Library for Visualizing Keras Models covering a variety of Layers.","archived":false,"fork":false,"pushed_at":"2024-06-17T22:19:50.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-18T00:02:44.752Z","etag":null,"topics":["keras","layers","tensorflow","visualization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swajayresources.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-17T22:16:26.000Z","updated_at":"2024-06-18T00:02:49.401Z","dependencies_parsed_at":"2024-06-18T00:02:48.809Z","dependency_job_id":"af2e6111-50d9-4c4c-b327-e121ea89d9ec","html_url":"https://github.com/swajayresources/LayerViz","commit_stats":null,"previous_names":["swajayresources/layerviz"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/swajayresources/LayerViz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swajayresources%2FLayerViz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swajayresources%2FLayerViz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swajayresources%2FLayerViz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swajayresources%2FLayerViz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swajayresources","download_url":"https://codeload.github.com/swajayresources/LayerViz/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swajayresources%2FLayerViz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32678621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T02:33:58.958Z","status":"ssl_error","status_checked_at":"2026-05-06T02:33:39.611Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["keras","layers","tensorflow","visualization"],"created_at":"2026-05-06T04:32:56.116Z","updated_at":"2026-05-06T04:33:00.525Z","avatar_url":"https://github.com/swajayresources.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LayerViz\n\n\n\n![logo (2)](https://github.com/swajay04/LayerViz/assets/111627785/93ba167d-f0a9-401a-9345-ca4a6fd2fe0f)\n\nA Python Library for Visualizing Keras Models covering a variety of Layers.\n\n\n## Table of Contents\n\n\u003c!-- TOC --\u003e\n\n* [LayerViz](#LayerViz)\n    * [Table of Contents](#table-of-contents)\n    * [Installation](#installation)\n        * [Install](#install)\n        * [Upgrade](#upgrade)\n    * [Usage](#usage)\n    * [Parameters](#parameters)\n    * [Settings](#settings)\n    * [Sample Usage](#sample-usage)\n    * [Supported layers](#supported-layers)\n\n\u003c!-- TOC --\u003e\n\n## Installation\n\n## Install\n\nUse python package manager (pip) to install LayerViz.\n\n```bash\npip install LayerViz\n```\n\n### Upgrade\n\nUse python package manager (pip) to upgrade LayerViz.\n\n```bash\npip install LayerViz --upgrade\n```\n\n## Usage\n\n```python\n\nfrom libname imoprt layerviz\n# create your model here\n# model = ...\n\nlayerviz(model, file_format='png')\n```\n\n## Parameters\n\n```python\nlayerviz(model, file_name='graph', file_format=None, view=False, settings=None)\n```\n\n- `model` : a Keras model instance.\n- `file_name` : where to save the visualization.\n- `file_format` : file format to save 'pdf', 'png'.\n- `view` : open file after process if True.\n- `settings` : a dictionary of available settings.\n\n\u003e **Note :**\n\u003e - set `file_format='png'` or `file_format='pdf'` to save visualization file.\n\u003e - use `view=True` to open visualization file.\n\u003e - use [settings](#settings) to customize output image.\n\n## Settings\n\nyou can customize settings for your output image. here is the default settings dictionary:\n\n```python\n recurrent_layers = ['LSTM', 'GRU']\n    main_settings = {\n        # ALL LAYERS\n        'MAX_NEURONS': 10,\n        'ARROW_COLOR': '#707070',\n        # INPUT LAYERS\n        'INPUT_DENSE_COLOR': '#2ecc71',\n        'INPUT_EMBEDDING_COLOR': 'black',\n        'INPUT_EMBEDDING_FONT': 'white',\n        'INPUT_GRAYSCALE_COLOR': 'black:white',\n        'INPUT_GRAYSCALE_FONT': 'white',\n        'INPUT_RGB_COLOR': '#e74c3c:#3498db',\n        'INPUT_RGB_FONT': 'white',\n        'INPUT_LAYER_COLOR': 'black',\n        'INPUT_LAYER_FONT': 'white',\n        # HIDDEN LAYERS\n        'HIDDEN_DENSE_COLOR': '#3498db',\n        'HIDDEN_CONV_COLOR': '#5faad0',\n        'HIDDEN_CONV_FONT': 'black',\n        'HIDDEN_POOLING_COLOR': '#8e44ad',\n        'HIDDEN_POOLING_FONT': 'white',\n        'HIDDEN_FLATTEN_COLOR': '#2c3e50',\n        'HIDDEN_FLATTEN_FONT': 'white',\n        'HIDDEN_DROPOUT_COLOR': '#f39c12',\n        'HIDDEN_DROPOUT_FONT': 'black',\n        'HIDDEN_ACTIVATION_COLOR': '#00b894',\n        'HIDDEN_ACTIVATION_FONT': 'black',\n        'HIDDEN_LAYER_COLOR': 'black',\n        'HIDDEN_LAYER_FONT': 'white',\n        # RECURRENT LAYERS\n        'RECURRENT_LAYER_COLOR': '#9b59b6',\n        'RECURRENT_LAYER_FONT': 'white',\n        # OUTPUT LAYER\n        'OUTPUT_DENSE_COLOR': '#e74c3c',\n        'OUTPUT_LAYER_COLOR': 'black',\n        'OUTPUT_LAYER_FONT': 'white',\n    }\n\n\n    for layer_type in recurrent_layers:\n      main_settings[layer_type + '_COLOR'] = '#9b59b6'\n    settings = {**main_settings, **settings} if settings is not None else {**main_settings}\n    max_neurons = settings['MAX_NEURONS']\n```\n\n**Note**:\n\n* set `'MAX_NEURONS': None` to disable max neurons constraint.\n* see list of color names [here](https://graphviz.org/doc/info/colors.html).\n\n```python\n\n\nmy_settings = {\n    'MAX_NEURONS': None,\n    'INPUT_DENSE_COLOR': 'teal',\n    'HIDDEN_DENSE_COLOR': 'gray',\n    'OUTPUT_DENSE_COLOR': 'crimson'\n}\n\n# model = ...\n\nlayerviz(model, file_format='png', settings=my_settings)\n```\n## Sample Usage \n📖 **Resource:** The architecture we're using below is a scaled-down version of [VGG-16](https://arxiv.org/abs/1505.06798), a convolutional neural network which came 2nd in the 2014 [ImageNet classification competition](http://image-net.org/).\n\nFor reference, the model we're using replicates TinyVGG, the computer vision architecture which fuels the [CNN explainer webpage](https://poloclub.github.io/cnn-explainer/).\n```python\nfrom keras import models, layers\nfrom libname import layerviz\nimport tensorflow as tf\nmodel_1 = tf.keras.models.Sequential([\n  tf.keras.layers.Conv2D(filters=10, \n                         kernel_size=3, # can also be (3, 3)\n                         activation=\"relu\", \n                         input_shape=(224, 224, 3)), # first layer specifies input shape (height, width, colour channels)\n  tf.keras.layers.Conv2D(10, 3, activation=\"relu\"),\n  tf.keras.layers.MaxPool2D(pool_size=2, # pool_size can also be (2, 2)\n                            padding=\"valid\"), # padding can also be 'same'\n  tf.keras.layers.Conv2D(10, 3, activation=\"relu\"),\n  tf.keras.layers.Conv2D(10, 3, activation=\"relu\"), # activation='relu' == tf.keras.layers.Activations(tf.nn.relu)\n  tf.keras.layers.MaxPool2D(2),\n  tf.keras.layers.Flatten(),\n  tf.keras.layers.Dense(1, activation=\"sigmoid\") # binary activation output\n])\n\nlayerviz(model_1, file_name='sample1', file_format='png')\n\nfrom IPython.display import Image\nImage('sample1.png')\n```\n![download](https://github.com/swajay04/LayerViz/assets/111627785/b68f367b-a97c-4df0-810f-84710d86f23c)\n\n## Supported layers\n\n[Explore list of **keras layers**](https://keras.io/api/layers/)\n\n1. Core layers\n    - [x] Input object\n    - [x] Dense layer\n    - [x] Activation layer\n    - [x] Embedding layer\n    - [ ] Masking layer\n    - [ ] Lambda layer\n\n2. Convolution layers\n    - [x] Conv1D layer\n    - [x] Conv2D layer\n    - [x] Conv3D layer\n    - [x] SeparableConv1D layer\n    - [x] SeparableConv2D layer\n    - [x] DepthwiseConv2D layer\n    - [x] Conv1DTranspose layer\n    - [x] Conv2DTranspose layer\n    - [x] Conv3DTranspose layer\n\n3. Pooling layers\n    - [x] MaxPooling1D layer\n    - [x] MaxPooling2D layer\n    - [x] MaxPooling3D layer\n    - [x] AveragePooling1D layer\n    - [x] AveragePooling2D layer\n    - [x] AveragePooling3D layer\n    - [x] GlobalMaxPooling1D layer\n    - [x] GlobalMaxPooling2D layer\n    - [x] GlobalMaxPooling3D layer\n    - [x] GlobalAveragePooling1D layer\n    - [x] GlobalAveragePooling2D layer\n    - [x] GlobalAveragePooling3D layer\n\n4. Reshaping layers\n    - [ ] Reshape layer\n    - [x] Flatten layer\n    - [ ] RepeatVector layer\n    - [ ] Permute layer\n    - [ ] Cropping1D layer\n    - [ ] Cropping2D layer\n    - [ ] Cropping3D layer\n    - [ ] UpSampling1D layer\n    - [ ] UpSampling2D layer\n    - [ ] UpSampling3D layer\n    - [ ] ZeroPadding1D layer\n    - [ ] ZeroPadding2D layer\n    - [ ] ZeroPadding3D layer\n\n5. Regularization layers\n    - [x] Dropout layer\n    - [x] SpatialDropout1D layer\n    - [x] SpatialDropout2D layer\n    - [x] SpatialDropout3D layer\n    - [x] GaussianDropout layer\n    - [ ] GaussianNoise layer\n    - [ ] ActivityRegularization layer\n    - [x] AlphaDropout layer\n\n6. Recurrent Layers\n    - [x] LSTM\n    - [x] GRU\n          \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswajayresources%2Flayerviz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswajayresources%2Flayerviz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswajayresources%2Flayerviz/lists"}