All Projects → alinlab → consistency-adversarial

alinlab / consistency-adversarial

Licence: other
Consistency Regularization for Adversarial Robustness (AAAI 2022)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to consistency-adversarial

KitanaQA
KitanaQA: Adversarial training and data augmentation for neural question-answering models
Stars: ✭ 58 (+56.76%)
Mutual labels:  data-augmentation, adversarial-training
Tensorflow-data-loader
Reading data into tensorflow using tf.data function
Stars: ✭ 15 (-59.46%)
Mutual labels:  data-augmentation
fastai sparse
3D augmentation and transforms of 2D/3D sparse data, such as 3D triangle meshes or point clouds in Euclidean space. Extension of the Fast.ai library to train Sub-manifold Sparse Convolution Networks
Stars: ✭ 46 (+24.32%)
Mutual labels:  data-augmentation
adan
Language-Adversarial Training for Cross-Lingual Text Classification (TACL)
Stars: ✭ 60 (+62.16%)
Mutual labels:  adversarial-training
semantic-parsing-dual
Source code and data for ACL 2019 Long Paper ``Semantic Parsing with Dual Learning".
Stars: ✭ 17 (-54.05%)
Mutual labels:  data-augmentation
resnet-cifar10
ResNet for Cifar10
Stars: ✭ 21 (-43.24%)
Mutual labels:  data-augmentation
Keras-MultiClass-Image-Classification
Multiclass image classification using Convolutional Neural Network
Stars: ✭ 48 (+29.73%)
Mutual labels:  data-augmentation
numpy-data-augmentation
Data Augmentation using NumPy
Stars: ✭ 50 (+35.14%)
Mutual labels:  data-augmentation
mixup
speechpro.com/
Stars: ✭ 23 (-37.84%)
Mutual labels:  data-augmentation
elasticdeform
Differentiable elastic deformations for N-dimensional images (Python, SciPy, NumPy, TensorFlow, PyTorch).
Stars: ✭ 134 (+262.16%)
Mutual labels:  data-augmentation
bird species classification
Supervised Classification of bird species 🐦 in high resolution images, especially for, Himalayan birds, having diverse species with fairly low amount of labelled data
Stars: ✭ 59 (+59.46%)
Mutual labels:  data-augmentation
FeatureScatter
Feature Scattering Adversarial Training
Stars: ✭ 64 (+72.97%)
Mutual labels:  adversarial-training
mnist-challenge
My solution to TUM's Machine Learning MNIST challenge 2016-2017 [winner]
Stars: ✭ 68 (+83.78%)
Mutual labels:  data-augmentation
Awesome-Few-Shot-Image-Generation
A curated list of papers, code and resources pertaining to few-shot image generation.
Stars: ✭ 209 (+464.86%)
Mutual labels:  data-augmentation
allie
🤖 A machine learning framework for audio, text, image, video, or .CSV files (50+ featurizers and 15+ model trainers).
Stars: ✭ 93 (+151.35%)
Mutual labels:  data-augmentation
AdMRL
Code for paper "Model-based Adversarial Meta-Reinforcement Learning" (https://arxiv.org/abs/2006.08875)
Stars: ✭ 30 (-18.92%)
Mutual labels:  adversarial-training
candock
A time series signal analysis and classification framework
Stars: ✭ 56 (+51.35%)
Mutual labels:  data-augmentation
augraphy
Augmentation pipeline for rendering synthetic paper printing, faxing, scanning and copy machine processes
Stars: ✭ 49 (+32.43%)
Mutual labels:  data-augmentation
general backbone
No description or website provided.
Stars: ✭ 37 (+0%)
Mutual labels:  data-augmentation
Robust-Semantic-Segmentation
Dynamic Divide-and-Conquer Adversarial Training for Robust Semantic Segmentation (ICCV2021)
Stars: ✭ 25 (-32.43%)
Mutual labels:  adversarial-training

Consistency Regularization for Adversarial Robustness

Official PyTorch implementation of Consistency Regularization for Adversarial Robustness (AAAI 2022) by Jihoon Tack, Sihyun Yu, Jongheon Jeong, Minseon Kim, Sung Ju Hwang, and Jinwoo Shin.

1. Dependencies

conda create -n con-adv python=3
conda activate con-adv

conda install pytorch torchvision cudatoolkit=11.0 -c pytorch 

pip install git+https://github.com/fra31/auto-attack
pip install advertorch tensorboardX

2. Training

2.1. Training option and description

The option for the training method is as follows:

  • <DATASET>: {cifar10,cifar100,tinyimagenet}
  • <AUGMENT>: {base,autoaug,autoaug_sche}
  • <ADV_TRAIN OPTION>: {adv_train,adv_trades,adv_mart}

Current code are assuming l_infinity constraint adversarial training and PreAct-ResNet-18 as a base model.
To change the option, simply modify the following configurations:

  • WideResNet-34-10: --model wrn3410
  • l_2 constraint: --distance L2

2.2. Training code

Standard cross-entropy training

# Standard cross-entropy
python train.py --mode ce --augment_type base --dataset <DATASET>

Adversarial training

# Adversarial training
python train.py --mode <ADV_TRAIN OPTION> --augment_type <AUGMENT> --dataset <DATASET>

# Example: Standard AT under CIFAR-10
python train.py --mode adv_train --augment_type base --dataset cifar10

Consistency regularization

# Consistency regularization
python train.py --consistency --mode <ADV_TRAIN OPTION> --augment_type <AUGMENT> --dataset <DATASET>

# Example: Consistency regularization based on standard AT under CIFAR-10
python train.py --consistency --mode adv_train --augment_type autoaug_sche --dataset cifar10 

3. Evaluation

3.1. Evaluation option and description

The description for treat model is as follows:

  • <DISTANCE>: {Linf,L2,L1}, the norm constraint type
  • <EPSILON>: the epsilon ball size
  • <ALPHA>: the step size of PGD optimization
  • <NUM_ITER>: iteration number of PGD optimization

3.2. Evaluation code

Evaluate clean accuracy

python eval.py --mode test_clean_acc --dataset <DATASET> --load_path <MODEL_PATH>

Evaluate clean & robust accuracy against PGD

python eval.py --mode test_adv_acc --distance <DISTANCE> --epsilon <EPSILON> --alpha <ALPHA> --n_iters <NUM_ITER> --dataset <DATASET> --load_path <MODEL_PATH>

Evaluate clean & robust accuracy against AutoAttack

python eval.py --mode test_auto_attack --epsilon <EPSILON> --distance <DISTANCE> --dataset <DATASET> --load_path <MODEL_PATH>

Evaluate mean corruption error (mCE)

python eval.py --mode test_mce --dataset <DATASET> --load_path <MODEL_PATH>

Citation

@inproceedings{tack2022consistency,
  title={Consistency Regularization for Adversarial Robustness},
  author={Jihoon Tack and Sihyun Yu and Jongheon Jeong and Minseon Kim and Sung Ju Hwang and Jinwoo Shin},
  booktitle={AAAI Conference on Artificial Intelligence},
  year={2022}
}
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].