cleverhans-lab / cleverhans

An adversarial example library for constructing attacks, building defenses, and benchmarking both
MIT License
6.2k stars 1.39k forks source link

How to save and load model? #139

Closed shenqixiaojiang closed 7 years ago

shenqixiaojiang commented 7 years ago

Hello,I have trouble in loading model when I saved the model with TF format. The model can't load using 'saver.restore'. So could you give me some suggestion on saving and loading the trained model? Thanks.

npapernot commented 7 years ago

This is an issue that we have to address yes. The save feature doesn't work because we are defining the model using keras. Any contributions are welcome if you are able to make it work, otherwise I would suggest defining the model directly using tf

goodfeli commented 7 years ago

Quick comment: I think the bug where reloading the model in Keras doesn't work might be due to an "initialize_all_variables" call. That's worth checking at some point.

shenqixiaojiang commented 7 years ago

@npapernot @goodfeli I had tried some methods to address it. Unfortunately,it didn't work. Finally, FGSM was implemented by Keras with TF backend. During this, I found a funny thing that same architectures in different platform had different performance and the difference was huge which was explored in the MNIST datasets. The phenomenon seems to be inconsistent with "The Space of Transferable Adversarial Examples".

npapernot commented 7 years ago

@shenqixiaojiang, did you get a chance to look at what @goodfeli suggested?

shenqixiaojiang commented 7 years ago

@npapernot Sorry,I made a mistake of the suggestion of @goodfeli . Now, it works. Thank you very much.

npapernot commented 7 years ago

Would you be willing to open a PR to include the code that is able to load/save models?

shenqixiaojiang commented 7 years ago

@npapernot yeah,my pleasure. A PR was opened for this problem. In addition, could you give me some suggests with the following problem: Same architectures in different platform such as Keras,pyTorch and Caffe had different performance and the difference was huge which was explored in the MNIST datasets. The phenomenon seems to be inconsistent with the theory of "The Space of Transferable Adversarial Examples".