face_rec icon indicating copy to clipboard operation
face_rec copied to clipboard

Error while running face_rec.py

Open ahsanfarooqui opened this issue 5 years ago • 6 comments

Hi,

I am getting following error while running face_rec.py. Any suggestions?

Traceback (most recent call last):
  File "face_rec.py", line 199, in <module>
    frame = detect_and_display(model, video_capture, face_detector, open_eyes_detector,left_eye_detector,right_eye_detector, data, eyes_detected)
  File "face_rec.py", line 95, in detect_and_display
    encoding = face_recognition.face_encodings(rgb, [(y, x+w, y+h, x)])[0]
  File "C:\Users\xxx\AppData\Local\Continuum\anaconda3\envs\ddd\lib\site-packages\face_recognition\api.py", line 209, in face_encodings
    raw_landmarks = _raw_face_landmarks(face_image, known_face_locations, model="small")
  File "C:\Users\xxx\AppData\Local\Continuum\anaconda3\envs\ddd\lib\site-packages\face_recognition\api.py", line 155, in _raw_face_landmarks
    face_locations = [_css_to_rect(face_location) for face_location in face_locations]
  File "C:\Users\xxx\AppData\Local\Continuum\anaconda3\envs\ddd\lib\site-packages\face_recognition\api.py", line 155, in <listcomp>
    face_locations = [_css_to_rect(face_location) for face_location in face_locations]
  File "C:\Users\xxx\AppData\Local\Continuum\anaconda3\envs\ddd\lib\site-packages\face_recognition\api.py", line 46, in _css_to_rect
    return dlib.rectangle(css[3], css[0], css[1], css[2])
Boost.Python.ArgumentError: Python argument types in
    rectangle.__init__(rectangle, numpy.int32, numpy.int32, numpy.int32, numpy.int32)
did not match C++ signature:
    __init__(struct _object * __ptr64, long left, long top, long right, long bottom)
    __init__(struct _object * __ptr64)

ahsanfarooqui avatar Oct 16 '19 13:10 ahsanfarooqui

Same problem

simlimone avatar Dec 02 '19 13:12 simlimone

I received this error... [LOG] Collecting images ... 0it [00:00, ?it/s] [LOG] Encoding faces ... 0it [00:00, ?it/s]

any ideas what's wrong? Where do i place my own images?

yusra-shaikh avatar May 08 '20 07:05 yusra-shaikh

I received this error... [LOG] Collecting images ... 0it [00:00, ?it/s] [LOG] Encoding faces ... 0it [00:00, ?it/s]

any ideas what's wrong? Where do i place my own images?

Create the dir inline with dataset dir and name it as faces and in that create your name dir (i.e amol) and place your img in the folder

faces dir structure should be like:

  faces/

             amol/ ### 1 picture
                     anything.jpg

            barak/ ### 1 picture
                      anything.jpg
      

extension should be .jpg

amoljagadambe avatar Aug 28 '20 06:08 amoljagadambe

Hi,

I am getting following error while running face_rec.py. Any suggestions?

Traceback (most recent call last):
  File "face_rec.py", line 199, in <module>
    frame = detect_and_display(model, video_capture, face_detector, open_eyes_detector,left_eye_detector,right_eye_detector, data, eyes_detected)
  File "face_rec.py", line 95, in detect_and_display
    encoding = face_recognition.face_encodings(rgb, [(y, x+w, y+h, x)])[0]
  File "C:\Users\xxx\AppData\Local\Continuum\anaconda3\envs\ddd\lib\site-packages\face_recognition\api.py", line 209, in face_encodings
    raw_landmarks = _raw_face_landmarks(face_image, known_face_locations, model="small")
  File "C:\Users\xxx\AppData\Local\Continuum\anaconda3\envs\ddd\lib\site-packages\face_recognition\api.py", line 155, in _raw_face_landmarks
    face_locations = [_css_to_rect(face_location) for face_location in face_locations]
  File "C:\Users\xxx\AppData\Local\Continuum\anaconda3\envs\ddd\lib\site-packages\face_recognition\api.py", line 155, in <listcomp>
    face_locations = [_css_to_rect(face_location) for face_location in face_locations]
  File "C:\Users\xxx\AppData\Local\Continuum\anaconda3\envs\ddd\lib\site-packages\face_recognition\api.py", line 46, in _css_to_rect
    return dlib.rectangle(css[3], css[0], css[1], css[2])
Boost.Python.ArgumentError: Python argument types in
    rectangle.__init__(rectangle, numpy.int32, numpy.int32, numpy.int32, numpy.int32)
did not match C++ signature:
    __init__(struct _object * __ptr64, long left, long top, long right, long bottom)
    __init__(struct _object * __ptr64)

this error is related to dlib library

did you have windows 8 sdk installed if yes then retarget the sdk you can find docs on how to retraget the sdk and if no download the sdk restart your computer and reinstall dlib using pip and your good to go

amoljagadambe avatar Aug 28 '20 06:08 amoljagadambe

Hi,

I am getting following error while running face_rec.py. Any suggestions?

Using TensorFlow backend. Traceback (most recent call last): File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in from tensorflow.python._pywrap_tensorflow_internal import * ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "face_rec.py", line 7, in from eye_status import * File "D:\Sem7\client\face_recog_research\liveness\face_rec-master\test\eye_status.py", line 4, in import keras File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\site-packages\keras_init_.py", line 3, in from . import utils File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\site-packages\keras\utils_init_.py", line 6, in from . import conv_utils File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\site-packages\keras\utils\conv_utils.py", line 9, in from .. import backend as K File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\site-packages\keras\backend_init_.py", line 84, in from .tensorflow_backend import * File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\site-packages\keras\backend\tensorflow_backend.py", line 5, in import tensorflow as tf File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow_init_.py", line 41, in from tensorflow.python.tools import module_util as module_util File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python_init.py", line 39, in from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\Users\Acer\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in from tensorflow.python._pywrap_tensorflow_internal import * ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.

TerrisGO avatar Mar 08 '21 12:03 TerrisGO

ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.

Check if your CPU support AVX if it doesn't support the AVX then you need to downgrade the tensorflow version to 1.5

https://github.com/gitkwr/Install_Instructions-Win10-Deeplearning-Keras-Tensorflow

this link will help you install the tensorflow

amoljagadambe avatar Mar 08 '21 12:03 amoljagadambe