Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Segmentation fault when calling bin/PreprocessMesh #88

Open
danielegrattarola opened this issue Feb 8, 2022 · 9 comments
Open

Segmentation fault when calling bin/PreprocessMesh #88

danielegrattarola opened this issue Feb 8, 2022 · 9 comments

Comments

@danielegrattarola
Copy link

Hi,

after following the build instructions of #81 (comment) I get a segmentation fault when I try to run

bin/PreprocessMesh -m in.obj -o out.npz

Is this a known issue? Are there any current workarounds?

Thanks

@ChengChen2020
Copy link

Hi,

I met this problem as well. Have you solved it?

@danielegrattarola
Copy link
Author

danielegrattarola commented Apr 6, 2022

Here's what I did to build the program and all dependencies. You need to be root for some of these commands to work.
Also, this will not work if you're running the program in a remote SSH session, you need to have a screen (I tried some workarounds but I couldn't get it to work).

Anyway, I suggest you not spend too much time trying to make this code work.
There's a much better python library called mesh-to-sdf (https://pypi.org/project/mesh-to-sdf/) that does the same thing without any of the hassle.
Just pip install mesh-to-sdf and you're good to go.
Still won't work in a remote session unfortunately, but it's also way faster than the code in this repo.

Here's the full list of commands (disclaimer: don't just copy-paste the whole thing, make sure that every command executes successfully):

apt install git cmake build-essential libglfw3-dev libgles2-mesa-dev libgtest-dev libeigen3-dev

# Install CLI11
git clone https://github.com/CLIUtils/CLI11.git
cd CLI11
mkdir build
cd build
git submodule update --init
cmake ..
cmake --build .
sudo cmake --install .
cd ../..

# Install Pangolin
git clone --recursive https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
./scripts/install_prerequisites.sh all
git checkout v0.6
mkdir build && cd build
cmake ..
cmake --build .
sudo cmake --install .
cd ../..

# Install nanoflann
git clone https://github.com/jlblancoc/nanoflann.git
cd nanoflann
mkdir build && cd build
cmake ..
make
sudo make install
mkdir /usr/local/include/nanoflann
cp /usr/local/include/nanoflann.hpp /usr/local/include/nanoflann
cd ../..

# DeepSDF
git clone https://github.com/facebookresearch/DeepSDF.git
cd DeepSDF

###### Comment out line 97 of src/ShaderProgram.cpp
sed -i "97 s/^/\/\//" src/ShaderProgram.cpp

git submodule update --init
mkdir build && cd build
cmake .. -DCMAKE_CXX_STANDARD=17
make


# Run
export MESA_GL_VERSION_OVERRIDE=3.3
export PANGOLIN_WINDOW_URI=headless://

@ChengChen2020
Copy link

Thanks for your response!

Just to confirm, so do you mean that both methods donot work in a remote session?

@danielegrattarola
Copy link
Author

It's been a while now, but as far as I remember neither works remotely.
I finally settled on using mesh-to-sdf locally on my laptop and I haven't looked back.

@ChengChen2020
Copy link

Thank you very much for your help!

@philippwulff
Copy link

Just a small note: I feel like mesh_to_sdf produces inferior SDF samples compared to this code (more adversarial samples and my experiments obtain better results on SDF samples from this preprocessing pipeline than from mesh_to_sdf).

@philippwulff
Copy link

philippwulff commented Jan 25, 2023

BTW, I can use this code as well as mesh_to_sdf remotely, but I am not doing anything differently than you...

@evinpinar
Copy link

I couldn't manage to have a reasonable training with mesh-to-sdf generated sdf. I have some questions @danielegrattarola @philippwulff

  • Which cmake version did you use to make this preprocessing work?
  • Can I ask how you converted the representation to be suitable as an input to DeepSDF? from voxel to points, I simply generated normalized point coordinates, and didn't apply positive/negative sampling. But even with this, it should have some dropping loss. Are there any other assumptions?

@YZircon
Copy link

YZircon commented Apr 15, 2023

@danielegrattarola Thanks! I spent nearly 24h to find the correct way to preprocess mesh and finally stuck in a strange error: some models can be processed correctly but others may trigger a segmentation fault in line 413 of PreprocessMesh.cpp pangolin::GlGeometry gl_geom = pangolin::ToGlGeometry(geom);
you remind me of the correct version of nanoflann, which finally helps me to solve the problem

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants