{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# How to create a descriptor pipeline?" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from geomfum.dataset import NotebooksDataset\n", "from geomfum.descriptor.pipeline import (\n", " ArangeSubsampler,\n", " DescriptorPipeline,\n", " L2InnerNormalizer,\n", ")\n", "from geomfum.descriptor.spectral import HeatKernelSignature, WaveKernelSignature\n", "from geomfum.shape import TriangleMesh" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[Load a mesh](00_load_mesh_from_file.ipynb)." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO: Data has already been downloaded... using cached file ('/home/ubuntu/.geomfum/data/cat-00.off').\n", "/home/ubuntu/giulio_vigano/geomfum_proj/venv/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] } ], "source": [ "dataset = NotebooksDataset()\n", "mesh = TriangleMesh.from_file(dataset.get_filename(\"cat-00\"))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[Set Laplace eigenbasis](./02_mesh_laplacian_spectrum.ipynb)." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mesh.laplacian.find_spectrum(spectrum_size=10, set_as_basis=True)\n", "\n", "mesh.basis" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A pipeline is composed of [`Descriptor`](./03_descriptors.ipynb), `Subsampler`(./sampler.ipynb) and `Normalizer`." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "steps = [\n", " HeatKernelSignature.from_registry(n_domain=4),\n", " ArangeSubsampler(subsample_step=2),\n", " WaveKernelSignature.from_registry(n_domain=3),\n", " L2InnerNormalizer(),\n", "]\n", "\n", "pipeline = DescriptorPipeline(steps)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(5, 7207)" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "descr = pipeline.apply(mesh)\n", "\n", "descr.shape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Further reading\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* [How to compute a functional map?](./07_functional_map.ipynb)\n", "\n", "* [How to use feature exactors for descriptors](./05_descriptors_with_feat_extractors.ipynb)\n", "\n", "* [How to set landmarks?](./06_landmarks.ipynb)" ] } ], "metadata": { "kernelspec": { "display_name": "venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" } }, "nbformat": 4, "nbformat_minor": 2 }