ageitgey / face_recognition

The world's simplest facial recognition api for Python and the command line
MIT License
53.36k stars 13.48k forks source link

【Bug】Fail to run facerec_from_webcam_faster.py #1509

Open WaveBird opened 1 year ago

WaveBird commented 1 year ago

Description

Fail to run the realtime example code and met with the following error after install dependency

Traceback (most recent call last):
  File ".../face_recognition/examples/facerec_from_webcam_faster.py", line 55, in <module>
    face_encodings = face_recognition.face_encodings(rgb_small_frame, face_locations)
  File ".../face_recognition/face_recognition/api.py", line 214, in face_encodings
    return [np.array(face_encoder.compute_face_descriptor(face_image, raw_landmark_set, num_jitters)) for raw_landmark_set in raw_landmarks]
  File ".../face_recognition/face_recognition/api.py", line 214, in <listcomp>
    return [np.array(face_encoder.compute_face_descriptor(face_image, raw_landmark_set, num_jitters)) for raw_landmark_set in raw_landmarks]
TypeError: compute_face_descriptor(): incompatible function arguments. The following argument types are supported:
    1. (self: _dlib_pybind11.face_recognition_model_v1, img: numpy.ndarray[(rows,cols,3),numpy.uint8], face: _dlib_pybind11.full_object_detection, num_jitters: int = 0, padding: float = 0.25) -> _dlib_pybind11.vector
    2. (self: _dlib_pybind11.face_recognition_model_v1, img: numpy.ndarray[(rows,cols,3),numpy.uint8], num_jitters: int = 0) -> _dlib_pybind11.vector
    3. (self: _dlib_pybind11.face_recognition_model_v1, img: numpy.ndarray[(rows,cols,3),numpy.uint8], faces: _dlib_pybind11.full_object_detections, num_jitters: int = 0, padding: float = 0.25) -> _dlib_pybind11.vectors
    4. (self: _dlib_pybind11.face_recognition_model_v1, batch_img: List[numpy.ndarray[(rows,cols,3),numpy.uint8]], batch_faces: List[_dlib_pybind11.full_object_detections], num_jitters: int = 0, padding: float = 0.25) -> _dlib_pybind11.vectorss
    5. (self: _dlib_pybind11.face_recognition_model_v1, batch_img: List[numpy.ndarray[(rows,cols,3),numpy.uint8]], num_jitters: int = 0) -> _dlib_pybind11.vectors

Invoked with: <_dlib_pybind11.face_recognition_model_v1 object at 0x112682530>, array([[[121, 114, 101],
        [121, 114, 102],
        [121, 113, 103],
        ...,
        [250, 253, 251],
        [251, 253, 252],
        [250, 253, 252]],

       [[120, 112, 100],
        [123, 115, 105],
        [120, 112, 102],
        ...,
        [253, 255, 255],
        [253, 255, 255],
        [252, 254, 254]],

       [[126, 118, 106],
        [123, 115, 104],
        [124, 116, 106],
        ...,
        [253, 255, 255],
        [253, 255, 255],
        [253, 255, 255]],

       ...,

       [[138, 196, 193],
        [157, 217, 213],
        [144, 204, 200],
        ...,
        [227, 210, 191],
        [226, 208, 187],
        [229, 206, 177]],

       [[162, 222, 217],
        [146, 205, 203],
        [163, 225, 222],
        ...,
        [234, 215, 198],
        [228, 210, 188],
        [229, 207, 181]],

       [[137, 196, 192],
        [164, 226, 221],
        [135, 194, 191],
        ...,
        [ 90,  74,  59],
        [227, 211, 192],
        [234, 213, 188]]], dtype=uint8), <_dlib_pybind11.full_object_detection object at 0x1126824b0>, 1
andersprenger commented 1 year ago

see #1531