low-frequency-adversarial
low-frequency-adversarial copied to clipboard
LF-BA using Hyperband option does not work
Hi,
I can run LF-BA with fixed frequency ratio, and the results are great, but when using hyperband to turn freq. ratio. sth went wrong.
I used the following command:
python run_dba_simple.py --data_root /mnt/imgnet/mini_val_2 --num_runs 32 --num_steps 100 --perturb_mode dct --dct_ratio 0.0325 --blended_noise --spherical_step 0.2 --repeat_images 4 --halve_every 500 --batch_size 8
and I got this error:
Traceback (most recent call last): File "run_dba_simple.py", line 82, in <module> perturbed, mse_stats, distance_stats, spherical_step_stats, source_step_stats = boundary_attack( File "/mnt/atseng/low-frequency-adversarial/boundary_attack_simple.py", line 45, in boundary_attack idx = torch.arange(0, batch_size).long().cuda()[preds.eq(labels)] IndexError: The shape of the mask [32] at index 0 does not match the shape of the indexed tensor [8] at index 0
The problem seems to be the image batch is repeated but the batch size
in the code is the size of the image batch that is "before it is repeated"
Am I missing anything? Thanks!