Skip to content

yemeen/ectnet

Repository files navigation

ECTNet

A collection of pipelines for analyzing plant morphology using the Euler Characteristic Transform (ECT) — a topological descriptor that converts a 2D contour into a matrix of Euler characteristics across angles and radial thresholds. The resulting matrix is treated as an image and fed into convolutional neural networks.

Project structure

ectnet/
├── leaf_classification/         # ECT-based classification of leaf / cell shapes
├── ect_to_shape/                # Predict leaf shape masks from radial ECTs (U-Net)
├── synthetic_vein_prediction/   # Predict vein patterns from synthetic grapevine leaves (U-Net)
├── figures/                     # Scripts and assets for paper figures
├── data/                        # Datasets and WebDataset shards (not tracked)
└── runs/                        # Training outputs and checkpoints (not tracked)

Pipelines

1. Leaf classification — leaf_classification/

Classifies plant shapes (herbarium leaf outlines, pavement cells) by computing ECTs from 2D point clouds and training a CNN. Supports three datasets: LeafMachine2 herbarium leaves, 2017 leaf collection, and pavement cells. Includes WebDataset packing, ECT pre-baking, training, and evaluation.

Quick start:

cd leaf_classification
uv sync
python 01_train.py

2. ECT-to-shape reconstruction — ect_to_shape/

Trains a U-Net to invert the ECT — predicting a binary leaf shape mask from the corresponding radial ECT image. Demonstrates that shape information is recoverable from the transform.

Quick start:

cd ect_to_shape
python scripts/0_radial_ect_and_masks.py   # prepare data
python scripts/1_leaf_segmentation.py      # train
python scripts/2_predict_and_visualize.py  # visualize predictions

3. Synthetic vein prediction — synthetic_vein_prediction/

Generates synthetic grapevine leaves via PCA + SMOTE in shape space, then trains a U-Net to predict vein structure from a two-channel input (blade ECT + blade mask).

Quick start:

cd synthetic_vein_prediction
unzip data.zip
python scripts/1_generate_synthetic_leaves.py
python scripts/2_train_unet.py
python scripts/3_figure.py

Where figures live

Figure Location
Paper figures (Figure 1, Figure 2, …) figures/Figure1/, figures/Figure2/, … — hand-crafted scripts and Illustrator source files
Classification evaluation (confusion matrix, PR curves, per-class metrics) runs/wds_<dataset>/<run_name>/ — written automatically at end of each eval run; checkpoints at runs/wds_<dataset>/best_<dataset>.pt
ECT-to-shape segmentation predictions ect_to_shape/outputs/
Synthetic vein prediction figure synthetic_vein_prediction/outputs/figure/

Setup

All pipelines share the same environment. From the repo root:

uv sync

Requires Python 3.11.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors