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

Add and multiply implementation #3

Open
ahmadmughees opened this issue Sep 27, 2024 · 0 comments
Open

Add and multiply implementation #3

ahmadmughees opened this issue Sep 27, 2024 · 0 comments

Comments

@ahmadmughees
Copy link

Hello,

I have few questions regarding your add and multiply implementation (which is not super clear from the paper).

  1. Why did you use canonical combination instead of convex? Do you have any specific reason?
def add(img1, img2, beta):
    a, b = get_ab(beta)
    img1, img2 = img1 * 2 - 1, img2 * 2 - 1
    out = a * img1 + b * img2
    out = (out + 1) / 2
    return out
  1. In the add implementation: why did you renormalize to [-1, 1] range? any benefits in numerical stability which I am not aware of?
def multiply(img1, img2, beta):
    a, b = get_ab(beta)
    img1, img2 = img1 * 2, img2 * 2
    out = (img1 ** a) * (img2.clip(1e-37) ** b)
    out = out / 2
    return out

  1. As per the paper multiply is the geometric mean, which I can say is the weighted geometric mean. it should follow the equation
    $$\text{GM}(x) = \left( \text{img1}(x)^{a} \times \text{img2}(x)^{b} \right)^{\frac{1}{a + b}}$$

this ${\frac{1}{a + b}}$ is missing from your implementation. Also here you normalize to [0, 2] range. can you help me understand this implementation? Thanks, a lot.

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

1 participant