Image Generation

Generating art for poetry using a GAN with CLIP embeddings

Project Info

TypeProject
Year2022
Image Generation

VQGAN+CLIP Image Generation

VQGAN+CLIP constitutes a two-stage neural architecture for text-to-image synthesis, implementing a generative pipeline wherein vector quantization techniques are coupled with contrastive learning methodologies. The VQGAN (Vector Quantized Generative Adversarial Network) component functions as the image synthesis module, employing a discrete latent codebook to compress visual data into a finite set of learned representations.

This codebook architecture enables efficient mapping between the latent space and pixel distributions while maintaining high-fidelity reconstructions. CLIP, trained on approximately 400 million text-image pairs, provides the optimization target by computing cosine similarity between embeddings of the generated image and the target text prompt. The generation process initializes from random noise in VQGAN's latent space, followed by gradient-based optimization to maximize the CLIP score.

This optimization operates iteratively through backpropagation, where gradients flow through CLIP's image encoder into VQGAN's latent representation, which will refine the image in alignment with CLIP's understanding of images.