From 36baf819a0e87f086339890c7d811f1826a6499e Mon Sep 17 00:00:00 2001 From: Eklavya SARKAR <eklavya.sarkar@idiap.ch> Date: Thu, 10 Mar 2022 19:42:02 +0100 Subject: [PATCH] More README formatting --- README.rst | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/README.rst b/README.rst index 08db191..ba0572a 100644 --- a/README.rst +++ b/README.rst @@ -33,41 +33,44 @@ Downloading Models ------------------ The projection process relies on several pre-existing models: - * **DLIB Face Landmark detector** for cropping and aligning the projected faces exactly as in FFHQ. (Example_). - * StyleGAN2_ as the main face synthesis network. (Original repository_). We are using Config-F, trained on FFHQ at resolution 1024 x 1024. - * A pretrained VGG16_ model, used to compute a perceptual loss between projected and target image. +* **DLIB Face Landmark detector** for cropping and aligning the projected faces exactly as in FFHQ. (Example_). +* StyleGAN2_ as the main face synthesis network. (Original repository_). We are using Config-F, trained on FFHQ at resolution 1024 x 1024. +* A pretrained VGG16_ model, used to compute a perceptual loss between projected and target image. -In order to download those models, one must specify the destination path in the ``~/.bobrc`` file, through the following commands:: +In order to download those models, one must specify the destination path of choice in the ``~/.bobrc`` file, through the following commands:: $ bob config set sg2_morph.dlib_lmd_path /path/to/dlib/landmark/detector.dat $ bob config set sg2_morph.sg2_path /path/to/stylegan2/pretrained/model.pkl $ bob config set sg2_morph.vgg16_path /path/to/vgg16/pretrained/model.pkl Finally, all the models can be downloaded by running:: - $ python download_models.py + $ python download_models.py. Generating Morphs ------------------ **Note**: StyleGAN2 requires custom GPU-only operations, and at least 12 GB of GPU RAM. Therefore, to run all following examples and perform additional experiments, it is necessary to run this code on a GPU. -The morphs of the following varieties can be generated with ``gen_morphs.py``: +The script options can be viewed with:: - * OpenCV - * FaceMorpher - * StyleGAN2 - * MIPGAN-II + $ python gen_morphs.py -h + +The morphs of the following types of morphs can be generated at different alphas: + +* OpenCV +* FaceMorpher +* StyleGAN2 +* MIPGAN-II Typical usage:: $ conda activate bob.paper.icassp2021_morph $ python gen_morphs.py --opencv --facemorpher --stylegan2 --mipgan2 -s path/to/folder/of/images/ -l path/to/csv/of/pairs.csv -d path/to/destination/folder --latents path/to/latent/vectors --alphas 0.3 0.5 0.7 - -The ``pairs.csv`` file should simply be a 2 column `.csv` file **without a header** containing only the filenames of the 2 images you want to morph: - * image1.png, image2.png - * image1.png, image3.png +The ``pairs.csv`` file should simply be a 2 column `.csv` file **without a header** containing only the filenames of the 2 images you want to morph: +* image1.png, image2.png +* image1.png, image3.png **Note**: Keep in mind that for the ``--stylegan2`` and ``--mipgan2`` arguments, it is necessary to have the latent vectors of all required images generated **beforehand**. @@ -78,7 +81,7 @@ This can be done with the ``gen_latents.py``. Typical usage:: License ------- -This package is released under a custom `license <https://gitlab.idiap.ch/bob/bob.paper.icassp2022_morph_generate/-/blob/master/LICENSE.txt>`_. It uses some components from the `official release of the StyleGAN2 model <https://github.com/NVlabs/stylegan2>`_, which is itself released under the `Nvidia Source Code License-NC <https://gitlab.idiap.ch/bob/bob.paper.ijcb2021_synthetic_dataset/-/blob/master/bob/paper/ijcb2021_synthetic_dataset/stylegan2/LICENSE.txt>`_. +This package uses some components from the `official release of the StyleGAN2 model <https://github.com/NVlabs/stylegan2>`_, which is itself released under the `Nvidia Source Code License-NC <https://gitlab.idiap.ch/bob/bob.paper.ijcb2021_synthetic_dataset/-/blob/master/bob/paper/ijcb2021_synthetic_dataset/stylegan2/LICENSE.txt>`_. Contact @@ -88,10 +91,6 @@ For questions or reporting issues to this software package, kindly contact our development team by asking your question on `stackoverflow`_ and with the tag *python-bob*, or alternatively contact the first author_. .. _author: eklavya.sarkar@idiap.ch - -Before doing that, check our documentation by clicking in the links on the top. - -.. Place your references here: .. _bob: https://www.idiap.ch/software/bob .. _installation: https://www.idiap.ch/software/bob/install .. _conda: https://conda.io -- GitLab