WindVChen / DiffAttack

An unrestricted attack based on diffusion models that can achieve both good transferability and imperceptibility.
Apache License 2.0
115 stars 9 forks source link

No such file or directory: 'pretrained_models/tf2torch_adv_inception_v3.npy' #17

Closed Nikos-86 closed 3 months ago

Nikos-86 commented 3 months ago

Hello Chen,

Great work there! I am really enjoying it so far!

I only have a small issue. After the adv examples are crafted and the code starts evaluating on transferability on other models, everything runs smooth until it's time for the tf2torch_adv_inception_v3.npy to be evaluated. Then the code crashes and I get the following error :

" *****Transfer to tf2torch_adv_inception_v3**** Traceback (most recent call last): File "/users/40241245/work/scripts/DiffAttack/torch_nets/tf2torch_adv_inception_v3.py", line 14, in load_weights weights_dict = np.load(weight_file, allow_pickle=True).item() File "/users/40241245/.local/lib/python3.8/site-packages/numpy/lib/npyio.py", line 417, in load fid = stack.enter_context(open(os_fspath(file), "rb")) FileNotFoundError: [Errno 2] No such file or directory: 'pretrained_models/tf2torch_adv_inception_v3.npy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "main.py", line 195, in model_transfer(images, adv_images, label, res, save_path=save_dir, args=args) File "/users/40241245/work/scripts/DiffAttack/other_attacks.py", line 111, in model_transfer model = model_selection(name) File "/users/40241245/work/scripts/DiffAttack/other_attacks.py", line 59, in model_selection model = net.KitModel(model_path) File "/users/40241245/work/scripts/DiffAttack/torch_nets/tf2torch_adv_inception_v3.py", line 27, in init _weights_dict = load_weights(weight_file) File "/users/40241245/work/scripts/DiffAttack/torch_nets/tf2torch_adv_inception_v3.py", line 16, in load_weights weights_dict = np.load(weight_file, allow_pickle=True, encoding='bytes').item() File "/users/40241245/.local/lib/python3.8/site-packages/numpy/lib/npyio.py", line 417, in load fid = stack.enter_context(open(os_fspath(file), "rb")) FileNotFoundError: [Errno 2] No such file or directory: 'pretrained_models/tf2torch_adv_inception_v3.npy' "

Any ideas or advise on this? Many Thanks!

WindVChen commented 3 months ago

Hi @Nikos-86 ,

Thank you for reaching out. Please ensure the pretrained weights have been downloaded beforehand. You can find detailed instructions in the requirements section of the README.md file:

image

Hope this helps.

Nikos-86 commented 3 months ago

Hi again Chen!

Yes, just myself not paying proper attention to the information provided... Not the first time this happens! :P

It's working just fine now!

Many thanks for your prompt reply and once again, big congratulations for your work folks! It's really great!

Have a nice day!

WindVChen commented 3 months ago

Thanks for your warm words :)! You too, have a fantastic day!