Open andvikt opened 3 years ago
Wow that's something why i can't fix this bug whenever i search on google. I think im gonna use haar cascade if this issue doesn't solve yet
Hey folks,
Thanks for the issue. Could you give us a reproducible bug to check? A colab notebook with the bug would do! TIA š
I can confirm that this is still an issue. I was following the face align tutorial, and kept running into this exact issue. I eventually added all of the facealigner.py code into my code and got the same error. Adding int() to the tuple fixed it:
eyesCenter = (int((leftEyeCenter[0] + rightEyeCenter[0]) // 2),
int((leftEyeCenter[1] + rightEyeCenter[1]) // 2))
Maybe I'm using a bad version? This is what my pip reports:
Package Version
--------------------- --------
cmake 3.22.3
dlib 19.23.1
imutils 0.5.4
numpy 1.22.3
opencv-contrib-python 4.5.5.64
Hi @ariG23498 this is still an issue as I got a ticket from a customer today about this
Tagging @abhishekthanki and @ritwikraha to this issue!
I had this issue too with opencv-python 4.6.0.66 and numpy 1.19.5. Thanks @AKSoapy29 for the easy fix.
det = dlib.get_frontal_face_detector() pred = dlib.shape_predictor(r'...\shape_predictor_68_face_landmarks.dat') alg = FaceAligner(pred, desiredFaceWidth = 256) This tries to do face-normalisation
This makes this error 'Can't parse 'Center''
frame = cv2.imread('img.jpg') gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) rect = detector(gray,1)[0] faceAligned = aligner.align(frame, gray, rect)
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\imutils\face_utils\facealigner.py:68, in FaceAligner.align(self, image, gray, rect) 64 eyesCenter = ((leftEyeCenter[0] + rightEyeCenter[0]) // 2, 65 (leftEyeCenter[1] + rightEyeCenter[1]) // 2) 67 # grab the rotation matrix for rotating and scaling the face ---> 68 M = cv2.getRotationMatrix2D(eyesCenter, angle, scale) 70 # update the translation component of the matrix 71 tX = self.desiredFaceWidth * 0.5
TypeError: Can't parse 'center'. Sequence item with index 0 has a wrong type
For me, casting the eyesCenter from <class 'numpy.int64>
to type <class 'int'>
instead of fixed it:
in faceAligner.py:64 I did:
eyesCenter = (int((leftEyeCenter[0] + rightEyeCenter[0]) // 2),
int((leftEyeCenter[1] + rightEyeCenter[1]) // 2))
For me, casting the eyesCenter from
<class 'numpy.int64>
to type<class 'int'>
instead of fixed it:in faceAligner.py:64 I did:
eyesCenter = (int((leftEyeCenter[0] + rightEyeCenter[0]) // 2), int((leftEyeCenter[1] + rightEyeCenter[1]) // 2))
This works for me! Thanks @dunland
Hi Pyimagesearch/imutils,
We know how annoying auto-reply and email confirmation responses are, but we wanted to send you a quick reply and let you know that your email has safely landed in our inbox. Hooray!
We try to respond to emails within 72 hours, Monday-Friday.
In the meantime, hereās a few quick tips to help you out:
We really appreciate your understanding, we hope this email didnāt let you down. See you at pyimagesearch.com!
PyImageSearch Team {#HS:2604959745-309633#}
the actual shape of eyesCenter is (np.int64, np.int64), but must be (int, int) it can be easyly fixed by
[int(x) for x in eyesCenter]
I will provide PR fixing that