Drag Your GAN: Interactive Point-based Manipulation on the Generative Image Manifold

Xingang Pan, Ayush Tewari, Thomas Leimkühler, Lingjie Liu, Abhimitra Meka, Christian Theobalt

Introduction

Generative Adversarial Networks (GANs) have revolutionized image synthesis, producing high-fidelity images that are often indistinguishable from reality. However, the ability to precisely control these outputs remains a significant hurdle. Traditional methods for controllable synthesis typically rely on 3D priors, extensive manual annotations, or text-based prompts. While text-to-image models offer semantic control, they lack the "pixel-level" granularity required for specific structural adjustments—such as moving a limb or changing a facial expression by a precise amount.

"DragGAN" introduces a paradigm shift in interactive image editing. By allowing users to simply "drag" points on an image to target locations, the framework achieves flexible, precise, and category-agnostic control over GAN-generated content. This approach leverages the internal representations of a pre-trained GAN to maintain photorealism and object rigidity without the need for additional neural networks or manual labels.

Methodology: Motion and Tracking on the Generative Manifold

DragGAN operates by navigating the "generative manifold"—the latent space representing all possible images the GAN can produce. The system does not require external supervision; instead, it leverages the internal discriminative features of a pre-trained StyleGAN2. The process is iterative, consisting of two primary components:

1. Motion Supervision

When a user defines a "handle point" (source) and a "target point" (destination), the system optimizes the GAN’s latent code ($w$). It employs a shifted patch loss on the generator's internal feature maps. This loss encourages the features at the handle point to move incrementally toward the target. To maintain the object's identity while changing its shape or pose, optimization is restricted to the first few layers of the StyleGAN2 architecture, which govern spatial structure rather than fine-grained appearance.

2. Point Tracking

As the latent code is updated, the image content shifts. To ensure the "handle" remains attached to the correct semantic part (e.g., the tip of a lion's nose), DragGAN performs point tracking. It utilizes a nearest neighbor search within the GAN’s own feature space. Because these internal features are highly discriminative, the generator effectively acts as its own tracker, identifying the new location of the handle point without needing external models like optical flow.

Key Insights

The success of DragGAN stems from several critical observations regarding the nature of generative models:

  • The GAN as its own Tracker: The intermediate feature maps of a GAN contain sufficient spatial information to track points across deformations, eliminating the need for separate tracking AI.
  • Hallucination via Manifold Constraints: Because edits occur within the learned latent space, the model naturally maintains physical plausibility. When a user drags a face to turn it sideways, the GAN "hallucinates" previously hidden features, such as an ear, based on the statistical patterns it learned during training.
  • Selective Latent Optimization: By targeting the first six layers of the $w^+$ latent space, the system can decouple pose and shape from fine-grained details like texture and color, ensuring the subject's identity remains intact during manipulation.

Results and Performance

The researchers evaluated DragGAN across a wide variety of datasets, including human faces (FFHQ), cars (LSUN Car), and various animal categories (AFHQ).

  • Precision and Quality: DragGAN consistently outperformed state-of-the-art methods in landmark precision tests. Furthermore, it maintained higher image quality (measured by FID scores) than methods using external trackers, which often suffer from visual artifacts or "drifting" during the editing process.
  • Efficiency: The process is highly efficient. On a single NVIDIA RTX 3090 GPU, most edits are processed in a few seconds, facilitating a truly interactive "live" user experience.
  • Real-World Utility: Through GAN inversion, the system can edit real photographs by first mapping them into the GAN's latent space, then applying the point-based manipulation to the reconstructed image.

Limitations and Future Outlook

While powerful, DragGAN faces challenges with Out-of-Distribution (OOD) poses. If a user attempts to drag an object into a configuration never seen during training (e.g., an impossible limb twist), the model may produce artifacts. Additionally, tracking can lose accuracy in texture-less regions where feature maps lack distinctiveness. Future work may involve extending these techniques to 3D generative models to provide even more robust spatial manipulation.

Summary updated

BibTeX
@inproceedings{pan2023drag,
  author = {Xingang Pan and Ayush Tewari and Thomas Leimkühler and Lingjie Liu and Abhimitra Meka and Christian Theobalt},
  title = {{Drag Your GAN: Interactive Point-based Manipulation on the Generative Image Manifold}},
  booktitle = {SIGGRAPH (Conference Paper Track)},
  year = {2023},
  doi = {10.1145/3588432.3591500},
}
Figure