Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

算法过程 #30

Open
wattting opened this issue Mar 19, 2024 · 15 comments
Open

算法过程 #30

wattting opened this issue Mar 19, 2024 · 15 comments

Comments

@wattting
Copy link

作者你好,我有一个问题,在用预训练好的无条件扩散模型进行有条件扩散的具体过程是如何控制逆扩散过程中的随机性,我们如何保证在采样过程中从XT的高斯噪声渐渐变成我想要的图像而不是随机图像。如果您有机会看到,请大佬帮我解解惑,十分感谢!

@yuanzhi-zhu
Copy link
Owner

条件就是guidance, 引导生成指向我们想要的方向。
我们的算法中有额外的一项对应data-subproblem保证生成的图像和条件LR图像的一致性。

@wattting
Copy link
Author

十分感谢大佬的回复,
是不是算法过程中第四步:solving data proximal subproblem,作为数据一致项来保证第三步predict z和x的一致性,这个x是不是条件LR图像。
guidance引导生成具体是如何操作的,是不是通过guidance_scale来控制,大佬方便的话,可以具体告诉引导的具体代码在哪吗,还有第四步的一些代码步骤。再次感谢!

@yuanzhi-zhu
Copy link
Owner

y是condition,x和z是两个子问题要求接的变量.
你可以先看一下这个slides https://yuanzhi-zhu.github.io/documents/slides/diffusion_models_for_pnp_IR.pdf 和论文,可以对我们的算法有更加深入的理解。

@wattting
Copy link
Author

好的,感谢大佬!

@wattting
Copy link
Author

大佬您好,再看了你给的相关slides之后,我发现了我的问题有可能出现在第四步中进行Solving data proximal subproblem,关于||y - H(x)||和rho||x - x_0_t||,其中的x变量是什么? 是不是这个||y - H(x)||是不是就是一种传统模型方法来得到一个比较好的值,然后rho||x - x_0_t||,就是在使用扩散过程的去噪效果,从而生成更高质量的图像。不知道我的理解有没有错误。往大佬指教,非常感谢!!!

@wattting
Copy link
Author

是不是第四步就是在求解一个最优的x的问题,x不是一个自变量,而是一个因变量

大佬您好,再看了你给的相关slides之后,我发现了我的问题有可能出现在第四步中进行Solving data proximal subproblem,关于||y - H(x)||和rho||x - x_0_t||,其中的x变量是什么? 是不是这个||y - H(x)||是不是就是一种传统模型方法来得到一个比较好的值,然后rho||x - x_0_t||,就是在使用扩散过程的去噪效果,从而生成更高质量的图像。不知道我的理解有没有错误。往大佬指教,非常感谢!!!

@yuanzhi-zhu
Copy link
Owner

在第三步中我们得到了一个很好的x_0的表示x_0_t, 第四步是优化整个data subproblem目标,找到一个x使得 ||y - H(x)|| + rho||x - x_0_t|| 这个objective尽可能低,也就是希望找到x同时接近y和x_0_t。
整个算法中y只出现在第四步里面,用来保证最终复原的图片和y接近。

@wattting
Copy link
Author

懂了懂了,再次感谢大佬的帮助, 祝好!!!

@wattting
Copy link
Author

wattting commented Mar 27, 2024 via email

@yuanzhi-zhu
Copy link
Owner

我不知道问题在哪里,这需要你自己研究🧐

@wattting
Copy link
Author

wattting commented Mar 27, 2024 via email

@chagelo
Copy link

chagelo commented Jul 21, 2024

Hello, I have a question that Solving data proximal subproblem correspond to which lines in your code.

@yuanzhi-zhu
Copy link
Owner

@chagelo just below this closed-form solution code block

DiffPIR/main_ddpir.py

Lines 380 to 382 in 111d26e

# --------------------------------
# step 2, closed-form solution / FFT
# --------------------------------

@chagelo
Copy link

chagelo commented Jul 21, 2024

For deblur, I should know the blur kernel for each pair of images, right?
My task is deblur, and I have paired images(clean and blurred image) without blur kernel. And I see solving data proximal subproblem utilize the blur kernel.

@yuanzhi-zhu
Copy link
Owner

yuanzhi-zhu commented Jul 21, 2024

For deblur, I should know the blur kernel for each pair of images, right? My task is deblur, and I have paired images(clean and blurred image) without blur kernel. And I see solving data proximal subproblem utilize the blur kernel.

for your setup, you can refer to https://arxiv.org/abs/2303.11435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants