Real-World Super-Resolution via Kernel Estimation and Noise Injection(realSR)代码怎么跑起来?

论文名称:Real-World Super-Resolution via Kernel Estimation and Noise Injection

代码地址:

https://github.com/Tencent/Real-SR

环境配置

可以按照仓库中给的库版本进行配置,也可以搜索basicSR的代码,配置basicSR环境

跑track1的代码

要运行这两个文件,首先要在path.yml中将路径修改,格式如下:

df2k:
  tdsr:
    source: '../../ntire20/Corrupted-tr-x'
    target: '../../ntire20/Corrupted-tr-y'
    valid:
datasets:       # 输出的目录
  df2k: '../datasets/DF2K'

确定输入输出路径:

输入:source是低分辨率图片,而target是高清图片。在df2k中:Corrupted-tr-x是NEIRE中的source data Corrupted-tr-y是高清的target data

输出:dataset:下的内容

如果是自己的数据集还有修改create_bicubic_dataset.py中的程序

因为还要将路径从yml文件中读取出来,赋值给变量

也是仿照tf2k的写法就可以了

elif opt.dataset == 'hcp':          # 通过读取yaml文件指定路径,这个也是通过键值对的形式,df2k就是有LR,HR对的,else里面是没有的那一种
    path_sdsr = PATHS['datasets']['hcp'] + '/generated/sdsr/'
    path_tdsr = PATHS['datasets']['hcp'] + '/generated/tdsr/'
    input_source_dir = PATHS['hcp']['tdsr']['source']
    input_target_dir = PATHS['hcp']['tdsr']['target']
    source_files = [os.path.join(input_source_dir, x) for x in os.listdir(input_source_dir) if utils.is_image_file(x)]
    target_files = [os.path.join(input_target_dir, x) for x in os.listdir(input_target_dir) if utils.is_image_file(x)]

然后开始下采样和采集噪声

create_bicubic_dataset.py 会进行下采样,然后,对源域和目标域进行下采样。

python3 ./preprocess/create_bicubic_dataset.py --dataset df2k --artifacts tdsr

这一步回创建dataset文件夹中的/generated/tdsr/中的hr和lr

collect_noise.py 好像就是把图像变成灰度,然后随机裁剪保留高频?

python3 ./preprocess/collect_noise.py --dataset df2k --artifacts tdsr

同样在运行这个程序的时候也要将collect_noise.py 中的路径更改

然后运行训练程序即可

bug:

https://github.com/Tencent/Real-SR/issues/16

按照方法2解决了

bug

ValueError: Required crop size (80, 80) is larger then input image size (50, 50)

self.noises = noiseDataset(opt['noise_data'], opt['GT_size']/opt['scale'])

这里是决定crop_size的

RuntimeError: The size of tensor a (192) must match the size of tensor b (96) at non-singleton dimension 3

应该是scale改了2但是没有起作用,还是4x超分了

RuntimeError: mat1 and mat2 shapes cannot be multiplied (16x4608 and 8192x100)

论文的判别器一定要是128或者是256.这可咋整

只能将<128的图片去掉

要求noise_img也大于64

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值