Facial Landmarks with Raspberry Pi and Python

Опубликовано: 03 Август 2026
на канале: aveevu
282
5

My ultimate goal is to do facial sentiment recognition with the raspberry pi. I give updates at joshlamstein.com.

Because robots aren't smart enough, I'm teaching the raspberry pi to recognize and follow faces. Using Python's dlib library and two servo motors, the script finds 68 facial landmarks and tracks the face. The tracking was tricky as sometimes the servo would overshoot or wouldn't go far enough. I think a clear method would be to approximate the distance of the person based on the width of their head. This assumes everyone has the same sized head, which is hand-wavy. But, knowing the distance lets us know the angle the servo need to turn. Ideally, you would use a depth sensor for better accuracy. In this video, I just divided the displacement of my face from the center of the frame by a constant (which was 2), and used that for how much to turn the servos. I knew I wanted the servos to move more if the head was far and less if the head was close. The constant was found by guess and check.