Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.3.0 ImageDataGenerator : unexpected keyword argument 'interpolation_order' #13347

Closed
mrever opened this issue Sep 19, 2019 · 12 comments
Closed
Labels
type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited.

Comments

@mrever
Copy link

mrever commented Sep 19, 2019

Just upgraded to 2.3.0

This used to work (in 2.2.4):

from keras.preprocessing.image import ImageDataGenerator
train_datagen = ImageDataGenerator(
rescale=1./255,
rotation_range=20,
width_shift_range=0.2,
height_shift_range=0.2,
horizontal_flip=True,
fill_mode='nearest')

#or just train_datagen = ImageDataGenerator()

but now I get:
...
TypeError: init() got an unexpected keyword argument 'interpolation_order'

Thanks

@upuil
Copy link

upuil commented Sep 23, 2019

same problem

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-14-90f82dba206d> in <module>()
     52 # this is the augmentation configuration we will use for training
     53 train_datagen = ImageDataGenerator(
---> 54     rescale=1. / 255)
     55 
     56 # this is the augmentation configuration we will use for testing:

/home/app/anaconda3/lib/python3.6/site-packages/keras/preprocessing/image.py in __init__(self, featurewise_center, samplewise_center, featurewise_std_normalization, samplewise_std_normalization, zca_whitening, zca_epsilon, rotation_range, width_shift_range, height_shift_range, brightness_range, shear_range, zoom_range, channel_shift_range, fill_mode, cval, horizontal_flip, vertical_flip, rescale, preprocessing_function, data_format, validation_split, interpolation_order, dtype)
    290             validation_split=validation_split,
    291             interpolation_order=interpolation_order,
--> 292             dtype=dtype)
    293 
    294     def flow(self,

TypeError: __init__() got an unexpected keyword argument 'interpolation_order'


@gowthamkpr gowthamkpr added the type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited. label Sep 26, 2019
@FraLupo
Copy link

FraLupo commented Sep 30, 2019

Same
File "train_triplet_deepfashion.py", line 118, in main horizontal_flip=True, fill_mode="nearest") File "/usr/local/lib/python2.7/dist-packages/keras/preprocessing/image.py", line 292, in __init__ dtype=dtype) TypeError: __init__() got an unexpected keyword argument 'interpolation_order'

@SubigyaPanta
Copy link

same problem.
TypeError: __init__() got an unexpected keyword argument 'interpolation_order' from ImageDataGenerator.
Everything works on 2.2.4

@venergiac
Copy link

same error

generator.flow_from_directory(
path,
target_size=target_size,
batch_size=batch_size,
color_mode=color_mode,
class_mode=class_mode,
subset=subset)

got

init() got an unexpected keyword argument 'interpolation_order'

Everything works on 2.2.5

@gaizi-0208
Copy link

same problem.
how to solve it?

@FraLupo
Copy link

FraLupo commented Oct 11, 2019

Downgrade to keras 2.2.4

@JavierClearImageAI
Copy link

JavierClearImageAI commented Oct 22, 2019

you can also try the new version of keras, which is syncronized with tf. It might not solve all keras compatibility problems, but it worked for my case, allowing me to keep working with the more recent version of Keras

from tensorflow.keras.preprocessing.image import ImageDataGenerator

More info here: keras vs tf.keras

@xhm1014
Copy link

xhm1014 commented Oct 23, 2019

Same problem. and I tried

from tensorflow.keras.preprocessing.image import ImageDataGenerator

it is working now.

Thanks JavierClearImageAI

@Sanjeeth8733
Copy link

The same error can anyone help me out?
TypeError Traceback (most recent call last)
in
207 X,label=shuffle(X,label,random_state=2)
208 model=get_model()
--> 209 fit_model(model,X,label)

in fit_model(model, X, label)
189
190 datagen.fit(X_train)
--> 191 model.fit_generator(datagen.flow(X_train, y_train, batch_size=32, class_mode="categorical",target_size=(64, 64),color_mode="rgb",save_to_dir=r'/Users/Sanjeeth/Python work space/project1/testing/resnet/', save_prefix='fudus', save_format='jpeg'), steps_per_epoch=len(X_train) / 32, epochs=4)
192
193

TypeError: flow() got an unexpected keyword argument 'class_mode'

@pengpaiSH
Copy link

you can also try the new version of keras, which is syncronized with tf. It might not solve all keras compatibility problems, but it worked for my case, allowing me to keep working with the more recent version of Keras

from tensorflow.keras.preprocessing.image import ImageDataGenerator

More info here: keras vs tf.keras

Thank you. It really works. But I am wondering why Keras version does not work.

@oranatefa
Copy link

thanks this:
from tensorflow.keras.preprocessing.image import ImageDataGenerator
worked for me as well....

@apatsekin
Copy link

If you don't want to mix tf.keras and keras in your code base (as I did), the alternative is:
pip3 install --ugprade keras-preprocessing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:support User is asking for help / asking an implementation question. Stackoverflow would be better suited.
Projects
None yet
Development

No branches or pull requests