yuanzhi-zhu / DiffPIR

"Denoising Diffusion Models for Plug-and-Play Image Restoration", Yuanzhi Zhu, Kai Zhang, Jingyun Liang, Jiezhang Cao, Bihan Wen, Radu Timofte, Luc Van Gool.
https://yuanzhi-zhu.github.io/DiffPIR/
MIT License
390 stars 32 forks source link

How to determine the value of σn in Algorithm 1 #1

Closed 448357739 closed 1 year ago

448357739 commented 1 year ago

In the code, σn is generated by 'sigmas.append(reduced_alpha_cumprod[num_train_timesteps-1-i])', but I can't find the relevant description from the paper. Can you tell me the reason? Thank you very much.

yuanzhi-zhu commented 1 year ago

Hi @448357739 ,

The reduced_alpha_cumprod is defined as the ratio $\sqrt\frac{1-\bar\alpha_i}{\bar\alpha_i}$, which can be considered as the equivalent $\sigma_i$ in the VESDE form (see eq(40) in DDIM paper).

In DiffPIR, at each timestep in the sub-sequence, the equivalent sigma (curr_sigma in the code) is used as noise levels and hence input to the diffusion model https://github.com/yuanzhi-zhu/DiffPIR/blob/main/main_ddpir_sisr.py#LL296C62-L296C88. That's to say, the sigma is a variable introduced for the convenience of the noise level (the common noise level in IR tasks following DPIR's setting). Moreover, we use function _utils_model.findnearest to find the corresponding $t_i$ to this curr_sigma.

It's also worth mentioning that one can find definitions like $\text{SNR}(t) = 1/(\text{reduced alpha cumprod }(t))^2$ as in https://arxiv.org/abs/2107.00630 eq(2) which appears in many recent works.

Please do not hesitate if you have any other questions.