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

两张照片不同的人,距离也很小 #29

Open
HandsLing opened this issue Oct 17, 2019 · 2 comments
Open

两张照片不同的人,距离也很小 #29

HandsLing opened this issue Oct 17, 2019 · 2 comments

Comments

@HandsLing
Copy link

使用get_emb.py得到两张照片中的人脸embding,但是经过测试,两张照片同一个人和两张照片不同的人距离差别不大,请问如何来设置阈值呢?我使用的是欧氏距离计算
同一个人对应的距离:
dist1 : [[0.23265116]]
dist2 : 0.23265092
dist3 : 0.07422299692117233
simlarity : 0.9729368
不同人对应的距离::
dist1 : [[0.33493966]]
dist2 : 0.33493972
dist3 : 0.1071193271412563
simlarity : 0.94390774
其中dist1是我自己写的计算欧氏距离的函数,dist2使用的是作者提供的计算欧氏距离的函数,dist3是使用作者提供的计算cos距离的函数得到的,simlarity计算的是相似度,计算方式是:
def distance(embeddings1, embeddings2):
dot = np.dot(embeddings1, embeddings2)
norm = np.linalg.norm(embeddings1, ord=2) * np.linalg.norm(embeddings2, ord=2)
similarity = dot / norm
if similarity > 1:
similarity = 1.0
return similarity
大家都有这种问题吗?

@qwn19970728
Copy link

Change line102 in get_embd.py from:saver = tf.train.Saver(var_list=tf.trainable_variables()) --> saver = tf.train.Saver() to get the right embedding.

@HandsLing
Copy link
Author

@qwn19970728 thx, but i did changed that before, and i can get the same embedding for one image twice. and the distance in this issue was calculated by these embeddings

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

2 participants