class Model:
def __init__(self):
self.model = Sequential()
self.model.add(Conv2D(24, 3, 2, 'valid', input_shape=(75, 75, 3)))
self.model.add(BatchNormalization())
self.model.add(Conv2D(24, 3, 2))
self.model.add(BatchNormalization())
self.model.add(Conv2D(24, 3, 2))
self.model.add(BatchNormalization())
self.model.add(Conv2D(24, 3, 2))
self.model.add(BatchNormalization())
self.model.add(Flatten())
def get_model(self):
return self.model
class CNN_MLP:
def __init__(self):
model = Model()
self.model = model.get_model()
self.optimizer = optimizers
def get_model(self):
self.model = self.extend(self.model)
return self.model
def extend(self, model):
self.model = model
self.sequence = Input(shape=(75, 75, 3), name='Sequence')
self.features = Input(shape=(11, ), name='Features')
conv_sequence = self.model(self.sequence)
merged_features = concatenate([conv_sequence, self.features])
fc1 = Dense(256, activation='relu')(merged_features)
fc2 = Dense(256, activation='relu')(fc1)
logits = Dense(10, activation='softmax')(fc2)
# In the following statement I am getting the error
self.model = Model(inputs=[self.sequence, self.features], outputs=[logits])
return self.model
Я пытаюсь выполнить приведенный выше код и получаю вышеупомянутую ошибку.Я на версии 2.2.4-tf Keras.Я не могу понять причину ошибки.
Может ли кто-нибудь помочь мне определить и, таким образом, устранить проблему?
Спасибо!
Редактировать 1: Полный возврат:
<ipython-input-29-5112dc1649fd> in <module>()
1 if args.model == 'CNN_MLP':
2 model = CNN_MLP()
----> 3 model = model.get_model()
1 frames
<ipython-input-28-6491bbcf21c5> in get_model(self)
6
7 def get_model(self):
----> 8 self.model = self.extend(self.model)
9 return self.model
10
<ipython-input-28-6491bbcf21c5> in extend(self, model)
20 logits = Dense(10, activation='softmax')(fc2)
21
---> 22 self.model = Model(inputs=[self.sequence, self.features], outputs=[logits])
23 return self.model
TypeError: __init__() got an unexpected keyword argument 'inputs'