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

detec_face_align_rec.py报错 #9

Open
yililiangbaikai opened this issue Nov 12, 2020 · 5 comments
Open

detec_face_align_rec.py报错 #9

yililiangbaikai opened this issue Nov 12, 2020 · 5 comments

Comments

@yililiangbaikai
Copy link

image

@yililiangbaikai
Copy link
Author

image
我需要修改这段代码才能跑成功 不知道是不是这个问题

@hpc203
Copy link
Owner

hpc203 commented Nov 13, 2020

出现这个错误,你的faces_feature应该是只包含有1个人脸的特征向量的。做人脸识别,通常是需要提取多个人脸的特征向量,然后保存到faces_feature矩阵里的。看get_face_feature.py里第99行代码:
face_feature = (np.squeeze(np.asarray(feature_list)), name_list)
这里之所以使用了np.squeeze去消除维度是1的维,是因为在arcface输出的特征量是1x512的,如果提取10个人脸特征向量,那么就得到10x1x512的矩阵,显然1是多余的,因此就是用np.squeeze消除它。而如果只提取了一个人脸特征向量,那么得到1x1x512的矩阵,这是使用np.squeeze会把人脸个数1这个维度信息也消除掉,得到长度是512的一维数组,那么在后面运行detect_face_align_rec.py时,就会出现上面的错误:XA必须是2维数组

@hpc203
Copy link
Owner

hpc203 commented Nov 13, 2020

我已经修改了get_face_feature.py和detect_face_align_rec.py里的程序逻辑,您可以同步更新一下

@yililiangbaikai
Copy link
Author

我想通过两张人脸欧拉距离得到人脸相似度,要怎么做呢,翻了很久资料没找到答案。个人感觉目前这个arcface的特征值比对结果也不太理想,有没有更好的选择。

@hpc203
Copy link
Owner

hpc203 commented Nov 17, 2020

arcface建议重新训练,我用的是arcface已开源的训练模型

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