图像超分DASR复现

在复现DASR代码时,经过生成器生成的图片为黑白色背景图。
经过下采样的图片已生成是模糊的图像,但经过生成器就输出图像不对。
请问一下为什么出现这样情况,怎么修改呢,谢谢!

if torch.cuda.is_available():   
            resize_img_tensor = torch.from_numpy(resize_img).unsqueeze(0).cuda()  #数组转为张量   # tensor:(1351510,3resize_img = resize_img_tensor.permute(0, 3, 1, 2).float()  #    # tensor:(13351510fake_img = model_g(resize_img)  # tensor:(1,3351510fake_img = fake_img.squeeze(0).cpu()#tensor:(3351510path = os.path.join(tdsr_lr_ddm_s_dir, os.path.basename(file))
        TF.to_pil_image(fake_img).save(path, 'PNG')
mold_g:class Generator(nn.Module):
    def __init__(self, n_res_blocks=8):
        super(Generator, self).__init__()
        self.block_input = nn.Sequential(
            nn.Conv2d(3, 64, kernel_size=3, padding=1),
            nn.PReLU()
        ) 
        self.res_blocks = nn.ModuleList([ResidualBlock(64) for _ in range(n_res_blocks)])
        self.block_output = nn.Conv2d(64, 3, kernel_size=3, padding=1)
    

    def forward(self, x):
        block = self.block_input(x)
        for res_block in self.res_blocks:
            block = res_block(block)
        block = self.block_output(block) # tensor(1.64.351.510)
        return torch.sigmoid(block)  # tensor(1.3.351.510)

class ResidualBlock(nn.Module):
    def __init__(self, channels):
        super(ResidualBlock, self).__init__()
        self.conv1 = nn.Conv2d(channels, channels, kernel_size=3, padding=1)
        self.prelu = nn.PReLU()
        self.conv2 = nn.Conv2d(channels, channels, kernel_size=3, padding=1)

    def forward(self, x):
        residual = self.conv1(x)
        residual = self.prelu(residual)
        residual = self.conv2(residual)
        return x + residual

其中fake_img张量如下

img

![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/754047415586184.png "#left")

img

在图像超分领域中,生成器的目标通常是生成高分辨率的图像,这些高分辨率的图像应该是彩色的。如果你生成的图像是黑白的,可能是因为你的生成器在设计时没有考虑彩色化的问题。

另外,下采样得到的图像通常是模糊的,这是因为在下采样的过程中,图像的信息被减少了很多。当这些模糊的图像输入到生成器中时,生成器需要对其进行处理以生成高分辨率的图像。但是,如果生成器的设计不够好,它可能无法正确地处理这些模糊的图像,导致输出错误的图像。