Coder Social home page Coder Social logo

mivrc / msrn-pytorch Goto Github PK

View Code? Open in Web Editor NEW
291.0 11.0 56.0 1.4 GB

This repository is a PyTorch version of the paper "Multi-scale Residual Network for Image Super-Resolution" (ECCV 2018).

License: MIT License

Python 88.79% MATLAB 10.29% Shell 0.92%
eccv eccv-2018 super-resolution msrn

msrn-pytorch's People

Contributors

cv-junchengli avatar fyxx avatar mivrc-cv 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

msrn-pytorch's Issues

验证集

你好,我想问一下,在训练网络时,我把验证集换成Set5或者Set14得出来的PSNR的结果曲线,和用Matlab测试Set5和Set14数据集得出来的PSNR值的结果差别很大,这是什么原因呢?

数据集

您好,我想用自己的数据集来训练模型,但是出现了问题,可以麻烦您帮我看一下可以吗?
Making model...
Preparing loss function:
1.000 * L1
[Epoch 1] Learning rate: 1.00e-4
Traceback (most recent call last):
File "main.py", line 19, in
t.train()
File "/home/customer/Nibbles/SR/MSRN/RES2NET_MSRN/Train2/trainer.py", line 45, in train
for batch, (lr, hr, _, idx_scale) in enumerate(self.loader_train):
File "/home/customer/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 286, in next
return self._process_next_batch(batch)
File "/home/customer/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 307, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
RuntimeError: Traceback (most recent call last):
File "/home/customer/Nibbles/SR/MSRN/RES2NET_MSRN/Train2/dataloader.py", line 47, in _ms_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/customer/Nibbles/SR/MSRN/RES2NET_MSRN/Train2/dataloader.py", line 47, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/customer/Nibbles/SR/MSRN/RES2NET_MSRN/Train2/data/srdata.py", line 151, in getitem
lr, hr, rgb_range=self.args.rgb_range
File "/home/customer/Nibbles/SR/MSRN/RES2NET_MSRN/Train2/data/common.py", line 50, in np2Tensor
return [_np2Tensor(a) for a in args]
File "/home/customer/Nibbles/SR/MSRN/RES2NET_MSRN/Train2/data/common.py", line 50, in
return [_np2Tensor(a) for a in args]
File "/home/customer/Nibbles/SR/MSRN/RES2NET_MSRN/Train2/data/common.py", line 45, in _np2Tensor
tensor = torch.from_numpy(np_transpose).float()
RuntimeError: Trying to resize storage that is not resizable at /opt/conda/conda-bld/pytorch_1524584710464/work/aten/src/TH/generic/THStorage.c:183

training on Y channel

sorry but I have some questions that need your help.
I wanna train my own model based EDSR on Y channel, and my evaluation on DIV2K is rising,but when I evaluate on Set5, Set14, compared with the model training on RGB, the result is lower,Do you know why ?
Thanks a lot anyway
Looking forward to your reply

PSNR测试与论文结果差距过大?

您好,我用了所有您项目提供的代码、数据集。没有改变任何参数,但是我用python代码测试出来的结果(也是用您的x2训练模型)但是在set5上的平均PSNR=35.86618025 与 您论文提供的PSNR = 38.08 差距过大!请问这是什么原因呢?

issue about pre-trained model

Hi, thanks for your working.
Why is the psnr value on Set14/bridge I get with Test/model/MSRN_x2.pt not so good?
this is psnr, it different from you provided:
x2 3 bridge.png: PSNR= 26.207258 SSIM= 0.839023

how do you compute the PSNR and SSIM on this bridge image? It is gray image, but the output of net is RGB image.

issue about training x8 model

Hi, I used the following command to train a x8 model.
python3 main.py --template MSRN --save MSRN_X8 --scale 8 --reset --save_results --patch_size 384 --ext sep

But I got an error as follow,

[Epoch 1]	Learning rate: 1.00e-4
Traceback (most recent call last):
  File "main.py", line 19, in <module>
    t.train()
  File "/home/iccd/zjq/MSRN/MSRN/Train/trainer.py", line 45, in train
    for batch, (lr, hr, _, idx_scale) in enumerate(self.loader_train):
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 336, in __next__
    return self._process_next_batch(batch)
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 357, in _process_next_batch
    raise batch.exc_type(batch.exc_msg)
RuntimeError: Traceback (most recent call last):
  File "/home/iccd/zjq/MSRN/MSRN/Train/dataloader.py", line 49, in _ms_loop
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 187, in default_collate
    return [default_collate(samples) for samples in transposed]
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 187, in <listcomp>
    return [default_collate(samples) for samples in transposed]
  File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 164, in default_collate
    return torch.stack(batch, 0, out=out)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 384 and 380 in dimension 3 at /pytorch/aten/src/TH/generic/THTensorMath.cpp:3616

Could you give me some suggestions?

模型参数量

您好,我看您论文里写的模型参数量Parameters为6.3M,但是我复现网络得出来的Parameters结果是24.3M。请问一下,您是怎么得出这个结果的呢?

training problems

hello, I want to train the model with my own dataset, but meet some problems in the training. The problem described as below:
Making model...
Preparing loss function:
1.000 * L1
[Epoch 1] Learning rate: 1.00e-4
Traceback (most recent call last):
File "main.py", line 19, in
t.train()
File "/home/weihq/superresolution1/MSRN-PyTorch-master/MSRN-PyTorch-master/MSRN/Train/trainer.py", line 45, in train
for batch, (lr, hr, _, idx_scale) in enumerate(self.loader_train):
File "/home/weihq/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 286, in next
return self._process_next_batch(batch)
File "/home/weihq/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 307, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
IndexError: Traceback (most recent call last):
File "/home/weihq/superresolution1/MSRN-PyTorch-master/MSRN-PyTorch-master/MSRN/Train/dataloader.py", line 47, in _ms_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/weihq/superresolution1/MSRN-PyTorch-master/MSRN-PyTorch-master/MSRN/Train/dataloader.py", line 47, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/weihq/superresolution1/MSRN-PyTorch-master/MSRN-PyTorch-master/MSRN/Train/data/srdata.py", line 148, in getitem
lr, hr = self.get_patch(lr, hr)
File "/home/weihq/superresolution1/MSRN-PyTorch-master/MSRN-PyTorch-master/MSRN/Train/data/srdata.py", line 197, in get_patch
multi_scale=multi_scale
File "/home/weihq/superresolution1/MSRN-PyTorch-master/MSRN-PyTorch-master/MSRN/Train/data/common.py", line 21, in get_patch
args[0][iy:iy + ip, ix:ix + ip, :],
IndexError: too many indices for array

I don't know what's happened in the process, is the size of my images too big?

About log.txt file

Hi, thanks for your sharing. It's a wonderful job.
My own training is not efficient, so could you provide any log.txt file? Such as MSRN_X2.
This is my e-mail, [email protected]. Thanks a lot.

Something wrong about self.loader_test

Hello, firstly, thank you for your test code.
But I get some errors about self.loader_test when I run the demo code.
At 'MSRN/Test/code/trainer.py' line 111, self.ckp.log[-1, idx_scale] = eval_acc / len(self.loader_test), I get the error which reports that the len(self.loader_test) is zero. I check the self.loader_test which is dataloader.MSDataLoader object, and its length should be zero in python3.6. Maybe the version of something is still different, or the path to somewhere has not been modified. I hope that you can make some suggestions. Thanks.

1*1 conv branch adds into MSRB?

image
image
Have your ever tried 1x1 conv to Multi-scale Residual Block(MSRB), just like the same way as 3x3 conv or 5x5 conv? Is it preform better?
thx a lot.

Issue about image format?

Hi, thanks for your sharing. It's a wonderful job.
The training dataset is DIV2K in your paper and the images are PNG format. However, the image format of testing dataset are BMP and JPG.
I found that BMP images could be reconstructed well while the reconstruction of JPG images were poor when the training dataset was original DIV2K.
Then I want to know how do you realize reconstruction quality of JPG images. Do you make JPG
training dataset with DIV2K?
Best

dataset

您好,使用您的模型进行了学习,在训练时用div2k数据可以进行训练,但是因为数据在训练之前做了预处理所以在使用自己的数据集时无法进行训练(1024*1024)请问该问题要怎么解决呢

就论文的复现有几个问题想请教一下

作者 你好,这篇文章融合不同尺度的特征图来获取更好的结果,我觉得很受启发。所以我尝试着复现论文中的结果,下面这个是现在正在跑的结果。
epoch 17
Avg bicubic psnr = 33.691134694590936
Avg predicted psnr = 37.55205991379186
Avg bicubic ssim = 0.8475448663228888
Avg predicted ssim = 0.8952058433758587

  1. 因为实验室的设备问题,DIV2K这样大的数据集跑不了,所以我仅仅将训练集换成了那291张图片,其他没做改变。所以我想问一下,这样的改变会对PSNR产生多大的影响,我测试了一下,图片x2的情况,epoch到9达到了极大值37.63,现在到了epoch17,徘徊在37.5左右。源代码是20epoch,我想问一下,你觉得还有必要跑下去吗?
  2. 在做test的时候,SSIM明显是不对的,数据在上面。所以我想问是不是代码出了问题,还是我的设备出了问题。
    希望得到作者的解答,谢谢!

Is pretrain model available?

Hello,
Thank you for this impressive work.
I wonder that any pretrain model available to reproduce paper results?
Thank you

Grayish images during testing

Hi !

When I trained a model with your [new MSRN] code on DIV2K using n-colors=3, it shows good validation accuracy but when I tested on Set5, the output images are grayish and PSNR is ~=10.

Test command:
python main.py --degradation BI --data_test MyImage --scale 2 --model MSRN --pre_train ../model/model_best.pt --test_only --save_results --chop --save "MSRN" --testpath ../LR/LRBI --testset Set5

Train : I am using demo.sh for training, no other changes are made.

Testing on patches

Hi, during testing on the benchmark datasets, do you use the low resolution patches or do you use the whole image?

关于训练曲线

您好,我想请问一下论文里的性能对比曲线图,您是怎么画出来的?

Issue about Manga109

Hi, I have another doubt about Manga109 dataset. The size of image in Manga109 is 1654✖1170. If only the right half of the picture is used to test, the size of SR_x2 should be 827✖1170. However, the size of images in your test results is 826✖1170. I want to know how do you get HR images from Manga109? Only get(829:1654, :, :) from Manga109 or other strategy?

Could you share processed HR_Manga109? Especially the image named PrayerHaNemurenai. Mine is damaged. such as:
A S

Best.

When will the model be published?

Impressive to your great job and code!!!
Will the trained model which could reproduce the result of your paper be published?
If so, when?
Thanks!!!

input and target shapes do not match

HI, thanks for your great work.
Now, i get some problem when i run your codes ( about training ). Could you please give me some advice to how to make it work?
THAT IS:
I want to train your network by DIV2K in X8 scale, but it give back me an error about shape do not match.
My option are bellow:

root@docker18:/MSRN-PyTorch-master/MSRN/Train# CUDA_VISIBLE_DEVICES=13 python main.py --template MSRN --save MSRN_X8_DIV2K --scale 8 --reset --save_results --save_models --patch_size 384 --ext sep --epochs 100 --n_GPUs 1 --data_train DIV2K --data_test DIV2K --batch_size 1 --data_range 1-895/896-900 --n_threads 1
Making model...
Preparing loss function:
1.000 * L1
[Epoch 1]	Learning rate: 1.00e-4
Traceback (most recent call last):
  File "main.py", line 22, in <module>
    t.train()
  File "/MSRN-PyTorch-master/MSRN/Train/trainer.py", line 55, in train
    loss = self.loss(sr, hr)
  File "/root/miniconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "/data2/yaozhaoliang/MSRN-PyTorch-master/MSRN/Train/loss/__init__.py", line 73, in forward
    loss = l['function'](sr, hr)
  File "/root/miniconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "/root/miniconda3/lib/python3.6/site-packages/torch/nn/modules/loss.py", line 87, in forward
    return F.l1_loss(input, target, reduction=self.reduction)
  File "/root/miniconda3/lib/python3.6/site-packages/torch/nn/functional.py", line 1702, in l1_loss
    input, target, reduction)
  File "/root/miniconda3/lib/python3.6/site-packages/torch/nn/functional.py", line 1674, in _pointwise_loss
    return lambd_optimized(input, target, reduction)
RuntimeError: input and target shapes do not match: input [1 x 3 x 384 x 384], target [1 x 3 x 380 x 384] at /pytorch/aten/src/THCUNN/generic/AbsCriterion.cu:12

Thank you again for your kindness help!

关于论文中4.4 Qualitative Analysis 的一些疑问

@MIVRC-CV @CV-JunchengLi @FYXX ,你们好,这篇文章的idea令我眼前一亮,融合不同尺度的feature来得到更好的feature map。 不过我有一些小疑问。。。

在Section 4.4 的 Benefit of MSRB 中,你们提到对比了不同的feature extraction 模块,你们的结果表现十分恐怖。。。但是你们的MSRB是由多路网络组成, 一个MSRB中相当于3层网络,我们知道res block一般是一两层,例如EDSR中就是3x3conv-relu-3x3conv, 而dense block 一般是多个conv-relu堆叠然后最后加一个1x1conv。但是文中没有给出你们在对比中使用的单个res block 和dense block的具体参数,所以我想询问一下在你们的对比实验中对于这两个模块的具体设置是怎么样的?你们在对比实验设计的时候有没有考虑过单个block的参数量呢?谢谢!

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.