Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use face_recognition on raspberry, “segmentation fault” occurred #294

Open
sxyzzzzzzz opened this issue Jan 11, 2018 · 10 comments
Open

Comments

@sxyzzzzzzz
Copy link

  • face_recognition version:0.2.0
  • Python version:3.5
  • Operating System:raspbian

#python facerec_on_raspberry_pi.py
segmentation fault

@sxyzzzzzzz
Copy link
Author

sxyzzzzzzz commented Jan 11, 2018

Similar to #119

@sxyzzzzzzz
Copy link
Author

cpu 100%,then segmentation fault. raspberry pi 3.

@sxyzzzzzzz
Copy link
Author

seems to freeze the function "face_encodings"

@jparedesj
Copy link

Do you found a solution for this?

@andrewda
Copy link

andrewda commented Aug 2, 2018

Any solution found for this? Been debugging for many hours now to no avail.

@xyG67
Copy link

xyG67 commented Sep 3, 2018

Have you found the solution? I met the same problem

@andrewda
Copy link

andrewda commented Sep 3, 2018

Unfortunately I never found a solution to this, besides using some faster hardware. I'd love to hear if others have figured this out, though!

@andrewplesniak
Copy link

I was experiencing the same problem, segmentation fault when calling the face_encodings on the raspberry pi 3. In my case, I compiled dlib with OpenBLAS for linear algebra optimizations which allows dlib functionality to execute faster. However, OpenBLAS itself is multi-threaded and if you try and use it in a muilt-threaded application it will peg the CPU and cause the seg fault. For use in multi-threaded applications, OpenBlas recommends you set it to single thread mode.

In my case, I set some environmental variables in my virtual environment to tell OpenBLAS to only use a single thread by doing the following:

$ workon myvenv
$ nano VIRTUAL_ENV/bin/postactivate

add the following lines and save:
export OPENBLAS_NUM_THREADS=1
export OPENBLAS_MAIN_FREE=1

By doing this, I was able to achieve ~15 fps of facial recognition in my application that was previously crashing on my pi.

@AlexBdx
Copy link

AlexBdx commented Jun 7, 2019

I was experiencing the same problem, segmentation fault when calling the face_encodings on the raspberry pi 3. In my case, I compiled dlib with OpenBLAS for linear algebra optimizations which allows dlib functionality to execute faster. However, OpenBLAS itself is multi-threaded and if you try and use it in a muilt-threaded application it will peg the CPU and cause the seg fault. For use in multi-threaded applications, OpenBlas recommends you set it to single thread mode.

In my case, I set some environmental variables in my virtual environment to tell OpenBLAS to only use a single thread by doing the following:

$ workon myvenv
$ nano VIRTUAL_ENV/bin/postactivate

add the following lines and save:
export OPENBLAS_NUM_THREADS=1
export OPENBLAS_MAIN_FREE=1

By doing this, I was able to achieve ~15 fps of facial recognition in my application that was previously crashing on my pi.

This solved my issue too. The Pi is now using only one CPU core instead of 4 but does not crash when calling face_encodings!
Any idea how all 4 cores could be used to increase the FPS?

@SeanIsAllRobot
Copy link

I have the same issue, but I'm not working within a virtual environment, so where would i write

export OPENBLAS_NUM_THREADS=1
export OPENBLAS_MAIN_FREE=1

to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants