Code Monkey home page Code Monkey logo

diso's People

Contributors

sarahweiii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

diso's Issues

Cuda not available on any gpus other than 0

I'm using the diso package, and it seems that it can't be put on any gpu device other than 0.
I'm simply using the following line:

device = "cuda:1"
diffmc = DiffMC(dtype=torch.float32).to(device) # or dtype=torch.float64
verts_diso, faces_diso = diffmc(sdf)  # or deform=None

The error seems like:

CUDA error 700: an illegal memory access was encountered (/tmp/pip-install-sw1umf14/diso_21b51e2d772f45e48cb953d19111a5ab/src/cumc.cu:673)
CUDA error 700: an illegal memory access was encountered (/tmp/pip-install-sw1umf14/diso_21b51e2d772f45e48cb953d19111a5ab/src/cumc.cu:679)
CUDA error 700: an illegal memory access was encountered (/tmp/pip-install-sw1umf14/diso_21b51e2d772f45e48cb953d19111a5ab/src/cumc.cu:680)
CUDA error 700: an illegal memory access was encountered (/tmp/pip-install-sw1umf14/diso_21b51e2d772f45e48cb953d19111a5ab/src/cumc.cu:692)
CUDA error 700: an illegal memory access was encountered (/tmp/pip-install-sw1umf14/diso_21b51e2d772f45e48cb953d19111a5ab/src/cumc.cu:721)
Traceback (most recent call last):
  File "test_data.py", line 54, in <module>
    verts_diso, faces_diso = diffmc(sdf)  # or deform=None
  File "/mnt/homes/zhenjun/miniconda3/envs/vtaco/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
    return forward_call(*input, **kwargs)
  File "/mnt/homes/zhenjun/miniconda3/envs/vtaco/lib/python3.8/site-packages/diso/__init__.py", line 54, in forward
    verts, tris = self.func.apply(grid, deform, isovalue)
  File "/mnt/homes/zhenjun/miniconda3/envs/vtaco/lib/python3.8/site-packages/diso/__init__.py", line 22, in forward
    verts, tris = mc.forward(grid, isovalue)
RuntimeError: The specified pointer resides on host memory and is not registered with any CUDA device.

There won't be any problem if I set device = "cuda:0", and the same issue occured on DiffDMC.
Could you help me with this? Really appreciate it!

strange box when trying to convert tensoRF to mesh

Hi, I tried to convert tensoRF to mesh using:

verts, faces = diffmc_worker(pytorch_3d_sdf_tensor - level, None)

    verts_numpy = verts.cpu().numpy()
    mesh_points = np.zeros_like(verts_numpy)
    mesh_points[:, 0] = bbox[0,0] + verts_numpy[:, 0] * (bbox[1,0] - bbox[0,0])
    mesh_points[:, 1] = bbox[0,1] + verts_numpy[:, 1] * (bbox[1,1] - bbox[0,1])
    mesh_points[:, 2] = bbox[0,2] + verts_numpy[:, 2] * (bbox[1,2] - bbox[0,2])

    # try writing to the obj file
    mesh = trimesh.Trimesh(vertices=mesh_points, faces=faces.cpu().numpy(), process=False)
    print("saving mesh to %s" % (ply_filename_out))
    mesh.export(ply_filename_out)

However, I get strange result like a lego inside a box:
image
is there any modification I need inorder to make it right?

Option to disable mesh normalization.

Hi, I noticed in the init.py there is vertices normalization logic

        verts = verts - 1
        verts = verts / (
            torch.tensor([dimX, dimY, dimZ], dtype=verts.dtype, device=verts.device) - 1
        )

I think add an option to disable these will be useful.

batched training with DiffMC

Hi, thanks for sharing this amazing implementation!

I have a question about batched training with diso.
It seems current implementation saves internal states (e.g., used_to_first_mc_tri, used_cell_code) inside the mc struct, which makes it unable to performed batched forward & backward even with a for loop. For example:

loss = 0
for b in range(B):
    v, f = diffmc(sdf[b], deform[b]) # forward multiple times, only the last state is recorded
    loss = loss + loss_func(v)
loss.backward() # wrong gradient, all backwards use the state of the last batch

I wonder is there any workaround to make this work?
For example, maybe move all internal variables outside the struct and into the context of torch Function?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.