Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.4k views
in Technique[技术] by (71.8m points)

keras - TypeError: ('Keyword argument not understood:', 'mode')

Siamese Network

def create_base_network_signet(input_shape):
'''Base Siamese Network'''

seq = Sequential()
seq.add(Conv2D(96, kernel_size=(11, 11), activation='relu', name='conv1_1', strides=4, input_shape= input_shape, 
                    kernel_initializer='glorot_uniform'))
seq.add(BatchNormalization(epsilon=1e-06, mode=0, axis=1, momentum=0.9))
seq.add(MaxPooling2D((3,3), strides=(2, 2)))    
seq.add(ZeroPadding2D((2, 2), dim_ordering='tf'))

seq.add(Conv2D(256, kernel_size=(5, 5), activation='relu', name='conv2_1', strides=1, kernel_initializer='glorot_uniform'))
seq.add(BatchNormalization(epsilon=1e-06, mode=0, axis=1, momentum=0.9))
seq.add(MaxPooling2D((3,3), strides=(2, 2)))
seq.add(Dropout(0.3))# added extra
seq.add(ZeroPadding2D((1, 1)))

seq.add(Conv2D(384, kernel_size=(3, 3), activation='relu', name='conv3_1', strides=1, kernel_initializer='glorot_uniform'))
seq.add(ZeroPadding2D((1, 1)))

seq.add(Conv2D(256, kernel_size=(3, 3), activation='relu', name='conv3_2', strides=1, kernel_initializer='glorot_uniform'))    
seq.add(MaxPooling2D((3,3), strides=(2, 2)))
seq.add(Dropout(0.3))# added extra
seq.add(Flatten(name='flatten'))
seq.add(Dense(1024, W_regularizer=l2(0.0005), activation='relu', kernel_initializer='glorot_uniform'))
seq.add(Dropout(0.5))

seq.add(Dense(128, W_regularizer=l2(0.0005), activation='relu', kernel_initializer='glorot_uniform')) # softmax changed to relu

return seq

Error

    TypeError                                 Traceback (most recent call last)
<ipython-input-68-ffbba8b5172f> in <module>()
      1 # network definition
----> 2 base_network = create_base_network_signet(input_shape)
      3 
      4 input_a = Input(shape=(input_shape))
      5 input_b = Input(shape=(input_shape))

4 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/utils/generic_utils.py in validate_kwargs(kwargs, allowed_kwargs, error_message)
    806   for kwarg in kwargs:
    807     if kwarg not in allowed_kwargs:
--> 808       raise TypeError(error_message, kwarg)
    809 
    810 

TypeError: ('Keyword argument not understood:', 'mode')

I am not able to solve this error what changes I should do in order to run the code? It is siamese network code for signature verification. I am using updated keras and tensorflow

question from:https://stackoverflow.com/questions/65829897/typeerror-keyword-argument-not-understood-mode

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...