Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test with the reprocessed image #1

Open
WeicongChen opened this issue Dec 12, 2018 · 3 comments
Open

Test with the reprocessed image #1

WeicongChen opened this issue Dec 12, 2018 · 3 comments

Comments

@WeicongChen
Copy link

Hi, great repo!

I am little confused with this line

pred_adv = np.argmax(model(inp).data.cpu().numpy())

As far as I know, it is more reasonable to test with the reprocessed image rather than inp.

@sarathknv
Copy link
Owner

sarathknv commented Dec 12, 2018 via email

@WeicongChen
Copy link
Author

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

@sarathknv
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants