insightface
insightface copied to clipboard
distance / similarity calculation version 0.5
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
Use normed_embedding instead
Hi, check this https://github.com/deepinsight/insightface/issues/2199#issuecomment-1379880149