To rescale an input in the [0, 255] range to be in the [0, 1] range, you would pass scale=1./255.
To rescale an input in the [0, 255] range to be in the [-1, 1] range, you would pass scale=1./127.5, offset=-1.
I understood the above example.
but, I can't understand this code
tf.keras.layers.Rescaling(scale=4.0, offset=1.0)
As above, if I pass the scale and offset values as above, I wonder what the range of the input value will be, and I'm curious about the meaning of scale and offset.
CodePudding user response:
Rescaling is done by scale*inputs offset
.
In this case for
[0,255] range it would give 4*[0, 255] 1 : [1, 1021]