GithubHelp home page GithubHelp logo

real-sr's Introduction

RealSR

logo

Real-World Super-Resolution via Kernel Estimation and Noise Injection (CVPR 2020 Workshops)

Xiaozhong Ji, Yun Cao, Ying Tai, Chengjie Wang, Jilin Li, and Feiyue Huang

Tencent Youtu Lab

Our solution is the winner of CVPR NTIRE 2020 Challenge on Real-World Super-Resolution in both tracks.

(Official PyTorch Implementation)

Update - September 1, 2020

  • Release training code at Github/Tencent.

Update - May 26, 2020

  • Add DF2K-JPEG Model.
  • Executable files based on ncnn are available. Test your own images on windows/linux/macos. More details refer to realsr-ncnn-vulkan
    • Usage - ./realsr-ncnn-vulkan -i in.jpg -o out.png
    • -x - use ensemble
    • -g 0 - select gpu id.

Introduction

Recent state-of-the-art super-resolution methods have achieved impressive performance on ideal datasets regardless of blur and noise. However, these methods always fail in real-world image super-resolution, since most of them adopt simple bicubic downsampling from high-quality images to construct Low-Resolution (LR) and High-Resolution (HR) pairs for training which may lose track of frequency-related details. To address this issue, we focus on designing a novel degradation framework for real-world images by estimating various blur kernels as well as real noise distributions. Based on our novel degradation framework, we can acquire LR images sharing a common domain with real-world images. Then, we propose a real-world super-resolution model aiming at better perception. Extensive experiments on synthetic noise data and real-world images demonstrate that our method outperforms the state-of-the-art methods, resulting in lower noise and better visual quality. In addition, our method is the winner of NTIRE 2020 Challenge on both tracks of Real-World Super-Resolution, which significantly outperforms other competitors by large margins.

RealSR

If you are interested in this work, please cite our paper

@InProceedings{Ji_2020_CVPR_Workshops,
               author = {Ji, Xiaozhong and Cao, Yun and Tai, Ying and Wang, Chengjie and Li, Jilin and Huang, Feiyue},
               title = {Real-World Super-Resolution via Kernel Estimation and Noise Injection},
               booktitle = {The IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
               month = {June},
               year = {2020}
     }

and challenge report NTIRE 2020 Challenge on Real-World Image Super-Resolution: Methods and Results

@article{Lugmayr2020ntire,
        title={NTIRE 2020 Challenge on Real-World Image Super-Resolution: Methods and Results},
        author={Andreas Lugmayr, Martin Danelljan, Radu Timofte, Namhyuk Ahn, Dongwoon Bai, Jie Cai, Yun Cao, Junyang Chen, Kaihua Cheng, SeYoung Chun, Wei Deng, Mostafa El-Khamy Chiu, Man Ho, Xiaozhong Ji, Amin Kheradmand, Gwantae Kim, Hanseok Ko, Kanghyu Lee, Jungwon Lee, Hao Li, Ziluan Liu, Zhi-Song Liu, Shuai Liu, Yunhua Lu, Zibo Meng, Pablo Navarrete, Michelini Christian, Micheloni Kalpesh, Prajapati Haoyu, Ren Yong, Hyeok Seo, Wan-Chi Siu, Kyung-Ah Sohn, Ying Tai, Rao Muhammad Umer, Shuangquan Wang, Huibing Wang, Timothy Haoning Wu, Haoning Wu, Biao Yang, Fuzhi Yang, Jaejun Yoo, Tongtong Zhao, Yuanbo Zhou, Haijie Zhuo, Ziyao Zong, Xueyi Zou},
        journal={CVPR Workshops},
        year={2020},
    }

Visual Results

0

1

Quantitative Results Compared with Other Participating Methods

'Impressionism' is our team. Note that the final decision is based on MOS (Mean Opinion Score) and MOR (Mean Opinion Rank).

0

1

Qualitative Results Compared with Other Participating Methods

'Impressionism' is our team.

0

1

Dependencies and Installation

This code is based on BasicSR.

  • Python 3 (Recommend to use Anaconda)
  • PyTorch >= 1.0
  • NVIDIA GPU + CUDA
  • Python packages: pip install numpy opencv-python lmdb pyyaml
  • TensorBoard:
    • PyTorch >= 1.1: pip install tb-nightly future
    • PyTorch == 1.0: pip install tensorboardX

Pre-trained models

  • Models for challenge results
    • DF2K for corrupted images with processing noise.
    • DPED for real images taken by cell phone camera.
  • Extended models

Testing

Download dataset from NTIRE 2020 RWSR and unzip it to your path.

For convenient, we provide Corrupted-te-x and DPEDiphone-crop-te-x.

cd ./codes

DF2K: Image processing artifacts

  1. Modify the configuration file options/df2k/test_df2k.yml
    • line 1 : 'name' -- dir name for saving the testing results
    • line 13 : 'dataroot_LR' -- test images dir
    • line 26 : 'pretrain_model_G' -- pre-trained model for testing
  2. Run command : CUDA_VISIBLE_DEVICES=X python3 test.py -opt options/df2k/test_df2k.yml
  3. The output images is saved in '../results/'

DPED: Smartphone images

  1. Modify the configuration file options/dped/test_dped.yml
    • line 1 : 'name' -- dir name for saving the testing results
    • line 13 : 'dataroot_LR' -- test images dir
    • line 26 : 'pretrain_model_G' -- pre-trained model for testing
  2. Run command : CUDA_VISIBLE_DEVICES=X python3 test.py -opt options/dped/test_dped.yml
  3. The output images is saved in '../results/'

Training

Track 1

  1. prepare training data

    • specify dataset paths in './preprocess/path.yml' and create bicubic dataset : python3 ./preprocess/create_bicubic_dataset.py --dataset df2k --artifacts tdsr

    • run the below command to collect high frequency noise from Source : python3 ./preprocess/collect_noise.py --dataset df2k --artifacts tdsr

  2. train SR model

    • Modify the configuration file options/df2k/train_bicubic_noise.yml
    • Run command : CUDA_VISIBLE_DEVICES=4,5,6,7 python3 train.py -opt options/df2k/train_bicubic_noise.yml
    • checkpoint dir is in '../experiments'

Track 2

  1. prepare training data

    • Use KernelGAN to generate kernels from source images. Clone the repo here. Replace SOURCE_PATH with specific path and run :

      cd KernelGAN
      CUDA_VISIBLE_DEVICES=4,5,6,7 python3 train.py --X4 --input-dir SOURCE_PATH
      
    • specify dataset paths in './preprocess/path.yml' and generated KERNEL_PATH to kernel create kernel dataset: python3 ./preprocess/create_kernel_dataset.py --dataset dped --artifacts clean --kernel_path KERNEL_PATH

    • run the below command to collect high frequency noise from Source: python3 ./preprocess/collect_noise.py --dataset dped --artifacts clean

  2. train SR model

    • Modify the configuration file options/dped/train_kernel_noise.yml
    • run command : CUDA_VISIBLE_DEVICES=4,5,6,7 python3 train.py -opt options/dped/train_kernel_noise.yml
    • checkpoint dir is in '../experiments'

real-sr's People

Contributors

nihui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

real-sr's Issues

It looks track2 (dped) does not use target data (tr-y) for train

It looks Track2 (dped) does not use target data (DPEDiphone-tr-y) for train.
https://github.com/Tencent/Real-SR/blob/master/codes/preprocess/create_kernel_dataset.py

There is no 'target' option in paths.yml.
https://github.com/Tencent/Real-SR/blob/master/codes/preprocess/paths.yml

While, Track1 use "Corrupted-tr-y and down-sampled Corrupted-tr-y" for train as GT and input with Corrupted-tr-x.
https://github.com/Tencent/Real-SR/blob/master/codes/preprocess/create_bicubic_dataset.py

Is that right? or did I miss something?
If it's right then was 'cleaned tr-x' enough for target data for GAN?

Thank you for sharing the code :-) 👍

RRDB_PSNR_x4.pth

Hello,

Thank you for sharing the code for your great work.

Can you please point where can I take RRDB_PSNR_x4.pth pretrained model for training procedure.

Inference on Image and CUDA out of memory

#DVK
!python test.py -opt options/df2k/test_df2k.yml

{'name': 'Track1', 'suffix': None, 'model': 'srgan', 'distortion': 'sr', 'scale': 4, 'crop_border': None, 'gpu_ids': [0], 'datasets': {'test_1': {'name': 'DIV2K', 'mode': 'LR', 'dataroot_LR': '/content/drive/MyDrive/RealSR/Real-SR/codes/testimages/images', 'phase': 'test', 'scale': 4, 'data_type': 'img'}}, 'network_G': {'which_model_G': 'RRDBNet', 'in_nc': 3, 'out_nc': 3, 'nf': 64, 'nb': 23, 'upscale': 4, 'scale': 4}, 'path': {'pretrain_model_G': '/content/drive/MyDrive/RealSR/Real-SR/codes/pretrained_model/DF2K.pth', 'results_root': '/content/drive/MyDrive/RealSR/Real-SR/results/Track1', 'root': '/content/drive/MyDrive/RealSR/Real-SR', 'log': '/content/drive/MyDrive/RealSR/Real-SR/results/Track1'}, 'is_train': False}
22-06-09 05:38:07.840 - INFO: name: Track1
suffix: None
model: srgan
distortion: sr
scale: 4
crop_border: None
gpu_ids: [0]
datasets:[
test_1:[
name: DIV2K
mode: LR
dataroot_LR: /content/drive/MyDrive/RealSR/Real-SR/codes/testimages/images
phase: test
scale: 4
data_type: img
]
]
network_G:[
which_model_G: RRDBNet
in_nc: 3
out_nc: 3
nf: 64
nb: 23
upscale: 4
scale: 4
]
path:[
pretrain_model_G: /content/drive/MyDrive/RealSR/Real-SR/codes/pretrained_model/DF2K.pth
results_root: /content/drive/MyDrive/RealSR/Real-SR/results/Track1
root: /content/drive/MyDrive/RealSR/Real-SR
log: /content/drive/MyDrive/RealSR/Real-SR/results/Track1
]
is_train: False

22-06-09 05:38:09.095 - INFO: Dataset [LRDataset - DIV2K] is created.
22-06-09 05:38:09.096 - INFO: Number of test images in [DIV2K]: 1
22-06-09 05:38:30.196 - INFO: Loading model for G [/content/drive/MyDrive/RealSR/Real-SR/codes/pretrained_model/DF2K.pth] ...
22-06-09 05:38:33.049 - INFO: Model [SRGANModel] is created.
22-06-09 05:38:33.049 - INFO:
Testing [DIV2K]...
Traceback (most recent call last):
File "test.py", line 61, in
model.test()
File "/content/drive/MyDrive/RealSR/Real-SR/codes/models/SRGAN_model.py", line 205, in test
self.fake_H = self.netG(self.var_L)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/parallel/data_parallel.py", line 166, in forward
return self.module(*inputs[0], **kwargs[0])
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/content/drive/MyDrive/RealSR/Real-SR/codes/models/modules/RRDBNet_arch.py", line 69, in forward
fea = self.lrelu(self.upconv2(F.interpolate(fea, scale_factor=2, mode='nearest')))
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/conv.py", line 447, in forward
return self._conv_forward(input, self.weight, self.bias)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/conv.py", line 444, in _conv_forward
self.padding, self.dilation, self.groups)
RuntimeError: CUDA out of memory. Tried to allocate 7.97 GiB (GPU 0; 14.76 GiB total capacity; 10.54 GiB already allocated; 2.23 GiB free; 11.29 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

Dimension Error in train.py

I am running train.py with the correct options and it is givinig me this error
21-05-24 21:22:32.620 - INFO: Loading model for G [/data2/superresolution/real-world-sr/esrgan-fs/experiments/Multiview_SR/models/55000_G.pth] ... 21-05-24 21:22:32.946 - INFO: Model [SRGANModel] is created. 21-05-24 21:22:32.946 - INFO: Start training from epoch: 0, iter: 0 /data2/superresolution/BasicSR/venv/lib/python3.8/site-packages/torch/nn/modules/loss.py:94: UserWarning: Using a target size (torch.Size([16, 3, 128, 128])) that is different to the input size (torch.Size([16, 3, 256, 256])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size. return F.l1_loss(input, target, reduction=self.reduction) Traceback (most recent call last): File "train.py", line 244, in <module> main() File "train.py", line 163, in main model.optimize_parameters(current_step) File "/data3/shivam/lsdr/Real-SR/codes/models/SRGAN_model.py", line 147, in optimize_parameters l_g_pix = self.l_pix_w * self.cri_pix(self.fake_H, self.var_H) File "/data2/superresolution/BasicSR/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/data2/superresolution/BasicSR/venv/lib/python3.8/site-packages/torch/nn/modules/loss.py", line 94, in forward return F.l1_loss(input, target, reduction=self.reduction) File "/data2/superresolution/BasicSR/venv/lib/python3.8/site-packages/torch/nn/functional.py", line 2633, in l1_loss expanded_input, expanded_target = torch.broadcast_tensors(input, target) File "/data2/superresolution/BasicSR/venv/lib/python3.8/site-packages/torch/functional.py", line 71, in broadcast_tensors return _VF.broadcast_tensors(tensors) # type: ignore RuntimeError: The size of tensor a (256) must match the size of tensor b (128) at non-singleton dimension 3

Please can somebody help me resolve this error? I am looking at all the possible cases which could have caused this but couldn't find one yet.

I would be very thankful if you could offer some suggestions or advice.

有关与提取的核和噪声

统计模糊核与真实噪声分布主要是并用于制作训练数据对;可以使得LR与真实世界图像处于同域。
但是核和噪声提取的效果很差怎么办?

question about clean-up

Hi, I have a question about clean-up section.
realSR "adopt bicubic downsampling on the real image in the source domain to remove noise and make the image sharper".

But bicubic downsampling preserve as much information as possible, including noise and content, but rather than "remove noise".
I tested on DIV2K train image 0048.png, which has severe noise. area / bicubic / bilinear downsampled 720*720 images are compared.

image

bicubic downsampled [bottom left] same visual quaility as HR;
area downsampled [top right] eliminate most background noise;
bilinear downsampled [bottom right] slightly denoise ;

or bicubic downsampling clean-up is just to fit with KernelGAN setting?

How to train x2 model?

Hello, I use kernelGAN to generate x4 kernels. If I want to train x2 model, should I re-generate x2 kernels with kernelGAN with --X2 parameters? or could I prepare the datapair by x4 kernels? What's more, could I finetune x2 model from pretrained RRDB_PSNR_x4.pth model ?

inferrence

why exits "self.netG.train()" in SRGAN_model.SRGANModel.test函数中as follows:,推理应该只包括test部分吧?

def test(self):
self.netG.eval()
with torch.no_grad():
self.fake_H = self.netG(self.var_L)
self.netG.train()

Question about clean-up

I gonna training with track2 method.

My question is what is clean up scale factor.

In paper, HR image is made with LR image downsampled using bicubic interpolation.

Then, there is notion about clean up scale factor.

How could I using clean up scale factor?

Could you let me know the calculation method for clean up scale factor?

image

train error

Thanks for your awesome code, I train it by my custom dataset, but some problems happened,

Original Traceback (most recent call last):
  File "/data/computervision/liuxingyu/envs/server31/anaconda3/envs/torch/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop
    data = fetcher.fetch(index)
  File "/data/computervision/liuxingyu/envs/server31/anaconda3/envs/torch/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/data/computervision/liuxingyu/envs/server31/anaconda3/envs/torch/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/data/computervision/liuxingyu/projects/super_resolution/Real-SR/codes/data/LQGT_dataset.py", line 147, in __getitem__
    noise = self.noises[np.random.randint(0, len(self.noises))]
  File "mtrand.pyx", line 746, in numpy.random.mtrand.RandomState.randint
  File "_bounded_integers.pyx", line 1254, in numpy.random._bounded_integers._rand_int64
ValueError: low >= high

Could you give some advice to handle it, Thanks a lot!

Question about the Reported Results

Hi, thanks for your wonderful work.

I am confused about some details of the evaluation.

  1. Are the results reported on the validation set or the test set?
  2. If they are reported on the test set, how can I reproduce these quantitative results? Or how can I get the results on the validation set?
  3. Are the results reported on the Y channel or RGB channels?
  4. Are the LPIPS results calculated directly on the range of [0, 255] or [-1, 1] like the official repo do?

I will appreciate it a lot if you can help me with these questions.

Thanks.

DF2K-JPEG Training

@tencent-adm can you share details about how the DF2K-JPEG model was trained with respect to the initial model used and what was the data preparation strategy?

Your Results in New Super-Resolution Benchmarks

Hello,

MSU Graphics & Media Lab Video Group has recently launched two new Super-Resolution Benchmarks.

Your method achieved 4th place in Video Upscalers Benchmark: Quality Enhancement in 'Animation 2x' category and 1st place in Super-Resolution for Video Compression Benchmark in 'x264 compression' category. We congratulate you on your result and look forward to your future work!

We would be grateful for your feedback on our work.

Less training

Is training for 60k steps with multisteplr decay and batch size 16 of 128x128x3 patches enough after using pretrained generator?

Where is the pretrained KernalGAN

Thank for great work!
But I could not found KernalGAN anywhere in this repo,
Where can I found the KernalGAN code and pretrained model?

RuntimeError in test

Thx for the great suggestion!

The following error occurred during testing.
RuntimeError: DataLoader worker (pid(s) 8448) exited unexpectedly
Probably due to lack of memory.
This may be resolved by setting the n_workers of the Data_loader to 0.
How do I set n_workers during testing?
I would also like to know if there is a better way.

Strategies for noise collection? How are max_var and min_mean set? Is there any principle?

Hi

hi, how are max_var and min_mean set in the noise collection method? Do you have any experience and skills? When I collected it myself, I found that most of the noise pictures are white environment pictures. Is it because the sky pictures have more obvious noise? For face data max_var = 20, min_mean = 50 is appropriate?

  if opt.dataset == 'df2k':
        img_dir = PATHS[opt.dataset][opt.artifacts]['source']
        noise_dir = PATHS['datasets']['df2k'] + '/Corrupted_noise'
        sp = 256
        max_var = 20
        min_mean = 0
    else:
        img_dir = PATHS[opt.dataset][opt.artifacts]['hr']['train']
        noise_dir = PATHS['datasets']['dped'] + '/DPEDiphone_noise'
        sp = 256
        max_var = 20
        min_mean = 50

thanks for your sharing! ! !

erro in multi-GPU training

when I train with multiply GPU,an erro occur:
File "/wytdata/Real-SR/codes/models/SRGAN_model.py", line 74, in __init__ model = create_model(opt) File "/wytdata/Real-SR/codes/models/__init__.py", line 14, in create_model m = M(opt) File "/wytdata/Real-SR/codes/models/SRGAN_model.py", line 74, in __init__ device_ids=[torch.cuda.current_device()]) File "/opt/conda/lib/python3.7/site-packages/torch/nn/parallel/distributed.py", line 238, in __init__ device_ids=[torch.cuda.current_device()]) File "/opt/conda/lib/python3.7/site-packages/torch/nn/parallel/distributed.py", line 238, in __init__ "DistributedDataParallel is not needed when a module " AssertionError: DistributedDataParallel is not needed when a module doesn't have any parameter that requires a gradient. "DistributedDataParallel is not needed when a module " AssertionError: DistributedDataParallel is not needed when a module doesn't have any parameter that requires a gradient.

The cause of the error appears to be to stop updating the parameters of VGG,Is there any solution?
if self.cri_fea: # load VGG perceptual loss
self.netF = networks.define_F(opt, use_bn=False).to(self.device)
if opt['dist']:
self.netF = DistributedDataParallel(self.netF,device_ids=[torch.cuda.current_device()]) #erro occurs here
else:
self.netF = DataParallel(self.netF)

about D_real、D_fake、l_d_fake、l_d_real in tb_logger

截图_2021-05-21_17-44-35
截图_2021-05-21_17-44-57

I’m not sure that the D_real and D_fake respectly corresponds to which part of the formula fo Lgan. Should they each gradually become larger or smaller? Can you help me see my picture if the training state is correct? i guess D_real represent E[C(Xr)] and D_fake represent E[C(Xf)]?and l_d_real represents log(D(Xr, Xf)) and l_d_fake represents the log(1-D(Xf, Xr)) ?

Where can I get training dataset for track 1?

Hi there,
I want to know where could I get Corrupted-tr-x and Corrupted-tr-y
as the default path in preprocess/paths.yml
source: '../../ntire20/Corrupted-tr-x'
target: '../../ntire20/Corrupted-tr-y'

Best regards,
Chase

train with custom dataset

Hello I'm trying to train model with my custom datasets
but, it shows error below.

TypeError: Caught TypeError in DataLoader worker process 0.

TypeError: object of type 'module' has no len()
I saw past's Issue so I edit data_loader as

self.noise_imgs = [os.path.join(root, name)
for root, dirs, files in os.walk(base)
for name in files
if name.endswith(('png'))]

I think It shows problem in noise part
espacially here

    if self.opt['phase'] == 'train':
        print(self.opt)
        # add noise to LR during train
        if self.opt['aug'] and 'noise' in self.opt['aug']:
            print(len(self.noises))
            noise = self.noises[np.random.randint(0, len(self.noises))]

            img_LQ = torch.clamp(img_LQ + noise, 0, 1)

and this is my yml file that relates with train

name: Corrupted_noise
use_tb_logger: true
model: srgan
distortion: sr
scale: 4
gpu_ids: [4]

datasets

datasets:
train:
name: train
mode: LQGT
aug: noise
scale: 4
noise_data: /media/soft/20EE2B81EE2B4DFA/Tak/Real-SR/codes/open/train/Corrupted_noise
dataroot_GT: /media/soft/20EE2B81EE2B4DFA/Tak/Real-SR/codes/open/train/generated/tdsr/HR
dataroot_LQ: /media/soft/20EE2B81EE2B4DFA/Tak/Real-SR/codes/open/train/generated/tdsr/LR
use_shuffle: true
n_workers: 6 # per GPU
batch_size: 16
GT_size: 128
use_flip: true
use_rot: true
color: RGB

I need your help...!

Corrupted_noise is empty?

why Corrupted_noise is empty?,length is 0,run the code:python3 train.py -opt options/df2k/train_bicubic_noise.yml
the error is :
Traceback (most recent call last):
File "/home/user/data/lost+found/Real-SR/Real-SR-master/codes/train.py", line 241, in
main()
File "/home/user/data/lost+found/Real-SR/Real-SR-master/codes/train.py", line 154, in main
for _, train_data in enumerate(train_loader):
File "/home/user/miniconda/lib/python3.11/site-packages/torch/utils/data/dataloader.py", line 631, in next
data = self._next_data()
^^^^^^^^^^^^^^^^^
File "/home/user/miniconda/lib/python3.11/site-packages/torch/utils/data/dataloader.py", line 1346, in _next_data
return self._process_data(data)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/miniconda/lib/python3.11/site-packages/torch/utils/data/dataloader.py", line 1372, in _process_data
data.reraise()
File "/home/user/miniconda/lib/python3.11/site-packages/torch/_utils.py", line 722, in reraise
raise exception
ValueError: Caught ValueError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/user/miniconda/lib/python3.11/site-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop
data = fetcher.fetch(index)
^^^^^^^^^^^^^^^^^^^^
File "/home/user/miniconda/lib/python3.11/site-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/miniconda/lib/python3.11/site-packages/torch/utils/data/_utils/fetch.py", line 51, in
data = [self.dataset[idx] for idx in possibly_batched_index]
~~~~~~~~~~~~^^^^^
File "/home/user/data/lost+found/Real-SR/Real-SR-master/codes/data/LQGT_dataset.py", line 147, in getitem
noise = self.noises[np.random.randint(0, len(self.noises))]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "numpy/random/mtrand.pyx", line 782, in numpy.random.mtrand.RandomState.randint
File "numpy/random/_bounded_integers.pyx", line 1334, in numpy.random._bounded_integers._rand_int64
ValueError: high <= 0

color shift in SR output

There is a noticeable color shift in the output of Real-SR (at least with DF2K-JPEG, I didn't test other models).

That color-shift seems to be texture-dependent, and I'm a bit surprised that SR methods don't avoid this. Other SR methods seem to be flawed by the same issue.

Here's how to post-process the output of Real-SR to remove the color shift: downscale the SR image, compute the difference with the LR image, Gaussian blur, upscale, add to the SR image. All computation is done in linear color space.
This gives this one-line G'MIC script (edited to work also with older versions of gmic):

gmic image.jpg image_4x.jpg -srgb2rgb [1] -resize[1] 25%,25%,[0],[0],2 -sub[0,1] -blur[0] 2 -resize[0] 400%,400%,[0],[0],3 -add -rgb2srgb -output image_4x_nocolorshift.jpg

any advices for images with characters?

Thanks for releasing this awesome project!!!
I test some pictures that have a lot of characters and the results are a little ...like this,
Real-SR
Do you have any advices for these pictures? (which might be more common in actual scenario)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.