geomfum package#

Subpackages#

Submodules#

geomfum.basis module#

Basis implementations.

class geomfum.basis.Basis[source]#

Bases: ABC

Basis.

class geomfum.basis.EigenBasis(vals, vecs, use_k=None)[source]#

Bases: Basis

Eigenbasis.

Parameters:
  • vals (array-like, shape=[full_spectrum_size]) – Eigenvalues.

  • vecs (array-like, shape=[dim, full_spectrum_size]) – Eigenvectors.

  • use_k (int) – Number of values to use on computations.

property full_spectrum_size#

Full spectrum size.

Returns:

spectrum_size (int) – Spectrum size.

property nonzero_vals#

Nonzero eigenvalues.

Returns:

vals (array-like, shape=[spectrum_size - n_zeros]) – Eigenvalues.

property nonzero_vecs#

Eigenvectors corresponding to nonzero eigenvalues.

Returns:

vecs (array-like, shape=[dim, spectrum_size - n_zeros]) – Eigenvectors.

property spectrum_size#

Spectrum size.

Returns:

spectrum_size (int) – Spectrum size.

truncate(spectrum_size)[source]#

Truncate basis.

Parameters:

spectrum_size (int) – Spectrum size.

Returns:

basis (Eigenbasis) – Truncated eigenbasis.

property vals#

Eigenvalues.

Returns:

vals (array-like, shape=[spectrum_size]) – Eigenvalues.

property vecs#

Eigenvectors.

Returns:

vecs (array-like, shape=[dim, spectrum_size]) – Eigenvectors.

class geomfum.basis.LaplaceEigenBasis(shape, vals, vecs, use_k=None)[source]#

Bases: EigenBasis

Laplace eigenbasis.

Parameters:
  • shape (Shape) – Shape.

  • vals (array-like, shape=[spectrum_size]) – Eigenvalues.

  • vecs (array-like, shape=[dim, spectrum_size]) – Eigenvectors.

  • use_k (int) – Number of values to use on computations.

property pinv#

Inverse of the eigenvectors matrix.

Returns:

pinv (array-like, shape=[spectrum_size, n_vertices]) – Inverse of the eigenvectors matrix.

project(array)[source]#

Project on the eigenbasis.

Parameters:

array (array-like, shape=[…, n_vertices]) – Array to project.

Returns:

projected_array (array-like, shape=[…, spectrum_size]) – Projected array.

truncate(spectrum_size)[source]#

Truncate basis.

Parameters:

spectrum_size (int) – Spectrum size.

Returns:

basis (LaplaceEigenBasis) – Truncated eigenbasis.

property use_k#

Number of values to use on computations.

Returns:

use_k (int) – Number of values to use on computations.

geomfum.convert module#

Conversion between pointwise and functional maps.

class geomfum.convert.BaseFmFromP2pConverter[source]#

Bases: ABC

Functional map from pointwise map.

class geomfum.convert.BaseNeighborFinder(n_neighbors=1)[source]#

Bases: ABC

Base class for a Neighbor finder.

A simplified blueprint of sklearn.NearestNeighbors implementation.

Parameters:

n_neighbors (int) – Number of neighbors.

abstract fit(X, y=None)[source]#

Store the reference points.

Parameters:
  • X (array-like, shape=[n_points_x, n_features]) – Reference points.

  • y (Ignored)

abstract kneighbors(X, return_distance=True)[source]#

Find k nearest neighbors using Sinkhorn regularization.

Parameters:
  • X (array-like, shape=[n_points_y, n_features]) – Query points.

  • return_distance (bool) – Whether to return the distances.

Returns:

  • distances (array-like, shape=[n_points_y, n_neighbors]) – Distances to the nearest neighbors, only present if return_distance is True.

  • indices (array-like, shape=[n_points_y, n_neighbors]) – Indices of the nearest neighbors.

class geomfum.convert.BaseP2pFromFmConverter[source]#

Bases: ABC

Pointwise map from functional map.

class geomfum.convert.FmFromP2pBijectiveConverter[source]#

Bases: BaseFmFromP2pConverter

Bijective functional map from pointwise map method.

References

[VM2024]

Giulio Viganò Simone Melzi. Bijective upsampling and learned embedding for point clouds correspondences. Computers and Graphics, 2024. https://doi.org/10.1016/j.cag.2024.103985.

class geomfum.convert.FmFromP2pConverter(pseudo_inverse=False)[source]#

Bases: BaseFmFromP2pConverter

Functional map from pointwise map.

Parameters:

pseudo_inverse (bool) – Whether to solve using pseudo-inverse.

class geomfum.convert.NamFromP2pConverter(iter_max=200, patience=10, min_delta=0.0001, device='cpu')[source]#

Bases: BaseFmFromP2pConverter

Neural Adjoint Map from pointwise map using Neural Adjoint Maps (NAMs).

class geomfum.convert.P2pFromFmConverter(neighbor_finder=None, adjoint=False, bijective=False)[source]#

Bases: BaseP2pFromFmConverter

Pointwise map from functional map.

Parameters:
  • neighbor_finder (NeighborFinder) – Nearest neighbor finder.

  • adjoint (bool) – Whether to use adjoint method.

  • bijective (bool) – Whether to use bijective method. Check [VM2023].

References

[OCSBG2012]

Maks Ovsjanikov, Mirela Ben-Chen, Justin Solomon, Adrian Butscher, and Leonidas Guibas. “Functional Maps: A Flexible Representation of Maps between Shapes.” ACM Transactions on Graphics 31, no. 4 (2012): 30:1-30:11. https://doi.org/10.1145/2185520.2185526.

[VM2023] (1,2)

Giulio Viganò Simone Melzi. “Adjoint Bijective ZoomOut: Efficient Upsampling for Learned Linearly-Invariant Embedding.” The Eurographics Association, 2023. https://doi.org/10.2312/stag.20231293.

class geomfum.convert.P2pFromNamConverter(neighbor_finder=None)[source]#

Bases: BaseP2pFromFmConverter

Pointwise map from Neural Adjoint Map (NAM).

Parameters:

neighbor_finder (NeighborFinder) – Nearest neighbor finder.

class geomfum.convert.SinkhornNeighborFinder(*args, **kwargs)[source]#

Bases: WhichRegistryMixins

Sinkhorn neighbor finder.

Finds neighbors based on the solution of optimal transport (OT) maps computed with Sinkhorn regularization.

References

[Cuturi2013]

Marco Cuturi. “Sinkhorn Distances: Lightspeed Computation of Optimal Transport.” Advances in Neural Information Processing Systems (NIPS), 2013. http://marcocuturi.net/SI.html

class geomfum.convert.SinkhornP2pFromFmConverter(neighbor_finder=None, adjoint=False, bijective=False)[source]#

Bases: P2pFromFmConverter

Pointwise map from functional map using Sinkhorn filters.

Parameters:
  • neighbor_finder (SinkhornKNeighborsFinder) – Nearest neighbor finder.

  • adjoint (bool) – Whether to use adjoint method.

  • bijective (bool) – Whether to use bijective method. Check [VM2023].

References

[PRMWO2021]

Gautam Pai, Jing Ren, Simone Melzi, Peter Wonka, and Maks Ovsjanikov. “Fast Sinkhorn Filters: Using Matrix Scaling for Non-Rigid Shape Correspondence with Functional Maps.” Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021, pp. 11956-11965. https://hal.science/hal-03184936/document

geomfum.forward_functional_map module#

Optimization of the functional map with a forward pass.

class geomfum.forward_functional_map.ForwardFunctionalMap(lmbda=1000.0, resolvent_gamma=1, bijective=True)[source]#

Bases: ABC, Module

Class for the forward pass of the functional map.

Parameters:
  • lmbda (float) – Weight of the mask (default: 1e3).

  • resolvent_gamma (float) – Resolvant of the regularized functional map (default: 1).

  • bijective (bool) – Whether we compute the map in both the directions (default: True).

geomfum.functional_map module#

Factors to build functional map objective function.

class geomfum.functional_map.FactorSum(factors, weight=1.0)[source]#

Bases: WeightedFactor

Factor sum.

Parameters:

factors (list[WeightedFactor]) – Factors.

gradient(fmap_matrix)[source]#

Compute energy gradient wrt functional map matrix.

Parameters:

fmap_matrix (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Functional map matrix.

Returns:

energy_gradient (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Weighted energy gradient wrt functional map matrix.

class geomfum.functional_map.LBCommutativityEnforcing(vals_sqdiff, weight=1.0)[source]#

Bases: WeightedFactor

Laplace-Beltrami commutativity constraint.

Parameters:
  • ev_sqdiff (array-like, shape=[spectrum_size_b, spectrum_size_a]) – (Normalized) matrix of squared eigenvalue differences.

  • weight (float) – Weight of the factor.

static from_bases(basis_a, basis_b, weight=1.0)[source]#
gradient(fmap_matrix)[source]#

Compute energy gradient wrt functional map matrix.

Parameters:

fmap_matrix (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Functional map matrix.

Returns:

energy_gradient (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Weighted energy gradient wrt functional map matrix.

class geomfum.functional_map.OperatorCommutativityEnforcing(oper_a, oper_b, weight=1.0)[source]#

Bases: WeightedFactor

Operator commutativity constraint.

Parameters:
  • oper_a (array-like, shape=[spectrum_size_a, spectrum_size_a]) – Operator on first basis.

  • oper_b (array-like, shape=[spectrum_size_b, spectrum_size_b]) – Operator on second basis.

  • weight (float) – Weight of the factor.

static compute_multiplication_operator(basis, descr)[source]#

Compute the multiplication operators associated with the descriptors.

Parameters:

descr (array-like, shape=[…, n_vertices])

Returns:

operators (array-like, shape=[…, spectrum_size, spectrum_size])

static compute_orientation_operator(shape, descr, reversing=False, normalize=False)[source]#

Compute orientation preserving or reversing operators associated to each descriptor.

Parameters:
  • reversing (bool) –

    whether to return operators associated to orientation inversion instead

    of orientation preservation (return the opposite of the second operator)

  • normalize (bool) –

    whether to normalize the gradient on each face. Might improve results

    according to the authors

Returns:

list_op (list) – (n_descr,) where term i contains (D1,D2) respectively of size (k1,k1) and (k2,k2) which represent operators supposed to commute.

classmethod from_multiplication(basis_a, descr_a, basis_b, descr_b, weight=1.0)[source]#
Parameters:
  • descr_a (array-like, shape=[…, n_vertices])

  • descr_b (array-like, shape=[…, n_vertices])

classmethod from_orientation(shape_a, descr_a, shape_b, descr_b, reversing_a=False, reversing_b=False, normalize=False, weight=1.0)[source]#
Parameters:
  • descr_a (array-like, shape=[…, n_vertices])

  • descr_b (array-like, shape=[…, n_vertices])

gradient(fmap_matrix)[source]#

Compute energy gradient wrt functional map matrix.

Parameters:

fmap_matrix (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Functional map matrix.

Returns:

energy_gradient (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Weighted energy gradient wrt functional map matrix.

class geomfum.functional_map.SpectralDescriptorPreservation(sdescr_a, sdescr_b, weight=1.0)[source]#

Bases: WeightedFactor

Spectral descriptor energy preservation.

Parameters:
  • sdescr_a (array-like, shape=[…, spectrum_size_a]) – Spectral descriptors on first basis.

  • sdescr_a (array-like, shape=[…, spectrum_size_b]) – Spectral descriptors on second basis.

  • weight (float) – Weight of the factor.

gradient(fmap_matrix)[source]#

Compute energy gradient wrt functional map matrix.

Parameters:

fmap_matrix (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Functional map matrix.

Returns:

energy_gradient (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Weighted energy gradient wrt functional map matrix.

class geomfum.functional_map.WeightedFactor(weight)[source]#

Bases: ABC

Weighted factor.

Parameters:

weight (float) – Weight of the factor.

abstract gradient(fmap_matrix)[source]#

Compute energy gradient wrt functional map matrix.

Parameters:

fmap_matrix (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Functional map matrix.

Returns:

energy_gradient (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Weighted energy gradient wrt functional map matrix.

geomfum.io module#

geomfum.io.load_mesh(filename)[source]#

Load a mesh from a file.

Parameters:

filename (str) – File name.

Returns:

  • vertices (array-like, shape=[n_vertices, 3])

  • faces (array_like, shape=[n_faces, 3])

geomfum.io.load_pointcloud(filename)[source]#

Load a point cloud from a file.

Parameters:

filename (str) – File name.

Returns:

vertices (array-like, shape=[n_vertices, 3])

geomfum.laplacian module#

Laplacian-related algorithms.

class geomfum.laplacian.BaseLaplacianFinder[source]#

Bases: ABC

Algorithm to find the Laplacian.

class geomfum.laplacian.LaplacianFinder(*args, **kwargs)[source]#

Bases: MeshWhichRegistryMixins, BaseLaplacianFinder

Algorithm to find the Laplacian.

class geomfum.laplacian.LaplacianSpectrumFinder(spectrum_size=100, nonzero=False, fix_sign=False, laplacian_finder=None, eig_solver=None)[source]#

Bases: object

Algorithm to find Laplacian spectrum.

Parameters:
  • spectrum_size (int) – Spectrum size. Ignored if eig_solver is not None.

  • nonzero (bool) – Remove zero zero eigenvalue.

  • fix_sign (bool) – Wheather to have all the first components with positive sign.

  • laplacian_finder (BaseLaplacianFinder) – Algorithm to find the Laplacian. Ignored if Laplace and mass matrices were already computed.

  • eig_solver (EigSolver) – Eigen solver.

property spectrum_size#

Spectrum size.

Returns:

spectrum_size (int) – Spectrum size.

geomfum.linalg module#

Linear algebra utils.

geomfum.linalg.columnwise_scaling(vec, mat)[source]#

Columnwise scaling.

Parameters:
  • vec (array-like, shape=[…, k]) – Vector of scalings.

  • mat (array-like, shape=[…, n, k]) – Matrix.

Returns:

scaled_mat (array-like, shape=[…, n, k])

geomfum.linalg.matvecmul(mat, vec)[source]#

Matrix vector multiplication.

Parameters:
  • mat (array-like, shape=[…, m, n]) – Matrix.

  • vec (array-like, shape=[…, n]) – Vector.

Returns:

matvec (array-like, shape=[…, m]) – Matrix vector multiplication.

geomfum.linalg.normalize(array, axis=-1)[source]#

Normalize array along axis.

Parameters:
  • array (array-like, shape=[…, n, …]) – Array to normalize.

  • axis (int) – Axis to use for normalization.

Returns:

array (array-like, shape=[…, n, …]) – Normalized array.

geomfum.linalg.rowwise_scaling(vec, mat)[source]#

Columnwise scaling.

Parameters:
  • vec (array-like, shape=[…, n]) – Vector of scalings.

  • mat (array-like, shape=[…, n, k]) – Matrix.

Returns:

scaled_mat (array-like, shape=[…, n, k])

geomfum.linalg.scalarvecmul(scalar, vec)[source]#

Scalar vector multiplication.

Parameters:
  • scalar (array-like, shape=[….]) – Scalar.

  • vec (array-like, shape=[…, n]) – Vector.

Returns:

scaled_vec (array-like, shape=[…, n]) – Scaled vector.

geomfum.linalg.scale_to_unit_sum(array, axis=-1)[source]#

Scale array to sum one along axis.

Parameters:
  • array (array-like, shape=[…, n, …]) – Array to normalize.

  • axis (int) – Axis to use for normalization.

Returns:

array (array-like, shape=[…, n, …]) – Scaled array.

geomfum.neural_adjoint_map module#

Neural Adjoint Maps (NAMs) for functional maps.

class geomfum.neural_adjoint_map.MLP(input_dim, output_dim, depth=4, width=128, act=LeakyReLU(negative_slope=0.01), bias=True)[source]#

Bases: Module

A simple MLP (Multi-Layer Perceptron) module.

Parameters:
  • input_dim (int) – The dimension of the input data.

  • output_dim (int) – The dimension of the output data.

  • depth (int) – The number of layers in the MLP.

  • width (int) – The width of each layer in the MLP.

  • act (torch.nn.Module) – The activation function to be used in the MLP.

forward(x)[source]#

Forward pass through the MLP.

class geomfum.neural_adjoint_map.NeuralAdjointMap(input_dim, output_dim, linear_module=None, non_linear_module=None, device='cpu')[source]#

Bases: Module

Neural Adjoint Map (NAM) composed by a linear branch and a non-linear MLP branch.

Parameters:
  • input_dim (int) – The dimension of the input data.

  • output_dim (int) – The dimension of the output data. If None, it defaults to input_dim.

  • depth (int) – The number of layers in the MLP.

  • width (int) – The width of each layer in the MLP.

  • act (torch.nn.Module) – The activation function to be used in the MLP.

References

forward(x)[source]#

Forward pass through both the linear and non-linear modules.

geomfum.operator module#

Functional operators.

class geomfum.operator.FaceDivergenceOperator(*args, **kwargs)[source]#

Bases: WhichRegistryMixins, VectorFieldOperator

Divergence of a function on a mesh.

class geomfum.operator.FaceOrientationOperator(*args, **kwargs)[source]#

Bases: WhichRegistryMixins, VectorFieldOperator

Orientation operator associated to a gradient field.

For a given function \(g\) on the vertices, this operator linearly computes \(< \grad(f) x \grad(g)\), n> for each vertex by averaging along the adjacent faces. In practice, we compute \(< n x \grad(f), \grad(g) >\) for simpler computation.

class geomfum.operator.FaceValuedGradient(*args, **kwargs)[source]#

Bases: WhichRegistryMixins, FunctionalOperator

Gradient of a function on a mesh.

Computes the gradient of a function on f using linear interpolation between vertices.

class geomfum.operator.FunctionalOperator(shape)[source]#

Bases: ABC

Functional operator.

class geomfum.operator.Laplacian(shape, stiffness_matrix=None, mass_matrix=None)[source]#

Bases: FunctionalOperator

Laplacian.

Check [P2016] for representation choice.

Parameters:
  • stiffness_matrix (array-like, shape=[n_vertices, n_vertices]) – Stiffness matrix.

  • mass_matrix (array-like, shape=[n_vertices, n_vertices]) – Diagonal lumped mass matrix.

References

[P2016]

Giuseppe Patané. “STAR - Laplacian Spectral Kernels and Distances for Geometry Processing and Shape Analysis.” Computer Graphics Forum 35, no. 2 (2016): 599–624. https://doi.org/10.1111/cgf.12866.

property basis#

Laplace eigenbasis.

Returns:

basis (LaplaceEigenBasis) – Laplace eigenbasis.

find(laplacian_finder=None, recompute=False)[source]#

Find Laplacian.

Parameters:
  • laplacian_finder (BaseLaplacianFinder) – Algorithm to find the Laplacian.

  • recompute (bool) – Whether to recompute Laplacian if information is cached.

Returns:

  • stiffness_matrix (array-like, shape=[n_vertices, n_vertices]) – Stiffness matrix.

  • mass_matrix (array-like, shape=[n_vertices, n_vertices]) – Diagonal lumped mass matrix.

find_spectrum(spectrum_size=100, laplacian_spectrum_finder=None, set_as_basis=True, recompute=False)[source]#

Find Laplacian spectrum.

Parameters:
  • spectrum_size (int) – Spectrum size. Ignored if laplacian_spectrum_finder is not None.

  • laplacian_spectrum_finder (LaplacianSpectrumFinder) – Algorithm to find Laplacian spectrum.

  • set_as_basis (bool) – Whether to set spectrum as basis.

  • recompute (bool) – Whether to recompute spectrum if information is cached in basis.

Returns:

  • eigenvals (array-like, shape=[spectrum_size]) – Eigenvalues.

  • eigenvecs (array-like, shape=[n_vertices, spectrum_size]) – Eigenvectors.

property mass_matrix#

Mass matrix.

Returns:

mass_matrix (array-like, shape=[n_vertices, n_vertices]) – Mass matrix.

property stiffness_matrix#

Stiffness matrix.

Returns:

stiffness_matrix (array-like, shape=[n_vertices, n_vertices]) – Stiffness matrix.

class geomfum.operator.VectorFieldOperator(shape)[source]#

Bases: ABC

Vector field operator.

geomfum.plot module#

Plotting functions.

In this file we define the plotting logic. Since each plotting library has its own method of plotting, we define general functions that works with any library implemented

class geomfum.plot.MeshPlotter(*args, **kwargs)[source]#

Bases: WhichRegistryMixins, ShapePlotter

Plotting object to display meshes.

class geomfum.plot.ShapePlotter[source]#

Bases: ABC

Plotting object.

Primitive clas to plot meshes, pointclouds or specific useful informations (scalar functions, landmarks, etc..)

abstract add_mesh(mesh)[source]#

Add mesh to plot.

highlight_vertices(coords, color, size)[source]#

Highlight vertices on mesh.

set_vertex_scalars(scalars)[source]#

Set vertex scalars on mesh.

abstract show()[source]#

Display plot.

geomfum.refine module#

Functional map refinement machinery.

class geomfum.refine.AdjointBijectiveZoomOut(nit=10, step=1)[source]#

Bases: ZoomOut

Adjoint bijective zoomout algorithm.

Parameters:
  • nit (int) – Number of iterations.

  • step (int or tuple[2, int]) – How much to increase each basis per iteration.

References

[]

class geomfum.refine.FastSinkhornFilters(nit=10, step=1, neighbor_finder=None)[source]#

Bases: ZoomOut

Fast Sinkhorn filters.

Parameters:
  • nit (int) – Number of iterations.

  • step (int or tuple[2, int]) – How much to increase each basis per iteration.

  • neighbor_finder (SinkhornKNeighborsFinder) – Nearest neighbor finder.

References

[PRMWO2021]

Gautam Pai, Jing Ren, Simone Melzi, Peter Wonka, and Maks Ovsjanikov. “Fast Sinkhorn Filters: Using Matrix Scaling for Non-Rigid Shape Correspondence with Functional Maps.” Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021, pp. 11956-11965. https://hal.science/hal-03184936/document

class geomfum.refine.IcpRefiner(nit=10, atol=0.0001, p2p_from_fm_converter=None, fm_from_p2p_converter=None)[source]#

Bases: IterativeRefiner

Iterative refinement of functional map using SVD.

Parameters:
  • nit (int) – Number of iterations.

  • atol (float) – Convergence tolerance.

  • p2p_from_fm_converter (P2pFromFmConverter) – Pointwise map from functional map.

  • fm_from_p2p_converter (FmFromP2pConverter) – Functional map from pointwise map.

References

[OCSBG2012]

Maks Ovsjanikov, Mirela Ben-Chen, Justin Solomon, Adrian Butscher, and Leonidas Guibas. “Functional Maps: A Flexible Representation of Maps between Shapes.” ACM Transactions on Graphics 31, no. 4 (2012): 30:1-30:11. https://doi.org/10.1145/2185520.2185526.

class geomfum.refine.IdentityRefiner[source]#

Bases: Refiner

A dummy refiner.

class geomfum.refine.IterativeRefiner(nit=10, step=0, atol=None, p2p_from_fm_converter=None, fm_from_p2p_converter=None, iter_refiner=None)[source]#

Bases: Refiner

Iterative refinement of functional map.

At each iteration, it computes a pointwise map, converts it back to a functional map, and (optionally) furthers refines it.

Parameters:
  • nit (int) – Number of iterations.

  • step (int or tuple[2, int]) – How much to increase each basis per iteration.

  • atol (float) – Convergence tolerance. Ignored if step different than 1.

  • p2p_from_fm_converter (P2pFromFmConverter) – Pointwise map from functional map.

  • fm_from_p2p_converter (FmFromP2pConverter) – Functional map from pointwise map.

  • iter_refiner (Refiner) – Refinement algorithm that runs within each iteration.

iter(fmap_matrix, basis_a, basis_b)[source]#

Refiner iteration.

Parameters:
  • fmap_matrix (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Functional map matrix.

  • basis_a (Eigenbasis.) – Basis.

  • basis_b (Eigenbasis.) – Basis.

Returns:

fmap_matrix (array-like, shape=[spectrum_size_b + step_b, spectrum_size_a + step_a]) – Refined functional map matrix.

property step#

How much to increase each basis per iteration.

Returns:

step (tuple[2, int]) – Step.

class geomfum.refine.NeuralZoomOut(nit=10, step=1, device='cpu')[source]#

Bases: ZoomOut

Neural zoomout algorithm.

Parameters:
  • nit (int) – Number of iterations.

  • step (int or tuple[2, int]) – How much to increase each basis per iteration.

References

[VOM2025]

Giulio Viganò, Maks Ovsjanikov, Simone Melzi. “NAM: Neural Adjoint Maps for refining shape correspondences”.

class geomfum.refine.OrthogonalRefiner(flip_neg_det=True)[source]#

Bases: Refiner

Refinement using singular value decomposition.

Parameters:

flip_neg_det (bool) – Whether to flip negative determinant for square matrices.

References

[OCSBG2012]

Maks Ovsjanikov, Mirela Ben-Chen, Justin Solomon, Adrian Butscher, and Leonidas Guibas. “Functional Maps: A Flexible Representation of Maps between Shapes.” ACM Transactions on Graphics 31, no. 4 (2012): 30:1-30:11. https://doi.org/10.1145/2185520.2185526.

class geomfum.refine.ProperRefiner(p2p_from_fm_converter=None, fm_from_p2p_converter=None)[source]#

Bases: Refiner

Refinement projecting the functional map to the proper functional map space.

Parameters:
  • p2p_from_fm_converter (P2pFromFmConverter) – Pointwise map from functional map.

  • fm_from_p2p_converter (FmFromP2pConverter) – Functional map from pointwise map.

class geomfum.refine.Refiner[source]#

Bases: ABC

Functional map refiner.

class geomfum.refine.ZoomOut(nit=10, step=1, p2p_from_fm_converter=None, fm_from_p2p_converter=None)[source]#

Bases: IterativeRefiner

Zoomout algorithm.

Parameters:
  • nit (int) – Number of iterations.

  • step (int or tuple[2, int]) – How much to increase each basis per iteration.

  • p2p_from_fm_converter (P2pFromFmConverter) – Pointwise map from functional map.

  • fm_from_p2p_converter (FmFromP2pConverter) – Functional map from pointwise map.

References

[MRRSWO2019]

Simone Melzi, Jing Ren, Emanuele Rodolà, Abhishek Sharma, Peter Wonka, and Maks Ovsjanikov. “ZoomOut: Spectral Upsampling for Efficient Shape Correspondence.” arXiv, September 12, 2019. http://arxiv.org/abs/1904.07865

geomfum.sample module#

Sampling methods.

class geomfum.sample.BaseSampler[source]#

Bases: ABC

Sampler.

abstract sample(shape)[source]#

Sample shape.

class geomfum.sample.FarthestPointSampler(min_n_samples)[source]#

Bases: BaseSampler

Farthest point sampling.

Parameters:

min_n_samples (int) – Minimum number of samples to target.

sample(shape, first_point=None, points_pool=None)[source]#

Perform farthest point sampling on a mesh.

Parameters:
  • shape (TriangleMesh) – The mesh to sample points from.

  • first_point (int, optional) – Index of the initial point to start sampling from. If None, a random point is chosen.

  • points_pool (array-like or int, optional) – Pool of candidate points to sample from. If None, all vertices in the mesh are used.

Returns:

samples (array-like of shape (min_n_samples,)) – Indices of sampled points.

class geomfum.sample.PoissonSampler(*args, **kwargs)[source]#

Bases: WhichRegistryMixins

Poisson disk sampling.

class geomfum.sample.VertexProjectionSampler(min_n_samples=100, sampler=None, neighbor_finder=None, unique=False)[source]#

Bases: BaseSampler

Sample by projecting samples to the closest vertex.

Uses nearest neighbor to get indices of sample coordinates resulting from another sampler.

Parameters:
  • min_n_samples (int) – Minimum number of samples to target. Ignored if sampler is not None. Not guaranteed if unique is True.

  • sampler (BaseSampler) – Coordinates sampler.

  • neighbor_finder (sklearn.NearestNeighbors) – Nearest neighbors finder.

  • unique (bool) – Whether to remove duplicates.

sample(shape)[source]#

Sample using Poisson disk sampling.

Parameters:

shape (Shape) – Shape to be sampled.

Returns:

samples (array-like, shape=[n_samples]) – Vertex indices of samples.

Module contents#