def create_model(self, height=32, width=32, channels=3, load_weights=False, batch_size=128):
"""
Creates a model to be used to scale images of specific height and width.
"""
init = super(ExpantionSuperResolution, self).create_model(height, width, channels, load_weights, batch_size)
x = Convolution2D(self.n1, self.f1, self.f1, activation='relu', border_mode='same', name='level1')(init)
x1 = Convolution2D(self.n2, self.f2_1, self.f2_1, activation='relu', border_mode='same', name='lavel1_1')(x)
x2 = Convolution2D(self.n2, self.f2_2, self.f2_2, activation='relu', border_mode='same', name='lavel1_2')(x)
x3 = Convolution2D(self.n2, self.f2_3, self.f2_3, activation='relu', border_mode='same', name='lavel1_3')(x)
x = merge([x1, x2, x3], mode='ave')
out = Convolution2D(channels, self.f3, self.f3, activation='relu', border_mode='same', name='output')(x)
model = Model(init, out)
adam = optimizers.Adam(lr=1e-3)
model.compile(optimizer=adam, loss='mse', metrics=[PSNRLoss])
if load_weights: model.load_weights(self.weight_path)
self.model = model
return model
评论列表
文章目录