def get_small_model_with_other_model_as_layer(): inp_mask = Input(shape=(128, 128, 3)) pretrain_model_mask = MobileNet(input_shape=(128, 128, 3), include_top=False, weights='imagenet', pooling='avg') try: pretrain_model_mask.name = 'mobilenet' except: pretrain_model_mask._name = 'mobilenet' x = pretrain_model_mask(inp_mask) out = Dense(2, activation='sigmoid')(x) model = Model(inputs=inp_mask, outputs=[out]) return model
def get_small_model_with_other_model_as_layer(): from keras.layers import Input, Dense from keras.models import Model from keras.applications.mobilenet import MobileNet inp_mask = Input(shape=(128, 128, 3)) pretrain_model_mask = MobileNet(input_shape=(128, 128, 3), include_top=False, weights='imagenet', pooling='avg') pretrain_model_mask.name = 'mobilenet' x = pretrain_model_mask(inp_mask) out = Dense(2, activation='sigmoid')(x) model = Model(inputs=inp_mask, outputs=[out]) return model