FoundationPose icon indicating copy to clipboard operation
FoundationPose copied to clipboard

On WSL2 run:run_nerf.py issue

Open Goddard-Wen opened this issue 9 months ago • 1 comments

My env is win11+wsl2-ubuntu24.04, I can run with model-based method, but to run: run_nerf.py, I meet a lot of problem.

Anyhow, each time when Using accelerated ArrayDatatype, there has issues, search on internet, someone say it is the wsl problem, can not run pyrender with egl, so I added the os.environ['PYOPENGL_PLATFORM'] = 'osmesa' in front of run_nerf.py, and still, have you have met and solved this. Thanks.

now, the error is AttributeError: 'NoneType' object has no attribute 'glGetError'

(foundationpose) goddard@Wen:/mnt/d/000project/mypose/FoundationPose_note$ python bundlesdf/run_nerf.py --ref_view_dir /mnt/d/000project/mypose/FoundationPose_note/model_free_ref_views/ycbv/ref_views_16 --dataset ycbv Warp 1.0.2 initialized: CUDA Toolkit 11.5, Driver 12.6 Devices: "cpu" : "x86_64" "cuda:0" : "NVIDIA GeForce RTX 4070 Ti SUPER" (16 GiB, sm_89, mempool enabled) Kernel cache: /home/goddard/.cache/warp/1.0.2 /mnt/d/000project/mypose/FoundationPose_note/bundlesdf/run_nerf.py:67: DeprecationWarning: Starting with ImageIO v3 the behavior of this function will switch to that of iio.v3.imread. To keep the current behavior (and make this warning disappear) use import imageio.v2 as imageioor callimageio.v2.imread` directly. rgb = imageio.imread(color_file) [compute_scene_bounds()] compute_scene_bounds_worker start [compute_scene_bounds()] compute_scene_bounds_worker done [compute_scene_bounds()] merge pcd [compute_scene_bounds()] compute_translation_scales done translation_cvcam=[ 0.00114478 0.00392944 -0.00655522], sc_factor=11.946805208886905 [build_octree()] Octree voxel dilate_radius:1 [init()] level:0, vox_pts:torch.Size([1, 3]), corner_pts:torch.Size([8, 3]) [init()] level:1, vox_pts:torch.Size([8, 3]), corner_pts:torch.Size([27, 3]) [init()] level:2, vox_pts:torch.Size([64, 3]), corner_pts:torch.Size([125, 3]) [init()] level:3, vox_pts:torch.Size([480, 3]), corner_pts:torch.Size([693, 3]) [draw()] level:3 [draw()] level:3 level 0, resolution: 32 level 1, resolution: 39 level 2, resolution: 47 level 3, resolution: 56 level 4, resolution: 68 level 5, resolution: 81 level 6, resolution: 98 level 7, resolution: 117 level 8, resolution: 141 level 9, resolution: 169 level 10, resolution: 204 level 11, resolution: 245 level 12, resolution: 295 level 13, resolution: 354 level 14, resolution: 426 level 15, resolution: 512 GridEncoder: input_dim=3 n_levels=16 level_dim=2 resolution=32 -> 512 per_level_scale=1.2030 params=(36112368, 2) gridtype=hash align_corners=False sc_factor 11.946805208886905 translation [ 0.00114478 0.00392944 -0.00655522] [init()] denoise cloud [init()] Denoising rays based on octree cloud [init()] bad_mask#=0 rays torch.Size([815338, 12]) [train()] train progress 0/1001 [train_loop()] Iter: 0, valid_samples: 524288/524288, valid_rays: 2048/2048, loss: 31.9741154, rgb_loss: 6.7816586, rgb0_loss: 0.0000000, fs_rgb_loss: 0.0000000, depth_loss: 0.0000000, depth_loss0: 0.0000000, fs_loss: 19.8721848, point_cloud_loss: 0.0000000, point_cloud_normal_loss: 0.0000000, sdf_loss: 5.0730171, eikonal_loss: 0.0000000, variation_loss: 0.0000000, truncation(meter): 0.0100000, pose_reg: 0.0000000, reg_features: 0.0995187,

[train()] train progress 100/1001 [train()] train progress 200/1001 [train()] train progress 300/1001 [train()] train progress 400/1001 [train()] train progress 500/1001 Saved checkpoints at /mnt/d/000project/mypose/FoundationPose_note/model_free_ref_views/ycbv/ref_views_16/ob_0000001/nerf/model_latest.pth [train_loop()] Iter: 500, valid_samples: 524032/524288, valid_rays: 2047/2048, loss: 1.6859456, rgb_loss: 0.5624812, rgb0_loss: 0.0000000, fs_rgb_loss: 0.0000000, depth_loss: 0.0000000, depth_loss0: 0.0000000, fs_loss: 0.2592853, point_cloud_loss: 0.0000000, point_cloud_normal_loss: 0.0000000, sdf_loss: 0.8382474, eikonal_loss: 0.0000000, variation_loss: 0.0000000, truncation(meter): 0.0100000, pose_reg: 0.0000000, reg_features: 0.0236973,

[extract_mesh()] query_pts:torch.Size([175616, 3]), valid:164640 [extract_mesh()] Running Marching Cubes [extract_mesh()] done V:(12948, 3), F:(25892, 3) [train()] train progress 600/1001 [train()] train progress 700/1001 [train()] train progress 800/1001 [train()] train progress 900/1001 [train()] train progress 1000/1001 Saved checkpoints at /mnt/d/000project/mypose/FoundationPose_note/model_free_ref_views/ycbv/ref_views_16/ob_0000001/nerf/model_latest.pth [train_loop()] Iter: 1000, valid_samples: 523520/524288, valid_rays: 2045/2048, loss: 1.4862849, rgb_loss: 0.3132568, rgb0_loss: 0.0000000, fs_rgb_loss: 0.0000000, depth_loss: 0.0000000, depth_loss0: 0.0000000, fs_loss: 0.3501890, point_cloud_loss: 0.0000000, point_cloud_normal_loss: 0.0000000, sdf_loss: 0.8018618, eikonal_loss: 0.0000000, variation_loss: 0.0000000, truncation(meter): 0.0100000, pose_reg: 0.0000000, reg_features: 0.0185096,

[extract_mesh()] query_pts:torch.Size([175616, 3]), valid:164640 [extract_mesh()] Running Marching Cubes [extract_mesh()] done V:(12900, 3), F:(25796, 3) [extract_mesh()] query_pts:torch.Size([175616, 3]), valid:164640 [extract_mesh()] Running Marching Cubes [extract_mesh()] done V:(12900, 3), F:(25796, 3) [()] OpenGL_accelerate module loaded [()] Using accelerated ArrayDatatype Traceback (most recent call last): File "/mnt/d/000project/mypose/FoundationPose_note/bundlesdf/run_nerf.py", line 125, in run_bop() File "/mnt/d/000project/mypose/FoundationPose_note/bundlesdf/run_nerf.py", line 112, in run_bop run_ycbv() File "/mnt/d/000project/mypose/FoundationPose_note/bundlesdf/run_nerf.py", line 91, in run_ycbv mesh = run_one_ob(base_dir=base_dir, cfg=cfg) File "/mnt/d/000project/mypose/FoundationPose_note/bundlesdf/run_nerf.py", line 79, in run_one_ob mesh = run_neural_object_field(cfg, K, rgbs, depths, masks, cam_in_obs, save_dir=save_dir, debug=0) # 这是进行Nerf的命令 File "/mnt/d/000project/mypose/FoundationPose_note/bundlesdf/run_nerf.py", line 49, in run_neural_object_field mesh = nerf.mesh_texture_from_train_images(mesh, rgbs_raw=rgbs, tex_res=1028) # 获取纹理 File "/mnt/d/000project/mypose/FoundationPose_note/bundlesdf/nerf_runner.py", line 1143, in mesh_texture_from_train_images renderer = ModelRendererOffscreen(cam_K=self.K, H=self.H, W=self.W, zfar=self.cfg['far']*self.cfg['sc_factor']) File "/mnt/d/000project/mypose/FoundationPose_note/bundlesdf/../offscreen_renderer.py", line 47, in init self.r = pyrender.OffscreenRenderer(self.W, self.H) File "/home/goddard/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pyrender/offscreen.py", line 31, in init self._create() File "/home/goddard/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pyrender/offscreen.py", line 149, in _create self._platform.init_context() File "/home/goddard/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pyrender/platforms/pyglet_platform.py", line 50, in init_context self._window = pyglet.window.Window(config=conf, visible=False, File "/home/goddard/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pyglet/window/xlib/init.py", line 170, in init super(XlibWindow, self).init(*args, **kwargs) File "/home/goddard/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pyglet/window/init.py", line 613, in init config = screen.get_best_config(config) File "/home/goddard/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pyglet/canvas/base.py", line 198, in get_best_config configs = self.get_matching_configs(template) File "/home/goddard/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pyglet/canvas/xlib.py", line 220, in get_matching_configs configs = template.match(canvas) File "/home/goddard/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pyglet/gl/xlib.py", line 58, in match have_13 = info.have_version(1, 3) File "/home/goddard/miniconda3/envs/foundationpose/lib/python3.9/site-packages/pyglet/gl/glx_info.py", line 86, in have_version client_version = self.get_client_version().split()[0] IndexError: list index out of range free(): invalid pointer libEGL warning: failed to open /dev/dri/card0: Permission denied

libEGL warning: failed to open /dev/dri/card0: Permission denied

libEGL warning: failed to open /dev/dri/card0: Permission denied

The XKEYBOARD keymap compiler (xkbcomp) reports:

Warning: Could not resolve keysym XF86CameraAccessEnable Warning: Could not resolve keysym XF86CameraAccessDisable Warning: Could not resolve keysym XF86CameraAccessToggle Warning: Could not resolve keysym XF86NextElement Warning: Could not resolve keysym XF86PreviousElement Warning: Could not resolve keysym XF86AutopilotEngageToggle Warning: Could not resolve keysym XF86MarkWaypoint Warning: Could not resolve keysym XF86Sos Warning: Could not resolve keysym XF86NavChart Warning: Could not resolve keysym XF86FishingChart Warning: Could not resolve keysym XF86SingleRangeRadar Warning: Could not resolve keysym XF86DualRangeRadar Warning: Could not resolve keysym XF86RadarOverlay Warning: Could not resolve keysym XF86TraditionalSonar Warning: Could not resolve keysym XF86ClearvuSonar Warning: Could not resolve keysym XF86SidevuSonar Warning: Could not resolve keysym XF86NavInfo Errors from xkbcomp are not fatal to the X server Aborted (core dumped)`

Goddard-Wen avatar Mar 25 '25 06:03 Goddard-Wen

Hey, I think I solved this, I had the same issue Try installing this first pip install pyopengl==3.1.7 pyopengl-accelerate==3.1.7 Then run your script with something like PYOPENGL_PLATFORM=osmesa python bundlesdf/run_nerf.py --ref_view_dir <your_directory>/ref_views --dataset linemod

Let me know if it works for you!

DanielMonta00 avatar Oct 23 '25 10:10 DanielMonta00