All Projects → ashafahi → Free_adv_train

ashafahi / Free_adv_train

Official TensorFlow Implementation of Adversarial Training for Free! which trains robust models at no extra cost compared to natural training.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Free adv train

Diffai
A certifiable defense against adversarial examples by training neural networks to be provably robust
Stars: ✭ 171 (+34.65%)
Mutual labels:  attack, robust
Ml Dl Scripts
The repository provides usefull python scripts for ML and data analysis
Stars: ✭ 119 (-6.3%)
Mutual labels:  classification
Pyani
Python module for average nucleotide identity analyses
Stars: ✭ 111 (-12.6%)
Mutual labels:  classification
Jlsca
Side-channel toolkit in Julia
Stars: ✭ 114 (-10.24%)
Mutual labels:  attack
Shiftresnet Cifar
ResNet with Shift, Depthwise, or Convolutional Operations for CIFAR-100, CIFAR-10 on PyTorch
Stars: ✭ 112 (-11.81%)
Mutual labels:  classification
Bird Recognition Review
A list of useful resources in the bird sound (song and calls) recognition, such as datasets, papers, links to open source projects and competitions
Stars: ✭ 116 (-8.66%)
Mutual labels:  classification
Sytora
A sophisticated smart symptom search engine
Stars: ✭ 111 (-12.6%)
Mutual labels:  classification
Arel
Code for the ACL paper "No Metrics Are Perfect: Adversarial Reward Learning for Visual Storytelling"
Stars: ✭ 124 (-2.36%)
Mutual labels:  adversarial-learning
Mobilenet
A Clearer and Simpler MobileNet Implementation in TensorFlow
Stars: ✭ 119 (-6.3%)
Mutual labels:  classification
Nailgun
Nailgun attack on ARM devices.
Stars: ✭ 114 (-10.24%)
Mutual labels:  attack
Mlr
Machine Learning in R
Stars: ✭ 1,542 (+1114.17%)
Mutual labels:  classification
Misp Maltego
Set of Maltego transforms to inferface with a MISP Threat Sharing instance, and also to explore the whole MITRE ATT&CK dataset.
Stars: ✭ 112 (-11.81%)
Mutual labels:  attack
Model Quantization
Collections of model quantization algorithms
Stars: ✭ 118 (-7.09%)
Mutual labels:  classification
Gpnd
Generative Probabilistic Novelty Detection with Adversarial Autoencoders
Stars: ✭ 112 (-11.81%)
Mutual labels:  adversarial-learning
Project alias
Alias is a teachable “parasite” that is designed to give users more control over their smart assistants, both when it comes to customisation and privacy. Through a simple app the user can train Alias to react on a custom wake-word/sound, and once trained, Alias can take control over your home assistant by activating it for you.
Stars: ✭ 1,577 (+1141.73%)
Mutual labels:  classification
Dni.pytorch
Implement Decoupled Neural Interfaces using Synthetic Gradients in Pytorch
Stars: ✭ 111 (-12.6%)
Mutual labels:  classification
Cinc Challenge2017
ECG classification from short single lead segments (Computing in Cardiology Challenge 2017 entry)
Stars: ✭ 112 (-11.81%)
Mutual labels:  classification
Traffic Signs
Building a CNN based traffic signs classifier.
Stars: ✭ 115 (-9.45%)
Mutual labels:  classification
Robovision
AI and machine leaning-based computer vision for a robot
Stars: ✭ 126 (-0.79%)
Mutual labels:  classification
Keras transfer cifar10
Object classification with CIFAR-10 using transfer learning
Stars: ✭ 120 (-5.51%)
Mutual labels:  classification

Free Adversarial Training

This repository belongs to the Free Adversarial Training paper. The implementation is inspired by CIFAR10 Adversarial Example Challenge so to them we give the credit. This repo is for the CIFAR-10 and CIFAR-100 datasets and is in Tensorflow. Our Free-m models can acheive comparable performance with conventional PGD adversarial training at a fraction of the time.

News!: We have released our ImageNet implementation of Free adversarial training in Pytorch !

CIFAR-10 WRN 32-10 (L-inf epsilon=8):
Model Natural PGD-100 CW-100 10 restart PGD-20 train-time (min)
Natrual 95.01 0.00 0.00 0.00 780
Free-2 91.45 33.20 34.57 33.41 816
Free-4 87.83 40.35 41.96 40.73 800
Free-8 85.96 46.19 46.60 46.33 785
Free-10 83.94 45.79 45.86 45.94 785
Madry 7-PGD (public model) 87.25 45.29 46.52 45.53 5418
CIFAR-100 WRN 32-10 (L-inf epsilon=8):
Model Natural PGD-20 PGD-100 train-time (min)
Natrual 78.84 0.00 0.00 811
Free-2 69.20 15.37 14.86 816
Free-4 65.28 20.64 20.15 767
Free-8 62.13 25.88 25.58 780
Free-10 59.27 25.15 24.88 776
Madry 2-PGD trained 67.94 17.08 16.50 2053
Madry 7-PGD trained 59.87 22.76 22.52 5157

Demo

To train a new robust model for free! run the following command specifying the replay parameter m:

python free_train.py -m 8

To evaluate a robust model using PGD-20 with 2 random restarts run:

python multi_restart_pgd_attack.py --model_dir $MODEL_DIR --num_restarts 2

Note that if you have trained a CIFAR-100 model, even for evaluation, you should pass the dataset argument. For example:

python multi_restart_pgd_attack.py --model_dir $MODEL_DIR_TO_CIFAR100 --num_restarts 2 -d cifar100

Requirements

To install all the requirements plus tensorflow for multi-gpus run: (Inspired By Illarion ikhlestov )

pip install -r requirements/gpu.txt

Alternatively, to install the requirements plus tensorflow for cpu run:

pip install -r requirements/cpu.txt

To prepare the data, please see Datasets section.

If you find the paper or the code useful for your study, please consider citing the free training paper:

@article{shafahi2019adversarial,
  title={Adversarial Training for Free!},
  author={Shafahi, Ali and Najibi, Mahyar and Ghiasi, Amin and Xu, Zheng and Dickerson, John and Studer, Christoph and Davis, Larry S and Taylor, Gavin and Goldstein, Tom},
  journal={arXiv preprint arXiv:1904.12843},
  year={2019}
}
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].