{"id":18545432,"url":"https://github.com/foxpace/signalscreen","last_synced_at":"2026-04-24T16:06:15.843Z","repository":{"id":126280789,"uuid":"337540404","full_name":"Foxpace/SignalScreen","owner":"Foxpace","description":"Set of functions for visual interpretation of 1D neural networks compatible with Tensorflow 2.0","archived":false,"fork":false,"pushed_at":"2021-02-11T11:10:13.000Z","size":471,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-15T06:11:13.523Z","etag":null,"topics":["1d","interpretation","keras","signal","signal-processing","tensorflow2","tf2","visualisation"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/Foxpace.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":"2021-02-09T21:25:02.000Z","updated_at":"2024-12-24T11:14:24.000Z","dependencies_parsed_at":"2023-06-16T03:00:08.843Z","dependency_job_id":null,"html_url":"https://github.com/Foxpace/SignalScreen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Foxpace/SignalScreen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foxpace%2FSignalScreen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foxpace%2FSignalScreen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foxpace%2FSignalScreen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foxpace%2FSignalScreen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Foxpace","download_url":"https://codeload.github.com/Foxpace/SignalScreen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foxpace%2FSignalScreen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32230438,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: 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":["1d","interpretation","keras","signal","signal-processing","tensorflow2","tf2","visualisation"],"created_at":"2024-11-06T20:20:11.803Z","updated_at":"2026-04-24T16:06:15.837Z","avatar_url":"https://github.com/Foxpace.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SignalScreen\n\nSet of functions for **visual interpretation of 1D neural networks compatible with Tensorflow 2.0**.\nThe set provides 3 different approaches:\n* [Occlusion sensitivity](https://arxiv.org/abs/1311.2901)\n* [Saliency maps](https://arxiv.org/abs/1312.6034)\n* [Grad-CAM](https://arxiv.org/abs/1610.02391)\n\n## Installation\n\nMeanwhile, the library is not available with pip install. Download the two files \"_signal_screen.py_\" and \n\"_signal_screen_tools.py_\", and you should be good to go. \n\n**Tested for configuration:**\n* Tensorflow 2.3.2\n* Python 3.6.7\n\n**Required libraries:**\n* [Tensorflow 2.x.x](https://www.tensorflow.org/install)\n* [NumPy](https://numpy.org/install/)\n* [Matplotlib](https://matplotlib.org/users/installing.html)\n* [SciPy](https://www.scipy.org/)\n* [tqdm](https://github.com/tqdm/tqdm) - optional\n\n## Usage\n### Occlusion sensitivity\n```python\nimport signal_screen\nimport signal_screen_tools\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# preprocess your data\n# create your model\n\nnumber_of_classes = 5\n\n# set up chart by yourself\nfig, axs = plt.subplots(nrows=number_of_classes, ncols=1)\nfig.suptitle(\"Occlusion sensitivity\")\nfig.tight_layout()\nfig.set_size_inches(10, 10)\naxs = axs.ravel()\n\n# iterate through your data, which you want to visualise\nfor c, row, ax, title in zip(range(number_of_classes), examples_to_visualise, axs, titles):\n    # pass model and input for the model - multiple inputs could be done by \n    # e.g. np.expand_dims(X_test[5:10, :], axis=(2))\n    sensitivity, _ = signal_screen.calculate_occlusion_sensitivity(model=model, # your model\n                                                                   # input of the model\n                                                                   data=np.expand_dims(X_test[row, :], axis=(0, 2)), \n                                                                   c=c,  # index of class to visualise\n                                                                   number_of_zeros=[15])  # length of window \n\n    # create gradient plot - inner tool for gradient chart\n    signal_screen_tools.plot_with_gradient(ax=ax, y=X_test[row, :].ravel(), gradient=sensitivity[0], title=title)\n\nplt.show()\n```\n\n![Occlussion sensitivity](images/occlusion_sensitivity.png)\n\n### Saliency maps\n\n```python\n# the same imports and preprocessing\nnumber_of_classes = 5\n\n# set up chart by yourself\nfig, axs = plt.subplots(nrows=number_of_classes, ncols=1)\nfig.suptitle(\"Saliency maps\")\nfig.tight_layout()\nfig.set_size_inches(10, 10)\naxs = axs.ravel()\n\n# iterate through your data, which you want to visualise\nfor c, row, ax, title in zip(range(number_of_classes), examples_to_visualise, axs, titles):\n    # pass model and input for the model - multiple inputs could be done by \n    # e.g. np.expand_dims(X_test[5:10, :], axis=(2))\n    saliency_map = signal_screen.calculate_saliency_map(model=model, # your model\n                                                        # input of the model\n                                                        data=np.expand_dims(X_test[row, :], axis=0),\n                                                        c=c)  # index of class to visualise\n    # create gradient plot - inner tool for gradient chart\n    signal_screen_tools.plot_with_gradient(ax=ax, y=X_test[row, :].ravel(), gradient=saliency_map, title=title)\n\nplt.show()\n```\n\n![Occlussion sensitivity](images/saliency_map.png)\n\n### Grad-CAM\n```python\n# the same imports and preprocessing\nnumber_of_classes = 5\n\n# set up chart by yourself\nfig, axs = plt.subplots(nrows=number_of_classes, ncols=1)\nfig.suptitle(\"Grad-CAM\")\nfig.tight_layout()\nfig.set_size_inches(10, 10)\naxs = axs.ravel()\n\n# iterate through your data, which you want to visualise\nfor c, row, ax, title in zip(range(number_of_classes), examples_to_visualise, axs, titles):\n    # pass model and input for the model - multiple inputs could be done by \n    # e.g. np.expand_dims(X_test[5:10, :], axis=(2))\n    grad_cam = signal_screen.calculate_grad_cam(model=model,\n                                                # in case of one input, expand dims is required with axis 0\n                                                data=X_test[row:row+5, :], \n                                                c=c) # index of class to visualise\n                                                \n    grad_cam = np.average(grad_cam, axis=0)  # averaging outputs of grad-cam\n    \n    # create gradient plot - inner tool for gradient chart\n    signal_screen_tools.plot_with_gradient(ax=ax, y=X_test[row, :].ravel(), gradient=grad_cam, title=title)\n\nplt.show()\n```\n\n![Occlussion sensitivity](images/grad_cam.png)\n\n\n### [For whole example and explanation visit jupiter notebook \"example.ipynb\"](example.ipynb)\n\n## References:\n* [Occlusion sensitivity - \"Visualizing and Understanding Convolutional Networks\" by Matthew D Zeiler, Rob Fergus](https://arxiv.org/abs/1311.2901)\n* [Saliency maps - \"Deep Inside Convolutional Networks: Visualising Image Classification Models and Saliency Maps\" by Karen Simonyan, Andrea Vedaldi, Andrew Zisserman](https://arxiv.org/abs/1312.6034)\n* [Grad-CAM - \"Grad-CAM: Visual Explanations from Deep Networks via Gradient-based Localization\" by Ramprasaath R. Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, Dhruv Batra](https://arxiv.org/abs/1610.02391)\n\n## Other useful libraries for images and other models:\n* [SHAP](https://github.com/slundberg/shap) - A game theoretic approach to explain the output of any machine learning model\n* [tf-explain](https://github.com/sicara/tf-explain) - Interpretability Methods for tf.keras models with Tensorflow 2.x\n* [tf-keras-vis](https://github.com/keisen/tf-keras-vis) - Neural network visualization toolkit for tf.keras\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxpace%2Fsignalscreen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoxpace%2Fsignalscreen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxpace%2Fsignalscreen/lists"}