coneypo / Dlib_face_recognition_from_camera

Detect and recognize the faces from camera / 调用摄像头进行人脸识别,支持多张人脸同时识别

Home Page:http://www.cnblogs.com/AdaminXie/p/9010298.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

屏幕中一出现人,就马上退出

hellowack opened this issue · comments

报这个错

IndexError: list assignment index out of range

是在录入人脸还是识别时候报错?可以贴一下完整的 log 吗;
是哪个 list 索引报错了?

E:\Anaconda3\envs\tensorflow_env\python.exe E:/PythonFiles/Dlib_face_recognition_from_camera-master/Dlib_face_recognition_from_camera-master/face_reco_from_camera.py
Faces in Database: 1

camera person 1

Traceback (most recent call last):
with person 1 the e distance: 0.4047276480891428
File "E:/PythonFiles/Dlib_face_recognition_from_camera-master/Dlib_face_recognition_from_camera-master/face_reco_from_camera.py", line 222, in
Minimum e distance with person Person_1
Unknown person

main()

File "E:/PythonFiles/Dlib_face_recognition_from_camera-master/Dlib_face_recognition_from_camera-master/face_reco_from_camera.py", line 218, in main
Face_Recognizer_con.run()
File "E:/PythonFiles/Dlib_face_recognition_from_camera-master/Dlib_face_recognition_from_camera-master/face_reco_from_camera.py", line 210, in run
self.process(cap)
File "E:/PythonFiles/Dlib_face_recognition_from_camera-master/Dlib_face_recognition_from_camera-master/face_reco_from_camera.py", line 192, in process
self.modify_name_camera_list()
File "E:/PythonFiles/Dlib_face_recognition_from_camera-master/Dlib_face_recognition_from_camera-master/face_reco_from_camera.py", line 115, in modify_name_camera_list
self.name_known_list[1] ='李四'.encode('utf-8').decode()
IndexError: list assignment index out of range

Process finished with exit code 1

是因为代码初始设置了两个名字吗,我现在注释掉了第二个名字“李四”,然后显示正常了

是因为代码初始设置了两个名字吗,我现在注释掉了第二个名字“李四”,然后显示正常了

嗯嗯是的
# 修改显示人名
def modify_name_camera_list(self):
# Default known name: person_1, person_2, person_3
self.name_known_list[0] ='张三'.encode('utf-8').decode()
self.name_known_list[1] ='李四'.encode('utf-8').decode()
# self.name_known_list[2] ='xx'.encode('utf-8').decode()
# self.name_known_list[3] ='xx'.encode('utf-8').decode()
# self.name_known_list[4] ='xx'.encode('utf-8').decode()

你如果只存了一个人,那 name_known_list[1] 就无法检索所以会报错。。。

谢谢大佬的回答,突然感觉问题有点low,hhh

谢谢大佬的回答,突然感觉问题有点low,hhh

嗯嗯如果没有其它问题,我就把 Issue 关了哈

嗯嗯,好的