This repository experiments with different neural network architectures for learning from the Euler Characteristic Transform (ECT). It compares ECC encoding strategies and representation models across several shape-classification benchmarks.
The code implements the experiments from the paper Encoding the Euler Characteristic Transform.
- Python 3.11
- uv (package manager)
Install dependencies:
uv syncDependencies are declared in pyproject.toml and include PyTorch, PyTorch Geometric, torchvision, and the dect library.
Downloaded automatically on first run via torchvision into data/FashionMNIST/.
Downloaded automatically on first run via PyTorch Geometric into data/TUDataset/ when running with --dataname Letter-low, Letter-med, or Letter-high.
Requires manual preparation:
-
Obtain the URL list file and place it at:
data/SwissBuildings3d/raw/ch.swisstopo.swissbuildings3d_3_0-1CKf2kEX.csv -
Download the raw files:
uv run download_swissbuildings.py
-
Process the dataset using the notebook prepare-swissbuildings.ipynb. This reads the raw files and writes the processed train/val/test splits to
data/SwissBuildings3d/processed/.
uv run main.py --dataname=<dataset> [--repeats=<n>]<dataset> is one of: FashionMNISTPointCloud, FashionMNISTCubical, SwissBuildings, Letter-low, Letter-med, Letter-high.
--repeats controls how many independent runs are averaged (default: 5).
Each run appends a row to <dataset>_results.csv with columns variant, model, transform, angle, params, acc.
bash runall.shbash runreduced.shTrains with training-set sizes from 100 to 2000 in steps of 300. Results are written to FashionMNISTPointCloud_reduced_results.csv with an additional size column.
Trains a backbone on SwissBuildings3D, then freezes it and retrains only the classification head on the other datasets:
uv run generalization_experiment.pyIf sw_backbone.pt already exists in the working directory, Phase 1 (SwissBuildings training) is skipped. Results are written to generalization_results.csv.
| Variant | Description |
|---|---|
discrete |
Discrete ECC |
discrete + transformer |
Discrete ECC with transformer encoder |
delta_ect_unsorted |
Continuous (delta ECT) |
| Model key | Architecture |
|---|---|
model1d |
1D convolution |
model2d |
2D convolution |
modelContour |
1D complex (contour) convolution |
modelSet |
Set-based |
modelFF |
Feedforward |
modelHybrid |
Hybrid |
The notebook result-analysis.ipynb reads the CSV result files and produces the figures in figures/.