论文名称: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 中的路径更改

然后运行训练程序即可

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

按照方法2解决了

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

print(np.max(augmented_image[0],1).shape) 两种显示方式 plt.imshow(augmented_image[0].numpy().astype(“uint8”)) plt.imshow(augmented_image[0] / 255)) (160, 160, 3) (160, 3) np.max(a,1) np.argmax(a, 1) When you set layer.trainable = False, the
append: 说明:append() 方法用于在列表末尾添加新的对象。 使用方法: list.append(obj) # obj添加到列表末尾的对象;该方法无返回值,但是会修改原来的列表。 extend: 说明:extend() 函数用于在列表末尾一次性...
欢迎使用Markdown编辑器 ValueError: Expected input batch_size (16) to match target batch_size (4). 原因:之前用的数据集输入尺寸为batch*3*32*32,每张图片尺寸为3*32*32,现在的是3*64*64,因此需要修改网络输入尺寸,否则Pytorch会将输入...
1、UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number #原语句: train_loss+=loss.data[0] #修改后: train_lo...
Real-World Super-Resolution via Kernel Estimation and Noise Injection(realSR)代码怎么跑起来? zyd的小飞船: 你好,麻烦问一下,最后一个bug crop_size是在什么文件里呢? yolov5 自己制作数据集,训练模型 labelImg标注 自动生成标签 么么哒的小谦: 0后面的四个数字分别代表什么? yolov5 自己制作数据集,训练模型 labelImg标注 自动生成标签 您的小宝贝提醒: 自建数据集只标注一类可以吗 yolov5 自己制作数据集,训练模型 labelImg标注 自动生成标签 dear suho: 自建数据集只标注一类可以吗 yolov5 自己制作数据集,训练模型 labelImg标注 自动生成标签 码农的后花园: --save-crop ,没有看到这个参数啊,yolov5中好像