392781 / FaceOff

Steps towards physical adversarial attacks on facial recognition
Creative Commons Attribution Share Alike 4.0 International
78 stars 14 forks source link

Information lost when converting mask to img and reading back into resnet #4

Closed tkangxun closed 4 years ago

tkangxun commented 4 years ago

I have noticed in the generation of the mask, the values used are in the range of (-1,1) seen both in:

adversarial_face_recognition.py ln 187: self.mask_list[i].data.clamp_(-1, 1)

and alogorithm.py ln 74: delta.data.clamp_(-1, 1)

I believe the range is to be in (0,1) as when imagize(adver.detach().cpu()) is called the values are normalised to fit in to the range (0,255). Howveer, when we try to read this image back into resnet by calling tensorize() the valuse (0,255) is fitted into the range of (0,1) instead of (-1,1). The resultant tensor is significantly different from the apply(input_tensor, delta) tensor. To prevent the data lost, the mask should be generated in the range of (0,1) instead.

392781 commented 4 years ago

Appreciated, thanks. Using that method was producing results leading in the right direction and I never checked that for issues.