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

Sometimes Similarity scores are above 1 #6

Open
djmv opened this issue Jul 15, 2022 · 0 comments
Open

Sometimes Similarity scores are above 1 #6

djmv opened this issue Jul 15, 2022 · 0 comments

Comments

@djmv
Copy link

djmv commented Jul 15, 2022

Hi,
After compute similarity, some scores are above 1. This part of code get person and score.

std::tuple<std::vector<std::string>, std::vector<float>> ArcFaceIR50::getOutputs(float *output_sims) {
    /*
        Get person corresponding to maximum similarity score based on cosine similarity matrix.
    */
    std::vector<std::string> names;
    std::vector<float> sims;
    for (int i = 0; i < croppedFaces.size(); ++i) {
        int argmax = std::distance(output_sims + i * classCount, std::max_element(output_sims + i * classCount, output_sims + (i + 1) * classCount));
        float sim = *(output_sims + i * classCount + argmax);
        std::string name = classNames[argmax];
        names.push_back(name);
        sims.push_back(sim);
    }
    return std::make_tuple(names, sims);
}

I put a cout, printing sim and name. name is the user ID in database and sim is a float, but get numbers liks 122.717. Is it possible to get these values ? Why ?
Another question is, How do you get the sim value ? May you explain me. Why compute memory position in that way?

Thanks,

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