Create landmarks

The first step is to run an python script which analyzes the image and determines the location of facial landmarks. The script is based on the Facial landmarks tutorial from www.learnopencv.com,

Because this script uses dlib, and in particular the dlib landmark detector, it can not be run from Blender. Instead we must run the script from a terminal window.

Open a terminal window (command prompt), and go to the AutoFace directory and then to the standalone subdirectory. On my Windows 7 machine, the full path is

C:\Users\Thomas\AppData\Roaming\Blender Foundation\Blender\2.79
\scripts\addons\autoface\standalone

Then run the following command:

python landmarks.py <input image> <basemesh> [-d <directory>]

The standalone scripts look for input images at the following locations:
  • A directory explicitly specified with the optional -d (or --dir) keyword.
  • In the directory AUTOFACE_DIR/inputs/.
  • In the example folder, autoface/exprnet/figures/ included with the add-on.
Here AUTOFACE_DIR is the main AutoFace work directory specified in config.txt, and the basemesh is either g8m or g8f, depending on whether the character is male of female. In the future additional base meshes may become available available.

AutoFace comes with three example images, located in the subdirectory exprnet/figures, which we will upload to Google Drive eventually.

Image credit: The images of Secretary Hillary Clinton and Senator Ted Cruz are in the Public Domain, while the image of Donald Trump is licensed under Creative Commons Attribution-Share Alike 2.0 Generic license.

To find the landmarks of two of the images, one male and one female, we issue the commands
python landmarks.py donald_trump.jpg g8m
python landmarks.py hillary_clinton.jpg g8f

When the script has finished, the image with the detected landmarks shown.


This script also creates five new directories under the AUTOFACE_DIR directory specified in config.txt.
  • icons: Contains a small copy of the original image, to be used as thumbnails in DAZ Studio.
  • figures: A copy of the input image and a csv file specifying the face's bounding box. This directory will be uploaded to Google Drive for analysis with the deep neural network.
  • results: Contains data about the image, to be used by other scripts.
  • parameters: Will contain the amplitudes for the eigenfaces after analysis by the deep neural network.
  • textures: Will contain the modified textures generated by the patch.py script.
 Only AUTOFACE_DIR/icons and AUTOFACE_DIR/figures  are filled with content by the landmarks script, the other directories are used later.