This is an implementation of the paper Interpretable Convolutional Neural Networks via Feedforward Design,
maintained by Min Zhang and Jiali Duan.
-
[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.py
orpython 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.ipynb
to 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 FGSM
python 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')
Jiali Duan (Email: [email protected])
Min Zhang (Email: [email protected])