Skip to content
StyleGAN - Official TensorFlow Implementation
Python Jupyter Notebook
Branch: master
Clone or download
Pull request Compare This branch is 4 commits ahead of halcy:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
metrics Initial commit. Feb 5, 2019
training Initial commit. Feb 5, 2019
.gitignore Add Bottle server. Jul 1, 2019
LICENSE.txt Update Jun 28, 2019
Stylegan-Generate-Encode.ipynb Improve interactive modification Mar 2, 2019
Stylegan-Interactive-Modification.ipynb Add Bottle server. Jul 1, 2019
mod_latents.npy Add interactive modification Mar 2, 2019 Initial commit. Feb 5, 2019
stylegan-teaser.png Initial commit. Feb 5, 2019
tag_dirs.pkl Add modification code and directions Feb 25, 2019
tags_use.pkl Add interactive modification Mar 2, 2019

Script to animate the mouth position of StyleGAN output from an audio file.


ffmpeg and NVIDIA CUDA drivers must be installed.

Prepare Python Environment

conda create -n animate pip python=3.7
conda activate animate
pip install tensorflow-gpu pillow requests sklearn pydub

Download a StyleGAN model file, like:


python <MP3 path> <Model path> <Output path>


python ~/data/presentday.mp3 ~/data 2019-04-30-stylegan-danbooru2018-portraits-02095-066083.pkl presentday.mp4


usage: [-h] [--psi PSI] [--truncate_pre TRUNCATE_PRE]
                        [--truncate_post TRUNCATE_POST]
                        [--output_dir OUTPUT_DIR] [--delete_imgs DELETE_IMGS]
                        [--randomize_noise RANDOMIZE_NOISE] [--seed SEED]
                        audio stylegan output

positional arguments:
  audio                 The filename of the audio file.
  stylegan              The filename of the StyleGAN pkl file.
  output                Set output filename of ffmpeg

optional arguments:
  -h, --help            show this help message and exit
  --psi PSI             The truncation psi. Default 0.7.
  --truncate_pre TRUNCATE_PRE
                        Truncate before dlatent modification. Default True.
  --truncate_post TRUNCATE_POST
                        Truncate after dlatent modification. Default True.
  --output_dir OUTPUT_DIR
                        Directory to output images to.
  --randomize_noise RANDOMIZE_NOISE
                        Whether to randomize the noise every step. Default False.
  --seed SEED           Random seed. 


The audio amplitude to mouth position mapping is pretty basic and could use some improvement.

See for original README. Tags from

You can’t perform that action at this time.