Reputation: 370
I've built the following model with Keras from Tensorflow (version = 2.2.4-tf)
model = tf.keras.Sequential()
model.add(Convolution2D(24, 5, 5, padding='same',init='he_normal', input_shape = (target_Width,target_Height, 3),dim_ordering="tf"))
model.add(Activation('relu'))
model.add(GlobalAveragePooling2D())
model.add(Dense(18))
But somehow I'm getting the following error: ('Keyword argument not understood:', 'init')
and ('Keyword argument not understood:', 'dim_ordering')
Upvotes: 0
Views: 4650
Reputation: 60321
None of these arguments exist, according to the documentation.
By init
, I take it you meant to use kernel_initializer
dim_ordering="tf"
is used only in stand-alone Keras (and not in tf.keras
), as stand-alone Keras can be used with either Tensorflow or Theano backends; these backends use different ordering scheme, hence the need to clarify this. It is not necessary here.
So, here your convolutional layer should be:
model.add(Conv2D(24, 5, 5, padding='same', kernel_initializer='he_normal', input_shape = (target_Width,target_Height, 3)))
If, as the answer answer suggests, you are indeed using keras.layers.convolutional.Convolution2D
from the stand-alone Keras package in a tf.keras.Sequential()
model, this mixing is highly not recommended, and you should revert to tf.keras.layers.Conv2D
instead (and do the same for the rest of the model layers as well).
Upvotes: 2
Reputation: 6799
It seems that you are trying to use keras.layers.convolutional.Convolution2D instead of tf.keras.layers.Conv2D. If that is the case then use this instead:
from keras.models import Sequential
model = Sequential()
model.add(keras.layers.convolutional.Convolution2D(24, 5, 5, padding='same',init='he_normal', input_shape = (target_Width,target_Height, 3),dim_ordering="tf"))
Or using Conv2D
from tf.keras
which does not have the arguments init
and dim_ordering
:
model = tf.keras.Sequential()
model.add(Conv2D(24, 5, 5, padding='same', kernel_initializer='he_normal', input_shape = (target_Width,target_Height, 3)))
Upvotes: 3