Closed qilong-zhang closed 5 years ago
Thanks for your interest in our work.
The input diversity is instantiated as a layer inside the network. So it is okay for input_tensor and padded_tensor to have different shapes
@cihangxie Hi, thank you for your reply!
but I still don't understand this sentence "The input diversity is instantiated as a layer inside the network. "
If the perturbation is generated from padded
, then the perturbation's shape will be [330,330,3]
。It's ok add this perturbation to the same shape(padded
), but the original img is [299,299,3]
。
How can you add to the original img? or when you test the accuracy of attack success, you using [330,330,3]
img to calculate the result?
Oh, now i understand what you are asking.
You can refer to the line here: https://github.com/cihangxie/DI-2-FGSM/blob/master/attack.py#L137 where we take the derivative of loss w.r.t. the original image (299x299x3), so the generated perturbation is also of the size 299x299x3. In this manner, you can interpret it as we resize the perturbation back to the size 299x299x3.
@cihangxie Ok, thanks! That's what I guessed before.
@cihangxie Hi! I have another detailed question. Is the size after rescaling (330x330 in your implementation) is the proper input size of the network? In other words, the model is supposed to take 330x330 inputs according to its architecture, right?
The default input size should be 299x299. But for ImageNet trained models, their performance usually will not be degraded if inputs are padded to a reasonably larger size (but too large size will significantly hurt performance)
I see. Thanks for the clarification!
Hi, I'm very intersted in your paper, but I have some problems about the img shape. Could you help me? In your code, the method
input_diversity()
will returnpadded
orinput_tensor
. Forpadded
, the code isand from the code, we can see that the shape of
padded
is "batch_sizex330x330x3"But for
input_tensor
and from the code, we can see that the shape of
input_tensor
is "batch_sizex229x229x3"Why are they different? Is it ok?