Giter Site home page Giter Site logo

meminf-defense's Introduction

Source code for paper "Protect Privacy of Deep Classification Networks by Exploiting Their Generative Power"

Environment

Python=3.7
Pytorch=1.3.1

Train models at different phases

Repo structure:

  • Detailed parameters are included in params/*.txt
  • Save your models as following:
    • Save your models under: models/dataset_name/your_model_name
    • Save your meminf data under: meminf_data/dataset_name/(auto_generated)
    • Save your attack models under: attack_models/dataset_name/(auto_generated)

Train a classifier

python train_jem.py @params/cls_params.txt

Train a JEM from scratch

python train_jem.py @params/jem_params.txt

Transferring to JEM

python train_jem.py @params/transfer_params.txt

Sample from a JEM

python train_jem.py @params/sample_params.txt

Retrain/Fine-tune the model

python train_jem.py @params/retrain_params.txt

Classifier(and JEM's classifier) evaluation

python eval_wrn_ebm.py --load_path=YOUR_MODEL --eval=test_clf --dataset=cifar_test

Shadow model attack

Generate (label, output, in_out) pairs

python gen_meminf_data.py --load_from=YOUR_SHADOW_MODEL

Train attack models

python train_attack_model.py --target_class=0 --path_prefix=meminf_data/cifar10/YOUR_SHADOW_MODEL

Evaluate attack models

python eval_attack_model.py --all_classes --att_model_prefix=attack_models/cifar10/YOUR_SHADOW_MODEL --eval

Train classifier with defenses

L2/dropout

  • Set weight_decay and dropout in parameters

DP-SGD

python train_jem.py @params/dp_params.txt

Min-Max

python train_jem.py @params/min_max_params.txt

meminf-defense's People

Contributors

chenjiyu avatar

Stargazers

 avatar Qianjun Zheng avatar

Watchers

 avatar Qianjun Zheng avatar

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.