Comments (4)
You can remove the upscale module in the model, which enable the input and output to have same size.
RCAN can be used for image inpainting, but you have to investigate more details by yourself.
from rcan.
Thanks for the support. I am not the familiarized with the Pytorch framework. Can you post here the changes in codes for RCAN_testing and RCAN_training which enable the same size for the input and output image?
- The second problem it is about a possible bug in your code.
The Y component is obtained with rgb2ycbcr function. The transform is most used in the video domain.
The problem with rgb2ycbcr is the range of Y values: [16,235].
From Wikipedia page: https://en.wikipedia.org/wiki/YCbCr:
"JFIF usage of JPEG supports Y′CbCr where Y′, CB and CR have the full 8-bit range of [0...255].[4] Below are the conversion equations expressed to six decimal digits of precision. (For ideal equations, see ITU-T T.871.[5]) Note that for the following formulae, the range of each input (R,G,B) is also the full 8-bit range of [0...255]."
I recommend this formula for JFIF for Y component: 0.299R+0.587G+0.114*B.
What do you think?
Best regards,
Ion
from rcan.
Hi,
1.To enable same sizes between input and output, just remove the line ‘common.Upsampler()’ in model/rcan.py/modules_tail
2.Thanks for pointing out this issue. Here, rgb2ycbcr() is only used for PSNR calculation, which is a little different from that in Matlab. But we don’t care too much about the transformation from rgb to ycbcr. The PSNR values in the training process is a rough indicator about the network ability. The rgb2ycbcr() would not affect the network performance. Anyway, you can modify this function, if you want.
from rcan.
Hi,
Thanks for support. I commented the line in both sub-folders of RCAN: train and test.
define tail module
modules_tail = [
#common.Upsampler(conv, scale, n_feats, act=False),
conv(n_feats, args.n_colors, kernel_size)]
But when I run the line (with your model/RCAN_BIX2.pt ):
/usr/bin/python3.6 main.py --data_test MyImage --scale 2 --model RCAN --n_resgroups 10 --n_resblocks 20 --n_feats 64 --pre_train ../model/RCAN_BIX2.pt --test_only --save_results --chop --save 'RCAN' --testpath ../LR/LRBI --testset Kodak
I obtain:
Traceback (most recent call last):
File "main.py", line 18, in
while not t.terminate():
File "/home/ionut/RCAN-master/RCAN_TestCode/code/trainer.py", line 139, in terminate
self.test()
File "/home/ionut/RCAN-master/RCAN_TestCode/code/trainer.py", line 96, in test
sr = self.model(lr, idx_scale)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/ionut/RCAN-master/RCAN_TestCode/code/model/init.py", line 52, in forward
return self.forward_chop(x)
File "/home/ionut/RCAN-master/RCAN_TestCode/code/model/init.py", line 145, in forward_chop
= sr_list[0][:, :, 0:h_half, 0:w_half]
RuntimeError: The expanded size of the tensor (768) must match the existing size (394) at non-singleton dimension 3
The Kodak input image has the same size has output image because it is custom scaled.
What changes are necessary to remove the error?
PS. I attached one custom scaled Kodak image which I used for testing.
Best regards,
Ion
from rcan.
Related Issues (20)
- 训练的时候出现RuntimeError !! HOT 2
- how to choose the best model for test images?model_best.pt or model_latest.pt ?
- About test on Set5 dataset
- The Training time increasses while increasing the number of GPU
- About test on Set14
- How to divide the image into patches?
- NameError: ForkingPickler(file, protocol).dump(obj) name 'torch' is not definedBrokenPipeError : [Errno 32] Broken pipe
- About the calculation of PSNR
- RuntimeError:
- Understanding the whole process
- RCAN: tail module
- Can you provide the change curve of psnr during your training?
- batchsize=1
- How do self-ensemble
- The output value explode
- PSNR Problem
- Baidu download link in the “The whole test pipeline” is not useful
- 为什么使用--chop和不使用--chop得到的结果不一样
- 训练中断了,我应该修改哪里的代码继续训练
- cuDNNerror:CUDNN_STATUS_EXECUTION_FAILED
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rcan.