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

Features normalization computing centers #5

Open
joppichristian opened this issue Mar 11, 2020 · 4 comments
Open

Features normalization computing centers #5

joppichristian opened this issue Mar 11, 2020 · 4 comments

Comments

@joppichristian
Copy link

Thank you for sharing code!

I have a question about the function get_centers that computes the centers of clusters.
Did you forget to normalize features before multiply them per mask? Or simply the normalization is in the net forward?

@WDYIE
Copy link

WDYIE commented May 25, 2020

I think that you can see the code normalizing features in clusteing.py :

def cos(self, pointA, pointB, cross):
    pointA = F.normalize(pointA, dim=1) #Cosine similarity only cares about direction
    pointB = F.normalize(pointB, dim=1)
    if not cross:
        return 0.5 * (1.0 - torch.sum(pointA * pointB, dim=1))
    else:
        NA = pointA.size(0)
        NB = pointB.size(0)
        assert(pointA.size(1) == pointB.size(1))
        return 0.5 * (1.0 - torch.matmul(pointA, pointB.transpose(0, 1)))

@HHHedo
Copy link

HHHedo commented Jun 10, 2020

Hi, I have the same question. It seems that the center is the sum of features instead of mean.

@WDYIE
Copy link

WDYIE commented Jun 10, 2020

Hi, There are normalize operation, Beacause Cosine similarity only cares about direction!

@HHHedo
Copy link

HHHedo commented Jun 11, 2020

Hi, There are normalize operation, Beacause Cosine similarity only cares about direction!

Thanks for your reply!

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

3 participants