You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the easiest solution (assuming PyTorch models) is to use images in [0, 1] and create a wrapper for the models like
classNewModel():
def__init__(self, model):
self.model=modeldef__call__(self, x):
z=x*2.-1.# z in [-1, 1] if x in [0, 1]returnself.model(z)
which takes input in [0, 1], but rescale it to [-1, 1] before inference. Please refer also to #13 for a similar case.
For TensorFlow models, I guess one could do something similar in the model definition, i.e. adding z = x * 2. - 1. on the input to rescale it to [-1, 1].
Hi, I found the normalization used for images is [0, 1]. If the normalization of images is [-1, 1], how could I revise the attack codes?
The text was updated successfully, but these errors were encountered: