cszn / BSRGAN

Designing a Practical Degradation Model for Deep Blind Image Super-Resolution (ICCV, 2021) (PyTorch) - We released the training code!
Apache License 2.0
1.17k stars 177 forks source link

Question about Gaussain Noise #32

Closed ShijianXu closed 2 years ago

ShijianXu commented 2 years ago

Hi, thank you for your work. I have a question about the degradation. For the Gaussian noise, in the general case, why you only set L=noise_level2/255.0 (https://github.com/cszn/BSRGAN/blob/main/utils/utils_blindsr.py#L371) instead of generating a random value between noise_level1 and noise_level2, like for the grayscale and color Gaussian noises?

Thanks!

XiaoqiangZhou commented 2 years ago

I have the same question.

HaolyShiit commented 2 years ago

I think the randomness of noise level is generated by following code: D = np.diag(np.random.rand(3)) U = orth(np.random.rand(3,3)) conv = np.dot(np.dot(np.transpose(U), D), U)

D and U are randomly sampled from 0~1.

ShijianXu commented 2 years ago

This is for randomness, not for the noise level. The degradation level is controlled by L: img += np.random.multivariate_normal([0,0,0], np.abs(L**2*conv), img.shape[:2]).astype(np.float32) This line simply means they only use the highest degradation level. This needs to be explained.

cszn commented 2 years ago

The noise level of 3D multivariate Gaussian noise is determined by six parameters, see Figure 1. This means we should not characterize the noise level of 3D Gaussian noise by a single scalar. For example, the covariance matrix of [1.21, 0, 0; 0, 0, 0; 0, 0, 0] means only the Red channel is added with the Gaussian noise with noise level 1.1, we cannot say the noise level of this RGB image is 1.1 or others. Due to limited space, I use a rough expression. noise_level1 is a small value, even if you set it to 0, and also even if you remove this multivariate Gaussian noise, the performance would not change too much.

cszn commented 2 years ago

We claimed in the paper that "One can conveniently modify the degradation model by changing the degradation parameter settings and adding more reasonable degradation types (e.g., speckle noise and unaligned double JPEG compression [21]) to improve the practicability for certain applications" It is not necessary to strictly follow my degradation design. We mainly sell the idea of "random shuffle+double degradation+different degradation types" for more realistic degradation design.