old photo老照片图像复原数据集

 来源

本来想拿DA-CLIP 训练一下old photo,训练代码没成功,毕设没时间就不研究了 

github搜old photo复原论文原作者好像没开源训练数据集,所以用了这个SynOld

训练集500对测试集200对

但是readme写的很差,其他什么也没交代

 

展示 

 

考证

拿GT图去Google搜图

搞了半天勉强搜上

与训练文件夹下第一张GT图相同

目测用的 PASCAL VOC

生成方法估计参考《Bringing Old Photos Back to Life》

分割代码 

第一次见这种保存数据集方式,我将它分割回更一般的 GT、LQ两个文件夹

import os
from PIL import Image

def split_images(input_dir, output_dir):
    """
    Split paired LQ and GT images into separate files.

    Args:
    input_dir (str): The path to the directory containing the paired images.
    output_dir (str): The path to the directory where the split images will be saved.
    """
    # Create LQ and GT subdirectories if they do not exist
    lq_dir = os.path.join(output_dir, 'LQ')
    gt_dir = os.path.join(output_dir, 'GT')
    os.makedirs(lq_dir, exist_ok=True)
    os.makedirs(gt_dir, exist_ok=True)

    for filename in os.listdir(input_dir):
        if filename.endswith('.jpg'):
            image_path = os.path.join(input_dir, filename)
            with Image.open(image_path) as img:
                # Assuming the images are horizontally paired
                width, height = img.size
                assert width % 2 == 0, "The width of the image is not even, cannot split into two equal parts."

                # Extract LQ image (left half)
                lq_img = img.crop((0, 0, width // 2, height))
                lq_output_path = os.path.join(lq_dir, os.path.splitext(filename)[0] + '_LQ.jpg')
                lq_img.save(lq_output_path)

                # Extract GT image (right half)
                gt_img = img.crop((width // 2, 0, width, height))
                gt_output_path = os.path.join(gt_dir, os.path.splitext(filename)[0] + '_GT.jpg')
                gt_img.save(gt_output_path)

                print(f"Saved split images: {lq_output_path} and {gt_output_path}")

# Set the paths for input and output directories
input_directory = 'E:\\SynOld-main\\test'
output_directory = 'C:\\Users\\86136\\Desktop\\LQ_images\\old photo'

# Call the function to split the paired images
split_images(input_directory, output_directory)

 只用两行地址

 input_directory = 'E:\\SynOld-main\\test'

这是要分割的图像所在文件夹地址,这里只分了test集


output_directory = 'C:\\Users\\86136\\Desktop\\LQ_images\\old photo'

这是我的结果保存路径

结果

 

 DA-CLIP自动检测复原结果

 很一般,没有inpainting那么惊艳,一般识别为snowy、shadow、JPEG压缩伪影啥的

只有少量小白点去除。

附复原了25张图的相关指标

PSNR: 21.679276 dB;

SSIM: 0.677668

 LPIPS    : 0.332356

  • 16
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值