Skip to content Skip to sidebar Skip to footer

Can't Import Apply_transform From Keras.preprocessing.image

I have been having issues importing apply_transform from keras.preprocessing.image. As far as I know the name has not changed according to Keras documentation. Anyone has any idea

Solution 1:

apply_transform has been removed from image module and has been refactored as one of the methods of ImageDataGenerator class. Instead you can define an instance of ImageDataGenerator class and use it:

from keras.preprocessing.image import ImageDataGenerator

img_gen = ImageDataGenerator()
img_gen.apply_transform(args)

or you can use apply_affine_transform() method from keras.preprocessing.image module if it satisfies your needs.

And I think you are right. The documentation is wrong about this:

keras.preprocessing.image.apply_transform(x, transform_parameters)

whereas it should be:

apply_transform(x, transform_parameters)


Post a Comment for "Can't Import Apply_transform From Keras.preprocessing.image"