ageitgey / face_recognition

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

same I am stuck.help #1493

Open Muchai248 opened 1 year ago

Muchai248 commented 1 year ago

Description

Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen. IMPORTANT: If your issue is related to a specific picture, include it so others can reproduce the issue.

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
Shangsit commented 1 year ago

Please help I am stuck in this error I am getting this exact error https://stackoverflow.com/questions/76025408/face-recognition-module-crashing-when-a-face-is-in-frame-python3

The traceback I received:- Traceback (most recent call last): File "f:\storage 1 backup\Coding\MINI PROJECT 6TH SEM\main.py", line 58, in face_encodings = face_recognition.face_encodings( File "F:\storage 1 backup\Coding\MINI PROJECT 6TH SEM\env\lib\site-packages\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 "F:\storage 1 backup\Coding\MINI PROJECT 6TH SEM\env\lib\site-packages\face_recognition\api.py", line 214, in 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 0x00000213428F0370>, array([[[207, 202, 201], [207, 202, 201], [208, 203, 202], ..., [176, 131, 104], [172, 127, 107], [174, 130, 100]],

   [[206, 203, 205],
    [204, 201, 202],
    [205, 202, 203],
    ...,
    [177, 135, 101],
    [173, 132,  98],
    [171, 130,  97]],

   [[207, 204, 206],
   [[133, 133, 149],
    [133, 133, 151],
    [135, 135, 154],
    ...,
    [ 36,  30,  33],
    [ 38,  33,  35],
    [ 37,  32,  34]]], dtype=uint8), <_dlib_pybind11.full_object_detection object at 0x000002132A5CB030>, 1
BirenMer commented 1 year ago

Hello there I am having the same issue, Please help me solve it ` /home/x/workspace/face-recognition-2/frc/bin/python /home/x/workspace/face-recognition-2/main.py Traceback (most recent call last): File "/home/x/workspace/face-recognition-2/main.py", line 54, in face_encodings = face_recognition.face_encodings(rgb_small_frame, face_locations) File "/home/x/workspace/face-recognition-2/frc/lib/python3.10/site-packages/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 "/home/x/workspace/face-recognition-2/frc/lib/python3.10/site-packages/face_recognition/api.py", line 214, in 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 0x7fdc4cbd59b0>, array([[[166, 182, 179], [167, 182, 180], [168, 184, 181], ..., [197, 206, 221], [197, 209, 221], [196, 208, 223]],

   [[170, 182, 180],
    [172, 181, 178],
    [172, 183, 179],
    ...,
    [193, 212, 221],
    [192, 212, 221],
    [192, 211, 218]],

   [[157, 180, 177],
    [163, 183, 181],
    [170, 183, 182],
    ...,
    [193, 213, 222],
    [191, 213, 218],
    [193, 211, 221]],

   ...,

   [[ 49,  49,  49],
    [ 45,  46,  44],
    [ 50,  51,  48],
    ...,
    [ 27,  27,  27],
    [ 26,  28,  28],
    [ 27,  29,  28]],

   [[ 48,  48,  47],
    [ 45,  46,  43],
    [ 50,  51,  48],
    ...,
    [ 27,  27,  27],
    [ 26,  30,  28],
    [ 25,  30,  28]],

   [[ 46,  46,  45],
    [ 48,  49,  43],
    [ 50,  51,  46],
    ...,
    [ 25,  28,  27],
    [ 27,  28,  28],
    [ 26,  29,  28]]], dtype=uint8), <_dlib_pybind11.full_object_detection object at 0x7fdc51ffde30>, 1`
BirenMer commented 1 year ago

Hey, this helped me in solving my issue,

Try rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) instead of rgb_frame = frame[:, :, ::-1]

Credits:-original issue