InterpretableCNNsviaFeedforwarddesign
January 12, 2019 ยท View on GitHub
This is an implementation of the paper Interpretable Convolutional Neural Networks via Feedforward Design,
maintained by Min Zhang and Jiali Duan.
Table of Content
-
[Requirements]
- Python3, keras, tensorflow, sklearn, cleverhans (Refer to https://github.com/tensorflow/cleverhans), pickle
-
[Dataset] ( Hand-written digits classification)
- [MNIST] ( train set: 60000, 28x28. Downloaded from Keras)
- [CIFAR10] ( train set: 50000, 32*32. Downloaded from Keras)
-
[Installation] (rensorflow, keras, pickle, sklearn and skimage)
- [Sklearn Installation] Refer to http://scikit-learn.org/stable/install.html)
- [Skimage Installation] (Refer to http://scikit-image.org/docs/dev/install.html)
- [Optional: Jupyter Notebook] (Refer to http://jupyter.org/install.html)
-
[Feedforward Steps]
- Command
python Getkernel.py, getting convolutional layers kernels - Command
python Getfeature.py, getting feature after convolution - Command
python Getweight.py, getting fully connected layers kernels and training accuracy - Command
python mnist_test.pyorpython test.py, getting test accuracy
- Command
-
[Adversarial attacks]
- BP/ff models are provided for cifar10 and mnist dataset under folder
dataset_structure_model - Models can be trained from scratch if no filename is specified
- By changing adversarial attack methods, different algorithms can be tested
- Refer to
show_sample.ipynbto visualize generated adversarial samples
- BP/ff models are provided for cifar10 and mnist dataset under folder
-
[Example usage]
python cifar_keras.py -train_dir cifar_BP_model -filename cifar.ckpt -method FGSMpython cifar_keras.py -train_dir cifar_ff_model -filename FF_init_model.ckpt -method BIM
cifar_keras.py:
--batch_size: Size of training batches
(default: '128')
(an integer)
--filename: Checkpoint filename.
(default: 'FF_init_model.ckpt')
--learning_rate: Learning rate for training
(default: '0.001')
(a number)
--[no]load_model: Load saved model or train.
(default: 'true')
--method: Adversarial attack method
(default: 'FGSM')
--nb_epochs: Number of epochs to train model
(default: '40')
(an integer)
--train_dir: Directory where to save model.
(default: 'cifar_ff_model')
Contact me
Jiali Duan (Email: jialidua@usc.edu)
Min Zhang (Email: zhan980@usc.edu)