forked from: https://gist.github.com/lzhbrian/bde87ab23b499dd02ba4f588258f57d5
may also check other references:
https://github.com/yuval-alaluf/hyperstyle/blob/main/scripts/align_faces_parallel.py
requirements:
pip install numpy pillow dlib scipy
wget http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
bzip2 -dk shape_predictor_68_face_landmarks.dat.bz2
ln -sf /usr/lib/x86_64-linux-gnu/libstdc .so.6 ${CONDA_PREFIX}/lib/libstdc .so.6
usage: python align_face_multi.py --input_dir /path/to/img_dir
, you may adjust the number of cores for multi-processing.
For in-code face alignment (no separate data preprocessing through CLI), refer to facexlib
where an example in GFPGAN is given here.
sanity check of facexlib code justifies it with the following links: face_template values · Issue #14 · xinntao/facexlib and source code.