kaolin-wisp icon indicating copy to clipboard operation
kaolin-wisp copied to clipboard

Mesh-to-octree conversion consumes a lot of memory

Open joeylitalien opened this issue 3 years ago • 0 comments
trafficstars

The mesh_to_octree() function in ops/spc/conversions.py has a number of surface samples hardcoded to 100M for voxel initialization. This consumes a large amount of memory, so much that even on a half-decent GPU like a Titan V (12GB), the vanilla NGLOD-SDF config will fail on a simple Armadillo.

One way to address this would be to expose this number directly in a config file (at the risk of possibly undersampling the shape). Another option would be to catch the runtime error to reduce the load to something more reasonable (e.g., 50M), which could be handled by a simple split-concat:

try:
   samples = mesh_ops.sample_surface(vertices.cuda(), faces.cuda(), 100000000)[0]
except RuntimeError as e:
   samples = [mesh_ops.sample_surface(vertices.cuda(), faces.cuda(), 10000000)[0] for _ in range(5)]
   samples = torch.cat(samples, dim=0)
   # Mention something about reducing number of samples to fit memory

Anyway, just a tip to make this application a bit more accessible to newcomers :)

joeylitalien avatar Aug 05 '22 18:08 joeylitalien