rakutentech / stAdv

Spatially Transformed Adversarial Examples with TensorFlow
MIT License
72 stars 18 forks source link

How to change the dimension while generating the flows? #9

Closed praveern closed 5 years ago

praveern commented 5 years ago

What are the suitable values for the flows variable? We were trying to change the dimension parameter from 2 to 1. However this seems incorrect.

Please help, thanks!

berangerd commented 5 years ago

It can be found in the doc:

flows (tf.Tensor) – flows of shape (B, 2, H, W), where the second dimension indicates the dimension on which the pixel shift is applied

where B is the batch size, and H and W is the height and width of the input images.

praveern commented 5 years ago

Does the value in the second dimension mean the index of the dimension? Example: 2 --> 'H', 3 --> 'W' ? Am I correct in my thought process here?

Thanks!

berangerd commented 5 years ago

I'm not sure I understand your question. flows is a tensor of rank 4. flows[:, 0, :, :] represent the shifts (for given pixels in given images) along the y axis, while flows[:, 1, :, :] represent the shifts along the x axis.