Git Product home page Git Product logo

model-sanitization's Introduction

model-sanitization

Codes for reproducing the results of the paper "Bridging Mode Connectivity in Loss Landscapes and Adversarial Robustness" published at ICLR 2020 https://openreview.net/forum?id=SJgwzCEKwH

Pleas go to the corresponding directory for more information

Cite

@inproceedings{
Zhao2020Bridging,
title={Bridging Mode Connectivity in Loss Landscapes and Adversarial Robustness},
author={Pu Zhao and Pin-Yu Chen and Payel Das and Karthikeyan Natesan Ramamurthy and Xue Lin},
booktitle={International Conference on Learning Representations},
year={2020},
url={https://openreview.net/forum?id=SJgwzCEKwH}
}

model-sanitization's People

Contributors

stevemar avatar zpert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

model-sanitization's Issues

AttributeError: 'CIFAR10' object has no attribute 'train_labels'

Hi, I want to reproduce the experiment result of performance against single-target backdoor attack. I run the command

python3 train_poison.py --dir=ckpt --dataset=CIFAR10 --data_path=data --model=VGG16 --epochs=100 --lr=0.05 --wd=5e-4 --use_test --transform=VGG

and I got error like this

Traceback (most recent call last):
  File "train_poison.py", line 68, in <module>
    args.use_test
  File "/home/pkun/workshop/model-sanitization/backdoor/backdoor-cifar/data.py", line 252, in loaders_poison
    x_raw = train_set.train_data
AttributeError: 'CIFAR10' object has no attribute 'train_data'

I repair the code x_raw = train_set.train_data to x_raw = train_set.data but I'm not sure if this will affect the experimental results. I change all train_data, test_data to data and train_labels, test_labels to targets in backdoor/backdoor-cifar/data.py. Then the code can run successfully, but the train_acc Always 55.0000, I don't think it's normal. Here is the output from my console.

python3 train_poison.py --dir=ckpt --dataset=CIFAR10 --data_path=data --model=VGG16 --epochs=100 --lr=0.05 --wd=5e-4 --use_test --transform=VGG
Files already downloaded and verified
You are going to run models on the test set. Are you sure?
Files already downloaded and verified
----  ---------  ---------  ---------  ---------  ---------  ---------  ---------  ---------
  ep         lr    tr_loss     tr_acc     te_nll     te_acc    poi_nll    poi_acc       time
----  ---------  ---------  ---------  ---------  ---------  ---------  ---------  ---------
   1     0.0500     1.6917    54.7220     2.7881    10.0000     0.5688   100.0000    27.7173
   2     0.0500     1.6777    55.0000     2.7681    10.0000     0.5874   100.0000    18.1426
   3     0.0500     1.6778    55.0000     2.7657    10.0000     0.5891   100.0000    18.1627
   4     0.0500     1.6779    55.0000     2.8170    10.0000     0.5418   100.0000    18.1949
   5     0.0500     1.6778    55.0000     2.7937    10.0000     0.5628   100.0000    18.1922
   6     0.0500     1.6779    55.0000     2.7275    10.0000     0.6278   100.0000    18.2009
   7     0.0500     1.6777    55.0000     2.7406    10.0000     0.6140   100.0000    18.2040
   8     0.0500     1.6778    55.0000     2.7449    10.0000     0.6107   100.0000    18.1640
   9     0.0500     1.6779    55.0000     2.7589    10.0000     0.5956   100.0000    18.2060
  10     0.0500     1.6778    55.0000     2.7577    10.0000     0.5972   100.0000    18.1984
  11     0.0500     1.6777    55.0000     2.7526    10.0000     0.6018   100.0000    18.2550
  12     0.0500     1.6776    55.0000     2.7856    10.0000     0.5699   100.0000    18.2314
  13     0.0500     1.6779    55.0000     2.7637    10.0000     0.5910   100.0000    18.2471
  14     0.0500     1.6779    55.0000     2.7987    10.0000     0.5580   100.0000    18.2632
  15     0.0500     1.6777    55.0000     2.7332    10.0000     0.6219   100.0000    18.2177
  16     0.0500     1.6780    55.0000     2.7328    10.0000     0.6222   100.0000    18.2367
  17     0.0500     1.6778    55.0000     2.7404    10.0000     0.6145   100.0000    18.2166
  18     0.0500     1.6779    55.0000     2.7718    10.0000     0.5831   100.0000    18.2409
  19     0.0500     1.6776    55.0000     2.7395    10.0000     0.6149   100.0000    18.2174
  20     0.0500     1.6774    55.0000     2.7126    10.0000     0.6446   100.0000    18.2022
  21     0.0500     1.6777    55.0000     2.7669    10.0000     0.5872   100.0000    18.2642
  22     0.0500     1.6778    55.0000     2.7509    10.0000     0.6036   100.0000    18.2141
  23     0.0500     1.6779    55.0000     2.7370    10.0000     0.6179   100.0000    18.2184
  24     0.0500     1.6777    55.0000     2.7383    10.0000     0.6163   100.0000    18.2216
  25     0.0500     1.6777    55.0000     2.7271    10.0000     0.6284   100.0000    18.2506
  26     0.0500     1.6776    55.0000     2.7267    10.0000     0.6285   100.0000    18.2698
  27     0.0500     1.6776    55.0000     2.7415    10.0000     0.6140   100.0000    18.2530
  28     0.0500     1.6778    55.0000     2.7560    10.0000     0.5987   100.0000    18.2714
  29     0.0500     1.6777    55.0000     2.7459    10.0000     0.6084   100.0000    18.2531
  30     0.0500     1.6775    55.0000     2.7733    10.0000     0.5819   100.0000    18.3161
  31     0.0500     1.6780    55.0000     2.7722    10.0000     0.5825   100.0000    18.2003
  32     0.0500     1.6777    55.0000     2.7354    10.0000     0.6194   100.0000    18.2231
  33     0.0500     1.6778    55.0000     2.7531    10.0000     0.6011   100.0000    18.2400
  34     0.0500     1.6775    55.0000     2.7329    10.0000     0.6231   100.0000    18.2604
  35     0.0500     1.6776    55.0000     2.7332    10.0000     0.6216   100.0000    18.2635
  36     0.0500     1.6776    55.0000     2.7349    10.0000     0.6204   100.0000    18.2244
  37     0.0500     1.6777    55.0000     2.7942    10.0000     0.5621   100.0000    18.2450
  38     0.0500     1.6780    55.0000     2.7428    10.0000     0.6120   100.0000    18.2343
  39     0.0500     1.6778    55.0000     2.7461    10.0000     0.6088   100.0000    18.2504
  40     0.0500     1.6778    55.0000     2.7323    10.0000     0.6233   100.0000    18.2152

How to generalise code for arbitrary models?

Hi, I am currently adapting your code to test on my own dataset and ResNet18 model, but I realise your code is highly hard-coded for CIFAR10 and particular WideResNet models. Can you guide me through on how I can adapt this to suit my test?

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.