I'm using ImageDataGenerator with flow_from_dataframe to load a dataset.
ImageDataGenerator allows you to specify a rescaling factor like this
datagen = ImageDataGenerator(rescale=1./255)
But what if I want to rescale my images in the range [-1,1]? I should do a subtraction followed by a division
images -= 128.0 images /= 128.0
How can I do these two operations in the rescale of ImageDataGenerator?
try using rescale=1/127.5-1 or you can use pre defined processor functions such as
preprocessing_function=tf.keras.applications.mobilenet.preprocess_input
2.1m questions
2.1m answers
60 comments
57.0k users