/DragGAN_pytorch

Unofficial implementation of DragGAN with StyleGAN2/3 pretrained models

Primary LanguagePythonMIT LicenseMIT

DragGAN_stylegan3

Unofficial implementation of DragGAN with StyleGAN2/3 pretrained models

Description


This repo is mainly to re-implement DragGAN based on stylegan2/3

Web Demo

Trying out the Web Demo for dragging your own image: Hugging Face Spaces

Getting Started

Prerequisites

  • Linux or macOS
  • NVIDIA GPU + CUDA CuDNN
  • Python 3

Installation

  • Clone the repository:
git clone https://github.com/MingtaoGuo/DragGAN_stylegan3.git
cd DragGAN_stylegan3
  • Dependencies:
    We recommend running this repository using Anaconda or Docker. All dependencies for defining the environment are provided in environment.yaml and Dockerfile .

Dragging

Downloading the stylegan2 pretrained models:

Drag generated image:

python draggan_stylegan2.py

Drag generated human image:

python draggan_stylegan2_human.py

Drag real image:

python draggan_stylegan2_realimg.py

In the draggan_stylegan2.py, src_points (red point in image) will be dragged to the tar_points (blue point in image), so just revise the points in src_points and tar_points.

Results

Drag generated image

FFHQ1 FFHQ2
Human1 Human2
AFHQ1 AFHQ2
AFHQ_Cat1 AFHQ_Cat2
AFHQ_Dog1 AFHQ_Dog2

Drag real image

Real image Projected image Drag Result

Author

Mingtao Guo E-mail: gmt798714378 at hotmail dot com

Acknowledgement

stylegan3 stylegan-human cutout team

Reference

[1]. Pan, Xingang, et al. "Drag Your GAN: Interactive Point-based Manipulation on the Generative Image Manifold." arXiv preprint arXiv:2305.10973 (2023).