katywarr / strengthening-dnns

Code repository to accompany the O'Reilly book: "Strengthening Deep Neural Networks: Making AI Less Susceptible to Adversarial Trickery"
https://learning.oreilly.com/library/view/strengthening-deep-neural/9781492044949/
MIT License
52 stars 22 forks source link

Bug: Chapter 6 "fashionMNIST_foolbox_boundary.ipynb" #3

Closed JafarBadour closed 4 years ago

JafarBadour commented 4 years ago

Main issue

I think the code was written with an older version of foolbox or tensorflow. Because while running cell

x_adv = attack(input_or_adv=x, 
               label = y,
               starting_point = starting_point_image,
               unpack = False,
               iterations = 2000,
               log_every_n_steps = 500)

This error arises:

TypeError  Traceback (most recent call last)
<ipython-input-20-f0698dcd1aa3> in <module>()
      4                unpack = False,
      5                iterations = 2000,
----> 6                log_every_n_steps = 500)

TypeError: __call__() missing 2 required positional arguments: 'inputs' and 'labels'

I tried renaming input_or_adv to inputsand label to np.ndarray([y]) but it doesnt work. the labels lengths and inputs length should be equal.

here is a link of what i had done on google colab

Colab link

katywarr commented 4 years ago

Hi @JafarBadour

I haven't been able to recreate this problem. Please could you let me know your versions of tensorflow and FoolBox? They should be as per the requirements.txt file.

Many thanks, Katy

JafarBadour commented 4 years ago

I have solved it by making virtual environment and installing older version of tensorflow ... problem was because of new version. Thank you for reply.