Face recognition attendance method and system based on improved ArcFace algorithm

By introducing an adaptive margin mechanism and GAN data augmentation into the ArcFace algorithm, combined with lightweight networks and template quality management, the problems of recognition accuracy and efficiency in complex scenarios of face recognition attendance systems are solved, achieving efficient and reliable identity verification.

CN121033917BActive Publication Date: 2025-12-26JILIN HONGFA RUIHE TRANSFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511553495.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-29
Publication Date
2025-12-26
Estimated Expiration
2045-10-29

AI Technical Summary

Technical Problem

Existing facial recognition attendance systems suffer from insufficient accuracy in complex scenarios, slow model inference speed, limited generalization ability, and uncontrollable template quality, making it difficult to adapt to changes in user appearance and device environment.

Method used

The ArcFace algorithm, which introduces an adaptive margin mechanism, combines generative adversarial network (GAN) data augmentation strategies with a lightweight neural network structure, adopts a two-stage comparison strategy, and performs dynamic template quality management.

Benefits of technology

It significantly improves the recognition accuracy of the system under complex conditions such as occlusion, changes in lighting, and attitude deflection, enhances the generalization ability and operating efficiency of the model, and ensures the real-time performance and reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121033917B_ABST
    Figure CN121033917B_ABST
Patent Text Reader

Abstract

The application discloses a face recognition attendance method and system based on an improved ArcFace algorithm, and relates to the technical field of artificial intelligence and computer vision. The method comprises the following steps: collecting a user face image and performing pretreatment; extracting face features by using a neural network model of the improved ArcFace algorithm, introducing an adaptive angle interval mechanism in a loss function, dynamically adjusting feature distribution according to sample quality, and improving recognition robustness under conditions of blur, occlusion and illumination change; combining a lightweight structure and model quantization optimization to realize fast reasoning and efficient deployment of edge devices; introducing template quality management and a two-stage retrieval mechanism in the comparison process to improve the accuracy and speed of matching. The system comprises an image acquisition module, a feature extraction module, a feature comparison and template management module and an attendance control module. Through the application, the accuracy, detection speed and generalization ability of the face recognition attendance and access control system are effectively improved, and the application is suitable for enterprise attendance and intelligent access control application scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of artificial intelligence and computer vision, and particularly relates to a face recognition attendance method and system. BACKGROUND

[0002] With the rapid development of artificial intelligence and deep learning technology, face recognition has become an important means of identity verification and access control, and is widely used in enterprise attendance, access control, visitor registration and other scenarios. Traditional attendance methods (such as punch cards, fingerprint recognition, etc.) have problems such as cumbersome operation, easy forgery, and poor user experience, while face recognition-based attendance systems have gradually become popular due to their non-contact, efficient, and convenient characteristics.

[0003] Currently, mainstream face recognition systems are mostly based on deep feature embedding algorithms such as ArcFace, CosFace, and SphereFace. Among them, the ArcFace algorithm effectively improves the class separability and intra-class compactness by introducing an additive angular margin loss (Additive Angular Margin Loss), and achieves excellent recognition performance on standard public datasets. However, in actual attendance and access control applications, the ArcFace algorithm still has the following shortcomings:

[0004] (1) Fixed feature distribution, lack of adaptability to sample quality:

[0005] The fixed margin design of ArcFace is prone to cause unstable feature distribution when dealing with low-quality samples (such as blur, uneven lighting, occlusion, or deflection), affecting recognition accuracy.

[0006] (2) High model complexity, insufficient edge deployment performance:

[0007] Traditional ArcFace models mostly rely on high-computational ResNet or IR-SE network structures, and the real-time inference speed on embedded devices or access control terminals is slow, making it difficult to meet the high-concurrency requirements of large-scale attendance scenarios.

[0008] (3) Single dataset, limited generalization ability:

[0009] In real-world scenarios, users' expressions, poses, wearing of masks or glasses, and other situations change frequently. If the training data lacks such samples, the model is prone to overfitting, leading to a decrease in recognition accuracy in complex environments.

[0010] (4) Template aging and quality management problems:

[0011] Existing systems usually fix the feature templates registered initially and do not dynamically update the template quality, making it difficult to adapt to changes in user appearance or device environment.

[0012] In view of the above problems, although existing researches have improved in feature extraction and lightweight network, the robustness and real-time performance of face recognition have not been comprehensively improved from the aspects of algorithm structure, sample generation and system deployment. Therefore, it is urgent to develop a comprehensive solution combining adaptive ArcFace algorithm and GAN data enhancement technology to improve the generalization ability and running efficiency of the model while ensuring the recognition accuracy, so as to be suitable for intelligent attendance and access control system in complex scenes. SUMMARY

[0013] The application provides a face recognition attendance method and system based on an improved ArcFace algorithm to solve the technical problems of insufficient recognition accuracy, slow model inference speed, limited generalization ability and uncontrollable template quality of the face recognition attendance system in complex scenes in the prior art.

[0014] According to one aspect of the application, a face recognition attendance method based on an improved ArcFace algorithm is provided, which comprises the following steps: collecting a face image of a target person by a camera device, and performing face detection, key point alignment and normalization preprocessing on the face image; inputting the preprocessed face image into a neural network model based on an improved ArcFace algorithm, and extracting a corresponding feature vector, wherein the backbone network of the neural network model adopts a MobileFaceNet structure, and an adaptive margin mechanism is introduced in an additive angular margin loss function of ArcFace, the adaptive margin mechanism dynamically adjusts the margin value in the loss function according to the length of the feature vector of the input sample, and the calculation formula of the dynamic margin value in the adaptive margin mechanism is: ; wherein, is the dynamically adjusted margin value; is the original fixed margin of ArcFace; is the adjustment coefficient; is the length of the sample feature vector; is the reference length; based on the extracted feature vector, two-stage comparison is performed, in the first stage, a vector retrieval algorithm is used to select the Top-K candidate features closest to the target feature from the feature library, in the second stage, cosine similarity calculation is used to perform secondary comparison on the Top-K candidate features, and the final matching result is obtained; according to the final matching result and a preset threshold, it is determined whether to pass the verification, if the verification is passed, the attendance information is recorded or the access control is performed.

[0015] Optionally, the loss function expression with the adaptive margin mechanism is:

[0016] ;

[0017] in, The loss function value represents the error between the predicted and actual values. The number of samples in the dataset. For scale parameters, For the first The angle between a sample and its category center For the first The sample and the first The angles between the centers of the categories, where , For the first The true class label of each sample.

[0018] Optionally, before inputting the preprocessed face images into the neural network model based on the improved ArcFace algorithm, the model also includes model building and training, specifically including: acquiring the original face image dataset and using a frame filtering algorithm to remove images of substandard quality; labeling the filtered images with identity tags and face locations; using a face detection algorithm based on the improved RetinaFace to locate faces in the labeled images, and then performing geometric correction using a five-point keypoint alignment algorithm. The improved RetinaFace face detection algorithm uses MobileNetV3-Small as its backbone structure and combines feature pyramids and multi-scale... A degree fusion mechanism is implemented to simultaneously detect faces of different sizes at feature layers with different resolutions; the corrected face images are uniformly scaled and cropped to a preset standard size; generative adversarial networks are used to perform data augmentation on the standardized face images to generate synthetic samples containing different occlusions, lighting, and poses, thus expanding the dataset; the expanded dataset is used to train the neural network model based on the improved ArcFace algorithm, with the Adam optimizer used during training, a learning rate of 0.001, a batch size of 128, and 200 epochs; after training, the trained model is used to extract features from the face images of the target person.

[0019] Optionally, the generative adversarial network adopts an improved StyleGAN2 architecture, in which the generator generates face samples with specific attributes through latent variable mapping and conditional control modules, and introduces an explicit occlusion masking mechanism to simulate the real occlusion distribution; its discriminator adopts a multi-scale convolutional PatchGAN structure; and its loss function is jointly optimized by adversarial loss and perceptual loss.

[0020] Optionally, a template quality management step is further included: when storing a user face feature template, record its corresponding feature module length as a quality indicator; when performing identity comparison, assign different weights to different templates according to the quality indicators; when detecting that the quality of a certain stored template is lower than a preset quality threshold, trigger new face image collection, and replace the original low-quality template in the database with the latest extracted high-quality feature vector.

[0021] Optionally, an abnormality identification mechanism is further included: when detecting that the recognition result is unstable or consecutive verification fails, automatically mark the current recognition as abnormal, and save the corresponding image for manual review, wherein the unstable recognition result includes: in consecutive M times of recognition of the same target person, the fluctuation range of the similarity score exceeds the preset range, or the output identity recognition result jumps between different registered persons.

[0022] Optionally, a security protection mechanism is further included: all feature data is processed using the AES-256 encryption algorithm during transmission and storage to protect user privacy and data security.

[0023] According to another aspect of the present application, a face recognition attendance system based on an improved ArcFace algorithm is also provided, based on the above face recognition attendance method, comprising: an image collection module for collecting user face images; a face detection and preprocessing module for face detection, key point alignment, cropping and illumination normalization processing on the collected face images; a feature extraction module for inputting the preprocessed face images into a neural network model based on the improved ArcFace algorithm, generating corresponding feature vectors, and using a lightweight convolutional backbone structure combined with quantization and accelerated inference technology to improve the running speed on edge devices; a comparison and template management module for identity recognition based on a two-stage comparison strategy, and management and update of the quality of templates in the database combined with feature module length; an attendance and access control module for automatically recording attendance information and controlling access switches according to the final recognition result.

[0024] Optionally, the feature extraction module uses a curriculum learning strategy during model training, reduces the weight of difficult samples in the early training stage to ensure rapid convergence of the model, and gradually increases the weight of difficult samples in the later training stage to improve the generalization ability to complex scenes, thereby improving the recognition accuracy of the system, wherein the difficult sample is defined as a sample whose feature vector module length is less than a preset quality threshold, or is misclassified by the model or has a classification probability lower than a preset confidence threshold during training.

[0025] Optionally, the comparison and template management module includes a template update mechanism that automatically replaces the old template in the database with the new feature when detecting that the module length of the newly collected user face feature is greater than the module length of the corresponding template in the database.

[0026] The present application effectively improves the face recognition accuracy of the system under complex conditions such as occlusion, illumination change and posture deflection, and significantly improves the running efficiency and practicability on edge devices by introducing adaptive angle interval mechanism, generative adversarial network (GAN) data enhancement strategy, lightweight neural network structure and template quality dynamic management mechanism.

[0027] Specifically, by introducing an adaptive angle interval mechanism in the traditional ArcFace algorithm, dynamic adjustment of sample quality is realized. The mechanism adaptively adjusts the classification interval according to the sample feature length, so that high-quality samples have greater inter-class discrimination in the feature space, and low-quality samples can still maintain stable distinguishability, thereby significantly improving the recognition robustness in complex scenarios. Experiments show that the recognition rate of this mechanism under conditions of occlusion, illumination change and posture deflection is about 5%~8% higher than that of the traditional algorithm.

[0028] In addition, to further enhance the model generalization ability, the present application innovatively introduces a data enhancement strategy based on generative adversarial network (GAN). This strategy can automatically generate face synthesis samples covering various occlusions (such as masks), expression changes and different lighting conditions in the background, effectively expanding the diversity and scale of training data, enabling the model to have stronger scene adaptability and significantly improving the recognition stability in real environments.

[0029] In the face comparison stage, the present application adopts a two-stage comparison strategy, combining approximate nearest neighbor search and high-precision similarity calculation to achieve a balance between recognition speed and accuracy, and can still maintain millisecond-level response in a million-level face database. Through lightweight network structure and model quantization optimization, the system can run efficiently on low-power edge devices, balancing performance and cost. At the same time, the present application also sets up a template quality dynamic management mechanism to automatically evaluate the template quality according to the feature length and execute the update strategy, ensuring that the feature database maintains a high-quality state for a long time, thereby significantly improving the recognition consistency and reliability of the system in long-term operation.

[0030] In summary, the present application introduces adaptive margin in ArcFace algorithm, realizes automatic enhancement of face samples through GAN network, achieves a balance between speed and accuracy through two-stage comparison, and combines lightweight deployment and template quality dynamic management to realize collaborative innovation from multiple dimensions of algorithm optimization, data enhancement, system architecture and template management, thereby improving the accuracy, speed and robustness of the face recognition attendance system, and having significant practical value and promotional significance. BRIEF DESCRIPTION OF DRAWINGS

[0031] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:

[0032] Figure 1 is a flowchart of a face recognition attendance method based on an improved ArcFace algorithm in an embodiment of the application;

[0033] Figure 2 is an algorithm running logic diagram in an embodiment of the application;

[0034] Figure 3 is a face recognition algorithm structure diagram in an embodiment of the application;

[0035] Figure 4 is a face recognition effect diagram in an embodiment of the application. DETAILED DESCRIPTION

[0036] In order to enable persons skilled in the art to better understand the present application scheme, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative labor should be within the scope of protection of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0037] Secondly, the "one embodiment" or "embodiment" referred to herein means that the specific features, structures or characteristics can be included in at least one implementation of the present application. The "in one embodiment" appearing in different places in the specification does not mean the same embodiment, nor is it an independent or selective embodiment that excludes other embodiments.

[0038] In the specification and claims of the present application, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, product or device including a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0039] Embodiment 1:

[0040] The embodiment provides a face recognition attendance method based on an improved ArcFace algorithm. The method embodiment provided by the embodiment can be executed in a server, a computer, a mobile phone or similar computing devices. The method mainly includes four stages of data acquisition, data preprocessing and enhancement, deep network training and system application. Referring to Figure 1 , Figure 1 is a flowchart of a face recognition attendance method based on an improved ArcFace algorithm, Figure 2 is an algorithm running logic diagram, including

[0041] Step 1: Data set acquisition

[0042] The embodiment selects a public face recognition data set as the basic data source for training and testing, mainly including a Labeled Faces in the Wild (LFW) data set, a CASIA-WebFace data set and a self-built face acquisition data. The LFW data set contains 13,233 face images, covers 5,749 different identities, has rich expression, posture and illumination changes, and is an internationally recognized face verification benchmark data set.

[0043] In the data acquisition stage, the system acquires real-time visible light video frames through a standard high-definition camera, and the sampling frequency is 15 frames per second. The acquired images are processed by a frame screening algorithm, and images with poor quality such as overexposure, blur or excessive posture deviation are removed. The final basic data set is labeled by a combination of manual and automatic labeling, and the identity label and face position label are labeled, providing reliable input for subsequent algorithm learning.

[0044] Step 2: Data preprocessing and GAN enhancement

[0045] After obtaining the data set, all face images in the data set are uniformly preprocessed and data enhanced. First, a face detection algorithm based on an improved RetinaFace network is used to realize high-precision face positioning. The detection network takes MobileNetV3-Small as the backbone structure, combines feature pyramid (FPN) and multi-scale fusion mechanism, and can detect large, medium and small size faces on different resolution feature layers, thereby improving the detection stability. The detected face region is geometrically corrected by a five-point key point alignment algorithm to unify the positions of the eyes, nose tip and mouth corner, and to ensure the posture consistency of the input features. The corrected face image is uniformly scaled and cropped to a standard input size of 112x112 pixels.

[0046] To further improve the recognition performance of the model in complex environments, the application introduces a generative adversarial network (GAN) to realize sample expansion. The GAN part adopts an improved StyleGAN2 architecture, and the generator generates face samples with specific attributes through a latent variable mapping and a condition control module. By controlling the latent variable parameters, images under different lighting, expressions, poses and occlusion conditions can be simulated, especially for the common conditions of wearing masks, side faces or occlusion in the attendance scene. The application introduces an explicit occlusion mask mechanism in the GAN, so that the generator simulates the real occlusion distribution at the feature level and generates a large number of high-quality synthetic samples with masks and partial occlusion. The discriminator adopts a multi-scale convolution structure to ensure the consistency of the generated samples and the real samples in terms of texture details. The generated images are detected and aligned, and then participate in training together with the original data. This enhancement strategy significantly improves the sample diversity and enhances the generalization ability of the model in the actual environment. After collecting the original face images of the user, the system can call the pre-trained GAN model to automatically generate diversified synthetic samples, including faces with masks or glasses, faces under different lighting conditions, faces with different pose angles, and faces with expression changes. In this way, even if the user initially only registers a non-occluded front face image, the system can still obtain samples under different environments and states, ensuring that the user can be accurately recognized in real use scenarios (such as wearing a mask to enter the attendance or access control).

[0047] wherein the generator structure is composed of a plurality of convolutional up-sampling modules, a latent vector The mapping network generates a sample.

[0048] The discriminator structure adopts a PatchGAN structure to judge the image authenticity through multi-scale features.

[0049] The loss function adopts a combined optimization of adversarial loss and perceptual loss, as shown in the following formula:

[0050] ;

[0051] In the formula, The joint loss is a weighted combination of the adversarial loss and the perceptual loss (the first two terms on the right side of the equation are the adversarial loss, and the third term is the perceptual loss), which optimizes the discriminator and the generator so that the generated images are as similar as possible to the real images in the perceptual level; represents the calculation expectation; represents the real image; represents the probability of the discriminator output, which represents the confidence of "the image is real". represents a random noise vector; represents the image output by the generator, is the probability that the discriminator determines that the generated image is true; represents a weight hyperparameter for balancing the adversarial loss and the perceptual loss; represents the gap between the generated image and the real image in the semantic level;

[0052] After data augmentation, all images are subjected to pixel value normalization processing, and light enhancement such as random mirroring, brightness disturbance, rotation and blur transformation is performed to further reduce overfitting. The final training set and validation set ratio is 8:2, ensuring that the model is representative in the learning and evaluation stages.

[0053] Step 3: Learning and modeling of the algorithm on the data set:

[0054] The improved ArcFace algorithm is used as the core face feature extraction and recognition framework, as shown in Figure 3 , the input is the standardized face image after alignment and preprocessing, and the output is a normalized 512-dimensional feature vector. The backbone network is designed based on the MobileFaceNet structure, including an initial convolutional layer, a deep separable convolutional layer, and a reverse residual bottleneck module. This structure greatly reduces the parameter amount while maintaining strong feature expression capability, enabling the model to run in real time on embedded devices. After the input image is processed by the convolutional layer and the PReLU activation function, the feature mapping is abstracted into a high-dimensional semantic representation layer by layer, compressed by the global average pooling layer, and then passed through the fully connected layer to generate a 512-dimensional embedding feature vector. Finally, it is mapped to the unit hypersphere through L2 normalization to ensure the angle comparability of the feature space.

[0055] In the loss function design, the invention improves the fixed interval strategy of the traditional ArcFace algorithm and introduces an adaptive angle interval mechanism. The traditional ArcFace introduces a fixed interval in the angle space to strengthen the distinction between classes, but this fixed interval cannot reflect the quality difference of samples, resulting in an imbalance in the gradient contribution of high-quality samples and low-quality samples during training. The adaptive interval proposed by the invention is dynamically adjusted with the sample feature length, which is defined as:

[0056] ;

[0057] wherein, is the adjusted interval, is the basic angle interval (i.e. the original fixed margin of ArcFace), is the adjustment parameter, is the reference length, Let be the magnitude of the sample feature vector. High-quality samples typically have larger magnitudes, so their margins are adaptively increased, further widening the inter-class distance between high-quality samples and thus enhancing discriminative power; the margins of low-quality samples are correspondingly reduced to avoid excessive penalty for gradient instability caused by blurry or occluded low-quality samples. Below When the margin is reduced to ensure the distinguishability of low-quality samples, Higher than At this time, the margin is increased to improve the discrimination ability of high-quality samples, thereby achieving dynamic adaptive differentiation of samples of different quality.

[0058] The resulting expression for the dynamically adaptive loss function is:

[0059] ;

[0060] in, The loss function value represents the error between the predicted and actual values. The number of samples in the dataset. For scale parameters, For the first The angle between a sample and its category center For the first The sample and the first Angles between the centers of each category ( ), For the first The true class label of each sample. This mechanism enables adaptive adjustment of the inter-class spacing based on sample quality, thereby improving the stability and recognition accuracy of the model under non-ideal acquisition conditions.

[0061] During training, the Adam optimization algorithm was used with a learning rate of 0.001, a batch size of 128, and 200 epochs. After training, the model achieved a recognition accuracy of 99.18% on the LFW dataset, and its accuracy on the occluded face dataset was approximately 1.7% higher than that of the traditional ArcFace.

[0062] In the identification stage, after inputting the image of the face to be identified, the system obtains a standardized face through the detection and alignment module, and then generates a 512-dimensional feature vector through the feature extraction network. The system uses a two-stage matching strategy based on cosine similarity: first, a vector retrieval algorithm such as hierarchical navigable small world graph (HNSW) or product quantization (PQ) based approximate nearest neighbor search method is used to quickly search the large-scale feature library to filter out several (Top-K) candidate features closest to the target feature in sub-linear time, realizing fast candidate retrieval, and then a high-precision cosine similarity calculation or Mahalanobis distance calculation is used to calculate the similarity of the candidate features. The closer the cosine similarity value is to 1, the more similar the two vectors are. When the similarity exceeds a certain threshold (which can be adjusted according to the false rejection rate and missed recognition rate of the actual application scenario), the identity verification is considered to be passed, the system outputs the identity recognition result, records the attendance information, and opens the access control, otherwise the verification fails. This two-stage comparison method balances speed (first stage) and accuracy (second stage), significantly improving search speed while ensuring recognition accuracy. This design ensures real-time recognition performance with an average matching delay of less than 50 milliseconds in a million-level database.

[0063] It is further explained that in face recognition, sub-linear time refers to when performing feature matching or search, the system does not need to compare each face feature in the database one by one, but quickly filters out the most similar candidates to the target feature through an efficient search algorithm (such as HNSW or product quantization), thereby significantly reducing search time in the case of large amounts of data, usually achieving faster retrieval speed than linear scanning. This allows the system to complete efficient recognition within tens of milliseconds even in a million-level or larger database.

[0064] When filtering Top-K candidate features (i.e. the K feature vectors with the highest similarity to the face feature vector to be identified), a vector retrieval algorithm is usually used. The core here is to evaluate the matching degree by calculating the distance (e.g. cosine similarity) between the sample to be identified and each feature vector in the database. The smaller the distance, the higher the similarity. The number of Top-K is between 5 and 20, and the specific K value can be adjusted according to the performance requirements of the system. If higher accuracy is required, the K value can be appropriately increased to increase the matching probability.

[0065] Step 4: System layer application

[0066] At the system level, the improved algorithm is integrated into the face recognition attendance machine to realize automatic identity recognition and attendance registration. The attendance machine is composed of a camera module, an embedded computing unit, a display and interaction module, a storage module, and a communication module. The camera module collects the face images of employees in real time, the embedded computing unit runs the face detection, feature extraction and recognition algorithm of the present application, and completes the identity comparison. The recognition result (such as Figure 4 ) is prompted by the display module, and the identity information and time stamp are recorded in the local database. Through the communication module, the device can upload the attendance data to the server for centralized storage and background statistical analysis.

[0067] To ensure the real-time performance and low power consumption of the terminal, the model is quantized and distilled. By using INT8 quantization technology, the floating point model is converted into a low precision representation, which reduces the calculation delay by about 60% and the memory occupancy by more than half. At the same time, the knowledge distillation method is introduced to guide the training of the lightweight student model with the high-precision teacher model, which greatly improves the inference speed while maintaining the recognition accuracy. According to the actual measurement, the real-time recognition rate of 25 frames per second can be realized on the NVIDIA Jetson NX and Raspberry Pi 5 devices.

[0068] During long-term operation, the template management module of the system will dynamically update the feature templates in the database according to the length and quality of the newly collected samples. The length (i.e. the modulus of the feature vector / the length of the feature vector) is usually used to measure the "clarity" or "significance" of the face features, which is an important measure of quality, and is usually proportional to the quality of the template. The longer the length of the feature vector, the more stable and clear the features of the template, and the higher the quality of the template. According to the quality, different weights are assigned to different templates, and when performing identity comparison, the system will adjust the "influence" in the comparison process according to the weight of the template. High-quality templates (i.e. templates with longer lengths) will occupy a more important position in the comparison, while low-quality templates (i.e. templates with shorter lengths) will be given lower weights, reducing their influence on the final comparison result and improving the overall recognition accuracy. When the quality of the newly collected template is better than that of the existing template, it is automatically replaced to ensure that the recognition library always maintains the optimal state.

[0069] In addition, the system also has an abnormality recognition and security protection mechanism. When the recognition result is unstable or consecutive recognition fails, it is automatically marked as abnormal and the image is saved for manual review. All feature data is encrypted using AES-256 algorithm during transmission and storage to protect user privacy and security.

[0070] The unstable recognition result includes at least one of the following situations:

[0071] In the continuous M times of identification of the same target person, the fluctuation range of the output similarity score exceeds the preset threshold, such as the same person continuously swiping the face, the system returns a matching similarity score that is high and low, and there is no stable value, for example, the first similarity is 0.95, the second suddenly drops to 0.70, and the third rises to 0.90;

[0072] Or in the continuous identification process, the output identity recognition result abnormally jumps between different registered persons, and cannot stably identify the user as the same person, for example, it jumps back and forth between "user A", "user B" and "recognition failure".

[0073] In summary, the present application introduces an adaptive margin and a curriculum learning mechanism in the ArcFace algorithm, realizes automatic enhancement of face samples through a GAN network, realizes the balance between speed and accuracy through a two-stage comparison, and combines lightweight deployment and dynamic management of template quality to comprehensively improve the accuracy, robustness and practicality of the face recognition attendance system from multiple aspects.

[0074] Embodiment 2:

[0075] Based on the same or corresponding concept as the above-mentioned embodiment 1, the present application provides a face recognition attendance system based on an improved ArcFace algorithm, which is used to realize the above-mentioned embodiments and preferred embodiments, and has been described. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, hardware, or a combination of software and hardware is also possible and is contemplated. The system includes:

[0076] An image acquisition module acquires a user face image;

[0077] A face detection and preprocessing module detects, aligns key points, crops and normalizes light for the acquired face image;

[0078] A feature extraction module inputs the preprocessed face image into a neural network model based on an improved ArcFace algorithm, generates a corresponding feature vector, and uses a lightweight convolutional backbone structure combined with quantization and accelerated inference technology to improve the running speed on edge devices;

[0079] A comparison and template management module performs identity recognition based on a two-stage comparison strategy, and manages and updates the quality of templates in the database in combination with feature length;

[0080] An attendance and access control module automatically records attendance information and controls the access switch according to the final recognition result.

[0081] In order to adapt to the real-time requirement in the attendance and access control scene, the feature extraction module adopts MobileFaceNet as the backbone structure, and combines the optimization technologies such as INT8 / FP16 model quantization and knowledge distillation during inference deployment, so that the model can realize fast inference on the low-power edge computing device, and the single identification delay is less than 100 ms, thereby meeting the needs of high-concurrency scenes.

[0082] The feature extraction module adopts a curriculum learning strategy in the model training process, and through the design of a 'learning process', the model starts training from simple and easily identifiable samples, and gradually introduces more difficult samples as the training progresses. Specifically, the weight of difficult samples is reduced in the early training to ensure rapid convergence of the model, and the weight of difficult samples is gradually increased in the later training to improve the generalization ability to complex scenes. This strategy of gradually increasing task difficulty can help the model to learn features stably and better adapt to complex situations in the later period, thereby improving the recognition accuracy of the system. The difficult sample refers to a sample whose feature vector length is less than a preset quality threshold, or a sample that is misclassified by the model in the training process or is correctly classified but has a classification probability lower than a preset confidence threshold.

[0083] The comparison and template management module includes a template updating mechanism for dynamic quality management. When a user registers or updates a template, the quality index of the template is calculated according to the feature length, and in the subsequent comparison process, low-quality templates are given a lower weight to reduce their interference with the results. When it is detected that the feature length of the newly collected sample is significantly better than the existing template, the template in the database will be automatically replaced, ensuring that the latest high-quality face features are always retained in the database, thereby reducing the false recognition rate caused by template aging or low-quality registered images.

[0084] Through the above implementation steps, the present application constructs a complete face recognition attendance system, which realizes full-chain optimization from data acquisition, algorithm training to terminal application. The system can maintain high recognition rate and real-time performance in various complex environments, has good universality and promotion value, and can be widely applied in the fields of intelligent access control, campus attendance, enterprise attendance and security monitoring.

[0085] It should be noted that the above modules can be realized by software or hardware. For the latter, the following implementation manners can be used, but are not limited thereto: the above modules are located in the same processor; or the above modules are located in different processors in any combination.

[0086] Embodiments of the present application also provide a storage medium having a computer program stored therein, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.

[0087] Optionally, in the embodiment, the storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various storage media that can store computer programs.

[0088] The above-mentioned embodiment numbers are only for description, and do not represent the advantages and disadvantages of the embodiments. In the above-mentioned embodiments, the description of each embodiment has its own emphasis, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0089] In the above-mentioned several embodiments provided, it should be understood that the disclosed technical content can be implemented by other ways. Among them, the system embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and actual implementation can have another division way, for example, a plurality of modules or unit components can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the coupling or direct coupling or communication connection between the displayed or discussed each other can be through some interface, indirect coupling or communication connection between units or modules, which can be electrical or other forms.

[0090] The integrated module, if realized in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or say the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various program code storage media.

[0091] The above-mentioned is only the preferred embodiment of the present application, and it should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be regarded as the protection scope of the present application.

Claims

1. A face recognition attendance method based on an improved ArcFace algorithm, characterized in that, The method comprises the following steps: Collecting a face image of a target person through a camera device, and performing face detection, key point alignment and normalization preprocessing on the face image; The preprocessed face image is input into a neural network model based on an improved ArcFace algorithm, and a corresponding feature vector is extracted, wherein a backbone network of the neural network model adopts a MobileFaceNet structure, and an adaptive margin mechanism is introduced in an additive angular margin loss function of the ArcFace, the adaptive margin mechanism dynamically adjusts a margin value in the loss function according to a feature vector module length of an input sample, and a calculation formula of a dynamic margin value in the adaptive margin mechanism is: ; wherein, is a dynamically adjusted margin value; is an original fixed margin of the ArcFace; is an adjustment coefficient; is a module length of a sample feature vector; is a reference module length; Based on the extracted feature vector, a two-stage comparison is performed, in the first stage, a vector retrieval algorithm is used to screen the Top-K candidate features closest to the target feature from the feature library, in the second stage, cosine similarity calculation is used to perform secondary comparison on the Top-K candidate features, and the final matching result is obtained; According to the final matching result and the preset threshold, it is judged whether the verification is passed, if the verification is passed, the attendance information is recorded or the access control is executed.

2. The face recognition attendance method based on the improved ArcFace algorithm according to claim 1, characterized in that, The loss function expression of the adaptive margin mechanism is: ; wherein, is a loss function value, representing the error between the predicted value and the actual value, is the number of samples in the dataset, is a scale parameter, is the angle of the sample to its class center, is the angle between the sample and the class center, wherein , is the true class label of the sample.

3. The face recognition attendance method based on the improved ArcFace algorithm according to claim 1, characterized in that, Before inputting the preprocessed face image into the neural network model based on the improved ArcFace algorithm, model construction and training are also included, specifically including: Obtain the original face image dataset, and use the frame screening algorithm to remove the images with unqualified quality; Identity label and face position annotation are performed on the screened images; An improved RetinaFace face detection algorithm is used to position the face of the labeled image, and then a five-point key point alignment algorithm is used for geometric correction, wherein the improved RetinaFace face detection algorithm takes MobileNetV3-Small as the backbone structure, and combines feature pyramid and multi-scale fusion mechanism to realize simultaneous detection of different size faces in different resolution feature layers; The corrected face image is uniformly scaled and cropped to a preset standard size; A generative adversarial network is used to perform data enhancement on the standardized face image to generate synthetic samples containing different occlusions, illuminations and poses, thereby expanding the dataset; The expanded dataset is used to train the neural network model based on the improved ArcFace algorithm, and during the training process, the Adam optimizer is used, the learning rate is set to 0.001, the batch size is 128, and the training number is 200 epochs; After training, the trained model is used to extract features from the face image of the target person.

4. The face recognition attendance method based on the improved ArcFace algorithm according to claim 3, characterized in that, The improved StyleGAN2 architecture is used in the generative adversarial network, the generator generates face samples with specific attributes through latent variable mapping and conditional control module, and an explicit occlusion mask mechanism is introduced to simulate the real occlusion distribution; the discriminator adopts a multi-scale convolution PatchGAN structure; and the loss function adopts a combined optimization of adversarial loss and perceptual loss.

5. The face recognition attendance method based on the improved ArcFace algorithm according to claim 1, characterized in that, It also includes a template quality management step: When storing the user's face feature template, record its corresponding feature length as a quality indicator; When performing identity comparison, different weights are assigned to different templates according to the quality indicators; When it is detected that the quality of a certain stored template is lower than the preset quality threshold, a new face image is collected, and the original low-quality template in the database is replaced with the newly extracted high-quality feature vector.

6. The face recognition attendance method based on the improved ArcFace algorithm according to claim 1, characterized in that, It also includes an abnormality recognition mechanism: When detecting that the recognition result is unstable or continuous verification fails, the current recognition is automatically marked as abnormal, and the corresponding image is saved for manual review, wherein the unstable recognition result includes that the fluctuation range of the similarity score exceeds the preset range in the continuous M times of recognition of the same target personnel, or the output identity recognition result jumps between different registered personnel.

7. The face recognition attendance method based on the improved ArcFace algorithm according to claim 1, characterized in that, Also includes security protection mechanism: All feature data in the process of transmission and storage using AES-256 encryption algorithm processing, guarantee user privacy and data security.

8. A face recognition attendance system based on an improved ArcFace algorithm, based on the face recognition attendance method of any one of claims 1 to 7, characterized in that, Including: Image acquisition module, for collecting user face image; Face detection and pretreatment module, for face detection, key point alignment, cutting and light normalization processing on the collected face image; Feature extraction module, for inputting the preprocessed face image into the neural network model based on the improved ArcFace algorithm, generating the corresponding feature vector, and using the lightweight convolutional backbone structure combined with quantization and acceleration reasoning technology to improve the running speed on the edge device; Comparison and template management module, for identity recognition based on two-stage comparison strategy, and management and update of the quality of templates in the database combined with feature length; Attendance and access control module, for automatically recording attendance information and controlling access switch according to the final recognition result.

9. The face recognition attendance system based on the improved ArcFace algorithm according to claim 8, characterized in that, The feature extraction module adopts a curriculum learning strategy during model training, reduces the weight of difficult samples in the early training stage to ensure rapid convergence of the model, and gradually increases the weight of difficult samples in the later training stage to improve the generalization ability to complex scenes, thereby improving the recognition accuracy of the system, wherein the difficult sample is defined as a sample with feature vector length less than a preset quality threshold, or a sample incorrectly classified by the model or with classification probability lower than a preset confidence threshold during training.

10. The face recognition attendance system based on the improved ArcFace algorithm according to claim 8, characterized in that, The comparison and template management module includes a template update mechanism, which automatically replaces the old template in the database with the new feature when detecting that the length of the newly collected user face feature is greater than the length of the corresponding template in the database.

Citation Information

Patent Citations

  • Face recognition model training method, face recognition method and related equipment

    CN120496151A

  • Cattle face recognition method and system based on A-SH-BNet

    CN120656211A