我正在开发一个基本的面部识别程序,我正在尝试实现一个超时系统来锁定计算机。基本上它应该等待一秒钟,然后在计数器达到 10 时将 1 添加到计数器,然后它会激活一个 if 语句来锁定计算机。但是当运行它时,它不会运行代码的任何其他部分,直到它看到一张脸。我对此相当陌生,因此感谢您提供任何帮助。
def facecheck():
if matches == face_recognition.compare_faces(taylor_face_encoding, known_face_encodings):
print("Confirmed")
Confirm = True
exit()
else:
print("Negative")
correct-=1
if correct <= -3:
print("User disallowed!")
subprocess.call('/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend',shell=True)
exit()
while continue1 == 1:
time.sleep(1)
print("Counting")
countdown+=1
facecheck()