kabkabm / defensegan

Defense-GAN: Protecting Classifiers Against Adversarial Attacks Using Generative Models (published in ICLR2018)
Apache License 2.0
229 stars 62 forks source link

TypeError: load() got an unexpected keyword argument 'transform_type' #3

Closed bibin-sebastian closed 5 years ago

bibin-sebastian commented 5 years ago

@po0ya @kabkabm . Thank you very much for the work .

I am trying to create deter physical adversarial attacks using defensegan and trained the GAN on celebA dataset. However, when I tried to reproduce the blackbox of whitebox attack I am stuck at this error. "TypeError: load() got an unexpected keyword argument 'transform_type'"
Any idea how to fix this ? I am running the code on a google cloud vm with Cuda 7.05 . Trained the gan up to 135000 iterations .

*2018-11-04 04:24:57.427800: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions tha t this TensorFlow binary was not compiled to use: AVX2 FMA 2018-11-04 04:24:59.468111: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:964] successful NUMA node read f rom SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2018-11-04 04:24:59.468505: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1411] Found device 0 with properties : name: Tesla K80 major: 3 minor: 7 memoryClockRate(GHz): 0.8235 pciBusID: 0000:00:04.0 totalMemory: 11.17GiB freeMemory: 11.10GiB 2018-11-04 04:24:59.468537: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1490] Adding visible gpu devices: 0 2018-11-04 04:24:59.777777: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] Device interconnect StreamExecu tor with strength 1 edge matrix: 2018-11-04 04:24:59.777830: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] 0 2018-11-04 04:24:59.777839: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0: N 2018-11-04 04:24:59.778142: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1103] Created TensorFlow device (/jo b:localhost/replica:0/task:0/device:GPU:0 with 10758 MB memory) -> physical GPU (device: 0, name: Tesla K80, pci bu s id: 0000:00:04.0, compute capability: 3.7) [] Checkpoint is read successfully from output/gans/celeba 2018-11-04 04:24:59.805142: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1490] Adding visible gpu devices: 0 2018-11-04 04:24:59.805183: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] Device interconnect StreamExecu tor with strength 1 edge matrix: 2018-11-04 04:24:59.805200: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] 0 2018-11-04 04:24:59.805210: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0: N 2018-11-04 04:24:59.805428: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1103] Created TensorFlow device (/jo b:localhost/replica:0/task:0/device:GPU:0 with 10758 MB memory) -> physical GPU (device: 0, name: Tesla K80, pci bu s id: 0000:00:04.0, compute capability: 3.7) Traceback (most recent call last): File "blackbox.py", line 762, in tf.app.run(main=main_cfg) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "blackbox.py", line 761, in main_cfg = lambda x: main(cfg, x) File "blackbox.py", line 685, in main defense_type=FLAGS.defense_type) File "blackbox.py", line 419, in blackbox get_cached_gan_data(gan, test_on_dev, orig_data_flag=True) File "blackbox.py", line 357, in get_cached_gan_data orig_data=orig_data_flag, File "blackbox.py", line 245, in get_celeba ds_test.load(split=dev_name, transform_type=1) TypeError: load() got an unexpected keyword argument 'transform_type' **

po0ya commented 5 years ago

Hi @bibin-sebastian, thanks for pointing this out! Unfortunately, we don't have the right environment/data setup to test the fix, can you please try get_celeba_fix branch (git pull origin get_celeba_fix and git checkout get_celeba_fix) and see if this is fixed. This is due to an obsolete argument transform_type for the load function. Let us know if more fixes are needed to get celeba running. Will merge the branch into master after making sure that it works fully.

bibin-sebastian commented 5 years ago

@po0ya .Thanks for the reply . tried that and hit two more issue. The first issue was with "dev_name = 'dev'" variable which did not have a matching description in CelebA.py. So changed dev_name to "val". Then the next issue where I am stuck badly is --- 'LazyDataset' object has no attribute 'shape'

screen shot 2018-11-04 at 2 58 50 pm

screen shot 2018-11-04 at 3 03 03 pm

My need is to run a whitebox attack on model A . the file that was run --> whitebox.py.

Error description below ------------

name: Tesla K80 major: 3 minor: 7 memoryClockRate(GHz): 0.8235pciBusID: 0000:00:04.0totalMemory: 11.17GiB freeMemory: 11.10GiB2018-11-04 19:56:36.788679: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1490] Adding visible gpu devices: 02018-11-04 19:56:37.093072: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] Device interconnect StreamExecutor with strength 1 edge matrix:2018-11-04 19:56:37.093135: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] 0 2018-11-04 19:56:37.093148: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0: N 2018-11-04 19:56:37.093444: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1103] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10758 MB memory) -> physical GPU (device: 0, name: Tesla K80, pci bus id: 0000:00:04.0, compute capability: 3.7) [*] Checkpoint is read successfully from output/gans/celebaTraceback (most recent call last): File "whitebox.py", line 395, in tf.app.run(main=main_cfg) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "whitebox.py", line 394, in main_cfg = lambda x: main(cfg, x) File "whitebox.py", line 292, in main num_train=FLAGS.num_train, File "whitebox.py", line 106, in whitebox x_shape = [None] + list(train_images.shape[1:])AttributeError: 'LazyDataset' object has no attribute 'shape'

po0ya commented 5 years ago

thanks again, pushed a few file changes, take a look at the file changes in #4, let us know if further changes are needed. Please git pull origin get_celeba_fix to get the updates.

bibin-sebastian commented 5 years ago

Hi , Thanks for the support. We have another error after changing the two files.

screen shot 2018-11-04 at 3 43 38 pm

po0ya commented 5 years ago

please pull again

bibin-sebastian commented 5 years ago

Hi . Sorry for the trouble . Here is another one screen shot 2018-11-04 at 4 15 57 pm

po0ya commented 5 years ago

please pull again

bibin-sebastian commented 5 years ago

Hi @po0ya we had to switch VM due to CUDA 7.21 so it took a bit of time to run the code after switching the VM . It felt like the code ran for some time since I could see that GPU (1300MB) & CPU utilization was up .However, we hit another road block.

screen shot 2018-11-04 at 6 24 21 pm

po0ya commented 5 years ago

np, please pull

bibin-sebastian commented 5 years ago

Hi. another similar error screen shot 2018-11-04 at 8 37 32 pm

po0ya commented 5 years ago

please pull, [now I remembered that this file is an older version of the file for some reason, from before the deadline! if it's not fixed in this conversation, I'll go find the latest version of this file.]

bibin-sebastian commented 5 years ago

Hi. Thanks very much. This looks promising. I will update you soon once the whole iteration is complete. screen shot 2018-11-04 at 9 35 16 pm

bibin-sebastian commented 5 years ago

Hi. @po0ya . Please find the update. screen shot 2018-11-05 at 8 27 51 am

bibin-sebastian commented 5 years ago

It would be highly appreciated if you can look for the correct file. Thank you.

po0ya commented 5 years ago

closing this since resolved in offline discussions

shubham-malaviya commented 5 years ago

Hi. @po0ya . Please find the update. screen shot 2018-11-05 at 8 27 51 am

Hi, i'm getting the same error after running whitbox.py with the configuration given in Readme. I go the error at line #210 "adv_x = attack_obj.generate(images_pl, **attack_params)". If you have resolved the issue can you please help me?

Thank you.