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

Some questions about the detach of the f in the ft_netAB #40

Closed
Liu-1994 opened this issue Apr 10, 2020 · 6 comments
Closed

Some questions about the detach of the f in the ft_netAB #40

Liu-1994 opened this issue Apr 10, 2020 · 6 comments

Comments

@Liu-1994
Copy link

Hello, thank you very much for providing the implementation code of the DG-Net model.
I encountered some problems during the implementation of the project. I will be honored if you can give me some suggestions.

I found the f=f.detch() in the ft_netAB. This causes the vector f to have no gradient. Then the loss_gen_recon_f_* has no no contribution to model parameter update. Is there something wrong with me or something wrong with the code?
1
2020-04-10 19-50-10屏幕截图

I will be grateful if you can give me some suggestions. Thank you!

@layumi
Copy link
Contributor

layumi commented Apr 11, 2020

Thank you @Liu-1994 .
‘f’ is the appearance code for image generation; We do not want the generation losses to update f.
Thus, we use the detach here. In this way, f is mainly updated via the re-id related losses.

@Liu-1994
Copy link
Author

@layumi Thanks for replying. I understood that.
And I have another small question. What is the role of the loss_gen_recon_f_a and loss_gen_recon_f_b ?As f is the input of the generator, I think the two losses may not update G.

@layumi
Copy link
Contributor

layumi commented Apr 11, 2020

Input -> Appearance Encoder(No Update) -> f (Detach)-> Decoder (Has Gradient) -> Generated Image (Has Gradient) -> Appearance Encoder(No Update, But has gradient) -> f

@Liu-1994
Copy link
Author

@layumi Thanks for teh replying. I have understood the process except the last step.
As the f.detach() is executed in the ft_netAB.forward(). I think the final f in the above process is also detachso there is no back propagation for f -> Appearance Encoder. When I debug the project, the grad_fn of f_a and f_a_recon are both None.
1

@layumi
Copy link
Contributor

layumi commented Apr 11, 2020

Thanks for the great suggestion.
I have not checked it yet. It may not work.
In fact, the feature reconstruction loss has a similar role with the ID recon loss.

@Liu-1994
Copy link
Author

Thank you very much for your reply. I have nothing else to ask about this issue.
By the way, if you are convenient, could you please take a look at another issue (#39 ) I raised.

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

2 participants