1adrianb / face-alignment

:fire: 2D and 3D Face alignment library build using pytorch
https://www.adrianbulat.com
BSD 3-Clause "New" or "Revised" License
7.11k stars 1.35k forks source link

Segmentation Fault Error #85

Closed cenaliu closed 6 years ago

cenaliu commented 6 years ago

When I execute 'import face_alignment', I meet 'Segmentation fault (core dumped)' and don't know how to debug it. I use Pytorch 0.4.0 and Python 3.6.5 Anaconda. Would you please help me and tell me what I should do to solve it. Thanks very much.

winnie1994 commented 6 years ago

After I updated pytorch to 0.4, I started getting this behaviour too. It seems to be a pytorch0.4+dlib problem-- try running 'import dlib' in commandline python and see if you still get a segfault. Additionally, see https://github.com/pytorch/pytorch/issues/8585 I'll post an update if I find a fix!

1adrianb commented 6 years ago

Hi both, While it will be slower can you try running dlib in cpu mode to see if you can get around this issue?

Ideally however you should replace dlib with a better face detection method.

winnie1994 commented 6 years ago

Thanks for the response! @cenaliu Compiling dlib from source with a gcc compiler newer than 4.9 solved it. (See last post in the issue linked to above.) The prebuilt dlib binaries in pypi are compiled with an older gcc compiler that causes problems with one of pytorch's third party dependencies.

In addition, is there a face detection model you'd particularly recommend? I've been playing around with mtcnn but am looking to try others too.

jeongyoonlee commented 6 years ago

I can confirm that @winnie1994's solution works for me.

I upgrade gcc with conda as follows:

conda uninstall gcc
conda install -c conda-forge isl=0.17.1
conda install -c bonsai-team gcc-5

After that, I compiled and installed dlib from the repo, and reinstalled face-alignment from the repo.

1adrianb commented 6 years ago

@cenaliu @winnie1994 @jeongyoonlee It should be all fixed now, in addition SFD face detector is now used by default. Option for using dlib is still preserved. Will update the documentation and add a new model soon.

jeongyoonlee commented 6 years ago

@1adrianb How is the face detection performance of SFD compared to dlib's? In my limited experience, I found that dlib's CNN face detector performs much better than other custom face detectors.

1adrianb commented 6 years ago

@jeongyoonlee its very good, it should be able to detect the whole range of facial poses