GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - antonyalexos/LWTA-SBP-Adversarial-Robustness-DNN: A repository about Robust Deep Neural Networks with Uncertainty, Local Competition and Error-Correcting-Output-Codes in TensorFlow.

BranchesTags
Open more actions menu

Latest commit

 

History

41 Commits
41 Commits

Folders and files

NameName
Last commit message
Last commit date
models
models
 
 
models_4
models_4
 
 
plots
plots
 
 
plots_4
plots_4
 
 
results
results
 
 
svg
svg
 
 
AttackModel.py
AttackModel.py
 
 
Attack_Model-DAA.ipynb
Attack_Model-DAA.ipynb
 
 
Attack_Model.ipynb
Attack_Model.ipynb
 
 
ClassBlender.py
ClassBlender.py
 
 
Clipper.py
Clipper.py
 
 
DataAugmenter.py
DataAugmenter.py
 
 
Grayscaler.py
Grayscaler.py
 
 
Model.py
Model.py
 
 
Model_Implementations.py
Model_Implementations.py
 
 
README.md
README.md
 
 
TrainModel.py
TrainModel.py
 
 
Train_Model.ipynb
Train_Model.ipynb
 
 
adver_environment.yml
adver_environment.yml
 
 
automatic_plot.ipynb
automatic_plot.ipynb
 
 
distributions.py
distributions.py
 
 
lwta_conv2d_activation.py
lwta_conv2d_activation.py
 
 
lwta_dense_activation.py
lwta_dense_activation.py
 
 
requirements.txt
requirements.txt
 
 
sbp_lwta_con2d_layer.py
sbp_lwta_con2d_layer.py
 
 
sbp_lwta_dense_layer.py
sbp_lwta_dense_layer.py
 
 

Repository files navigation

Local Competition and Uncertainty for Adversarial Robustness

This repository is the official implementation of Local Competition and Uncertainty for Adversarial Robustness.

Requirements

We have provided the conda environment adver_environment.yml, in which we conducted the experiments. You can also see the dependencies in the file requirements.txt. There is a possibility that the command pip install -r requirements.txt may fail. For installing the conda environment use conda env create -f adver_environment.yml.

If you want to install CleverHans separately, please follow the instructions and you should probably use

pip install git+https://github.com/tensorflow/cleverhans.git#egg=cleverhans

Files

We give a brief description of the important files provided in this repository:

  • Model.py : Abstract base class implementing a baseline or ensemble model. Look at the implementation of "defineModel" in this file to see or modify the neural network architecture used by all ensemble models.

  • Model_Implementations.py : Implements model-specific methods of Model.py. Look at the implementation of "defineModelBaseline" in this file to see or modify the neural network architecture used by all baseline models.

  • Attack_Model.ipynb/Attack_Model.py : Code that runs the attacks. We have used mostly the notebook file.

  • Train_Model.ipynb/Train_Model.py : Code for training the models. We have used mostly the notebook file.

  • automatic_plot.ipynb : It is the code for the probability distribution figures from the text.

  • distributions.py : File that contains the functions for probabilities, distributions, sampling, etc.

  • lwta_conv2d_activation.py : main code for the LWTA activation for convolutional layers.

  • lwta_dense_activation.py: main code for the LWTA activation for dense layers.

  • sbp_lwta_con2d_layer.py : file that contains the code our Convolution layer with IBP and LWTA.

  • sbp_lwta_dense_layer.py : file that contains the code our Dense layer with IBP and LWTA.

Training

To train the model(s) in the paper, run either the Train_Model.ipynb or Train_Model.py. For the latter run:

python Train_Model.py

It is important to mention that the code runs eagerly. So for training comment the line 9 in Model_Implementations.py, and line 11 in Model.py. For MNIST dataset uncomment the lines for MNIST dataset parameters in file Train_Model.py, or Train_Model.ipynb(whichever you use), and comment the lines for CIFAR10 dataset parameters. For CIFAR10 do the opposite. For Mnist also you need to uncomment line 49 in Model_Implementations.py and comment line 47; also uncomment lines 114,115 in Model.py and comment lines 111,112. For CIFAR10 do the opposite of the previous sentence. There also some helpful comments on the code to guide through this process.

If you want to run a pretrained model, make sure to uncomment line 221 in Model.py, or else the model will start training from the beginning.

Adversarial Attacks.

To run the attacks you can use either Attack_Model.ipynb or Attack_Model.py. We used mostly the notebook. In order to run the attacks you have to disable eager execution from the files Model_Implementations.py and Model.py. There are some information/instructions inside the attacks file. It works just like the Training file. Only in this case you have to take the model and its parameters from the Train_Model.py, or Train_Model.ipynband put them inside the attack file. After the execution of the attacks you can see the cells that run the plot the figures and the probabilities from the LWTA activations as we have presented them in the paper.

Pre-trained Models

Having space constraints on the supplementary material(100 mb) we have not included all the pretrained models. We uploaded only a few models with 4 competing units since they do not produce good results, and all the models with 2 competing units.

References

We have used code from here and here

About

A repository about Robust Deep Neural Networks with Uncertainty, Local Competition and Error-Correcting-Output-Codes in TensorFlow.

Topics

adversarial-attacksadversarial-machine-learningattack-modelensemble-modelsibplocal-competitionrobustnessuncertaintyuncertainty-estimationuncertainty-neural-networks

Resources

Readme
Activity

Stars

4 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.