Skip to content

Sometimes Similarity scores are above 1  #6

Description

@djmv

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,

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions