anguyen8/sam

Bugs when running script-2

Chanfeechen opened this issue · 3 comments

Command attempted:
source gradient.sh

Issues:
Unable to convert comparison images from data.
After running the script, it create the data and saved in file ILSVRC2012_val_00002056. But the gradient image for comparison cannot convert successfully. Could you give a hint on how to fix it?

Running logs:

Setting the numpy seed with value: 0

Analyzing for model: madry
Loading model madry
My Attacker is False
Loading the robust ResNet-50 architectre
=> loading checkpoint './models/ResNet50_R.pt'
=> loaded checkpoint './models/ResNet50_R.pt' (epoch 105)
Saving results in /home/peijie/sam/results/gradient/ILSVRC2012_val_00020735
Analysing batch: 0 of size 1
Pre softmax analysis
Time taken for a batch is 0.040524959564208984


Analyzing for model: pytorch
Loading model resnet50
Loading ResNet50
Saving results in /home/peijie/sam/results/gradient/ILSVRC2012_val_00020735
Analysing batch: 0 of size 1
Pre softmax analysis
Time taken for a batch is 0.023482084274291992


Analyzing for model: googlenet
Loading model googlenet
Loading GoogleNet
Saving results in /home/peijie/sam/results/gradient/ILSVRC2012_val_00020735
Analysing batch: 0 of size 1
Pre softmax analysis
Time taken for a batch is 0.025446176528930664


Analyzing for model: madry_googlenet
Loading model madry_googlenet
My Attacker is False
Loading the robust GoogleNet architectre
Traceback (most recent call last):
  File "Gradient_Madry.py", line 198, in <module>
    model = load_model(arch=model_arg, if_pre=args.if_pre)  # Returns logits
  File "/home/peijie/sam/utils.py", line 188, in load_madry_model
    model, _ = model_utils.make_and_restore_model(**model_kwargs)
  File "/home/peijie/sam/naman_robustness/model_utils.py", line 46, in make_and_restore_model
    raise ValueError(error_msg)
ValueError: => no checkpoint found at './models/GoogleNet_R.pt'

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@python.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True

Traceback (most recent call last):
  File "formal_plot_gradient.py", line 48, in <module>
    heatmap = [np.load(os.path.join(args.result_path, heatmap_path[ll])) for ll in [0, 2, 3, 1]]
  File "formal_plot_gradient.py", line 48, in <listcomp>
    heatmap = [np.load(os.path.join(args.result_path, heatmap_path[ll])) for ll in [0, 2, 3, 1]]
IndexError: list index out of range

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@python.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True

convert: unable to access configure file `magic.xml' @ warning/configure.c/GetConfigureOptions/714.
convert: unable to open image './results/gradient/figure_noise_0.jpg': No such file or directory @ error/blob.c/OpenBlob/3315.
convert: no images defined `./results/gradient/figure_noise_0.jpg' @ error/convert.c/ConvertImageCommand/3275.
Setting the numpy seed with value: 0

Analyzing for model: madry
Loading model madry
My Attacker is False
Loading the robust ResNet-50 architectre
=> loading checkpoint './models/ResNet50_R.pt'
=> loaded checkpoint './models/ResNet50_R.pt' (epoch 105)
Saving results in /home/peijie/sam/results/gradient/ILSVRC2012_val_00020735
Analysing batch: 0 of size 1
Pre softmax analysis
Time taken for a batch is 0.048851728439331055


Analyzing for model: pytorch
Loading model resnet50
Loading ResNet50
Saving results in /home/peijie/sam/results/gradient/ILSVRC2012_val_00020735
Analysing batch: 0 of size 1
Pre softmax analysis
Time taken for a batch is 0.02651691436767578


Analyzing for model: googlenet
Loading model googlenet
Loading GoogleNet
Saving results in /home/peijie/sam/results/gradient/ILSVRC2012_val_00020735
Analysing batch: 0 of size 1
Pre softmax analysis
Time taken for a batch is 0.03033161163330078


Analyzing for model: madry_googlenet
Loading model madry_googlenet
My Attacker is False
Loading the robust GoogleNet architectre
Traceback (most recent call last):
  File "Gradient_Madry.py", line 198, in <module>
    model = load_model(arch=model_arg, if_pre=args.if_pre)  # Returns logits
  File "/home/peijie/sam/utils.py", line 188, in load_madry_model
    model, _ = model_utils.make_and_restore_model(**model_kwargs)
  File "/home/peijie/sam/naman_robustness/model_utils.py", line 46, in make_and_restore_model
    raise ValueError(error_msg)
ValueError: => no checkpoint found at './models/GoogleNet_R.pt'

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@python.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True

Traceback (most recent call last):
  File "formal_plot_gradient.py", line 44, in <module>
    heatmap = [np.load(os.path.join(args.result_path, heatmap_path[ll])) for ll in [0, 2, 3, 1]]
  File "formal_plot_gradient.py", line 44, in <listcomp>
    heatmap = [np.load(os.path.join(args.result_path, heatmap_path[ll])) for ll in [0, 2, 3, 1]]
IndexError: list index out of range

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@python.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True

convert: unable to access configure file `magic.xml' @ warning/configure.c/GetConfigureOptions/714.
convert: unable to open image './results/gradient/figure_noise_1.jpg': No such file or directory @ error/blob.c/OpenBlob/3315.
convert: no images defined `./results/gradient/figure_noise_1.jpg' @ error/convert.c/ConvertImageCommand/3275.
montage: unable to access configure file `magic.xml' @ warning/configure.c/GetConfigureOptions/714.
montage: unable to open image './results/gradient/figure_noise_0.jpg': No such file or directory @ error/blob.c/OpenBlob/3315.
montage: unable to open image './results/gradient/figure_noise_1.jpg': No such file or directory @ error/blob.c/OpenBlob/3315.
montage:  `./results/formal_gradient.jpg' @ error/montage.c/MontageImageCommand/1775.
Image path: ./results/formal_gradient.jpg

Hey @Chanfeechen

Thanks for your interest.

Looking at the logs, it seems that it could not find the ./models/GoogleNet_R.pt. I think this happened because you only downloaded the ./models/ResNet50_R.pt model and missed the other one. Could you check it first?

P.S. - Just to be double sure, I git cloned the repository on my machine and set up everything from scratch as mentioned in the instructions and confirmed that everything is working as expected.

Thanks,
Naman

Thank you for the reply! @bnaman50
I downloaded the all models form here.
And I git cloned the repository and tried again. But no luck, I encounter the exact same issues...

Just to make sure, do I need to run the train.sh script before I run source gradient.sh?

Thanks @Chanfeechen!

It turns out there was a typo in our code. @bnaman50

@chirag126 fixed it :) 6f89c6d