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

run_facewarp.py error #9

Closed
lzxzy opened this issue Dec 13, 2018 · 25 comments
Closed

run_facewarp.py error #9

lzxzy opened this issue Dec 13, 2018 · 25 comments
Assignees

Comments

@lzxzy
Copy link

lzxzy commented Dec 13, 2018

when I run shell
python runfacewarp.py --results_dir=frontalized_faces
I got the error Segmentation fault(core dumped)
It seemed the FaceWarperServer which was compiled has some problem
but I through the build and cmake got nothing

So, what's the problem is this, thank you

@christopher-beckham
Copy link
Collaborator

Hi lzxzy,

Thanks for the bug report. Just some questions:

  • What operating system are you using (if Linux, what distro)?
  • Can you attach the output of cmake / make when you built the server? This might give some useful information.
  • Does the segfault still happen if you run the example as described here?

@srajotte I have added you since you'll probably have a better idea of this than I do. Would it help if we had the core dump file? (Not that I dabble in such things...)

@srajotte
Copy link
Collaborator

@srajotte I have added you since you'll probably have a better idea of this than I do. Would it help if we had the core dump file? (Not that I dabble in such things...)

For now, having the answer to the three points you mentioned would be more helpful than a core dump.

Assuming FaceWarperServer successfully compiled, a possible source of the problem is if the destination directory doesn't exist or the source files (images, keypoints, etc.) don't exist. FaceWarperServer assumes that all input files are valid and exist. If a file or the destination directory doesn't exist, there is a high probability of a crash.

I suppose the Python script that @lzxzy is using is DepthNets/cyclegan/data/celeba/run_facewarp.py. In this script, if a file doesn't exist, an error message will be printed, but the command will still be sent to FaceWarperServer. @lzxzy do you get a message starting with "PB" on the standard output before FaceWarperServer crashes?

@christopher-beckham
Copy link
Collaborator

When I was running this a while ago, the python script would simply hang if a file or directory doesn’t exist, rather than segfault. If the example command in the facewarper works, then this would imply that maybe there’s a bug in my data prep script.

@srajotte
Copy link
Collaborator

Indeed, thinking about it again, I don't think a missing file/folder would generate a Segmentation fault. In this situation, FaceWarperServer should either hang or abort, but not segfault.

Knowing if the example works correctly would really help to pinpoint the source of the problem.

@lzxzy
Copy link
Author

lzxzy commented Dec 14, 2018

Hi lzxzy,

Thanks for the bug report. Just some questions:

  • What operating system are you using (if Linux, what distro)?
  • Can you attach the output of cmake / make when you built the server? This might give some useful information.
  • Does the segfault still happen if you run the example as described here?

@srajotte I have added you since you'll probably have a better idea of this than I do. Would it help if we had the core dump file? (Not that I dabble in such things...)

Thanks for your reply
first I run the build_linux.sh in FaceWarperServer, and I got this:

 -- The C compiler identification is GNU 5.4.0
 -- The CXX compiler identification is GNU 5.4.0
 -- Check for working C compiler: /usr/bin/cc
 -- Check for working C compiler: /usr/bin/cc -- works
 -- Detecting C compiler ABI info
 -- Detecting C compiler ABI info - done
 -- Detecting C compile features
 -- Detecting C compile features - done
 -- Check for working CXX compiler: /usr/bin/c++
 -- Check for working CXX compiler: /usr/bin/c++ -- works
 -- Detecting CXX compiler ABI info
 -- Detecting CXX compiler ABI info - done
 -- Detecting CXX compile features
 -- Detecting CXX compile features - done
 -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") 
 -- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.2.54") 
 -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so   
 -- Found GLUT: /usr/lib/x86_64-linux-gnu/libglut.so  
 -- Found GLEW: /usr/include  
 -- Configuring done
 -- Generating done
 -- Build files have been written to: 
 /media/liuzongxuan/disk2/workspace/github/DepthNets/FaceWarper/FaceWarperServer/build

It seems pass the build, and When I cd builddictionary , I found there nothing named FaceWarperServer, so I run the make command, finally I got this:

Scanning dependencies of target FaceWarperServer
[ 33%] Building CXX object CMakeFiles/FaceWarperServer.dir/source/FaceWarper.cpp.o
[ 66%] Building CXX object CMakeFiles/FaceWarperServer.dir/source/shader.cpp.o
[100%] Linking CXX executable FaceWarperServer
[100%] Built target FaceWarperServer

Looks make successfully also.
But when I run ' python run_facewarp.py --results_dir=frontalized_faces '
I still got the problem:

/media/liuzongxuan/disk2/workspace/github/DepthNets/FaceWarper/FaceWarperServer/build/FaceWarperServer
Segmentation fault (core dumped)

@lzxzy lzxzy closed this as completed Dec 14, 2018
@lzxzy lzxzy mentioned this issue Dec 14, 2018
@lzxzy lzxzy reopened this Dec 14, 2018
@srajotte
Copy link
Collaborator

If you execute FaceWarperServer by itself (run build/FaceWarperServer), does it segfault?
If you run the example, does it segfault?

@lzxzy
Copy link
Author

lzxzy commented Dec 14, 2018

If you execute FaceWarperServer by itself (run build/FaceWarperServer), does it segfault?
If you run the example, does it segfault?

Yes , when I run FaceWarperServer, It still got segmentation fault (core dumped)

@lzxzy
Copy link
Author

lzxzy commented Dec 14, 2018

If you execute FaceWarperServer by itself (run build/FaceWarperServer), does it segfault?
If you run the example, does it segfault?

and when run the example you raised , I got nothing. Nothing output either error imformation

@srajotte
Copy link
Collaborator

If FaceWarperServer crashes with a segfault by itself, then there is a problem with the executable.

I don't know what might cause this problem. My first hypothesis would be an incompatibility with one of the shared libraries (zlib/libpng/freeglut/opengl).

@lzxzy
Copy link
Author

lzxzy commented Dec 14, 2018

If FaceWarperServer crashes with a segfault by itself, then there is a problem with the executable.

I don't know what might cause this problem. My first hypothesis would be an incompatibility with one of the shared libraries (zlib/libpng/freeglut/opengl).

Ok, thanks for your reply
I'll try to re-install opengllib and see what happen
Thanks again

@christopher-beckham
Copy link
Collaborator

What is the operating system you're using?

Hmm so maybe ldconfig would be useful to use to figure out what versions the libraries are??

@lzxzy
Copy link
Author

lzxzy commented Dec 14, 2018

What is the operating system you're using?

Hmm so maybe ldconfig would be useful to use to figure out what versions the libraries are??

ubuntu 16.04
my opengl lib installed is normal
but I still got the problem

@lzxzy
Copy link
Author

lzxzy commented Dec 14, 2018

What is the operating system you're using?

Hmm so maybe ldconfig would be useful to use to figure out what versions the libraries are??

when I use dmesg to show the error info
I got this
FaceWarperServe[31903]: segfault at 0 ip 0000000000000000 sp 00007ffe39459e68 error 14 in FaceWarperServer[400000+19000]

@christopher-beckham
Copy link
Collaborator

christopher-beckham commented Dec 14, 2018

@srajotte is there an easy way for him to figure out the versions of all the libraries which the server is dependent on?

I know this doesn't help much, but if you have Ubuntu 18.04 (rather than 16.04) it should work. We've both compiled and run it successfully on this version.

@srajotte
Copy link
Collaborator

srajotte commented Dec 14, 2018

You can use ldd to know the dependencies and where the linker finds them. For example, when I run ldd -v FaceWarperServer on Ubuntu 18.04, I get the output in this file.

@lzxzy you might want to try to run this command and copy the output to see if something seems strange. Since you are using a different distribution version, the version of all the libraries will probably be different. It isn't a bad thing, but it makes spotting a problem very difficult.

Another thing that would help is run FaceWarperServer within gdb and get a backtrace.

@lzxzy
Copy link
Author

lzxzy commented Dec 16, 2018

You can use ldd to know the dependencies and where the linker finds them. For example, when I run ldd -v FaceWarperServer on Ubuntu 18.04, I get the output in this file.

@lzxzy you might want to try to run this command and copy the output to see if something seems strange. Since you are using a different distribution version, the version of all the libraries will probably be different. It isn't a bad thing, but it makes spotting a problem very difficult.

Another thing that would help is run FaceWarperServer within gdb and get a backtrace.

Thanks for reply, I had tried use gdb to found where the problem is , but it even can't going to the fist line in the main function, I set the break point at the first line in main function, and I run the gdb command r, it send out the same error immediately. I don't know what the problem is that can lead this.
I'll use the ldd method to try to found is there any different between 16.04 and 18.04 version, tomorrow

@christopher-beckham
Copy link
Collaborator

Thanks!!! We would love to know what’s different between the two Ubuntu versions. It would really help out others in the future who may get stuck as well.

@lzxzy
Copy link
Author

lzxzy commented Dec 17, 2018

Thanks!!! We would love to know what’s different between the two Ubuntu versions. It would really help out others in the future who may get stuck as well.

Hi, I have tried the ldd and there are really many differents. But I can't local wihch different could lead the problem, and this is my file

@srajotte
Copy link
Collaborator

srajotte commented Dec 17, 2018

Your problem looks similar to this problem on StackOverflow. For some reason, your executable doesn't link to libpthread. If you try this command :
LD_PRELOAD=/lib/x86_64-linux-gnu/libpthread.so.0 ./FaceWarperServer
does FaceWarperServer execute without crashing?

@lzxzy
Copy link
Author

lzxzy commented Dec 17, 2018

Your problem looks similar to this problem on StackOverflow. For some reason, your executable doesn't link to libpthread. If you try this command :
LD_PRELOAD=/lib/x86_64-linux-gnu/libpthread.so.0 ./FaceWarperServer
does FaceWarperServer execute without crashing?

Yeah I think it's the same error as me, but I run the command nothing change. I think it maybe Nvidia driver with OpenGL occur some error or something else.

@lzxzy
Copy link
Author

lzxzy commented Dec 18, 2018

Your problem looks similar to this problem on StackOverflow. For some reason, your executable doesn't link to libpthread. If you try this command :
LD_PRELOAD=/lib/x86_64-linux-gnu/libpthread.so.0 ./FaceWarperServer
does FaceWarperServer execute without crashing?

Hi guys , tanks for your suggestions. I'm happy to tell you I solved the problem. It seems that you are right @srajotte . but ues LD_PRELOAD=/lib/x86_64-linux-gnu/libpthread.so.0 ./FaceWarperServer doesn't useful. Instead I insert a line in CMakeLists.txt:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread") and it works.
Thank you guys again, I'm so excited HAHA.

@srajotte
Copy link
Collaborator

Good news! Thanks for taking the time to try to solve this problem.
For future reference, this Ubuntu bug report seems to be related to the problem you experienced : https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-319/+bug/1248642

srajotte added a commit that referenced this issue Dec 18, 2018
This should solve the linking problem seen on some systems (see issue #9).
@srajotte
Copy link
Collaborator

I have edited the CMakeLists.txt to force the compiler to use the "-pthread" flag on Linux systems.

@lzxzy could you try the fix to make sure it works on your system.

@lzxzy
Copy link
Author

lzxzy commented Dec 19, 2018

I have edited the CMakeLists.txt to force the compiler to use the "-pthread" flag on Linux systems.

@lzxzy could you try the fix to make sure it works on your system.

yes it works.
and I have the another question. which section can I achieve face rotation in this work.

srajotte added a commit that referenced this issue Dec 19, 2018
@christopher-beckham
Copy link
Collaborator

Cool if it's fixed we can close the issue.

With regard to to the face rotation, see this section of the readme in the depthnet-pytorch folder:

https://github.com/joelmoniz/DepthNets/blob/master/depthnet-pytorch/README.md#warping-a-source-face-to-a-rotating-target-face

With the export_anim_to_facewarper.py script, you can either rotate the source face directly, or warp the source face to rotations of a target face. In short, once you have the depth of the source face, you can compute the affine matrix needed to perform the rotation (there are some helper functions for that, like these here).

If you have any more questions regarding this, you can open up a new issue and we'll discuss it there.

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

3 participants