arrow_backProjects
UNIVERSITY•2023•Duccio Meconcelli

Twisted Thought GAN

PythonPyTorchGANsWasserstein DistanceSynthetic Images
§ 00 // ABSTRACT

A PyTorch Generative Adversarial Network trained on synthetic parametric harmonograph and Lissajous curves, investigating adversarial training dynamics, gradient penalty, and Sliced Wasserstein Distance.

Twisted Thought GAN is a generative modelling study developed in Python and PyTorch for the Neural Networks course (2023), investigating how deep convolutional Generative Adversarial Networks (GANs) learn—and deform—the strict periodic symmetries of parametric mathematical curves.

Generated grid of harmonograph-inspired figures from Twisted Thought GAN
Adversarial samples generated from latent Gaussian noise (run 1)
Organic and symmetrical forms synthesized by Twisted Thought GAN
Emergent organic morphologies produced at 128×128 and 256×256 resolutions (run 6)

Procedural Harmonograph Dataset & Architecture

Because no standardized dataset of multi-pendulum harmonograph curves exists, the pipeline includes a procedural generator (harmograph.py) that integrates damped harmonic oscillator equations with randomized frequencies, phase offsets, and decay envelopes to synthesize training sets at $128 \times 128$ and $256 \times 256$ resolutions.

The adversarial pipeline (GAN.py) explores several stabilization and evaluation mechanisms:

  • Asymmetric Discriminator Updates & Gradient Penalty: Configurable critic-to-generator update ratios (DISC_STEP), separate learning rates (DISC_LR, GEN_LR), and gradient penalty regularization (GP_WEIGHT) to mitigate mode collapse on thin line structures.
  • Sliced Wasserstein Distance (swd.py): Multi-scale statistical evaluation comparing Laplacian pyramid patches between real harmonographs and synthesized outputs across training checkpoints.
  • Automated Training Telemetry: Epoch-by-epoch GIF timelapse compilation (make_gif.py) and automated Telegram notifications (telegram_alert.py) for remote run tracking.

Emergent Morphologies

While the training corpus consists strictly of closed parametric oscillations, convolutional transpose layers introduce organic topological variations—loop bifurcations, bilateral tendrils, and Rorschach-like silhouettes—where local line curvature and filament density are preserved even as global periodic closure breaks down.

Resources