sarahweiii / diso Goto Github PK
View Code? Open in Web Editor NEWDifferentiable Iso-Surface Extraction Package (DISO)
License: Other
Differentiable Iso-Surface Extraction Package (DISO)
License: Other
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!
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:
is there any modification I need inorder to make it right?
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.
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
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.