Open thegnarwhals opened 1 year ago
0a6acbe0724b4fd0901b5a42c19c8952.zip
This is a zipped .glb scene containing a car. Unzipping and running the following script
import numpy as np import trimesh from mesh_to_sdf import mesh_to_sdf model_path = "0a6acbe0724b4fd0901b5a42c19c8952.glb" mesh = trimesh.load(model_path) sample_points = np.array([[0, 0, 0], [1, 1, 1], [2, 2, 2]]) sdf = mesh_to_sdf(mesh, sample_points, surface_point_method="scan", sign_method="depth") print(sdf)
gives
Killed (out of memory)
Having debugged, this has been narrowed down to the line near the top of __init__.py:
__init__.py
mesh = mesh.dump().sum()
which calls sum() on a numpy array of Trimesh. This apparently does some parallelisation which is too memory intensive for this geometry. If we do
sum()
Trimesh
mesh = mesh.dump(concatenate=True)
which uses trimesh's inbuilt mesh concatenation, the script completes with expected output
[-0.4379601 0.8417097 2.3150892]
I will open a pull request with this change.
I had the same issue, I tried your fix but it still raised OOM error (killed), the mesh I use is from shapenet: ShapeNetCore.v2/04256520/ccb08f869edde5e6d8adf1ca87495d41
0a6acbe0724b4fd0901b5a42c19c8952.zip
This is a zipped .glb scene containing a car. Unzipping and running the following script
gives
Having debugged, this has been narrowed down to the line near the top of
__init__.py
:which calls
sum()
on a numpy array ofTrimesh
. This apparently does some parallelisation which is too memory intensive for this geometry. If we dowhich uses trimesh's inbuilt mesh concatenation, the script completes with expected output
I will open a pull request with this change.