TadasBaltrusaitis / OpenFace

OpenFace – a state-of-the art tool intended for facial landmark detection, head pose estimation, facial action unit recognition, and eye-gaze estimation.
Other
6.77k stars 1.83k forks source link

OpenBLAS segmentation fault about memory regions #748

Open burak43 opened 5 years ago

burak43 commented 5 years ago

Hey,

I followed the instruction on basic ubuntu installation. It installed succesfully; however, when I run sudo ./bin/FeatureExtraction -f "../samples/default.wmv" -2Dfp I got the following error on the console after a few seconds:

Could not find the HAAR face detector location Reading the landmark detector/tracker from: ./bin/model/main_ceclm_general.txt Reading the landmark detector module from: ./bin/model/cen_general.txt Reading the PDM module from: ./bin/model/pdms/In-the-wild_aligned_PDM_68.txt....Done Reading the Triangulations module from: ./bin/model/tris_68.txt....Done Reading the intensity CEN patch experts from: ./bin/model/patch_experts/cen_patches_0.25_of.dat....Done Reading the intensity CEN patch experts from: ./bin/model/patch_experts/cen_patches_0.35_of.dat....Done Reading the intensity CEN patch experts from: ./bin/model/patch_experts/cen_patches_0.50_of.dat....Done Reading the intensity CEN patch experts from: ./bin/model/patch_experts/cen_patches_1.00_of.dat....Done Reading part based module....left_eye_28 Reading the landmark detector/tracker from: ./bin/model/model_eye/main_clnf_synth_left.txt Reading the landmark detector module from: ./bin/model/model_eye/clnf_left_synth.txt Reading the PDM module from: ./bin/model/model_eye/pdms/pdm_28_l_eye_3D_closed.txt....Done Reading the intensity CCNF patch experts from: ./bin/model/model_eye/patch_experts/left_ccnf_patches_1.00_synth_lid_.txt....Done Reading the intensity CCNF patch experts from: ./bin/model/model_eye/patch_experts/left_ccnf_patches_1.50_synth_lid_.txt....Done Could not find the HAAR face detector location Done Reading part based module....right_eye_28 Reading the landmark detector/tracker from: ./bin/model/model_eye/main_clnf_synth_right.txt Reading the landmark detector module from: ./bin/model/model_eye/clnf_right_synth.txt Reading the PDM module from: ./bin/model/model_eye/pdms/pdm_28_eye_3D_closed.txt....Done Reading the intensity CCNF patch experts from: ./bin/model/model_eye/patch_experts/ccnf_patches_1.00_synth_lid_.txt....Done Reading the intensity CCNF patch experts from: ./bin/model/model_eye/patch_experts/ccnf_patches_1.50_synth_lid_.txt....Done Could not find the HAAR face detector location Done Reading the landmark validation module....Done Reading the AU analysis module from: ./bin/AU_predictors/main_dynamic_svms.txt Reading the AU predictors from: ./bin/AU_predictors/AU_all_best.txt... Done Reading the PDM from: ./bin/AU_predictors/In-the-wild_aligned_PDM_68.txt... Done Reading the triangulation from:./bin/AU_predictors/tris_68_full.txt... Done Attempting to read from file: ../samples/default.wmv Device or file opened Starting tracking Reading the MTCNN face detector from: ./bin/model/mtcnn_detector/MTCNN_detector.txt Reading the PNet module from: ./bin/model/mtcnn_detector/PNet.dat Reading the RNet module from: ./bin/model/mtcnn_detector/RNet.dat Reading the ONet module from: ./bin/model/mtcnn_detector/ONet.dat 0% BLAS : Program is Terminated. Because you tried to allocate too many memory regions. BLAS : Program is Terminated. Because you tried to allocate too many memory regions. BLAS : Program is Terminated. Because you tried to allocate too many memory regions. Segmentation fault

First, I though this may be due to lack of BLAS where it showed, when compiling the OpenFace, that it couldn't find BLAS. Then I installed BLAS and re-run the install.sh. It didn't work out. Then, I played with OPENBLAS_NUM_THREADS, OMP_NUM_THREADS variables (changing them to 2,4,32 etc.) on my console. In my first trial, changing OMP_NUM_THREADS to 2 worked out. However, it was just a one time thing I presume, because now it does not work. From time to time, it works but this occurs very rarely. So, there's nothing reliable. What should I do? Any suggestion is appreciated.

Thanks.

TadasBaltrusaitis commented 5 years ago

This seems to be related to the following issue that I encounter on OSX: https://github.com/TadasBaltrusaitis/OpenFace/wiki/Mac-installation#openblas-performance

OpenFace uses OpenCV/TBB internally for threading, and that does not always get along well with OpenBLAS threading model. I attempted to resolve this by setting the number of threads used by OpenBLAS in code, but that does not always seem to work.

Have a look at the following issue: https://github.com/TadasBaltrusaitis/OpenFace/issues/537

burak43 commented 5 years ago

Exporting environment variables doesn't seem to work. Reinstalling OpenBLAS with openmp might be considered. I'll try it and reply back. Thanks for the reply.

burak43 commented 4 years ago

Recompiling opencv with openmp flag (i.e. -D WITH_OPENMP=ON) along with exporting environmental variables specified here solved the issue, although it's not a neat one.