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
337 stars 25 forks source link

Formula realization #25

Open ConanMusk opened 6 months ago

ConanMusk commented 6 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 6 months ago

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

ConanMusk commented 6 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 6 months ago

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

yuanzhi-zhu commented 6 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