https://github.com/inventwithdean/pix2pixhd
A PyTorch implementation of Pix2PixHD to generate 1024x1024 HD images of Celebrities using sketches.
https://github.com/inventwithdean/pix2pixhd
celeba-hq imagegeneration pix2pix-pytorch pix2pixhd pytorch
Last synced: 17 days ago
JSON representation
A PyTorch implementation of Pix2PixHD to generate 1024x1024 HD images of Celebrities using sketches.
- Host: GitHub
- URL: https://github.com/inventwithdean/pix2pixhd
- Owner: inventwithdean
- Created: 2024-10-05T06:28:42.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-16T02:31:32.000Z (8 months ago)
- Last Synced: 2025-04-01T02:12:42.075Z (about 2 months ago)
- Topics: celeba-hq, imagegeneration, pix2pix-pytorch, pix2pixhd, pytorch
- Language: Python
- Homepage:
- Size: 22.5 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pix2PixHD: Edges to Faces - CelebA-HQ
(
> *Generating photorealistic faces from edge maps using Conditional GANs (Pix2PixHD)*## ๐ Overview
Welcome to the **Pix2PixHD: Edges to Faces** project! In this repository, Iโve implemented and trained a modified **Pix2PixHD** model to generate high-resolution (1024x1024) photorealistic face images from edge maps using the **CelebA-HQ** dataset. This project extends the groundbreaking work presented in [โHigh-Resolution Image Synthesis and Semantic Manipulation with Conditional GANsโ](https://arxiv.org/abs/1711.11585), providing an exciting tool for tasks such as sketch-based image synthesis and image editing.## ๐ Results
The model takes edge maps as input and generates stunning, realistic face images. Below are some results from Phase 1 of training:| Input (Edge Map) | Output (Generated Image) |
|:----------------:|:-----------------------:|
|  |  |
|  |  |
|  |  |These outputs are produced using Global Generator with **512x512** resolution, giving exceptional detail and realism!
## ๐ Original Paper
This implementation is based on the paper [โHigh-Resolution Image Synthesis and Semantic Manipulation with Conditional GANsโ](https://arxiv.org/abs/1711.11585) by Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, and others. Pix2PixHD builds on the standard Pix2Pix architecture to produce images with higher resolutions and fidelity, especially useful for tasks such as semantic image synthesis.## ๐ Project Structure
- **`/data`**: Contains the dataset preprocessing scripts and edge map generation using Canny edge detection.
- **`./`**: The core PyTorch implementation of Pix2PixHD, including Global Generator, Local Enhancer, and the multi-scale Discriminators.
- **`/output`**: The generated outputs from the model.
- **`train.py`**: Script for training the model on edge-to-image task.## โ๏ธ How to Run
### Prerequisites
To get started, make sure you have the following installed:
- Python 3.12.x
- PyTorch 2.4.x with CUDA### Installation
1. Clone the repository:
```bash
git clone https://github.com/inventwithdean/pix2pixhd.git
cd pix2pixhd
```
2. Download the **CelebA-HQ** dataset and place it in the `/data` folder. You can find it [here](https://mmlab.ie.cuhk.edu.hk/projects/CelebA.html).
3. Make sure you have all the faces inside `data/faces` folder. And create a directory `data/sketches`.
4. Generating edge maps:
```bash
python create_dataset.py
```### Training
To train the model on the edge-to-face task, run:
```bash
python train.py
```
Create directories `enhanced_checkpoints` and `global_checkpoints` for checkpointing.## ๐ Features
- **High-Resolution Synthesis**: Generates 1024x1024 images from edge maps.
- **Conditional GAN Architecture**: Uses multi-scale discriminators for improved realism.
- **Instance-Level Control (WIP)**: Planned updates for fine-tuning specific features in generated images.
## ๐ Future Work
- Instance-wise control for fine-grained editing of facial features.
- Further improvements to training strategies for faster convergence.
- Integration of new datasets for generalization beyond CelebA-HQ.## ๐ ๏ธ Contributing
Feel free to fork this repo, submit issues, or make pull requests. Contributions are always welcome to improve the codebase!## ๐ฌ Contact
If you have any questions or feedback, feel free to reach out to me via [LinkedIn](https://www.linkedin.com/in/inventwithdean) or open an issue on GitHub.## ๐ก Acknowledgements
This work is inspired by the original **Pix2PixHD** implementation by [NVIDIA](https://github.com/NVIDIA/pix2pixHD) and the creators of the **CelebA-HQ** dataset.---
Enjoy experimenting! If you like the project, donโt forget to give it a โญ on GitHub!