giannisdaras / ilo

[ICML 2021] Official implementation: Intermediate Layer Optimization for Inverse Problems using Deep Generative Models
120 stars 11 forks source link

Projection back to the range step #3

Open 1094442522 opened 3 years ago

1094442522 commented 3 years ago

Hi, I read the paper and find there is a 'projection back to the range step' in Algorithm 1. Is this step implemented in the ilo_stylegan.py?

From my understanding of the code, there is a projection to the l1 ball neighbourhood of prev_gen_out, but I don't find the step z_p ← G1(z_k) in the code (the step 6 in Algorithm1). I am wondering if there is something wrong with my understanding.

Thanks for your help and attached is the algorithm 1. image

akashsharma02 commented 2 years ago

@1094442522 Did you figure this out? @giannisdaras It would be really helpful to get your clarification on this?

ffhibnese commented 2 years ago

I‘ve got the same question as you did...I doubt that the author didn't implement line5,6 in the ilo_stylegan.py @1094442522 @akashsharma02

giannisdaras commented 2 years ago

The following code projects back to the l1-ball from the solution of the previous layer: https://github.com/giannisdaras/ilo/blob/08a88f2ae0f6530211be93a0deed502d38a871bd/ilo_stylegan.py#L248

If the solution of the prev. layer lies within the range of the layer (which is definitely the case when you optimize in the first intermediate layer), you are guaranteed to stay in an l1-deviation from the range.

Is this answering what you guys are asking? Thanks for your interest!

ffhibnese commented 2 years ago

The following code projects back to the l1-ball from the solution of the previous layer:

https://github.com/giannisdaras/ilo/blob/08a88f2ae0f6530211be93a0deed502d38a871bd/ilo_stylegan.py#L248

If the solution of the prev. layer lies within the range of the layer (which is definitely the case when you optimize in the first intermediate layer), you are guaranteed to stay in an l1-deviation from the range.

Is this answering what you guys are asking? Thanks for your interest!

You wrote "This problem is solved by initializing a latent vector $z^p$ to $\hat{z}^p$ and then minimizing using gradient descent the loss $||G_1(z^k) − \tilde{z}_p||$" in the paper, namely the 5th line of Algorithm 1. But I don't find any inplementation of this. In my opinion, the code just simplly project present vector into an l1-deviation ball.

Thanks for answering my question! And I would be grateful if you help me figure this out.