def create_model(self, height=16, width=16, channels=3, load_weights=False, batch_size=128):
# Note height, width = 16 instead of 32 like usual
init = super(EfficientSubPixelConvolutionalSR, 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)
x = Convolution2D(self.n2, self.f2, self.f2, activation='relu', border_mode='same', name='level2')(x)
x = self._upscale_block(x, 1)
out = Convolution2D(3, 5, 5, activation='linear', border_mode='same')(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
评论列表
文章目录