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

Comments

@sxyzzzzzzz
Copy link

@sxyzzzzzzz sxyzzzzzzz commented Jan 11, 2018

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

#python facerec_on_raspberry_pi.py
segmentation fault

@sxyzzzzzzz

This comment has been minimized.

Copy link
Author

@sxyzzzzzzz sxyzzzzzzz commented Jan 11, 2018

Similar to #119

@sxyzzzzzzz

This comment has been minimized.

Copy link
Author

@sxyzzzzzzz sxyzzzzzzz commented Jan 11, 2018

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

@sxyzzzzzzz

This comment has been minimized.

Copy link
Author

@sxyzzzzzzz sxyzzzzzzz commented Jan 11, 2018

seems to freeze the function "face_encodings"

@jparedesj

This comment has been minimized.

Copy link

@jparedesj jparedesj commented Jun 6, 2018

Do you found a solution for this?

@andrewda

This comment has been minimized.

Copy link

@andrewda andrewda commented Aug 2, 2018

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

@xyG67

This comment has been minimized.

Copy link

@xyG67 xyG67 commented Sep 3, 2018

Have you found the solution? I met the same problem

@andrewda

This comment has been minimized.

Copy link

@andrewda 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

This comment has been minimized.

Copy link

@andrewplesniak andrewplesniak commented Feb 22, 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.

@AlexBdx

This comment has been minimized.

Copy link

@AlexBdx 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

This comment has been minimized.

Copy link

@SeanIsAllRobot SeanIsAllRobot commented Oct 19, 2019

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
Projects
None yet
7 participants
You can’t perform that action at this time.