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 Occlusion Robust Recognition Introduction #4: Multi-Scale Feature Fusion & Face Embedding with ArcFace Loss”.
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.
Here is the final result, each face is transformed into 128 numbers, and faces of the same person are placed close to each other. We are training three models with R-Face Loss, and one of the comparisons will be very decisive for the occlusion resistance in the final episode. Let's start. Hello, welcome to episode four of the occlusion-resistant face recognition series. Modern face recognition does not classify faces into a fixed list of names, but rather transforms faces into embedding factors. Two faces are compared by the angle between their vectors, so new people can be registered without retraining. Today we are combining multi-scale features into an embedding and training it with R-Face Loss.
Create a model_underscore_face.py file. The multi-scale fusion class uses FPN from the previous episode. Each feature map P2 to P5 is globally averaged into a 128 factor, the four are combined into 512 numbers, then projected with a linear layer and B-Norm into a 12,8-dimensional normalized embedding. As a comparison, the single-class class only uses the last layer feature of ResNet 18. Now R-Face Loss.
Each person has a weight factor that represents the center of their class. The cosine between the embedding and each center is calculated. Then, for the correct class, the angle is added with marine M of 0.5 radians before taking the cosine again. As a result, the model is forced to make the embedding much closer to its own class center than what softmax normally requires. All logits are scaled by S30, then entered into cross entropy. This is the additive angular marine that makes R-Face highly discriminative.
Create a train_underscore_face.py file. We load 112-pixel faces and use GPU if available. The augmentation function performs horizontal flipping, and with a 50% chance, adds one random occlusion, mask, glasses, or hand, placed using a landmark template because the face is already aligned. The accuracy identification function calculates the gallery embedding from the training data, averages it per person into a centroid, then each validation face is recognized as the centroid with the highest cosine.
The train function uses Adamwe, Cosine Anialing, and 12 Ipok. The occlusion parameter determines whether occlusion augmentation is used. The best model based on validation accuracy is saved. We will train three models: multi-scale fusion with occlusion augmentation, single-scale with occlusion augmentation, and multi-scale fusion without occlusion augmentation. Run.
Each epoch only takes a few seconds on the GPU. The Arc Loss Phase starts high, in the tens, due to the large marine, then drops quickly. All three models achieve validation identification accuracy around 95-97%. On faces without occlusion, all three are almost the same, and multi-scale fusion is not much different from single-scale. The real difference becomes visible when the face is covered, which we will test in the final episode. Done.
We have built multi-scale feature fusion, 128-dimensional face embedding, ArcFace loss with additive angular marine, and random occlusion augmentation, then trained three comparison models. In the next episode, we will use this embedding for face verification, cosine similarity, threshold, ROC curve, and IIR. Currently working on a thesis, dissertation, or AI research in the field of face and biometric recognition? Cerdas Inovasi Digital helps implement deep learning, from synthetic occlusion, face alignment, feature pyramid, ArcFace, verification, and ROC, up to face attendance applications, and opens deep learning courses with PyTorch. Want to master the entire series, from face datasets to attendance applications? All 6 episodes, complete with PDF step-by-step 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 the 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 →