ultravideo / Open3DGen

Open-Source software for reconstructing textured 3D models from RGB-D images
MIT License
117 stars 24 forks source link

couldn't init GLFW, aborting in main #15

Open yaghya opened 2 months ago

yaghya commented 2 months ago

I am trying the run the given command

./build/Open3DGen in data_files/demo_rock/ intr data_files/realsense_intrinsic_1280.matrix out data_files/out/ refine_cameras false reject_blur 1.1 crop false skip_stride 28 unwrap true pipeline full poisson_depth 7 simplify_voxel_size 0.075 out_res 4096 depth_far_clip 3.0 max_feature_count 750 assets_path data_files/

after building the Open3dGen repo inside a docker container on a VM.

I am getting this error

terminate called after throwing an instance of 'std::runtime_error'
  what():  couldn't init GLFW, aborting in main
Aborted (core dumped)

at this step in main.cpp textures::project_texture_sequence_on_mesh_gpu(DEFAULT_DEPTH_SCALE, pointcloud_world_scale, *mesh, textures, cameras, output_nth, workgroup_size, ray_threshold, reject_blur);

can someone please help me?

fador commented 2 months ago

Hi! Since it requires the use of a GPU, is the GPU available in the container/VM? Did you use nvidia-container-toolkit and --gpu all parameter to start the container?

yaghya commented 2 months ago

yes GPU is available on the VM , i checked usingnvidia-smi Fri Aug 23 08:35:29 2024
+---------------------------------------------------------------------------------------+ | NVIDIA-SMI 545.23.08 Driver Version: 545.23.08 CUDA Version: 12.3 | |-----------------------------------------+----------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+======================+======================| | 0 NVIDIA A100 80GB PCIe On | 00000001:00:00.0 Off | 0 | | N/A 43C P0 73W / 300W | 12037MiB / 81920MiB | 0% Default | | | | Disabled | +-----------------------------------------+----------------------+----------------------+ | 1 NVIDIA A100 80GB PCIe On | 00000002:00:00.0 Off | 0 | | N/A 38C P0 52W / 300W | 7MiB / 81920MiB | 0% Default | | | | Disabled | +-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=======================================================================================| | 0 N/A N/A 755217 C python 8392MiB | | 0 N/A N/A 795294 C python 3626MiB |

and I passed the parametes --gpus all while running docker.

fador commented 2 months ago

It could be that glfw doesn't like to run without a display, but I found that you can install xvfb to emulate a display, maybe it would work on your case. In ubuntu/debian apt-get install xvfb xvfb-run -a "your command"

yaghya commented 2 months ago

I tried running with

Xvfb :10 -screen 0 1920x1080x24 &
export DISPLAY=:10

this is the result of glxinfo command DISPLAY=:10 glxinfo | grep "OpenGL" OpenGL vendor string: Mesa OpenGL renderer string: llvmpipe (LLVM 15.0.7, 256 bits) OpenGL core profile version string: 4.5 (Core Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2 OpenGL core profile shading language version string: 4.50 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 4.5 (Compatibility Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2 OpenGL shading language version string: 4.50 OpenGL context flags: (none) OpenGL profile mask: compatibility profile OpenGL extensions: OpenGL ES profile version string: OpenGL ES 3.2 Mesa 23.2.1-1ubuntu3.1~22.04.2 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20 OpenGL ES profile extensions: xvfb-run -a "./build/Open3DGen" in data_files/demo_rock/ intr data_files/realsense_intrinsic_1280.matrix out data_files/out/ refine_cameras false reject_blur 1.1 crop false skip_stride 28 unwrap true pipeline full poisson_depth 7 simplify_voxel_size 0.075 out_res 4096 depth_far_clip 3.0 max_feature_count 750 assets_path data_files/ and also with xvfb-run -s "-screen 0 1920x1080x24" -a "./build/Open3DGen" in data_files/demo_rock/ intr data_files/realsense_intrinsic_1280.matrix out data_files/out/ refine_cameras false reject_blur 1.1 crop false skip_stride 28 unwrap true pipeline full poisson_depth 7 simplify_voxel_size 0.075 out_res 4096 depth_far_clip 3.0 max_feature_count 750 assets_path data_files/

in both of them I am getting this error terminate called after throwing an instance of 'std::runtime_error' what(): couldn't create OpenGL window, aborting in main Aborted (core dumped)

teo3n commented 2 months ago

Open3DGen texture GPU projection requires a valid opengl window to work correctly. IIRC there were some reasons why I had to cludge it like that, but I can't remember them anymore. There exists CPU-only implementations of the texture projection functionalities in texture_projector.cpp, but they will be considerably slower and I can't guarantee they actually work anymore. It has been a few years since I last touched this. The better way to solve this would be to modify the opengl initialization to support headless rendering on this line

fador commented 1 month ago

I pushed a new branch headless which replaces the GLFW with EGL when using cmake -DHEADLESS=ON parameter, I earlier pushed a branch to support Open3D 0.18 in Ubuntu 24.04, which the headless branch is built on top of. It includes a Dockerfile to show needed packages. Although, I was unable to get the headless mode running using WSL + Docker...