models.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Super-Resolution-using-Generative-Adversarial-Networks 作者: titu1994 项目源码 文件源码
def create_sr_model(self, ip):

        x = Convolution2D(self.filters, 5, 5, activation='linear', border_mode='same', name='sr_res_conv1',
                          init=self.init)(ip)
        x = BatchNormalization(axis=channel_axis, mode=self.mode, name='sr_res_bn_1')(x)
        x = LeakyReLU(alpha=0.25, name='sr_res_lr1')(x)

        # x = Convolution2D(self.filters, 5, 5, activation='linear', border_mode='same', name='sr_res_conv2')(x)
        # x = BatchNormalization(axis=channel_axis, mode=self.mode, name='sr_res_bn_2')(x)
        # x = LeakyReLU(alpha=0.25, name='sr_res_lr2')(x)

        nb_residual = 5 if self.small_model else 15

        for i in range(nb_residual):
            x = self._residual_block(x, i + 1)

        for scale in range(self.nb_scales):
            x = self._upscale_block(x, scale + 1)

        scale = 2 ** self.nb_scales
        tv_regularizer = TVRegularizer(img_width=self.img_width * scale, img_height=self.img_height * scale,
                                       weight=self.tv_weight) #self.tv_weight)

        x = Convolution2D(3, 5, 5, activation='tanh', border_mode='same', activity_regularizer=tv_regularizer,
                          init=self.init, name='sr_res_conv_final')(x)

        x = Denormalize(name='sr_res_conv_denorm')(x)

        return x
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号