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

A few questions #13

Closed user454365 closed 11 months ago

user454365 commented 11 months ago

Congrats on the fantastic work. I was looking into your code to understand it and had a few questions.

  1. In some of the steps I noticed that the data is divided by 2 and then 0.5 was added. What was the reason for that?
  2. I was wondering exactly in which step the data consistency is performed. Is it in the sr.data_solution function? Also how is it different than the model_fn function in utils_model?
yuanzhi-zhu commented 11 months ago
  1. some modules in the code require the image to be in the range of [0,1], and the pre-trained diffusion models are trained with image data in the range of [-1,1]. These conversions are necessary for our code.
  2. the data subproblem is solved here https://github.com/yuanzhi-zhu/DiffPIR/blob/36e81bc5e80408766830f45674d8f52af79e421b/main_ddpir_sisr.py#L316; the model_fn function is a wrapper for the unconditional diffusion models and used to solve the prior subproblem (unconditional generation).

Please let me know if this answers your questions :]