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
388 stars 31 forks source link

Formula realization #25

Open ConanMusk opened 11 months ago

ConanMusk commented 11 months ago

x = sqrt_alphas_cumprod[t_start] (2x-1) + sqrt_1m_alphas_cumprod[t_start] * torch.randn_like(x)

Is the code here corresponding to that formula? Looking forward to your reply.

yuanzhi-zhu commented 11 months ago

Hi @ConanMusk , you can find relevant discussion regarding t_start at #23. In short, this is an initialization strategy.

ConanMusk commented 10 months ago

May I ask where in your deblur code you introduced the conditionals, it seems that I didn't find out how you introduced the conditionals. Looking forward to your reply.

ConanMusk commented 10 months ago

image May I ask where you implemented the code implementation of these formulas? Looking forward to your reply.

yuanzhi-zhu commented 10 months ago

HI @ConanMusk

May I ask where in your deblur code you introduced the conditionals, it seems that I didn't find out how you introduced the conditionals. Looking forward to your reply.

We first construct the paired dataset from HR images and a given degradation operator (blurring here); in the sampling process, we do precalculation on condition LR $y$ https://github.com/yuanzhi-zhu/DiffPIR/blob/main/main_ddpir_deblur.py#L236 then solve the data subproblem: https://github.com/yuanzhi-zhu/DiffPIR/blob/main/main_ddpir_deblur.py#L284

May I ask where you implemented the code implementation of these formulas?

https://github.com/yuanzhi-zhu/DiffPIR/blob/main/main_ddpir_deblur.py#L344 https://github.com/yuanzhi-zhu/DiffPIR/blob/main/main_ddpir_deblur.py#L346