Face_recognition: Use face_recognition on raspberry, “segmentation fault” occurred

Created on 11 Jan 2018  ·  10Comments  ·  Source: ageitgey/face_recognition

python facerec_on_raspberry_pi.py

segmentation fault

Most helpful comment

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.

All 10 comments

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

seems to freeze the function "face_encodings"

Do you found a solution for this?

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

Have you found the solution? I met the same problem

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!

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.

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?

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dickyj picture dickyj  ·  3Comments

cjosephson picture cjosephson  ·  5Comments

Nijinsha picture Nijinsha  ·  5Comments

ramineniraviteja picture ramineniraviteja  ·  5Comments

xiao543348405 picture xiao543348405  ·  5Comments