https://github.com/mingtaoguo/draggan_pytorch
Unofficial implementation of DragGAN with StyleGAN2/3 pretrained models
https://github.com/mingtaoguo/draggan_pytorch
draggan gans image-editing stylegan2 stylegan3
Last synced: 3 months ago
JSON representation
Unofficial implementation of DragGAN with StyleGAN2/3 pretrained models
- Host: GitHub
- URL: https://github.com/mingtaoguo/draggan_pytorch
- Owner: MingtaoGuo
- License: mit
- Created: 2023-05-23T13:18:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-26T11:07:10.000Z (over 2 years ago)
- Last Synced: 2025-04-05T13:11:21.347Z (6 months ago)
- Topics: draggan, gans, image-editing, stylegan2, stylegan3
- Language: Python
- Homepage:
- Size: 154 MB
- Stars: 96
- Watchers: 4
- Forks: 11
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DragGAN_stylegan3
Unofficial implementation of DragGAN with StyleGAN2/3 pretrained models## Description
--------------This repo is mainly to re-implement DragGAN based on stylegan2/3
- DragGAN: [Drag Your GAN: Interactive Point-based Manipulation on the
Generative Image Manifold](https://vcai.mpi-inf.mpg.de/projects/DragGAN/)
## Web Demo
Trying out the Web Demo for dragging your own image: [](https://huggingface.co/spaces/wuutiing2/DragGAN_pytorch)
## 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](https://docs.anaconda.com/anaconda/install/) or Docker.
All dependencies for defining the environment are provided in `environment.yaml` and `Dockerfile` .### Dragging
Downloading the stylegan2 pretrained models:
- [stylegan2-ffhq-512x512.pt](https://drive.google.com/file/d/1OFbkHKkBOtrskyDbOrgVfjoq2eKIiTMs/view?usp=share_link)
- [stylegan2-afhqwild-512x512.pt](https://drive.google.com/file/d/1L4YN1iVC8urhW6EqCzJzJAa_Gz0_Ik7M/view?usp=share_link)
- [stylegan2-afhqdog-512x512.pt](https://drive.google.com/file/d/1pRqs6AEHaAkPaz-YbgXMSCmswhGlKnrt/view?usp=share_link)
- [stylegan2-afhqcat-512x512.pt](https://drive.google.com/file/d/1QUE-70ccfaJaYh890x-16lueoXc9y6V4/view?usp=share_link)
- [stylegan2-human-1024x1024.pt](https://drive.google.com/file/d/1cK6KHH19iF09iMUg-iUDrl_TMIq8HGhC/view?usp=share_link)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](https://github.com/NVlabs/stylegan3)
[stylegan-human](https://github.com/stylegan-human/StyleGAN-Human)
[cutout team](https://www.cutout.pro/)
## Reference
[1]. Pan, Xingang, et al. "Drag Your GAN: Interactive Point-based Manipulation on the Generative Image Manifold." arXiv preprint arXiv:2305.10973 (2023).