Giter Club home page Giter Club logo

Comments (5)

ririnicolae avatar ririnicolae commented on August 26, 2024

Hi, @Luke06! Please see the following comment about how to download h5 files without corrupting their integrity: h5py/h5py#757 (comment) Let me know if this solves the issue. Also, the model was created with keras==2.2.2; please consider using the same version to make sure that you can load it.

from adversarial-robustness-toolbox.

jlcollet avatar jlcollet commented on August 26, 2024

Hi
I looked at the comment but I don't see how it fix my problem , Iam using the std keras library to load the model and the file is they one from the ART repo that I retrieve thru a wget in my python notebook. the downloaded file seems to be correct. I am in Keras 2.2.4 ! but cannot move back to 2.2.2 due to others incompatibilities in my code :(. in fact my goal is to retrain my model using your defence training libraries but it was not working neither so....

from adversarial-robustness-toolbox.

ririnicolae avatar ririnicolae commented on August 26, 2024

@Luke06 I have tested your scenario. Loading the model does not work for me neither if I download it using wget. Actually, the model from the repo and the one downloaded with wget don't even have the same size on disk (I get 44357 for wget, just the same as you, and 2737408 for the model downloaded properly). That is what the comment I pointed you towards explains. You could clone the repo or use the solution in the comment to make sure you get a valid version of the file.

On a different note, if your goal is to train an architecture that you already have with the defenses from the library, you don't necessarily need to download the pre-trained models that we use as examples.

from adversarial-robustness-toolbox.

jlcollet avatar jlcollet commented on August 26, 2024

OK I understand the problem with the downloaded h5 file.
Yes my initial goal was to retrain my model using the defences from the libraries but I was encountering some issues probably due to invalid usage of the library, here is the code I tried to use
I have defined a CNN model called model and I create a Classifier wrapper :
Original_Classifier = KerasClassifier((0,1),model,use_logits=False)
Original_Classifier.fit(x_train, y_train, batch_size=128, nb_epochs=10)

Then I tried this lines that I found in the notebook sample called adversarial-training-mnist.ipynb

attacks = BasicIterativeMethod(Original_Classifier,eps=0.3,eps_step=0.01, max_iter=40)
trainer = AdversarialTrainer(Original_Classifier,attacks,ratio=1.0)
trainer.fit(x_train,y_train, nb_epochs=10,batch_size=50)

but the training ended after the 1 epochs with very strange results.
Can you pls provide me with the right way & sample code of doing that for my training against Fast Gradient Method attack ?
by advance thanks a lot

from adversarial-robustness-toolbox.

ririnicolae avatar ririnicolae commented on August 26, 2024

I would say that your original problem (.h5 files) is solved, so I will close this issue.

I don't see any obvious error in your code example. Would you mind opening a new issue for it, where you would copy the code example, as well as the full stack trace of the error you are getting when running it?

from adversarial-robustness-toolbox.

Related Issues (20)

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.