Memuat
Memuat
Want to go deeper?
Join one of our courses or ask us directly on WhatsApp.
Picked from the software, topic, and level of “Face Recognition Tahan Oklusi Class #2: Face Detection, 5 Landmarks & Alignment to ArcFace Template”.
Other ways we can help with Python.
Learn with a mentor
Scheduled AI & Machine Learning courses with live guidance and a certificate.

Multi-Objective Optimization Course: NSGA-II, MOPSO & Hybrid Algorithms (Python)

ECG Arrhythmia Classification Course with Wavelet & Deep Learning (PyTorch)

ANFIS + PSO/GA Course for Non-Linear Time Series Forecasting (Python)
Have it built for you
No time to learn Python? Our team can do the project for you.

Python Machine Learning — Prediction Models, Customer Segmentation, Fraud Detection & AI Apps

AI Image Creation with Stable Diffusion — Unlimited Custom Visual Production
★ 4.9

AI Image & Video Creation with Leonardo AI — All-in-One Visuals for Business
★ 4.9
Get notified about new Python classes
At most one email a week. Unfollow anytime with one click.
The full narration of this video. The current sentence is highlighted while the video plays; click any sentence to jump there.
This is the final result, each face is detected along with 5 landmark points, then rotated, shifted, and scaled so that the eyes, nose, and mouth always fall at the same points. This alignment is a small but crucial step for the accuracy of face recognition. Let's start. Welcome to episode two of the occlusion-resistant face recognition series. Real-world face photos are tilted, shifted, and vary in size. Modern face recognition models like ArcFace always align faces to a standard 112-pixel template first. Today we detect 5 face landmarks using UNED and align the entire dataset.
Create the face detection underscore file, face.py We use UNED, a lightweight face detector from OpenSea 6 Zoo, whose files are already in the model folder. The template contains the standard coordinates of ArcFace for 5 points: left eye, right eye, tip of the nose, left corner of the mouth, and right corner of the mouth on a 112-pixel image. The line set lock level hides the internal warning from OpenSea 6 so that the terminal remains clean. The landmark function enlarges the photo twice, because the LFW faces are small and UNED is more accurate on larger faces.
The detector returns the face box, 5 landmarks, and a score. We take 10 landmark numbers and divide them back by the scale. The align function calculates the similarity transformation, which is rotation, scaling, and shifting without distortion. From the landmarks to the template using estimate affine partial 2D, then warp affine produces the 11,2x112 face. Now create the prepare underscore face.py file.
We detect landmarks for the 3023 faces, align them, and save the results as face 112.npz. Faces that fail to be detected are skipped. Run. All 3023 faces were successfully aligned without any failures. In just about 20 seconds.
Let's take a look at the results. Top line: original photo with red landmarks from UNED detection, notice the tilted and turned face. Bottom line: the aligned result, with green points at the template positions. These five landmarks fall exactly at the same points for everyone. This is what allows the model to focus on facial differences between people, not on the position or tilt of the photo. Alignment also allows synthetic occlusion to be placed using the same template.
Done. We have detected the face and five landmarks using UNED, understood similarity transformations, and aligned the entire LFW dataset to the ArcFace 112 pixel template. In the next episode, we will extract multi-scale features using the pyramid network on top of ResNet 18. Currently working on a thesis, dissertation, or AI research in the field of facial recognition and biometrics? Cerdas Inovasi Digital helps implement deep learning, from synthetic occlusion, facial alignment, pyramid features, ArcFace, verification, and ROC, up to facial attendance applications, and also opens deep learning courses with PyTorch. Want to master the entire series, from facial datasets to attendance applications? All six episodes, complete with step-by-step PDF guides and source code, are available to premium tutorial subscribers. Subscribe starting at Rp69.000 per month, save 28% with the 12-month package, or pay once Rp999.000 for lifetime access. Want just one class? Buy a single class with lifetime access. Subscribe now at the premium page cerdasinovasidigital.com. Contact us via WhatsApp, or visit cerdasinovasidigital.com. Thank you for watching, see you in the next episode.
Type a question or keyword; we find the part of this episode that explains it and jump the video there.
Notes are saved with the current video time and are only visible to you.
Stuck on a step? Ask here; the instructor and other learners can answer.
No questions yet.

Cerdas Inovasi Digital Team
Software developers, BIM & 3D engineers, and AI practitioners
We build software, BIM models, games and AI automations for clients every day, and turn that hands-on work into step-by-step classes: every step is shown on screen and comes with a PDF guide you can keep.
See our clients →