{"id":13935544,"url":"https://github.com/ashutosh1919/explainable-cnn","last_synced_at":"2025-04-05T15:05:42.873Z","repository":{"id":42659612,"uuid":"469489692","full_name":"ashutosh1919/explainable-cnn","owner":"ashutosh1919","description":"📦 PyTorch based visualization package for generating layer-wise explanations for CNNs.","archived":false,"fork":false,"pushed_at":"2023-08-29T09:02:41.000Z","size":4181,"stargazers_count":225,"open_issues_count":1,"forks_count":33,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-28T17:01:46.098Z","etag":null,"topics":["cnn","cnn-classification","cnn-pytorch","cnn-visualization","cnn-visualization-technique","explainable-ai","explainable-ml","grad-cam","grad-cam-visualization","guided-backpropagation","guided-grad-cam","pytorch","pytorch-implementation","saliency-detection","saliency-map","visualization"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/explainable-cnn/","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/ashutosh1919.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-03-13T20:41:33.000Z","updated_at":"2025-03-25T04:49:09.000Z","dependencies_parsed_at":"2022-09-01T08:10:38.094Z","dependency_job_id":null,"html_url":"https://github.com/ashutosh1919/explainable-cnn","commit_stats":{"total_commits":41,"total_committers":5,"mean_commits":8.2,"dds":"0.14634146341463417","last_synced_commit":"c935ecae57b7e94df5368324f7e47bf7cdd9f2b0"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashutosh1919%2Fexplainable-cnn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashutosh1919%2Fexplainable-cnn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashutosh1919%2Fexplainable-cnn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashutosh1919%2Fexplainable-cnn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashutosh1919","download_url":"https://codeload.github.com/ashutosh1919/explainable-cnn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246970262,"owners_count":20862512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cnn","cnn-classification","cnn-pytorch","cnn-visualization","cnn-visualization-technique","explainable-ai","explainable-ml","grad-cam","grad-cam-visualization","guided-backpropagation","guided-grad-cam","pytorch","pytorch-implementation","saliency-detection","saliency-map","visualization"],"created_at":"2024-08-07T23:01:52.097Z","updated_at":"2025-04-05T15:05:42.855Z","avatar_url":"https://github.com/ashutosh1919.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Explainable CNNs\n[![Torch Version](https://img.shields.io/badge/torch\u003e=1.10.0-61DAFB.svg?style=flat-square)](#torch) [![Torchvision Version](https://img.shields.io/badge/torchvision\u003e=0.2.2-yellow.svg?style=flat-square)](#torchvision) [![Python Version](https://img.shields.io/badge/python-\u003e=3.6-blue.svg?style=flat-square)](#python) [![test workflow](https://github.com/ashutosh1919/explainable-cnn/blob/main/.github/workflows/test_workflow.yml/badge.svg)](#test_workflow) [![Price](https://img.shields.io/badge/price-free-ff69b4.svg?style=flat-square)](#price) [![Maintained](https://img.shields.io/badge/maintained-yes-green.svg?style=flat-square)](#maintained)\n\n**📦 Flexible visualization package for generating layer-wise explanations for CNNs.**\n\nIt is a common notion that a Deep Learning model is considered as a black box. Working towards this problem, this project provides flexible and easy to use `pip` package `explainable-cnn` that will help you to create visualization for any `torch` based CNN model. Note that it uses one of the data centric approach. This project focusses on making the internal working of the Neural layers more transparent. In order to do so, `explainable-cnn` is a plug \u0026 play component that visualizes the layers based on on their gradients and builds different representations including Saliency Map, Guided BackPropagation, Grad CAM and Guided Grad CAM. \n\n## Architechture\n\n\u003cp align=\"center\"\u003e\n\u003cimg src = \"https://github.com/ashutosh1919/explainable-cnn/blob/main/data/architecture.png\"\u003e\u003c/img\u003e\n\u003c/p\u003e\n:star: Star us on GitHub — it helps!\n\n## Usage\n\nInstall the package \n\n```bash\npip install explainable-cnn\n```\n\nTo create visualizations, create an instance of `CNNExplainer`.\n\n```python\nfrom explainable_cnn import CNNExplainer\n\nx_cnn = CNNExplainer(...)\n```\n\nThe following method calls returns `numpy` arrays corresponding to image for different types of visualizations.\n\n```python\nsaliency_map = x_cnn.get_saliency_map(...)\n\ngrad_cam = x_cnn.get_grad_cam(...)\n\nguided_grad_cam = x_cnn.get_guided_grad_cam(...)\n```\n\n\u003cp\u003eTo see full list of arguments and their usage for all methods, please refer to \u003ca href=\"https://github.com/ashutosh1919/explainable-cnn/blob/main/src/explainable_cnn/explainers/cnn_explainer.py\"\u003ethis file\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eYou may want to look at example usage in the \u003ca href=\"https://github.com/ashutosh1919/explainable-cnn/blob/main/examples/explainable_cnn_usage.ipynb\"\u003eexample notebook\u003c/a\u003e.\u003c/p\u003e\n\n## Output\n\u003cp\u003eBelow is a comparison of the visualization generated between GradCam and GuidedGradCam \u003c/p\u003e\n\n\u003cp align=\"center\"\u003e \n    \u003cimg src=\"https://github.com/ashutosh1919/explainable-cnn/blob/main/data/outputs/explainable-cnn-output.png\" align=\"center\" height=\"1000px\"\u003e\u003c/img\u003e\n\u003c/p\u003e\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/ashutosh1919\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/20843596?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAshutosh Hathidara\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ashutosh1919/explainable-cnn/commits?author=ashutosh1919\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#design-ashutosh1919\" title=\"Design\"\u003e🎨\u003c/a\u003e \u003ca href=\"#research-ashutosh1919\" title=\"Research\"\u003e🔬\u003c/a\u003e \u003ca href=\"#maintenance-ashutosh1919\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"#tutorial-ashutosh1919\" title=\"Tutorials\"\u003e✅\u003c/a\u003e \u003ca href=\"https://github.com/ashutosh1919/explainable-cnn/commits?author=ashutosh1919\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/L-Pandey\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/90662028?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eLalit Pandey\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#research-L-Pandey\" title=\"Research\"\u003e🔬\u003c/a\u003e \u003ca href=\"https://github.com/ashutosh1919/explainable-cnn/commits?author=L-Pandey\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n## References\n\n- [Grad-CAM: Visual Explanations from Deep Networks via Gradient-based Localization](https://arxiv.org/pdf/1610.02391.pdf)\n- [Grad CAM demonstrations in PyTorch](https://github.com/kazuto1011/grad-cam-pytorch)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashutosh1919%2Fexplainable-cnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashutosh1919%2Fexplainable-cnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashutosh1919%2Fexplainable-cnn/lists"}