All Projects → TooTouch → WhiteBox-Part1

TooTouch / WhiteBox-Part1

Licence: MIT License
In this part, I've introduced and experimented with ways to interpret and evaluate models in the field of image. (Pytorch)

Programming Languages

Jupyter Notebook
11667 projects

Projects that are alternatives of or similar to WhiteBox-Part1

Interpret
Fit interpretable models. Explain blackbox machine learning.
Stars: ✭ 4,352 (+12700%)
Mutual labels:  blackbox, interpretable-ai, explainable-ai
Deeplearning
Deep Learning From Scratch
Stars: ✭ 66 (+94.12%)
Mutual labels:  mnist, backpropagation
Deep Learning From Scratch
Six snippets of code that made deep learning what it is today.
Stars: ✭ 255 (+650%)
Mutual labels:  mnist, backpropagation
Pytorch Cnn Visualizations
Pytorch implementation of convolutional neural network visualization techniques
Stars: ✭ 6,167 (+18038.24%)
Mutual labels:  grad-cam, guided-backpropagation
Pytorch Grad Cam
Many Class Activation Map methods implemented in Pytorch for CNNs and Vision Transformers. Including Grad-CAM, Grad-CAM++, Score-CAM, Ablation-CAM and XGrad-CAM
Stars: ✭ 3,814 (+11117.65%)
Mutual labels:  grad-cam, interpretable-ai
InterpretDL
InterpretDL: Interpretation of Deep Learning Models,基于『飞桨』的模型可解释性算法库。
Stars: ✭ 121 (+255.88%)
Mutual labels:  grad-cam, smoothgrad
self critical vqa
Code for NeurIPS 2019 paper ``Self-Critical Reasoning for Robust Visual Question Answering''
Stars: ✭ 39 (+14.71%)
Mutual labels:  interpretable-ai, explainable-ai
mllp
The code of AAAI 2020 paper "Transparent Classification with Multilayer Logical Perceptrons and Random Binarization".
Stars: ✭ 15 (-55.88%)
Mutual labels:  interpretable-ai, explainable-ai
gans-2.0
Generative Adversarial Networks in TensorFlow 2.0
Stars: ✭ 76 (+123.53%)
Mutual labels:  mnist, cifar-10
fast-tsetlin-machine-with-mnist-demo
A fast Tsetlin Machine implementation employing bit-wise operators, with MNIST demo.
Stars: ✭ 58 (+70.59%)
Mutual labels:  mnist, explainable-ai
zennit
Zennit is a high-level framework in Python using PyTorch for explaining/exploring neural networks using attribution methods like LRP.
Stars: ✭ 57 (+67.65%)
Mutual labels:  interpretable-ai, explainable-ai
diffhask
DSL for forward and reverse mode automatic differentiation in Haskell. Port of DiffSharp.
Stars: ✭ 26 (-23.53%)
Mutual labels:  backpropagation
ELM-pytorch
Extreme Learning Machine implemented in Pytorch
Stars: ✭ 68 (+100%)
Mutual labels:  mnist
cifar-tensorflow
No description or website provided.
Stars: ✭ 18 (-47.06%)
Mutual labels:  cifar-10
COVID-CXNet
COVID-CXNet: Diagnosing COVID-19 in Frontal Chest X-ray Images using Deep Learning. Preprint available on arXiv: https://arxiv.org/abs/2006.13807
Stars: ✭ 48 (+41.18%)
Mutual labels:  grad-cam
cifar10
Predict CIFAR-10 labels with 88% accuracy using keras.
Stars: ✭ 32 (-5.88%)
Mutual labels:  cifar-10
keras-triplet-center-loss
Simple Keras implementation of Triplet-Center Loss on the MNIST dataset
Stars: ✭ 34 (+0%)
Mutual labels:  mnist
tailwindcss-landing-gradients
A landing page made with tailwindcss and the new Gradient feature.
Stars: ✭ 41 (+20.59%)
Mutual labels:  gradients
dextop
Dextop - Linux-based distribution workstation on Android
Stars: ✭ 24 (-29.41%)
Mutual labels:  blackbox
DenseNet-Cifar10
Train DenseNet on Cifar-10 based on Keras
Stars: ✭ 39 (+14.71%)
Mutual labels:  cifar-10

WhiteBox - Part1

Hits

The White Box Project is a project that introduces many ways to solve the part of the black box of machine learning. In this part, i've introduced and experimented with ways to interpret and evaluate models in the field of image.

I shared Korean versions for each reference to study methodology and English. Please refer to the reference.
참고자료별로 영어공부겸 한국어로 번역한 자료가 있습니다.

Requirements

pytorch >= 1.2.0
torchvision == 0.4.0

How to Run

Model Train

python main.py --train --target=['mnist','cifar10'] --attention=['CAM','CBAM','RAN','WARN']

Model Selectivity Evaluation

python main.py --eval=selectivity --target=['mnist','cifar10'] --method=['VGB','IB','DeconvNet','IG','GB','GC','GBGC']

Model ROAR & KAR Evaluation
For ROAR and KAR, the saliency map of each attribution methods that you want to evaluate must be saved prior to the evaluation.

python main.py --eval=['ROAR','KAR'] --target=['mnist','cifar10'] --method=['VGB','IB','DeconvNet','IG','GB','GC','GBGC']

Dataset

  • MNIST
  • CIFAR-10

Models

Simple CNN Model

  • 3 convolution layers networks (Simple CNN)

Attention Modules

  • Convolutional Block Attention Module (CBAM) [1]

Attention Models

  • Class Activation Methods (CAM) [2]
  • Residual Attention Network (RAN) [3]
  • Wide Attention Residual Network (WARN) [4]

Interpretable Methods

Attribution Methods

Ensemble Methods

  • SmoothGrad (SG) [9]
  • SmoothGrad-Squared (SG-SQ) [10]
  • SmoothGrad-VAR (SG-VAR) [10]

Evaluation

  • Coherence
  • Selectivity
  • Remove and Retrain (ROAR) [10]
  • Keep and Retrain (KAR) [10]

Experiments

Model Architecture & Performance

More information on the model architectures and learning process can be found on the notebook : [Evaluation] - Model Performance

MNIST Number of Parameters 0 - zero 1 - one 2 - two 3 - three 4 - four 5 - five 6 - six 7 - seven 8 - eight 9 - nine Total
Simple CNN 1284042 0.998 0.995 0.995 0.995 0.993 0.990 0.986 0.989 0.996 0.985 0.992
Simple CNN + CAM 1285332 0.994 0.995 0.989 0.995 0.988 0.988 0.993 0.981 0.986 0.977 0.988
Simple CNN + CBAM 1288561 0.998 0.995 0.992 0.996 0.990 0.990 0.990 0.991 0.995 0.989 0.993
RAN 27987466 0.997 0.998 0.996 0.995 0.989 0.991 0.996 0.988 0.994 0.990 0.994
CIFAR10 Number of Parameters airplane automobile bird cat deer dog frog horse ship truck Total
Simple CNN 2202122 0.872 0.905 0.692 0.731 0.843 0.660 0.904 0.864 0.860 0.916 0.825
Simple CNN + CAM 2203412 0.760 0.896 0.585 0.477 0.752 0.804 0.769 0.711 0.837 0.862 0.745
Simple CNN + CBAM 2206641 0.858 0.945 0.749 0.685 0.790 0.761 0.826 0.798 0.873 0.896 0.818
RAN 27990666 0.843 0.882 0.758 0.701 0.776 0.586 0.916 0.844 0.924 0.873 0.810

Evaluation Results

Saliency maps by Layers

Saliency maps by layers : CIFAR10

Top : SimpleCNN / Bottom : SimpleCNN + CBAM

Saliency maps of RAN by layers : CIFAR10

Coherence

[Notebook]

Coherence is a qualitative evaluation method that shows the importance of images. Attributions should fall on discriminative features (e.g. the object of interest).

Saliency maps of each attribution methods applied to the Simple CNN : MNIST & CIFAR10
mnist_coherence
cifar10_coherence

Selectivity

[Notebook]

Selecticity is a method for quantitative evaluation of the attribution methods. The evaluation method is largely divided into two courses. First, the feature map for the image is created and the most influential part is deleted from the image. The second is to create the feature map again with the modified image and repeat the first process.

As a result, IB, GB and GB-GC were the most likely attribution methods to degrade the performance of models for the two datasets.

selectivity

MNIST

CIFAR-10

ROAR/KAR

ROAR/KAR is a method for quantitative evaluation of the attribution methods that how the performance of the classifier changes as features are removed based on the attribution method.

  • ROAR : replace N% of pixels estimated to be most important [Notebook]
  • KAR : replace N% of pixels estimated to be least important
  • Retrain Model and measure change in test accuracy

ROAR and KAR graph of saliency maps of each attribution methods applied to the Simple CNN

ROAR and KAR graph of saliency maps extracted by Grad-CAM for each model

Reference

  • [1] Woo, S., Park, J., Lee, J. Y., & So Kweon, I. (2018). Cbam: Convolutional block attention module. In Proceedings of the European Conference on Computer Vision (ECCV) (pp. 3-19). [Paper]

  • [2] Zhou, B., Khosla, A., Lapedriza, A., Oliva, A., & Torralba, A. (2016). Learning deep features for discriminative localization. In Proceedings of the IEEE conference on computer vision and pattern recognition (pp. 2921-2929). [Paper]

  • [3] Wang, F., Jiang, M., Qian, C., Yang, S., Li, C., Zhang, H., ... & Tang, X. (2017). Residual attention network for image classification. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (pp. 3156-3164). [Paper]

  • [4] Rodríguez, P., Gonfaus, J. M., Cucurull, G., XavierRoca, F., & Gonzalez, J. (2018). Attend and rectify: a gated attention mechanism for fine-grained recovery. In Proceedings of the European Conference on Computer Vision (ECCV) (pp. 349-364). [Paper]

  • [5] Zeiler, M. D., & Fergus, R. (2014, September). Visualizing and understanding convolutional networks. In European conference on computer vision (pp. 818-833). Springer, Cham. [Paper] [Korean version]

  • [6] Springenberg, J. T., Dosovitskiy, A., Brox, T., & Riedmiller, M. (2014). Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806. [Paper]

  • [7] Sundararajan, M., Taly, A., & Yan, Q. (2017, August). Axiomatic attribution for deep networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70 (pp. 3319-3328). JMLR. org. [Paper]

  • [8] Selvaraju, R. R., Cogswell, M., Das, A., Vedantam, R., Parikh, D., & Batra, D. (2017). Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE International Conference on Computer Vision (pp. 618-626). [Paper] [Korean version]

  • [9] Smilkov, D., Thorat, N., Kim, B., Viégas, F., & Wattenberg, M. (2017). Smoothgrad: removing noise by adding noise. arXiv preprint arXiv:1706.03825. [Paper] [Korean version]

  • [10] Hooker, S., Erhan, D., Kindermans, P. J., & Kim, B. (2018). Evaluating feature importance estimates. arXiv preprint arXiv:1806.10758. [Paper] [Korean version]

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].