python 中的 openface alignlib

openface alignlib in python

我知道这是 openface 最愚蠢的问题但是我是 openface 的新手,我无法弄清楚这个问题

align = openface.AlignDlib()

我们需要在争论中传递什么。在 openface 文档中写着

align = openface.AlignDlib(args.dlibFacePredictor)

它在文档中说,参数是一个 dtring,它是 dlib 的路径。

我不知道这是什么意思这是我的第一个 openface 程序

该字符串预计会导致一些预训练模型(驻留在您的硬盘上)。列出了一些 dlib-models here(官方开发者)。

在openface方面,code显示:

mkdir -p dlib
if [ ! -f dlib/shape_predictor_68_face_landmarks.dat ]; then
  printf "\n\n====================================================\n"
  printf "Downloading dlib's public domain face landmarks model.\n"
  printf "Reference: https://github.com/davisking/dlib-models\n\n"
  printf "This will incur about 60MB of network traffic for the compressed\n"
  printf "models that will decompress to about 100MB on disk.\n"
  printf "====================================================\n\n"
  wget -nv \
       http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2 \
       -O dlib/shape_predictor_68_face_landmarks.dat.bz2
  [ $? -eq 0 ] || die "+ Error in wget."
  bunzip2 dlib/shape_predictor_68_face_landmarks.dat.bz2
  [ $? -eq 0 ] || die "+ Error using bunzip2."
fi

含义:它是shape_predictor_68_face_landmarks.dat(上面列表的一部分)。

您可以查看代码以获得更多理解,例如here:

def __init__(self, inputDir, outputDir, verbose):
    self.inputDir = inputDir
    self.dlibFacePredictor = os.path.join(
        dlibModelDir, "shape_predictor_68_face_landmarks.dat")