Code Monkey home page Code Monkey logo

mi_with_da's Introduction

Code for AAAI2021 paper "How Does Data Augmentation Affect Privacy in Machine Learning?"

Dependency

This code is tested with torch 1.5 and numpy 1.14.

We use benchmark datasets CIFAR10 and CIFAR100. The program will download the dataset automatically at the first run.

Training target model

We use random seed to generate individual transformation. Each integer seed corresponds to a different transformation. Therefore, the random seeds chosen during training can be used to re-generate augmented instances that the model is trained on.

The following command trains a ResNet110 model with 10 augmented instances for each image.

CUDA_VISIBLE_DEVICES=0 python cifar_train.py --arch resnet110 --aug_instances 10 --sess resnet110_N10

After standard training procedure, we record the outputs of trained model (loss and logits) in the results folder.

You can also train with WRN16-8 and 2-layer ConvNet. The commands are listed below.

CUDA_VISIBLE_DEVICES=0 python cifar_train.py --arch wrn16_8 --aug_instances 10 --weight_decay 5e-4  --sess wrn16_8_N10 

CUDA_VISIBLE_DEVICES=0 python cifar_train.py --arch convnet --aug_instances 10 --trainset_size 15000 --batchsize 256 --lr 0.01 --weight_decay 0.  --sess smallconv_N10

Set aug_instance 0 will train the target model without data augmentation. You can train above models on CIFAR100 by adding --c100 flag.

Evaluating membership inference algorithms

We implement five MI algorithms in mi_attack.py. You can evaluate them simultaneously with a given session name.

python mi_attack.py --sess resnet110_N10 --aug_instances 10

python mi_attack.py --sess wrn16_8_c100_N10 --aug_instances 10 --c100

The --random_t flag allows one to evalute our algorithms with augmented data which is not used in training.

python mi_attack.py --sess resnet110_N10 --aug_instances 10 --random_t

Citation

@inproceedings{yu2021how,
  title={How Does Data Augmentation Affect Privacy in Machine Learning?},
  author={Yu, Da and Zhang, Huishuai and Chen, Wei and Yin, Jian and Liu, Tie-Yan},
 year      = {2021},
 booktitle = {Proc. of the AAAI Conference on Artificial Intelligence}
}

mi_with_da's People

Contributors

dayu11 avatar

Stargazers

Shuo Shi avatar  avatar Dayrker avatar Ofey avatar Pan He avatar  avatar  avatar Yi Liu avatar

Watchers

James Cloos avatar  avatar

Forkers

melondli

mi_with_da's Issues

target model without data augmentation

Hi,I want to train the target model without data augmentation。I set the aug_instances to 0 ,but it reported ‘’a must be greater than 0 unless no samples are taken‘’ .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.