pytorch image-generation gan stylegan stylegan3 nvidia license:mit region:us
---
license: mit
library_name: pytorch
tags:
- image-generation
- gan
- stylegan
- stylegan3
- nvidia
---
# Male Faces Generator (StyleGAN3 by NVIDIA)

![sampleimages](SampleImages.png)

This is a [StyleGAN3 PyTorch](https://github.com/NVlabs/stylegan3) model trained on 50k faces of men scraped from pinterest and its associated bias.

### Usage

Demo on Spaces is not yet implemented.

If you want to generate your own images, follow the steps on [StyleGAN3 PyTorch](https://github.com/NVlabs/stylegan3) under "Getting started." Run gen_images.py and specify your seed and truncation.

#### Sample Images
Sample images were generated directly from model with no-postprocessing. Images were generated using a truncation of: '0.7'
Recommend using [CodeFormer](https://github.com/sczhou/CodeFormer) to restore faces and upscale to desired resolution (I like upscaling by 2x to 512x512).

### Dataset & Model Details

Dataset was scraped from pinterest and cropped using dlib. Further symmetry and rotation filtering applied via U2Net and MTCNN.

Training was done locally using StyleGAN3 with an RTX 4090 and cuda 11.8. Starting checkpoint was the ffhq 256x256 pre-trained model. Training took roughly 24 hours but hyperparameter tuning/restarting was modified about halfway through. Roughly at 400 ticks, dataset was filtered and reduced by half to images with greater symmetry.  

- Configuration: `stylegan3-r`
- GPUs: `1`
- Batch Size: `32`
- Gamma: `6.6`
- Final tick: `575`
- Image Resolution: '256x256'
- Final fid50k_full value (this pickle): `13.854398226827872`

### Credits

Please don't forget to give credit if you decide to share/distribute this model. Training these take a lot of time and effort :) 