Isabella98Liu / DG-Mesh

Dynamic Gaussian Mesh: Consistent Mesh Reconstruction from Monocular Videos

Home Page:https://www.liuisabella.com/DG-Mesh/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] parameter position is wrong in mesh_render function

Net-Maker opened this issue · comments

I encounter a AttributeError while running the code, the code in train.py is :

mask, mesh_image, verts, faces, _ = mesh_renderer(
                gaussians,
                d_xyz,
                d_normal,
                fid,
                glctx,
                deform_back,
                appearance,
                freeze_pos,
                dataset.white_background,
                viewpoint_cam,
            )

SO the mesh_render function should be like this?

def mesh_renderer(
    gaussians: gaussian_model,
    d_xyz: torch.Tensor,
    d_normal: torch.Tensor,
    fid: torch.Tensor,
    glctx: dr.RasterizeGLContext,
    deform_back: deform_back,
    appearance: appearance_net,
    freeze_pos: bool = False,
    whitebackground: bool = False,
    viewpoint_cam: Camera = None,
):

instead of the original :

def mesh_renderer(
    glctx: dr.RasterizeGLContext,
    gaussians: gaussian_model,
    d_xyz: torch.Tensor,
    d_normal: torch.Tensor,
    fid: torch.Tensor,
    deform_back: deform_back,
    appearance: appearance_net,
    freeze_pos: bool = False,
    whitebackground: bool = False,
    viewpoint_cam: Camera = None,
):

同时,我发现通过pip安装的diff_gaussian_rasterization可能会导致你出现CUDA error : illegal memory access,解决的方法是进入submodule/diff_gaussian_rasterization/setup.py,line29, 更换为extra_compile_args={"nvcc": ["-Xcompiler", "-fno-gnu-unique","-I" + os.path.join(os.path.dirname(os.path.abspath(__file__)), "third_party/glm/")]}) ,然后在diff_gaussian_rasterization目录下运行python setup.py install

Translated:

At the same time, I found that diff_gaussian_rasterization installed via pip may cause you to encounter CUDA error: illegal memory access. The solution is to go to submodule/diff_gaussian_rasterization/setup.py, line 29, replace it with extra_compile_args={"nvcc": ["-Xcompiler", "-fno-gnu-unique","-I" + os.path.join(os.path.dirname(os.path.abspath(file)), "third_party/glm/")]}) , then run python setup.py install in the diff_gaussian_rasterization directory

I tried this and am still receiving a seg fault

python dgmesh/train.py --config dgmesh/configs/d-nerf/jumpingjacks.yaml
Configuration loaded from dgmesh/configs/d-nerf/jumpingjacks.yaml
Optimizing outputs/d-nerf/jumpingjacks
Output folder: outputs/d-nerf/jumpingjacks/jumpingjacks-2024-07-12_12-15-17
/home/john/miniconda3/envs/dg-mesh/lib/python3.9/site-packages/torch/functional.py:512: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /opt/conda/conda-bld/pytorch_1716905971093/work/aten/src/ATen/native/TensorShape.cpp:3587.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
/home/john/miniconda3/envs/dg-mesh/lib/python3.9/site-packages/torch/utils/cpp_extension.py:1967: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation. 
If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
  warnings.warn(
Found transforms_train.json file, assuming Blender data set! [12/07 12:15:18]
Reading Training Transforms [12/07 12:15:18]
Reading Test Transforms [12/07 12:15:24]
Loading Training Cameras [12/07 12:15:25]
Loading Test Cameras [12/07 12:15:26]
Number of points at initialisation :  100000 [12/07 12:15:26]
Training progress:   0%|                                                                                                  
0/25001 [00:00<?, ?it/s]Segmentation fault (core dumped)

Translated:

At the same time, I found that diff_gaussian_rasterization installed via pip may cause you to encounter CUDA error: illegal memory access. The solution is to go to submodule/diff_gaussian_rasterization/setup.py, line 29, replace it with extra_compile_args={"nvcc": ["-Xcompiler", "-fno-gnu-unique","-I" + os.path.join(os.path.dirname(os.path.abspath(file)), "third_party/glm/")]}) , then run python setup.py install in the diff_gaussian_rasterization directory

I tried this and am still receiving a seg fault

python dgmesh/train.py --config dgmesh/configs/d-nerf/jumpingjacks.yaml
Configuration loaded from dgmesh/configs/d-nerf/jumpingjacks.yaml
Optimizing outputs/d-nerf/jumpingjacks
Output folder: outputs/d-nerf/jumpingjacks/jumpingjacks-2024-07-12_12-15-17
/home/john/miniconda3/envs/dg-mesh/lib/python3.9/site-packages/torch/functional.py:512: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /opt/conda/conda-bld/pytorch_1716905971093/work/aten/src/ATen/native/TensorShape.cpp:3587.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
/home/john/miniconda3/envs/dg-mesh/lib/python3.9/site-packages/torch/utils/cpp_extension.py:1967: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation. 
If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
  warnings.warn(
Found transforms_train.json file, assuming Blender data set! [12/07 12:15:18]
Reading Training Transforms [12/07 12:15:18]
Reading Test Transforms [12/07 12:15:24]
Loading Training Cameras [12/07 12:15:25]
Loading Test Cameras [12/07 12:15:26]
Number of points at initialisation :  100000 [12/07 12:15:26]
Training progress:   0%|                                                                                                  
0/25001 [00:00<?, ?it/s]Segmentation fault (core dumped)

Hi @atonalfreerider, could you provide a more detailed information about your SEG FAULT? Also, what is your hardware specification?

I encounter a AttributeError while running the code, the code in train.py is :

mask, mesh_image, verts, faces, _ = mesh_renderer(
                gaussians,
                d_xyz,
                d_normal,
                fid,
                glctx,
                deform_back,
                appearance,
                freeze_pos,
                dataset.white_background,
                viewpoint_cam,
            )

SO the mesh_render function should be like this?

def mesh_renderer(
    gaussians: gaussian_model,
    d_xyz: torch.Tensor,
    d_normal: torch.Tensor,
    fid: torch.Tensor,
    glctx: dr.RasterizeGLContext,
    deform_back: deform_back,
    appearance: appearance_net,
    freeze_pos: bool = False,
    whitebackground: bool = False,
    viewpoint_cam: Camera = None,
):

instead of the original :

def mesh_renderer(
    glctx: dr.RasterizeGLContext,
    gaussians: gaussian_model,
    d_xyz: torch.Tensor,
    d_normal: torch.Tensor,
    fid: torch.Tensor,
    deform_back: deform_back,
    appearance: appearance_net,
    freeze_pos: bool = False,
    whitebackground: bool = False,
    viewpoint_cam: Camera = None,
):

Thanks for pointing this out, I've fixed it.

@Isabella98Liu

Ubuntu 24
CUDA 11.8
RTX 2080Ti

I'm not sure where the core dump file is

Sorry, I'm not able to help without more information. How much memory does your system have? I suspect the issue might be related to insufficient memory. You can use gdb or another tool to set breakpoints and see where the issue occurs.

@Isabella98Liu

Ubuntu 24 CUDA 11.8 RTX 2080Ti

I'm not sure where the core dump file is

core dump error is tough to deal with, but it always comes with CUDA code error, can you run the original 3DGS code?