Git Product home page Git Product logo

Comments (4)

frgfm avatar frgfm commented on May 21, 2024

Hi @noobgrow 👋

Thanks for reporting this! So actually, the author reached out to me before the paper even came out to experiment with it. He validated the implementation back then, so I didn't question whether there would be some difference with the upcoming paper 😅

So let me check the difference you're talking about and get back to you 🙂

Cheers ✌️

from torch-cam.

noobgrow avatar noobgrow commented on May 21, 2024

OK! thanks for your fantastic work! Waiting for you @frgfm ^.^

from torch-cam.

frgfm avatar frgfm commented on May 21, 2024

So, this is going to be annoying without LaTex for math rendering, but let's try 😅
In the paper:

alpha_k^c = 1 / N * sum\limits_{i=0}^N (C(M_i))
# Let's expand M_i
alpha_k^c = 1 / N * sum\limits_{i=0}^N (C(sum\limits_{j=0}^{i-1} j / N * X_0 * A_l^k))
# Now we can simplify the sum
alpha_k^c = 1 / N * sum\limits_{i=0}^N (C(\frac{i * (i - 1)}{2N} * X_0 * A_l^k))

In the code, X_0 * A_l^k is stored as scored_inputs (cf. https://github.com/frgfm/torch-cam/blob/master/torchcam/methods/activation.py#L411-L414)
and \frac{i * (i - 1)}{2N} is stored as _coeff (cf. https://github.com/frgfm/torch-cam/blob/master/torchcam/methods/activation.py#L430)

So this line https://github.com/frgfm/torch-cam/blob/master/torchcam/methods/activation.py#L437 computes C(M_i) from the paper, they are summed in the following lines, and finally I divide by N here https://github.com/frgfm/torch-cam/blob/master/torchcam/methods/activation.py#L445

However, I realize that the docstring has some errors, I'll correct it to fix the documentation 👍
Let me know if some things are still unclear!

from torch-cam.

frgfm avatar frgfm commented on May 21, 2024

Closing this as the docstring has been fixed and the rest of the explanations have been detailed! Feel free to reopen @noobgrow if that's not the case :)

from torch-cam.

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.