Skip to main content

Blog

Learn About Our Meetup

5000+ Members

MEETUPS

LEARN, CONNECT, SHARE

Join our meetup, learn, connect, share, and get to know your Toronto AI community. 

JOB POSTINGS

INDEED POSTINGS

Browse through the latest deep learning, ai, machine learning postings from Indeed for the GTA.

CONTACT

CONNECT WITH US

Are you looking to sponsor space, be a speaker, or volunteer, feel free to give us a shout.

Ensemble model not converging while single model converges [DISCUSSION]

I am using two Imagenet models and multiplying their outputs to create an ensemble model consisting of those two models.

My first attempt is using the same model, but with different images sizes as inputs.

However this ensemble model doesn’t seem to be converging. It gets stuck at 78% accuracy, no matter how many layers I unfreeze. While a single model is converging and over-fitting.

Is there something wrong with my model setup or something you suggest I try?

def full_model_5(model_keys): """prediction x, y, multiply them , activation softmax""" model_key, model_key2 = model_keys base_model, preprocess = basemodel(model_key) base_model2, preprocess2 = basemodel(model_key2) for layer in base_model.layers: # all base_layers are not trainable layer.name = layer.name + "dup" layer.trainable = False for layer in base_model2.layers: # all base_layers are not trainable layer.trainable = False # first model x = base_model.output x = GlobalAveragePooling2D()(x) x = Dense(2048, activation='relu')(x) x = BatchNormalization()(x) x = Dense(512, activation='relu')(x) x = BatchNormalization()(x) predictions_x = Dense(classes, activation='relu')(x) # second model y = base_model2.output y = GlobalAveragePooling2D()(y) y = Dense(2048, activation='relu')(y) y = BatchNormalization()(y) y = Dense(512, activation='relu')(y) y = BatchNormalization()(y) predictions_y = Dense(classes, activation='relu')(y) # combine the models together predictions = Multiply()([predictions_x, predictions_y]) predictions = Activation("softmax")(predictions) ##predictions = Maximum()([predictions_x, predictions_y]) model = Model(inputs= [base_model.input,base_model2.input], outputs=predictions) return model,( preprocess,preprocess2) 

submitted by /u/bakamito
[link] [comments]