geomfum.descriptor package#

Submodules#

geomfum.descriptor.learned module#

Implementation of the learned descriptor.

The learned descriptor is a descriptor that uses a neural network to compute features.

class geomfum.descriptor.learned.BaseFeatureExtractor[source]#

Bases: ABC

Abstract base class for neural network feature extractors.

load_from_path(path)[source]#

Load model parameters from the provided file path.

Parameters:

path (str) – Path to the saved model parameters

save(path)[source]#

Save model parameters to the specified file path.

Parameters:

path (str) – Path to the saved model parameters

class geomfum.descriptor.learned.Descriptor[source]#

Bases: ABC

Abstract base class for shape descriptors.

class geomfum.descriptor.learned.FeatureExtractor(*args, **kwargs)[source]#

Bases: WhichRegistryMixins

Factory for creating feature extractors from registry.

class geomfum.descriptor.learned.FeatureExtractorRegistry[source]#

Bases: Registry

MAP = {'diffusionnet': ('DiffusionnetFeatureExtractor', None), 'pointnet': ('PointnetFeatureExtractor', None), 'transformer': ('TransformerFeatureExtractor', None)}#
default = 'diffusionnet'#
class geomfum.descriptor.learned.LearnedDescriptor(feature_extractor=None)[source]#

Bases: Descriptor, ABC, Module

Descriptor computed using neural network feature extractors.

Parameters:

feature_extractor (Feature Extractor) – Feature extractor to use.

forward(shape)[source]#

Compute descriptor.

Parameters:

shape (Shape.) – Shape.

Returns:

features (array-like, shape=[…, n_features, n_vertices]) – Descriptors of the shape, where n_features is the number of features extracted by the feature extractor.

class geomfum.descriptor.learned.WhichRegistryMixins(*args, **kwargs)[source]#

Bases: object

Mixin enabling registry-based instantiation via ‘which’ parameter.

classmethod from_registry(*args, which=None, **kwargs)[source]#

Create instance from registered implementation.

Parameters:

which (str) – A registered implementation.

Returns:

obj (BaseHeatKernelSignature) – Instantiated object.

geomfum.descriptor.pipeline module#

Descriptor pipeline.

class geomfum.descriptor.pipeline.ArangeSubsampler(subsample_step=1, axis=0)[source]#

Bases: Subsampler

Subsampler using uniform stride-based indexing.

Parameters:
  • subsample_step (int) – Arange step.

  • axis (int) – Axis from which to subsample.

class geomfum.descriptor.pipeline.Descriptor[source]#

Bases: ABC

Abstract base class for shape descriptors.

class geomfum.descriptor.pipeline.DescriptorPipeline(steps)[source]#

Bases: object

Sequential pipeline for computing and processing shape descriptors.

Parameters:

steps (list or tuple) – Steps to apply. Include: descriptor, subsampler, normalizer.

apply(shape)[source]#

Apply descriptor pipeline.

Parameters:

shape (Shape) – Shape to apply pipeline to.

Returns:

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

class geomfum.descriptor.pipeline.L2InnerNormalizer[source]#

Bases: Normalizer

Normalizer using L2 inner product with mass matrix.

class geomfum.descriptor.pipeline.LearnedDescriptor(feature_extractor=None)[source]#

Bases: Descriptor, ABC, Module

Descriptor computed using neural network feature extractors.

Parameters:

feature_extractor (Feature Extractor) – Feature extractor to use.

forward(shape)[source]#

Compute descriptor.

Parameters:

shape (Shape.) – Shape.

Returns:

features (array-like, shape=[…, n_features, n_vertices]) – Descriptors of the shape, where n_features is the number of features extracted by the feature extractor.

class geomfum.descriptor.pipeline.Normalizer[source]#

Bases: ABC

Abstract base class for descriptor normalization.

class geomfum.descriptor.pipeline.Subsampler[source]#

Bases: ABC

Abstract base class for array subsampling operations.

geomfum.descriptor.spectral module#

Spectral descriptors.

class geomfum.descriptor.spectral.HeatKernelFilter[source]#

Bases: SpectralFilter

Heat kernel filter computing exp(-t * λ) coefficients for HKS.

class geomfum.descriptor.spectral.HeatKernelSignature(scale=True, n_domain=3, domain=None, k=None)[source]#

Bases: WhichRegistryMixins, SpectralDescriptor

Heat Kernel Signature descriptor using heat diffusion over time.

Parameters:
  • scale (bool) – Whether to scale weights to sum to one.

  • n_domain (int) – Number of domain points. Ignored if domain is not None.

  • domain (callable or array-like, shape=[n_domain], optional) – Method to compute time domain points (f(shape)) or time domain points.

  • k (int, optional) – Number of eigenfunctions to use. If None, all eigenfunctions are used.

class geomfum.descriptor.spectral.HeatKernelSignatureRegistry[source]#

Bases: Registry

MAP = {'pyfm': ('PyfmHeatKernelSignature', None)}#
default = 'pyfm'#
has_internal = True#
class geomfum.descriptor.spectral.LandmarkHeatKernelSignature(scale=True, n_domain=3, domain=None, k=None)[source]#

Bases: WhichRegistryMixins, SpectralDescriptor

Heat Kernel Signature computed from landmark points.

Parameters:
  • scale (bool) – Whether to scale weights to sum to one.

  • n_domain (int) – Number of domain points. Ignored if domain is not None.

  • domain (callable or array-like, shape=[n_domain], optional) – Method to compute time domain points (f(shape)) or time domain points.

  • k (int, optional) – Number of eigenfunctions to use.

class geomfum.descriptor.spectral.LandmarkHeatKernelSignatureRegistry[source]#

Bases: Registry

MAP = {'pyfm': ('PyfmLandmarkHeatKernelSignature', None)}#
default = 'pyfm'#
has_internal = True#
class geomfum.descriptor.spectral.LandmarkWaveKernelSignature(scale=True, sigma=None, n_domain=3, domain=None, k=None)[source]#

Bases: WhichRegistryMixins, SpectralDescriptor

Wave Kernel Signature computed from landmark points.

Parameters:
  • scale (bool) – Whether to scale weights to sum to one.

  • sigma (float) – Standard deviation for the Gaussian.

  • n_domain (int) – Number of domain points. Ignored if domain is not None.

  • domain (callable or array-like, shape=[n_domain], optional) – Method to compute energy domain points (f(shape)) or energy domain points.

  • k (int, optional) – Number of eigenfunctions to use.

class geomfum.descriptor.spectral.LandmarkWaveKernelSignatureRegistry[source]#

Bases: Registry

MAP = {'pyfm': ('PyfmLandmarkWaveKernelSignature', None)}#
default = 'pyfm'#
has_internal = True#
class geomfum.descriptor.spectral.SpectralDescriptor(spectral_filter=None, domain=None, sigma=1, scale=True, landmarks=False, k=None)[source]#

Bases: Descriptor, ABC

Spectral descriptor computed from Laplacian eigenfunctions with spectral filters.

Parameters:
  • spectral_filter (SpectralFilter) – Spectral filter.

  • domain (callable or array-like, shape=[n_domain]) – Method to compute domain points (f(basis, n_domain)) or domain points.

  • sigma (float) – Standard deviation for the Gaussian.

  • scale (bool) – Whether to scale weights to sum to one.

  • landmarks (bool) – Whether to compute landmarks based descriptors.

  • k (int, optional) – Number of eigenvalues and eigenvectors to use. If None, basis.use_k is used.

class geomfum.descriptor.spectral.SpectralFilter[source]#

Bases: ABC

Abstract base class for computing spectral filter coefficients from eigenvalues.

class geomfum.descriptor.spectral.WaveKernelFilter[source]#

Bases: SpectralFilter

Wave kernel filter using Gaussian weighting in log-eigenvalue space for WKS.

class geomfum.descriptor.spectral.WaveKernelSignature(scale=True, sigma=None, n_domain=3, domain=None, k=None)[source]#

Bases: WhichRegistryMixins, SpectralDescriptor

Wave Kernel Signature descriptor using quantum mechanical wave propagation.

Parameters:
  • scale (bool) – Whether to scale weights to sum to one.

  • sigma (float) – Standard deviation for the Gaussian.

  • n_domain (int) – Number of domain points. Ignored if domain is not None.

  • domain (callable or array-like, shape=[n_domain], optional) – Method to compute energy domain points (f(shape)) or energy domain points.

  • k (int, optional) – Number of eigenfunctions to use. If None, all eigenfunctions are used.

class geomfum.descriptor.spectral.WaveKernelSignatureRegistry[source]#

Bases: Registry

MAP = {'pyfm': ('PyfmWaveKernelSignature', None)}#
default = 'pyfm'#
has_internal = True#
class geomfum.descriptor.spectral.WhichRegistryMixins(*args, **kwargs)[source]#

Bases: object

Mixin enabling registry-based instantiation via ‘which’ parameter.

classmethod from_registry(*args, which=None, **kwargs)[source]#

Create instance from registered implementation.

Parameters:

which (str) – A registered implementation.

Returns:

obj (BaseHeatKernelSignature) – Instantiated object.

class geomfum.descriptor.spectral.WksDefaultDomain(n_domain, sigma=None, n_overlap=7, n_trans=2)[source]#

Bases: object

Default domain generator for Wave Kernel Signature using logarithmic energy sampling.

Parameters:
  • shape (Shape.) – Shape with basis.

  • n_domain (int) – Number of energy points to use.

  • n_overlap (int) – Controls Gaussian overlap. Ignored if sigma is not None.

  • n_trans (int) – Number of standard deviations to translate energy bound by.

geomfum.descriptor.spectral.hks_default_domain(shape, n_domain)[source]#

Compute HKS default domain. The domain is a set of sampled time points.

Parameters:
  • shape (Shape.) – Shape with basis.

  • n_domain (int) – Number of time points.

Returns:

domain (array-like, shape=[n_domain]) – Time points.

Module contents#

Descriptors Module. This module contains various shape descriptors used in Geomfum. Including spectral descriptors, distance from landmarks, and feature extractors.

class geomfum.descriptor.Descriptor[source]#

Bases: ABC

Abstract base class for shape descriptors.

class geomfum.descriptor.DistanceFromLandmarksDescriptor[source]#

Bases: Descriptor

Descriptor computing geodesic distances from landmark points.

class geomfum.descriptor.SpectralDescriptor(spectral_filter=None, domain=None, sigma=1, scale=True, landmarks=False, k=None)[source]#

Bases: Descriptor, ABC

Spectral descriptor computed from Laplacian eigenfunctions with spectral filters.

Parameters:
  • spectral_filter (SpectralFilter) – Spectral filter.

  • domain (callable or array-like, shape=[n_domain]) – Method to compute domain points (f(basis, n_domain)) or domain points.

  • sigma (float) – Standard deviation for the Gaussian.

  • scale (bool) – Whether to scale weights to sum to one.

  • landmarks (bool) – Whether to compute landmarks based descriptors.

  • k (int, optional) – Number of eigenvalues and eigenvectors to use. If None, basis.use_k is used.