FaceCraft is a realistic face generator engineered using a StyleGan2 architecture.
FaceCraft's repository lets you train the model yourself or generate a face from a saved checkpoint locally.
Generate a face on our HuggingFace space: FaceCraft
- High-Resolution Image Generation: Generate images at different resolutions by adjusting the `LOG_RESOLUTION` setting.
- Noise Mapping and Style Injection: Implements a noise mapping network and uses style vectors to modulate the weights in the convolution layers.
- Gradient Penalty and Path Length Penalty: Includes implementations for WGAN-GP loss and perceptual path length regularization to stabilize training.
- Checkpointing: Supports saving and loading model checkpoints to resume training or perform inference at various stages.
NVIDIA Drivers
Install python 3.11.9+
Install Docker
Install Flickr-Faces-HQ Dataset: pip install kaggle && kaggle datasets download -d rahulbhalley/ffhq-1024x1024
Unzip the images. Images should be organized into subdirectories representing different classes if using `ImageFolder`.
Clone the Repository: git clone https://github.com/EthanStanks/FaceCraft
Build the docker image (takes 10 minutes)
docker build -f Dockerfile_Train -t facecraft-train:1.1 .
Run the container
docker run --gpus all -it -d -e DISPLAY=$DISPLAY -p 6006:6006 -v ${PWD}:/app facecraft-train:1.1
Open Visual Studio Code
code .
(Optional) Install Python Extension
Install Remote Development Extension
Attach Current Window to Container
Click the "Attach in Current Window" arrow next to "facecraft-train:1.1"
Navigate to the app directory
cd ../app
Run the Training Script
python Training/src/train.py
Build the docker image (takes 10 minutes)
docker build -f Dockerfile_App -t facecraft-app:1.1 .
Run the container
docker run --gpus all -it -e DISPLAY=$DISPLAY -p 7860:7860 -v ${PWD}:/app facecraft-app:1.1
Enter LocalHost:7860 Inside Broswer URL
0.0.0.0:7860
The Flickr-Faces-HQ Dataset (FFHQ) was used to train and test the GANs and Discriminator models with over 70,000 images of faces. FFHQ Dataset can be found here: Flickr-Faces-HQ Dataset
Special thank you to these individuals who helped us along the way!
- Rebecca Carroll
- Chad Gibson
- Philip Smith
This project is open-sourced under the MIT license. See the LICENSE file for more details.
The FaceCraft team is finished with the project. Check out each of our blogs if you'd like to read about our 5 months of work: