error : set_model() missing 1 required positional argument: ‘model’

  django, keras, machine-learning, python, tensorflow

I’ve created an emotion detection Model with resnet50 and I’m using the Adam optimizer. However, I get the following error


TypeError: set_model() missing 1 required positional argument: 'model'

And here’s my code to create a model:

# Build model on the top of base model
model = Sequential()

model.add(base_model)
model.add(Dropout(0.5))
model.add(Flatten())
model.add(BatchNormalization())

# fully connected layer-1
model.add(Dense(128, kernel_initializer = 'he_uniform'))
model.add(BatchNormalization())
model.add(Activation('relu'))
model.add(Dropout(0.5))

# fully connected layer-2
model.add(Dense(64, kernel_initializer = 'he_uniform'))
model.add(BatchNormalization())
model.add(Activation('relu'))
model.add(Dropout(0.5))

# fully connected layer-3
model.add(Dense(32, kernel_initializer = 'he_uniform'))
model.add(BatchNormalization())
model.add(Activation('relu'))

# output layer
model.add(Dense(7, activation = 'softmax'))

# model Summary
model.summary()

# compile model
model.compile(optimizer= 'Adam', loss='categorical_crossentropy', metrics=metric)
# model fitting
history = model.fit_generator(train_generator, validation_data=test_generator,epochs=60,verbose = 1,callbacks=callbacks)

please help me

Source: Python Questions

LEAVE A COMMENT