square-attack icon indicating copy to clipboard operation
square-attack copied to clipboard

Why the value of epsilon in step 4 in Algorithm 2 needs to be multiplied by 2?

Open jimo17 opened this issue 3 years ago • 2 comments

Hi, I'm very interested in your paper. I have a question. Why the value of epsilon in step 4 in Algorithm 2 needs to be multiplied by 2?

jimo17 avatar May 19 '22 09:05 jimo17

Hi, Thanks for the interest in our paper. 2*eps is there to ensure that we can go from one corner of the Linf cube to the other, i.e. change a value of -eps to eps and from eps to -eps.

max-andr avatar May 19 '22 09:05 max-andr

Thanks a lot for your answer. I have another question about 2eps in step 4 in Algorithm 2. Should [-eps,eps] be written as [-2eps,2*eps] in the corresponding place in the code? https://github.com/max-andr/square-attack/blob/ea95eebb5aca62ec790a927b5aa985ba4e87245c/attack.py#L236 written as deltas[i_img, :, center_h:center_h+s, center_w:center_w+s] = np.random.choice([-2*eps, 2*eps], size=[c, 1, 1])

jimo17 avatar May 19 '22 11:05 jimo17

Sorry, I somehow missed your reply.

[-eps, eps] in line 236 is correct since here we modify the values of the deltas directly instead of adding a perturbation to an existing delta (as in our algorithm description in the paper).

max-andr avatar Apr 12 '23 07:04 max-andr