All Projects → MisaOgura → Flashtorch

MisaOgura / Flashtorch

Licence: mit
Visualization toolkit for neural networks in PyTorch! Demo -->

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Flashtorch

Lstm Context Embeddings
Augmenting word embeddings with their surrounding context using bidirectional RNN
Stars: ✭ 57 (-89.84%)
Mutual labels:  neural-networks, cnn
Hyperdensenet
This repository contains the code of HyperDenseNet, a hyper-densely connected CNN to segment medical images in multi-modal image scenarios.
Stars: ✭ 124 (-77.9%)
Mutual labels:  neural-networks, cnn
Dltk
Deep Learning Toolkit for Medical Image Analysis
Stars: ✭ 1,249 (+122.64%)
Mutual labels:  neural-networks, cnn
Yann
This toolbox is support material for the book on CNN (http://www.convolution.network).
Stars: ✭ 41 (-92.69%)
Mutual labels:  neural-networks, cnn
Anime4k
A High-Quality Real Time Upscaler for Anime Video
Stars: ✭ 14,083 (+2410.34%)
Mutual labels:  neural-networks, cnn
Meme Generator
MemeGen is a web application where the user gives an image as input and our tool generates a meme at one click for the user.
Stars: ✭ 57 (-89.84%)
Mutual labels:  neural-networks, cnn
Codesearchnet
Datasets, tools, and benchmarks for representation learning of code.
Stars: ✭ 1,378 (+145.63%)
Mutual labels:  neural-networks, cnn
Torch Cam
Class activation maps for your PyTorch models (CAM, Grad-CAM, Grad-CAM++, Smooth Grad-CAM++, Score-CAM, SS-CAM, IS-CAM, XGrad-CAM)
Stars: ✭ 249 (-55.61%)
Mutual labels:  cnn, interpretability
Iresnet
Improved Residual Networks (https://arxiv.org/pdf/2004.04989.pdf)
Stars: ✭ 163 (-70.94%)
Mutual labels:  neural-networks, cnn
Livianet
This repository contains the code of LiviaNET, a 3D fully convolutional neural network that was employed in our work: "3D fully convolutional networks for subcortical segmentation in MRI: A large-scale study"
Stars: ✭ 143 (-74.51%)
Mutual labels:  neural-networks, cnn
Quickdraw
Implementation of Quickdraw - an online game developed by Google
Stars: ✭ 805 (+43.49%)
Mutual labels:  neural-networks, cnn
Tcdf
Temporal Causal Discovery Framework (PyTorch): discovering causal relationships between time series
Stars: ✭ 217 (-61.32%)
Mutual labels:  neural-networks, cnn
Sincnet
SincNet is a neural architecture for efficiently processing raw audio samples.
Stars: ✭ 764 (+36.19%)
Mutual labels:  neural-networks, cnn
Convisualize nb
Visualisations for Convolutional Neural Networks in Pytorch
Stars: ✭ 57 (-89.84%)
Mutual labels:  neural-networks, cnn
Tensorflow Tutorial
TensorFlow and Deep Learning Tutorials
Stars: ✭ 748 (+33.33%)
Mutual labels:  neural-networks, cnn
Sarcasmdetection
Sarcasm detection on tweets using neural network
Stars: ✭ 99 (-82.35%)
Mutual labels:  neural-networks, cnn
Text nn
Text classification models. Used a submodule for other projects.
Stars: ✭ 55 (-90.2%)
Mutual labels:  cnn, interpretability
Cnn Interpretability
🏥 Visualizing Convolutional Networks for MRI-based Diagnosis of Alzheimer’s Disease
Stars: ✭ 68 (-87.88%)
Mutual labels:  cnn, interpretability
Ncrfpp
NCRF++, a Neural Sequence Labeling Toolkit. Easy use to any sequence labeling tasks (e.g. NER, POS, Segmentation). It includes character LSTM/CNN, word LSTM/CNN and softmax/CRF components.
Stars: ✭ 1,767 (+214.97%)
Mutual labels:  neural-networks, cnn
Deep Learning With Python
Deep learning codes and projects using Python
Stars: ✭ 195 (-65.24%)
Mutual labels:  neural-networks, cnn

FlashTorch

PyPI - Python Version Build Status PyPI PyPI - License DOI Say Thanks!

A Python visualization toolkit, built with PyTorch, for neural networks in PyTorch.

Neural networks are often described as "black box". The lack of understanding on how neural networks make predictions enables unpredictable/biased models, causing real harm to society and a loss of trust in AI-assisted systems.

Feature visualization is an area of research, which aims to understand how neural networks perceive images. However, implementing such techniques is often complicated.

FlashTorch was created to solve this problem!

You can apply feature visualization techniques (such as saliency maps and activation maximization) on your model, with as little as a few lines of code.

It is compatible with pre-trained models that come with torchvision, and seamlessly integrates with other custom models built in PyTorch.

Interested?

Take a look at the quick 3min intro/demo to FlashTorch below!

FlashTorch demo

Want to try?

Head over to example notebooks on Colab!

  • Saliency maps: Saliency map demo

  • Activation maximization: Activation maximization demo

Overview

Installation

If you are installing FlashTorch for the first time:

$ pip install flashtorch

Or if you are upgrading it:

$ pip install flashtorch -U

API guide

These are currently available modules.

  • flashtorch.utils: some useful utility functions for data handling & transformation
  • flashtorch.utils.imagenet: ImageNetIndex class for easy-ish retrieval of class index
  • flashtorch.saliency.backprop: Backprop class for calculating gradients
  • flashtorch.activmax.gradient_ascent: GradientAscent class for activation maximization

You can inspect each module with Python built-in function help. The output of that is available on Quick API Guide for your convenience.

Quickstart

Use FlashTorch

Below, you can find simple demos to get you started, as well as links to some handy notebooks showing additional examples of using FlashTorch.

Image handling (flashtorch.utils)

Saliency maps (flashtorch.saliency)

Saliency in human visual perception is a subjective quality that makes certain things within the field of view stand out from the rest and grabs our attention.

Saliency maps in computer vision provide indications of the most salient regions within images. By creating a saliency map for neural networks, we can gain some intuition on "where the network is paying the most attention to" in an input image.

Using flashtorch.saliency module, let's visualize image-specific class saliency maps of AlexNet pre-trained on ImageNet classification tasks.

Saliency map of great grey owl in Alexnet

The network is focusing on the sunken eyes and the round head for this owl.

Activation maximization (flashtorch.activmax)

Activation maximization is one form of feature visualization that allows us to visualize what CNN filters are "looking for", by applying each filter to an input image and updating the input image so as to maximize the activation of the filter of interest (i.e. treating it as a gradient ascent task with filter activation values as the loss).

Using flashtorch.activmax module, let's visualize images optimized with filters from VGG16 pre-trained on ImageNet classification tasks.

VGG16 conv5_1 filters

Concepts such as 'eyes' (filter 45) and 'entrances (?)' (filter 271) seem to appear in the conv5_1 layer of VGG16.

Visit the notebook above to see what earlier layers do!

Develop FlashTorch

Here is how to setup a dev environment for FlashTorch.

From the project root:

  1. Create a conda environment.

    $ conda env create -f environment.yml
    
  2. Activate the environment.

    $ conda activate flashtorch
    
  3. Install FlashTorch in a development mode.

    $ pip install -e .
    
  4. Run the linter & test suit.

    $ flake8 flashtorch tests && pytest
    
  5. Add a kernel to Jupyter notebook.

    $ python -m ipykernel install --user --name flashtorch \
      --display-name <e.g. flashtorch-dev>
    
  6. Launch Jupyter notebook

    $ jupyter notebook
    
  7. Open a notebook in the ./examples directory.

  8. From the top menu, Kernel -> Change kernel -> flashtorch-dev

  9. From the top menu, Cell -> Run All

If the test suit runs and all the cells in the notebook execute - congratulations, you're good to go!

If you encounter any problem setting up the dev environment, please open an issue.

How to contribute

Thanks for your interest in contributing!

Please first head over to the Code of Conduct, which helps set the ground rules for participation in communities and helps build a culture of respect.

Next, please make sure that you have a dev environment set up (see the Develop FlashTorch section above).

Still here? Great! There are many ways to contribute to this project. Get started here.

Resources

Talks & blog posts

Reading

Inspiration

Citation

Misa Ogura, & Ravi Jain. (2020, January 2).
MisaOgura/flashtorch: 0.1.2 (Version v0.1.2).
Zenodo. http://doi.org/10.5281/zenodo.3596650

Author

Misa Ogura

Medium | twitter | LinkedIn

R&D Software Engineer @ BBC

Co-founder of Women Driven Development

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].