insightface icon indicating copy to clipboard operation
insightface copied to clipboard

distance / similarity calculation version 0.5

Open MyraBaba opened this issue 4 years ago • 2 comments

Hi ,

I am trying to calc distance in new insightface (onnx insightface latest 0.5) as below code . but got strance result.

what is the correct way to calculate dist / sim.?

def distance(f1,f2):
   
     diff = np.subtract(f1, f2)
     dist = np.sum(np.square(diff), 1)
    return dist

app = FaceAnalysis()
app.prepare(ctx_id=0, det_size=(640, 640))
img = ins_get_image('/Users/tulpar/Projects/person1')
img2 = ins_get_image("/Users/tulpar/Projects/person2")
faces1 = app.get(img)
faces2 = app.get(img2)

dis1 = distance(faces1[0].embedding , faces2[0].embedding)

distance gives high numbers : like 700 , 50 etc

MyraBaba avatar Oct 14 '21 10:10 MyraBaba

Use normed_embedding instead

nttstar avatar Oct 16 '21 01:10 nttstar

Hi, check this https://github.com/deepinsight/insightface/issues/2199#issuecomment-1379880149

beybars1 avatar Dec 08 '23 14:12 beybars1