{"id":20941651,"url":"https://github.com/mahyar-amiri/keras-visualizer","last_synced_at":"2026-06-02T15:00:45.752Z","repository":{"id":54563796,"uuid":"286092214","full_name":"mahyar-amiri/keras-visualizer","owner":"mahyar-amiri","description":"A Keras Model Visualizer","archived":false,"fork":false,"pushed_at":"2024-05-09T21:22:59.000Z","size":1867,"stargazers_count":30,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-20T23:54:30.290Z","etag":null,"topics":["keras","keras-visualization","keras-visualizer","neural-network-visualizations","python","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/mahyar-amiri.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,"zenodo":null}},"created_at":"2020-08-08T17:51:09.000Z","updated_at":"2025-07-23T07:43:27.000Z","dependencies_parsed_at":"2025-05-13T23:47:21.280Z","dependency_job_id":"e60b3ea2-f081-417a-913e-dc9283bccc13","html_url":"https://github.com/mahyar-amiri/keras-visualizer","commit_stats":{"total_commits":41,"total_committers":1,"mean_commits":41.0,"dds":0.0,"last_synced_commit":"40fb21db5badebd06406b5efdea32b6527d4e3c0"},"previous_names":["lordmahyar/keras-visualizer"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mahyar-amiri/keras-visualizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahyar-amiri%2Fkeras-visualizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahyar-amiri%2Fkeras-visualizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahyar-amiri%2Fkeras-visualizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahyar-amiri%2Fkeras-visualizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mahyar-amiri","download_url":"https://codeload.github.com/mahyar-amiri/keras-visualizer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahyar-amiri%2Fkeras-visualizer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33827067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-02T02:00:07.132Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","keras-visualization","keras-visualizer","neural-network-visualizations","python","tensorflow","visualization"],"created_at":"2024-11-18T23:17:28.227Z","updated_at":"2026-06-02T15:00:45.692Z","avatar_url":"https://github.com/mahyar-amiri.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Keras Visualizer\n\n![LOGO](logo.png)\n\n[![PyPI](https://img.shields.io/pypi/v/keras-visualizer?label=PyPI\u0026logo=pypi\u0026logoColor=FFE873)](https://pypi.org/project/keras-visualizer)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/keras-visualizer?label=Downloads\u0026color=blue)](https://pypistats.org/packages/keras-visualizer)\n[![GitHub - License](https://img.shields.io/github/license/mahyar-amiri/django-comment-system?label=License\u0026color=blue)](LICENSE)\n[![Virgool.io](https://img.shields.io/static/v1?label=Virgool.io\u0026message=keras-visualizer\u0026color=blue)](https://vrgl.ir/5KSoN)\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/mahyar-amiri/keras-visualizer/)\n\nA Python Library for Visualizing Keras Models.\n\n## Table of Contents\n\n\u003c!-- TOC --\u003e\n\n* [Keras Visualizer](#keras-visualizer)\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    * [Examples](#examples)\n        * [Example 1](#example-1)\n        * [Example 2](#example-2)\n        * [Example 3](#example-3)\n    * [Supported layers](#supported-layers)\n\n\u003c!-- TOC --\u003e\n\n## Installation\n\n### Install\n\nUse python package manager (pip) to install Keras Visualizer.\n\n```bash\npip install keras-visualizer\n```\n\n### Upgrade\n\nUse python package manager (pip) to upgrade Keras Visualizer.\n\n```bash\npip install keras-visualizer --upgrade\n```\n\n## Usage\n\n```python\nfrom keras_visualizer import visualizer\n\n# create your model here\n# model = ...\n\nvisualizer(model, file_format='png')\n```\n\n## Parameters\n\n```python\nvisualizer(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\nsettings = {\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    # OUTPUT LAYER\n    'OUTPUT_DENSE_COLOR': '#e74c3c',\n    'OUTPUT_LAYER_COLOR': 'black',\n    'OUTPUT_LAYER_FONT': 'white',\n}\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\nfrom keras_visualizer import visualizer\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\nvisualizer(model, file_format='png', settings=my_settings)\n```\n\n## Examples\n\nyou can use simple examples as `.py` or `.ipynb` format in [examples directory](examples).\n\n### Example 1\n\n```python\nfrom keras import models, layers\nfrom keras_visualizer import visualizer\n\nmodel = models.Sequential([\n    layers.Dense(64, activation='relu', input_shape=(8,)),\n    layers.Dense(6, activation='softmax'),\n    layers.Dense(32),\n    layers.Dense(9, activation='sigmoid')\n])\n\nvisualizer(model, file_format='png', view=True)\n```\n\n![example 1](examples/example1_output.png)\n\n---\n\n### Example 2\n\n```python\nfrom keras import models, layers\nfrom keras_visualizer import visualizer\n\nmodel = models.Sequential()\nmodel.add(layers.Conv2D(64, (3, 3), input_shape=(28, 28, 3), activation='relu'))\nmodel.add(layers.MaxPooling2D((2, 2)))\nmodel.add(layers.Flatten())\nmodel.add(layers.Dense(3))\nmodel.add(layers.Dropout(0.5))\nmodel.add(layers.Activation('sigmoid'))\nmodel.add(layers.Dense(1))\n\nvisualizer(model, file_format='png', view=True)\n```\n\n![example 2](examples/example2_output.png)\n\n---\n\n### Example 3\n\n```python\nfrom keras import models, layers\nfrom keras_visualizer import visualizer\n\nmodel = models.Sequential()\nmodel.add(layers.Embedding(64, output_dim=256))\nmodel.add(layers.LSTM(128))\nmodel.add(layers.Dense(1, activation='sigmoid'))\n\nvisualizer(model, file_format='png', view=True)\n```\n\n![example 3](examples/example3_output.png)\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    - [ ] 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahyar-amiri%2Fkeras-visualizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahyar-amiri%2Fkeras-visualizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahyar-amiri%2Fkeras-visualizer/lists"}