SRGAN记录

1.psnr

在超分辨率问题中,有一指标PSNR(信噪比)衡量重建图像的质量。



MSE为均方误差



K为图像对应的二进制位数,一般都是8(255位)

2.SRGAN原理

代码地址:https://github.com/aitorzip/PyTorch-SRGAN
1)网络结构:

class Generator(nn.Module):
    def __init__(self, n_residual_blocks, upsample_factor):
        super(Generator, self).__init__()
        self.n_residual_blocks = n_residual_blocks
        self.upsample_factor = upsample_factor

        self.conv1 = nn.Conv2d(3, 64, 9, stride=1, padding=4)

        for i in range(self.n_residual_blocks):
            self.add_module('residual_block' + str(i+1), residualBlock())

        self.conv2 = nn.Conv2d(64, 64, 3, stride=1, padding=1)
        self.bn2 = nn.BatchNorm2d(64)

        for i in range(self.upsample_factor/2):
            self.add_module('upsample' + str(i+1), upsampleBlock(64, 256))

        self.conv3 = nn.Conv2d(64, 3, 9, stride=1, padding=4)

    def forward(self, x):
        x = swish(self.conv1(x))

        y = x.clone()
        for i in range(self.n_residual_blocks):
            y = self.__getattr__('residual_block' + str(i+1))(y)

        x = self.bn2(self.conv2(y)) + x
        for i in range(self.upsample_factor/2):
            x = self.__getattr__('upsample' + str(i+1))(x)
        return self.conv3(x)

有一sub-pixel Convolution操作

2)损失函数
1.内容损失函数,把某一层特征图的逐像素损失作为了内容损失,学一些高层的语义特征和结构信息。

2)对抗损失
3)正则损失

你可能感兴趣的:(SRGAN记录)