GithubHelp home page GithubHelp logo

Comments (4)

nkolot avatar nkolot commented on July 22, 2024 1

I've located the source of assymetry. If you look at the lines (401,402) and (481,482) in this file, there is a statement

if (diff_grad <= 0)
 continue;

If you comment this out, then the 2 gradient values have the same magnitude and opposite signs. However I feel that this "hack" is not correct, even though it still passes all the test cases. Probably the code in this part needs to be written again from scratch. It is not documented well by the authors so it won't be trivial to figure out how it works.

Nevertheless, can you try to run it with this fix and see if your results improve?

from neural_renderer.

nkolot avatar nkolot commented on July 22, 2024

Ooops! That is indeed very weird. So it is an issue of the original Chainer implementation too. I will have to look into the equations of the paper and the CUDA code to try and figure out what is happening here.

We should expect that the gradients before and after should have the same magnitude and flipped sign.

from neural_renderer.

airalcorn2 avatar airalcorn2 commented on July 22, 2024

Thanks for looking into it, @nkolot. Initial results seem encouraging.

Positive Loss/Blacken
Before Fix
teapot_black_wrong_grads
After Fix
teapot_black_fixed_grads

Negative Loss/Whiten
Before Fix
teapot_white_wrong_grads
After Fix
teapot_white_fixed_grads

Agreed that the fix feels "hack-y", but it's hard to understand why the conditional is there in the first place because of the lack of documentation. My best guess is it's related to equations (1), (3), and (4) in the paper, where they set the partial derivative to zero when delta_P_j * delta_I_j >= zero, but the conditional in the code doesn't reference delta_P_j and is <= rather than >=. Very strange!

from neural_renderer.

nkolot avatar nkolot commented on July 22, 2024

I am reopening the issue, just to keep track that I have to properly fix this and submit a PR. Will do it when I find time, probably later in the week.

from neural_renderer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.