TopGit
GitHub Repo Review

DragGAN: Image Manipulation with Point Dragging

XingangPan/DragGAN
DTopGit review image for XingangPan/DragGAN
Review by Topgit.dev for XingangPan/DragGAN, with GitHub repository stats and README context.
Quick verdict

DragGAN turns image editing into a drag-and-drop interaction: place a handle point and a target point on a StyleGAN2-generated image, and the model reshapes it as you drag. It's a genuinely different editing gesture than prompting or masking, and it works as advertised. The catch: it only edits generated images out of the box, and the CC-BY-NC license rules out commercial use.

Stars
★ 35.7k
Forks
⑂ 3.4k
Language
Python
License
See repository
Topic
AI Tools
Updated
May 2024
Homepage
GitHub

What is DragGAN

DragGAN is the official implementation of 'Drag Your GAN,' a SIGGRAPH 2023 paper by Xingang Pan and coauthors that edits images by dragging points instead of typing a prompt or painting a mask. You place a handle point and a target point on a StyleGAN2-generated image, and DragGAN iteratively moves the latent code so that point's features track toward the target, keeping the rest of the image coherent.

Core features of DragGAN

  • ✓Point-based dragging: place multiple handle/target point pairs on a face, animal, or car and drag features — open an eye, turn a head, reshape a car body — interactively.
  • ✓Runs against StyleGAN2's latent space, so each edit regenerates a full coherent image instead of patching individual pixels.
  • ✓Ships both a native GUI (scripts/gui.sh or gui.bat) and a Gradio web demo (visualizer_drag_gradio.py) for the same workflow.
  • ✓Includes a download_model.py script for pretrained StyleGAN2 weights, plus optional StyleGAN-Human and Landscapes HQ (LHQ) checkpoints.
  • ✓Supports GAN inversion via external tools like PTI, so a real photo's latent code can be loaded and edited, not just synthetic faces.
  • ✓Dockerized visualizer for one-command setup with optional GPU passthrough.
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history ↗

Installing DragGAN

DragGAN's install path branches on your hardware. With an NVIDIA GPU, follow NVlabs/stylegan3's requirements, then run `conda env create -f environment.yml`, `conda activate stylegan3`, and `pip install -r requirements.txt`. Without CUDA — including Apple Silicon M1/M2 or CPU-only — strip the nvidia/cuda lines from environment.yml before creating the environment, then export `PYTORCH_ENABLE_MPS_FALLBACK=1` on macOS. Either way, fetch the pretrained StyleGAN2 weights with `python scripts/download_model.py` before launching the GUI or Gradio demo; optional StyleGAN-Human and Landscapes HQ (LHQ) checkpoints go under `./checkpoints`. There's also a Docker path: build the image, run it with the provided `docker run` command (add `--gpus all` for GPU passthrough), and launch the Gradio visualizer inside the container — budget about 25GB of disk space for the image.

Strengths

  • ✓Dragging points to reshape a face, animal, or car is a genuinely different editing gesture than prompting or masking, and it's fast to reason about.
  • ✓Two ready-made interfaces — a native GUI and a Gradio web demo — mean you're not building UI just to try the idea.
  • ✓The Mac M1/CPU fallback path is documented, not an afterthought bolted onto a CUDA-only project.
  • ✓download_model.py and the Docker image get you from clone to working demo without hunting for checkpoints yourself.

DragGAN requirements and constraints

  • △Editing a real photo isn't built in — you need a separate GAN inversion step (the README suggests PTI) to get a latent code before DragGAN can touch it.
  • △The DragGAN algorithm code is CC-BY-NC, and the rest of the codebase inherits Nvidia's Source Code License from StyleGAN3, so commercial use is blocked on two fronts.
  • △Any derivative must keep the 'AI Generated' watermark the README mandates, which limits how freely you can repackage output.
  • △Full GPU setup mirrors StyleGAN3's CUDA requirements, and the Docker image alone takes about 25GB of disk space.
  • △You're limited to whatever checkpoint you load — StyleGAN2, StyleGAN-Human, or the LHQ landscapes set — there's no general-purpose model behind the interaction.

Alternatives to DragGAN

Frequently asked questions about DragGAN

What license is DragGAN released under?

DragGAN's own algorithm code is licensed under CC-BY-NC (noncommercial use only), while most of the rest of the codebase — anything derived from StyleGAN3 — falls under Nvidia's Source Code License. Any use or derivative must also keep the 'AI Generated' watermark DragGAN adds to its output.

Can I run DragGAN on Mac M1 or without NVIDIA GPU?

DragGAN supports Mac M1/M2 and CPU-only setups: strip the nvidia/cuda lines from environment.yml before creating the conda environment, then set PYTORCH_ENABLE_MPS_FALLBACK=1 on macOS. It will run slower than the CUDA path documented for StyleGAN3.

Does DragGAN work with real photos or only generated images?

DragGAN's GUI edits GAN-generated images directly, but editing a real photo needs an extra GAN inversion step first — the README points to external tools like PTI to compute the image's latent code, which you then load into DragGAN before dragging points.

What pretrained models does DragGAN support?

DragGAN ships a script, download_model.py, that fetches pretrained StyleGAN2 weights, and the README also links optional checkpoints for StyleGAN-Human (human body images) and the Landscapes HQ (LHQ) dataset for scenes. Place any of these under the ./checkpoints folder before running the GUI or Gradio demo.

How is DragGAN different from StyleGAN editing?

Standard StyleGAN editing usually means moving along a semantic direction found in latent space (like a 'smile' vector) or manually tweaking latent codes. DragGAN instead lets you place handle and target points directly on the image and drags the underlying features toward the target through iterative point tracking and latent optimization.

Is DragGAN production ready for commercial use?

DragGAN is not licensed for commercial use — the algorithm code is CC-BY-NC (noncommercial) and the StyleGAN3-derived portions carry Nvidia's Source Code License, plus any derivative must preserve the 'AI Generated' watermark. Treat it as a research and prototyping codebase, not a production-ready commercial product.

The problem it solves

Most GAN-based image editing before DragGAN meant either training a separate network for each specific edit (a 'make him smile' model) or hunting through latent space for a semantic direction that happens to do what you want, with no guarantee it generalizes across images. DragGAN replaces that search with direct manipulation: mark where a feature is and where it should go, and the optimization finds the latent trajectory, so one method covers open-ended edits — reshape a jawline, turn a car, open an eye — without pretraining a network per edit type.

Best use cases

  • •Prototyping point-based face-editing demos — open/close eyes, change pose or expression — on StyleGAN2-generated portraits.
  • •Studying or extending the drag-optimization plus point-tracking method described in the SIGGRAPH 2023 paper without reimplementing it.
  • •Editing a specific real photo after running GAN inversion (e.g. with PTI) to obtain its latent code.
  • •Trying body-pose or landscape edits by swapping in the StyleGAN-Human or LHQ checkpoints instead of the default face model.

Who should try it — and who should skip

Try DragGAN if you're researching point-based generative editing, building a demo on StyleGAN2 outputs, or reproducing the SIGGRAPH 2023 paper's results — the GUI and Gradio demo get you dragging points within minutes of downloading weights. Skip it if you need to edit arbitrary real-world photos without a separate GAN-inversion step, need a commercial license (the algorithm code is CC-BY-NC and the rest inherits Nvidia's noncommercial terms), or don't want to manage a CUDA environment or a 25GB Docker image just to try it.

Related repositories

Source & attribution

Based on the XingangPan/DragGAN GitHub repository, its README, and the SIGGRAPH 2023 paper it accompanies.

GitHub data · last synced Aug 15, 2026Reviewed by Henry
← Back to TopGit

Want a second opinion on DragGAN?

Ask an AI that can read this page — one click and you get its take on DragGAN.

GitHub