问题描述
我正在尝试学习脸部重组,并在google colab和jupyter笔记本上都进行了尝试,但当我编写添加索引[0]的写入方式时,出现IndexError:列表索引超出范围,但没有给出当我省略[0]时出现错误,在这种情况下,当我尝试比较面孔时会出现另一个错误。 这是我的错误样子
IndexError Traceback(最近一次通话最近) 在()
2 for file in os.listdir(kNown_dir):
3 img = read_img(kNown_dir + '/' + file)
----> 4 img_enc = face_recognition.face_encodings(img)[0]
5 kNown_encodings.append(img_enc)
6 kNown_names.append(file.split('.')[0])
IndexError:列表索引超出范围
这是我的代码
kNown_dir = '/content/drive/My Drive/Colab Notebooks/behic_faces'
for file in os.listdir(kNown_dir):
img = read_img(kNown_dir + '/' + file)
img_enc = face_recognition.face_encodings(img)[0]
kNown_encodings.append(img_enc)
kNown_names.append(file.split('.')[0])
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)