InsightFace_Pytorch icon indicating copy to clipboard operation
InsightFace_Pytorch copied to clipboard

Why is the verification using l2 distance?

Open timost1234 opened this issue 6 years ago • 1 comments

Why is the code for testing using l2 distance instead of cosine distance? Thank you.

        embed1_train = embeddings1[train_set]
        embed2_train = embeddings2[train_set]
        _embed_train = np.concatenate((embed1_train, embed2_train), axis=0)
        # print(_embed_train.shape)
        pca_model = PCA(n_components=pca)
        pca_model.fit(_embed_train)
        embed1 = pca_model.transform(embeddings1)
        embed2 = pca_model.transform(embeddings2)
        embed1 = sklearn.preprocessing.normalize(embed1)
        embed2 = sklearn.preprocessing.normalize(embed2)
        # print(embed1.shape, embed2.shape)
        diff = np.subtract(embed1, embed2)
        dist = np.sum(np.square(diff), 1)

timost1234 avatar Dec 08 '18 08:12 timost1234

Hi did you got any answer to this? I was wondering the same thing

sdahan12 avatar Oct 07 '20 18:10 sdahan12