Exercises
- We used pre-existing libraries for face detection, landmarking, and aligning landmarks. There are other libraries that offer similar functionality. Not all libraries work the same way, and implementing the differences is an extremely useful exercise. Try replacing the
face_alignment
library with another library for detecting faces, such as https://github.com/timesler/facenet-pytorch or https://github.com/serengil/deepface. Open source has lots of useful libraries but learning the differences and when to use one over another can be difficult, and converting between them can be a useful practice. - We used
2D
landmarks for alignment in this chapter, but there may be a need for3D
landmarks instead. Try replacing the following:face_aligner = FaceAlignment(LandmarksType._2D, Â Â device=device, verbose=False)
with:
face_aligner = FaceAlignment(LandmarksType._3D, Â Â device=device, verbose=False)
and adjust the rest of the process accordingly...