Open WeicongChen opened 5 years ago
By 'reprocessed image' do you mean image with preprocessing undone?
On Wed, Dec 12, 2018, 8:56 AM juicecwc notifications@github.com wrote:
Hi, great repo!
I am little confused with this line
https://github.com/sarathknv/adversarial-examples-pytorch/blob/54887aa583ee19e94fc95e23684271019eecdd68/fgsm.py#L84 As far as I know, it is more reasonable to test with the reprocessed image rather than inp.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sarathknv/adversarial-examples-pytorch/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ59I3mu4eJOTlNGoc_kW7QM9cmw7Erpks5u4HdigaJpZM4ZOqdc .
No, what I mean is the adversarial image. Better viewed in the following code.
adv = inp.data.cpu().numpy()[0]
adv = adv.transpose(1, 2, 0)
adv = (adv * std) + mean
adv = np.clip(adv, 0, 1)
adv = (adv - mean) / std # this is what i mean
You are clipping the adversarial image before inputting to the model, so that after undoing preprocessing it is within the [0 255]
bound.
Yeah, this is sensible.
Hi, great repo!
I am little confused with this line https://github.com/sarathknv/adversarial-examples-pytorch/blob/54887aa583ee19e94fc95e23684271019eecdd68/fgsm.py#L84 As far as I know, it is more reasonable to test with the reprocessed image rather than
inp
.