I am trying to build a simple Siamese neural network for usage in Human re-identification.
For that, I have used MTCNN (https://github.com/timesler/facenet-pytorch) for face detection and official pytorch implementation of arcface algorithm (https://github.com/deepinsight/insightface/tree/master/recognition/arcface_torch) for CNN implementation.
I have used a pretrained model (ms1mv3_arcface_r50_fp16) trained on resnet 50 and a backbone CNN model from their repository for implementing the CNN. The CNN takes a 112x112 image and produces an array of 512x1.
So I get two arrays as a result of the network. I have tried to compare the two array using cosine similarity but It is not giving me the correct results all the time.
So, do I need to change my model parameters or do I need to use another metric for comparison?
My code: https://gist.github.com/desertSniper87/26f5f45f4cece9d0f3008e89cea94be8
I've tried and got fully enjoied Elasticsearch with standard dlib face vectors (128x1)... ES can store and search&compare such kind vectors super fast and accurate. I've used somthing like this to creat a ES index:
and then
to search similar vectors.