Comments (6)
I don't understand why you think the code is wrong.
The downscaling is done identically to all 3 channels.
Anyway, you are welcome to test this and open a PR if performance is maintained on DIV2K-RK
from kernelgan.
I got a grayscale image(even though it has 3 channels) when I debug the ouput tensor of 'resize_tensor_w_kernel' in python file 'util.py', I've read the paper and I think it should be a colored image.
I tried to change the 'resize_tensor_w_kernel' as below:
def resize_tensor_w_kernel(im_t, k, sf=None):
"""Convolves a tensor with a given bicubic kernel according to scale factor"""
# Expand dimensions to fit convolution: [out_channels, 1, k_height, k_width]
k = k.expand(im_t.shape[1], 1, k.shape[0], k.shape[1])
# Calculate padding
padding = (k.shape[-1] - 1) // 2
return F.conv2d(im_t, k, stride=round(1 / sf), padding=padding,groups=im_t.shape[1])#
I got a colored image.
maybe, there's something I missed about the paper,I would appreciate it if you help me with my doubts.
from kernelgan.
You might be correct about the gray scale - AFAIK it is not supposed to be gray.
I will try to look at it but it won't be in the near future - I am very busy on other issues
from kernelgan.
I got a grayscale image(even though it has 3 channels) when I debug the ouput tensor of 'resize_tensor_w_kernel' in python file 'util.py', I've read the paper and I think it should be a colored image.
I tried to change the 'resize_tensor_w_kernel' as below:
def resize_tensor_w_kernel(im_t, k, sf=None):
"""Convolves a tensor with a given bicubic kernel according to scale factor"""Expand dimensions to fit convolution: [out_channels, 1, k_height, k_width]
k = k.expand(im_t.shape[1], 1, k.shape[0], k.shape[1])
Calculate padding
padding = (k.shape[-1] - 1) // 2
return F.conv2d(im_t, k, stride=round(1 / sf), padding=padding,groups=im_t.shape[1])#I got a colored image.
maybe, there's something I missed about the paper,I would appreciate it if you help me with my doubts.
I have came across the same bug here, and I solved it in the same way. This bug has already been pointed out in a closed iussue.
if groupwise convolution is not used, it will generate black image, normal blured image with "groupwise" parameter.
By the way, in recent CVPR 2020 super resolution competition, "Real-World Super-Resolution via Kernel Estimation and Noise Injection" used your work kernelGAN to gain the first place in real-world SR. This might be the reason why more and more people are checking and trying to reproduce your results of KernelGAN.
from kernelgan.
I got a grayscale image(even though it has 3 channels) when I debug the ouput tensor of 'resize_tensor_w_kernel' in python file 'util.py', I've read the paper and I think it should be a colored image.
I tried to change the 'resize_tensor_w_kernel' as below:
def resize_tensor_w_kernel(im_t, k, sf=None):
"""Convolves a tensor with a given bicubic kernel according to scale factor"""Expand dimensions to fit convolution: [out_channels, 1, k_height, k_width]
k = k.expand(im_t.shape[1], 1, k.shape[0], k.shape[1])
Calculate padding
padding = (k.shape[-1] - 1) // 2
return F.conv2d(im_t, k, stride=round(1 / sf), padding=padding,groups=im_t.shape[1])#I got a colored image.
maybe, there's something I missed about the paper,I would appreciate it if you help me with my doubts.
here is the link #28
from kernelgan.
Could you please open a PR and I will go over it?
from kernelgan.
Related Issues (20)
- X4 kernel specs in DIV2KRK HOT 1
- It seems like a bug?
- UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize HOT 5
- RuntimeError: cuDNN error: CUDNN_STATUS_BAD_PARAM HOT 2
- network parameter asking HOT 6
- Why do you swap axis? HOT 2
- why not directly save the params of Generator for downscaling? why not non-linear? HOT 3
- Question about the DownScaleLoss HOT 1
- About DIV2KRK HOT 1
- about Generator and Discriminator output size HOT 5
- Questions about generator networks HOT 2
- How do you generate such an image? HOT 8
- How do you visualize the ".mat" files HOT 3
- There was a problem with training in another data set HOT 1
- How to gain the PSNR and SSIM HOT 2
- What's the meaning of "input-dir" and "input_img_path"
- Is your training data set the same as your test set HOT 2
- Why there needs flip orperation when calculate the kernel ? HOT 1
- No file .mat HOT 1
- ValueError: shapes (512,512,1) and (3,) not aligned: 1 (dim 2) != 3 (dim 0) HOT 2
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 kernelgan.