Python-IndexError:我的FaceID程序中的列表索引超出范围

时间:2019-06-14 14:01:42

标签: python-3.x face-recognition

我正在制作一个面部识别程序,该程序可以根据我在程序中提供的图片识别出我的面部。

<template>
  <div id="app">
    <div id="nav">
      <router-link to="/">Home</router-link> |
      <router-link to="/about">About</router-link>
    </div>
    <router-view/>
  </div>
</template>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
#nav {
  padding: 30px;
}

#nav a {
  font-weight: bold;
  color: #2c3e50;
}

#nav a.router-link-exact-active {
  color: #42b983;
}
</style>

这部分之后是用于实际面部识别的代码

我希望它能像往常一样正常工作,为我提供网络摄像头中任何内容的实时视频提要,但是却显示错误:

video_capture = cv2.VideoCapture(0)

# Load a sample picture and learn how to recognize it.
me_image = face_recognition.load_image_file("0000.jpg")
me_face_encoding = face_recognition.face_encodings(me_image)[0]

# Load a second sample picture and learn how to recognize it.
me2_image = face_recognition.load_image_file("0001.jpg")
me2_face_encoding = face_recognition.face_encodings(me2_image)[0]

#Load a third sample picture and learn how to recgonize it.
me3_image = face_recognition.load_image_file("0002.jpg")
me3_face_encoding = face_recognition.face_encodings(me3_image)[0]

#Load a fourth sample picture...you get it.
me4_image = face_recognition.load_image_file("0003.jpg")
me4_face_encoding = face_recognition.face_encodings(me4_image)[0]

me5_image = face_recognition.load_image_file("0004.jpg")
me5_face_encoding = face_recognition.face_encodings(me5_image)[0]

me6_image = face_recognition.load_image_file("0005.jpg")
me6_face_encoding = face_recognition.face_encodings(me6_image)[0]

me7_image = face_recognition.load_image_file("0006.jpg")
me7_face_encoding = face_recognition.face_encodings(me7_image)[0]

me8_image = face_recognition.load_image_file("0007.jpg")
me8_face_encoding = face_recognition.face_encodings(me8_image)[0]

me9_image = face_recognition.load_image_file("0008.jpg")
me9_face_encoding = face_recognition.face_encodings(me9_image)[0]

me10_image = face_recognition.load_image_file("0009.jpg")
me10_face_encoding = face_recognition.face_encodings(me10_image)[0]

me11_image = face_recognition.load_image_file("0010.jpg")
me11_face_encoding = face_recognition.face_encodings(me11_image)[0]

me12_image = face_recognition.load_image_file("0011.jpg")
me12_face_encoding = face_recognition.face_encodings(me12_image)[0]

me13_image = face_recognition.load_image_file("0012.jpg")
me13_face_encoding = face_recognition.face_encodings(me13_image)[0]

me14_image = face_recognition.load_image_file("0013.jpg")
me14_face_encoding = face_recognition.face_encodings(me14_image)[0]

me15_image = face_recognition.load_image_file("0014.jpg")
me15_face_encoding = face_recognition.face_encodings(me15_image)[0]

me16_image = face_recognition.load_image_file("0015.jpg")
me16_face_encoding = face_recognition.face_encodings(me16_image)[0]

me17_image = face_recognition.load_image_file("0016.jpg")
me17_face_encoding = face_recognition.face_encodings(me17_image)[0]

me18_image = face_recognition.load_image_file("0017.jpg")
me18_face_encoding = face_recognition.face_encodings(me18_image)[0]

me19_image = face_recognition.load_image_file("0018.jpg")
me19_face_encoding = face_recognition.face_encodings(me19_image)[0]

me20_image = face_recognition.load_image_file("0019.jpg")
me20_face_encoding = face_recognition.face_encodings(me20_image)[0]

me21_image = face_recognition.load_image_file("0020.jpg")
me21_face_encoding = face_recognition.face_encodings(me21_image)[0]

me22_image = face_recognition.load_image_file("0021.jpg")
me22_face_encoding = face_recognition.face_encodings(me22_image)[0]

me23_image = face_recognition.load_image_file("0022.jpg")
me23_face_encoding = face_recognition.face_encodings(me23_image)[0]

me24_image = face_recognition.load_image_file("0023.jpg")
me24_face_encoding = face_recognition.face_encodings(me24_image)[0]

me25_image = face_recognition.load_image_file("0024.jpg")
me25_face_encoding = face_recognition.face_encodings(me25_image)[0]

me26_image = face_recognition.load_image_file("0025.jpg")
me26_face_encoding = face_recognition.face_encodings(me26_image)[0]

me27_image = face_recognition.load_image_file("0026.jpg")
me27_face_encoding = face_recognition.face_encodings(me27_image)[0]

me28_image = face_recognition.load_image_file("0027.jpg")
me28_face_encoding = face_recognition.face_encodings(me28_image)[0]

me29_image = face_recognition.load_image_file("0028.jpg")
me29_face_encoding = face_recognition.face_encodings(me29_image)[0]

me30_image = face_recognition.load_image_file("0029.jpg")
me30_face_encoding = face_recognition.face_encodings(me30_image)[0]

me31_image = face_recognition.load_image_file("0030.jpg")
me31_face_encoding = face_recognition.face_encodings(me31_image)[0]

me32_image = face_recognition.load_image_file("0031.jpg")
me32_face_encoding = face_recognition.face_encodings(me32_image)[0]

# Create arrays of known face encodings and their names
my_face_encodings = [
    me_face_encoding,
    me2_face_encoding,
    me3_face_encoding,
    me4_face_encoding,
    me5_face_encoding,
    me6_face_encoding,
    me7_face_encoding,
    me8_face_encoding,
    me9_face_encoding,
    me10_face_encoding,
    me11_face_encoding,
    me12_face_encoding,
    me13_face_encoding,
    me14_face_encoding,
    me15_face_encoding,
    me16_face_encoding,
    me17_face_encoding,
    me18_face_encoding,
    me19_face_encoding,
    me20_face_encoding,
    me21_face_encoding,
    me22_face_encoding,
    me23_face_encoding,
    me24_face_encoding,
    me25_face_encoding,
    me26_face_encoding,
    me27_face_encoding,
    me28_face_encoding,
    me29_face_encoding,
    me30_face_encoding,
    me31_face_encoding,
    me32_face_encoding
]
known_face_names = "Rithwik Mishra"

# Initialize some variables
face_locations = []
face_encodings = []
face_names = []
process_this_frame = True

我需要有关加载数据库的帮助

0 个答案:

没有答案