Facenix is a face attribute manipulating application. This app is deployed by using Django web framework with STGAN and StyleGAN models as backend.
Video demonstration: Youtube
-
Environment
-
Python 3.6
-
TensorFlow 2.1.0
-
OpenCV, Django, scikit learn,...
-
We recommend Anaconda or Miniconda, then you can create the environment with commands below
conda create -n tf2 python=3.6 conda activate tf2 pip install --upgrade pip pip install tensorflow==2.1.0 pip install tensorflow_addons pip install django pip install dlib pip install opencv-python pip install sklearn pip install pillow pip install requests matplotlib
-
-
Run web application All commands are run from facenix directory after "git clone"
- Download pre-trained models
- weights.zip Google Drive
- Unzip and copy all folders into facenix/
unzip weights.zip
- Run web application
cd web_app ./runserver.sh
- Open web browser. Go to http://127.0.0.1:8000/. After the web page is loaded, you can try your own sample. If you would like to run web server on specific IP and port, you can pass it as arguments.
e.g. ./runserver.sh 192.168.1.254:8888
- Download pre-trained models
-
Re-training models
-
Make sure to clean all previous training
./clean_all.sh
-
STGAN dataset preparation: CelebA aligned
-
download the dataset
- img_align_celeba_crop_128.zip (move to facenix/data/img_align_celeba.zip): Google Drive
- list_attr_celeba.txt (move to facenix/data/list_attr_celeba.txt): Google Drive
-
unzip the dataset
cd data unzip ./img_align_celeba.zip
-
-
StyleGAN dataset preparation: CelebA-HQ
-
download the dataset
- CelebAMask-HQ.zip (move to facenix/data/CelebAMask-HQ.zip): Google Drive
-
unzip the dataset
cd data unzip ./CelebAMask-HQ.zip
-
-
Train STGAN
cd stgan python train.py --experiment_name origin
-
Train StyleGAN
-
Train generator
cd stylegan python train.py --experiment_name origin
-
Train classifier
cd classifier python train.py
-
Train attribute vectors
cd att_vector_finder python sample_maker.py python vector_finder.py
-
-
-
Samples STGAN
- Samples StyleGAN
- Attribute editing is not always successful.
- When editing with StyleGAN, the same picture could be led to different results each time the image is uploaded.
- The web server can serve 1 user each time due to high computing cost.