GNP models can be instantiated using the GNP model class:
from gnp.models import GNP
full_model = GNP(
node_dim=3,
edge_dim=6,
out_dim=1,
layers=[64] * 10,
conv_name="GraphConvolution",
conv_args={"neurons": 128},
nonlinearity="ReLU",
skip_connection=True,
device="cuda",
)See how to load more variants of the GNP in our Example Code
Pretrained models are loaded when instantiatiating the GeometryEstimator class. This can be used to gather geometric quantities and more by instantiating:
import numpy as np
import torch
from gnp import GeometryEstimator
pcd = torch.from_numpy(np.load('example_data/spot/xyz.npy'))
orientation = torch.from_numpy(np.load('example_data/spot/normals.npy'))
estimator = GeometryEstimator(pcd=pcd,
orientation=orientation,
model_name='clean_30k')Geometric quantities can be easily generated using
outputs = estimator.estimate_quantities(['mean_curvature', 'gaussian_curvature'])See our example code.
A stiffness matrix for the Laplace-Beltrami equation
stiffness_matrix, collocation_mask, outlier_mask = estimator.stiffness_matrix_gmls(
drop_ratio=0.1, radius=1, p=4, remove_outliers=False
)This can be paired with your favorite linear solvers and/or preconditioners. We use Scipy's LGMRES and PyAMG for preconditioning. See our collocation example code
Mean curvature flows (MCF) can be simulated using
flow_data = estimator.mean_flow(
num_steps=250,
save_data_per_step=25,
delta_t=0.0002,
subsample_radius=0.005,
smooth_radius=0.06,
smooth_x=False,
)See our example code.
We show a standalone example of how to train a Geometric Neural Operator (PatchGNP) from scratch to estimate surface curvatures on 3D point clouds.
The script train_curvature_estimator.py:
-
Generates synthetic surfaces -- analytically extracted mean and Gaussian curvatures as ground truth (GT).
Example surfaces: -- (i) unit sphere, (ii) torus, (iii) paraboloid.
-
Trains a
PatchGNPmodel end-to-end using MSE loss on both mean and gaussian curvature types.Remark: The model learns Legendre polynomial coefficients for local surface patches; curvatures are computed differentiably from those coefficients via the standard first and second fundamental forms.
-
Evaluates the trained model on each test surface to obtain the mean absolute errors of the curvature estimates.
python train_curvature_estimator.py --epochs 1000 --num_points 15000 \
--num_patches 64 --device cudaSee our training example code.



