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.
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.