简体   繁体   English

这是我识别人脸的代码。 我收到以下错误。 我正在使用 dlib 形状预测器

[英]This is my code for recognition of faces. I am getting the following error. i am using dlib shape predictor

align = openface.AlignDlib(dlibFacePredictor) subject=input("Enter Subject:") a=['BI','SIC','PGIS','SQA','ITSM'] path = 'C:/Users/ACER/Desktop/PROJECT ALL RESOURCE/Implementation/PYTHON FILES/images/' if subject in a: print("Success") wbook = load_workbook(filename = "C:/Users/ACER/Desktop/PROJECT ALL RESOURCE/Implementation/PYTHON FILES/Attendance/"+subject+".xlsx") sheet = wbook.get_sheet_by_name('TYBSCIT'+subject) else: print("Invalid")

def getDateColumns(): for i in range(1, len(sheet.rows[0]) + 1): cols = get_column_letter(i) if sheet.cell('%s%s'% (col,'1')).value == currentDate: return cols def getProfileId(Ids): connect = sqlite3.connect("C:/Users/ACER/Desktop/PROJECT ALL RESOURCE/Implementation/PYTHON FILES/sqlite3/Studentdb.db") cmd = "SELECT * FROM Students WHERE ID=" + str(Ids) cursor = connect.execute(cmd) profile = None for row in cursor: profile = row connect.close() return profile

attend = [0 for i in range(60)] rec = cv2.face.LBPHFaceRecognizer_create() # Local Binary Patterns Histograms rec.read('C:/Users/ACER/Desktop/PROJECT ALL RESOURCE/Implementation/PYTHON FILES/Training/trainingData.yml') # loading the trained data picNumber = 2 image= cv2.imread('C:/Users/ACER/Desktop/PROJECT ALL RESOURCE/Implementation/PYTHON FILES/images/'+subject+currentDate+'.jpg') font = cv2.FONT_HERSHEY_SIMPLEX # the font of text on face recognition gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # conveting the camera input into GrayScale dets = detector(image, 1) totalConf = 0.0 faceRec = 0 for i, d in enumerate(dets): image2 = image[d.top():d.bottom(), d.left():d.right()] rgbImg = cv2.cvtColor(image2, cv2.COLOR_BGR2RGB) bb = align.getLargestFaceBoundingBox(rgbImg) alignedFace = align.align(96, rgbImg, bb=None, landmarkIndices=openface.AlignDlib.OUTER_EYES_AND_NOSE) alignedFace= cv2.cvtColor(alignedFace, cv2.COLOR_BGR2GRAY) # conveting the camera input into GrayScale Ids, conf = rec.predict(alignFace) # Comparing from the trained data

Traceback (most recent call last): File "C:\Users\ACER\Desktop\PROJECT ALL RESOURCE\Implementation\PYTHON FILES\facerecognition.py", line 60, in <module> Ids, conf = rec.predict(alignFace) # Comparing from the trained data NameError: name 'alignFace' is not defined

As the TraceBack states, alignFace is not defined.正如 TraceBack 所述, alignFace You have made a typo of your previously-defined alignedFace - use this instead.您输入了之前定义的alignedFace的拼写错误 - 请改用它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我在Python中使用基本脚本但是出现以下错误。 这是什么意思? - I am using a basic script in Python but am getting the following error. What does it mean? 在对Boltzmann机器执行对比发散时,出现以下错误。 我正在使用最新版本的pytorch - While performing contrastive divergnece for the Boltzmann machine, i am getting the following error. i am using the latest version of pytorch 我正在尝试将图像上传到Firebase,但出现错误。 我正在使用python 3.6.1 - i am trying to upload an image to firebase but i am getting an error. i am using python 3.6.1 我正在尝试编辑现有帖子并将其保存到数据库,但是没有反向匹配错误。 下面是我的代码 - I am trying to edit an existing post and save it to the database but getting no reverse match error. below is my code 我在 pycharm 中执行面部识别代码时遇到错误,也尝试在终端上执行它 - i am getting an error in my face recognition code while excuting it in pycharm, have also tried executing it on terminal 我在谷歌识别中遇到查找错误 - I am getting lookup error in google recognition 当我运行我的代码时,我收到一个错误。 据说 &#39;SFA &#39; 未定义,但我将 SFA 设置为用户输入 - When I run my code I am getting an error. It is saying that 'SFA ' is not defined but I set SFA to a user input 在培训期间,我收到以下错误。 “ ValueError:没有为任何变量提供梯度” - Whie training I am getting the following error. “ ValueError: No gradients provided for any variable” 为什么我的代码中出现以下错误:TypeError: &#39;int&#39; object does not support item assignment - Why am I getting the following error in my code: TypeError: 'int' object does not support item assignment 为什么我没有得到以下代码的输出? - Why am I not getting output for the following code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM