Face recognition algorithm and smart hat sticker based on face recognition and positioning detection

The face recognition algorithm and smart hat sticker provide accurate and continuous tracking by optimizing neural networks for improved face recognition, addressing the inaccuracies and costs of existing positioning technologies.

CN118840778BActive Publication Date: 2024-12-03SICHUAN HUANYU ZHONGHENG TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411328315.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2024-12-03
Estimated Expiration
2044-09-24

AI Technical Summary

Technical Problem

Existing positioning card technologies, such as GPS and Bluetooth, are prone to inaccuracies and misuse, leading to ineffective personnel tracking due to the separation of the person and the card, and manual management is costly.

Method used

A face recognition algorithm integrated with a smart hat sticker that uses a face recognition camera to identify and track individuals by decoding face images, optimizing a neural network for accurate recognition, and utilizing support vector machines to ensure correct positioning through real-time feedback.

Benefits of technology

Ensures accurate and continuous tracking of individuals by preventing separation of the person and the card, reducing costs through automated management, and enhancing recognition accuracy with expanded sample sizes and optimized neural networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118840778B_ABST
    Figure CN118840778B_ABST
Patent Text Reader

Abstract

The present invention discloses a face recognition algorithm and a smart hat sticker based on face recognition and positioning detection, belonging to the technical field of smart hat stickers, and the method steps are as follows: obtaining a number of face images taken by a face recognition camera; decoding the face images and redistributing samples to obtain a face image training set; constructing a target face recognition neural network; training the target face recognition neural network; using the trained target face recognition neural network to classify and identify the images to be identified, and screen out a number of frontal face images; according to the pre-stored face images of the wearer corresponding to the locator, respectively perform similarity judgment on each frontal face image to obtain the identification result of the current wearer. The smart hat sticker includes a locator set on the brim of the hat and a face recognition camera that uses a face recognition algorithm to perform live identification. The present invention solves the problem of invalid positioning or inaccurate positioning caused by the separation of the person and the card during personnel positioning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of smart cap stickers, and in particular relates to a face recognition algorithm and a smart cap sticker based on face recognition and positioning detection. Background Art

[0002] For scenes with many people and complicated identities, it is usually necessary to locate each person in order to facilitate personnel management and ensure on-site safety. Existing image positioning is difficult to reflect the real spatial position, and the method of face recognition for people in image positioning lacks the screening of facial features, resulting in insufficient accuracy; secondly, personnel management through manpower will also greatly increase the cost of management personnel. Therefore, positioning cards are usually used, so that each person on the scene carries a positioning card, so that managers can obtain personnel location information in the corresponding background management system.

[0003] Existing positioning card technologies are generally divided into GPS positioning cards and Bluetooth positioning cards. GPS positioning card technology obtains the location information of the GPS positioning card by receiving signals from GPS satellites. Bluetooth positioning technology uses Bluetooth signals for location perception and positioning, and obtains the location of the Bluetooth positioning card by receiving the Bluetooth signal strength or the Bluetooth signal arrival time difference. However, existing positioning card technologies can only track the location of the receiving device. The wearer of the receiving device can easily discard the positioning card or deliberately cheat to circumvent positioning, resulting in the positioning card being unable to accurately reflect the wearer's location. Summary of the invention

[0004] In view of the above-mentioned deficiencies in the prior art, the present invention provides a face recognition algorithm and a smart hat sticker based on face recognition and positioning detection, which immediately feed back the wearer's position information through a locator after the face recognition camera completes photographing the wearer's face, and uses the face recognition camera to perform live identification on the wearer using the face recognition algorithm to obtain the current wearer's identification result, thereby realizing unified positioning management of the person and the card, and solving the problem of invalid positioning or inaccurate positioning caused by the separation of the person and the card during personnel positioning.

[0005] In order to achieve the above-mentioned object of the invention, the technical solution adopted by the present invention is:

[0006] On the one hand, the present invention provides a face recognition algorithm, comprising the following steps:

[0007] S1. Obtaining a number of face images taken by a face recognition camera;

[0008] S2, decoding the face image and redistributing samples to obtain a face image training set;

[0009] S3, optimizing the initial face recognition neural network according to the neural architecture search method to construct the target face recognition neural network;

[0010] S4, training a target face recognition neural network based on a face image training set to obtain a trained target face recognition neural network;

[0011] S5, obtaining a number of images to be recognized taken by a face recognition camera, and using the trained target face recognition neural network to classify and recognize the images to be recognized, and screening out a number of frontal face images whose face classification results are frontal faces;

[0012] S6. Based on the pre-stored facial images of the wearer corresponding to the locator, similarity determination is performed on each frontal face image to obtain the recognition result of the current wearer.

[0013] The beneficial effects of the present invention are as follows: a face recognition algorithm provided by the present invention can be used for liveness detection of photographed face images, and by decoding face images and redistributing samples, the sample size of face images can be effectively expanded, thereby obtaining a face image data set with rich samples, and providing a basis for training a target face recognition neural network to improve the accuracy of classification and recognition; the initial face recognition neural network is optimized according to the neural architecture search method, and a target face recognition neural network can be constructed, and after the target face recognition neural network is trained, a number of frontal face images can be quickly identified and screened, and the accuracy of similarity recognition of facial features of the wearer can be effectively guaranteed based on the frontal face images; according to the face images of the wearer corresponding to the pre-stored locator, the similarity of each frontal face image is judged respectively, and a high-accuracy recognition result of the current wearer can be obtained, and the combination of the current wearer recognition result and the positioning capability of the positioning card can realize continuous tracking and positioning of the smart hat wearer in the scene, thereby effectively preventing the phenomenon of separation of the person and the card during the positioning process.

[0014] Furthermore, the S2 comprises the following steps:

[0015] S21, decoding each face image into RGB format to obtain a number of decoded face images as training samples;

[0016] S22. Based on the SCRFD model, the training samples are redistributed to expand and increase the training samples to obtain a face image training set.

[0017] The beneficial effect of adopting the above further scheme is: in the present invention, the face image is decoded into RGB format to facilitate pixel-level processing of the image, and through sample redistribution, the amount of training samples can be effectively increased, thereby improving the recognition accuracy of the target face recognition neural network.

[0018] Furthermore, S3 comprises the following steps:

[0019] S31, selecting an initial face recognition neural network model;

[0020] S32. According to the neural architecture search method, the convolution in the backbone network of the initial face recognition neural network model is replaced with point-by-point convolution and dilated convolution to obtain an optimized backbone network to extract multi-scale features corresponding to the input image;

[0021] S33, connecting the input end of the feature pyramid network to the output end of the optimized backbone network, so as to fuse the multi-scale feature maps using the feature pyramid network to obtain a fused feature image;

[0022] S34, connecting the input end of ResNet18 to the output end of the feature pyramid network, so as to use ResNet18 to perform feature extraction and dense sampling on the fused feature image to obtain a candidate window;

[0023] S35. Connect the input end of the support vector machine SVM to the output end of ResNet18 to complete the construction of the target face recognition neural network.

[0024] The beneficial effects of adopting the above further scheme are as follows: the present invention provides a method for constructing a target face recognition neural network, which can effectively improve the feature extraction capability and effect through point-by-point convolution and hole convolution, and can consider multi-scale image features based on the feature pyramid network, thereby improving the richness of image features. Through ResNet18 and the residual connection therein, it can effectively prevent overfitting while fully performing feature extraction, and provide a basis for the accurate classification of support vector machines. The target face recognition neural network provided by the present invention can quickly and accurately extract the front face image of the current wearer.

[0025] Furthermore, the S4 comprises the following steps:

[0026] S41, inputting each training sample in the face image training set into the optimized backbone network to obtain multi-scale features corresponding to each face image;

[0027] S42, using a feature pyramid network to fuse the multi-scale features corresponding to each face image, to obtain a fused feature image corresponding to each face image;

[0028] S43, using ResNet18 to perform feature extraction and dense sampling on the fused feature images corresponding to each face image, to obtain a candidate window corresponding to each face image;

[0029] S44, classifying facial features using a support vector machine (SVM) according to the candidate windows corresponding to each facial image to obtain a facial classification result;

[0030] S45, repeat S41-S44 until a preset number of training times is reached to obtain a trained target face recognition neural network.

[0031] The beneficial effect of adopting the above further scheme is: the present invention provides a method for training a target face recognition neural network based on a face image training set, and through an appropriate number of training times, the target face recognition neural network can achieve a high-accuracy face classification effect after training.

[0032] Further, the S44 comprises the following steps:

[0033] S441, obtaining facial features based on candidate windows corresponding to each facial image;

[0034] S442, obtaining facial feature key points in the facial features, wherein the facial feature key points include a left pupil key point, a right pupil key point, a nose tip key point, a left corner of the mouth key point, and a right corner of the mouth key point;

[0035] S443, performing data mapping according to the left pupil key point, the right pupil key point and the nose tip key point, and calculating the lateral deflection ratio of the face;

[0036] The calculation expression of the lateral deflection ratio of the face is as follows:

[0037] ,

[0038] Where Pfr represents the lateral deflection ratio of the face, a represents the foot point of the perpendicular line from the nose tip key point to the left pupil key point and the right pupil key point, m represents the midpoint of the line between the left pupil key point and the right pupil key point, / represents the ratio, || || represents the vector distance calculation, x1 represents the position of the left pupil key point, and x2 represents the position of the right pupil key point;

[0039] S444: If the horizontal deflection ratio of the face is greater than the horizontal deflection threshold, the horizontal face feature is a horizontal non-frontal face; otherwise, the horizontal face feature is a horizontal frontal face;

[0040] S445, performing data mapping according to the nose tip key point, the left corner of the mouth key point and the right corner of the mouth key point, and calculating the longitudinal deflection ratio of the face;

[0041] The calculation expression of the vertical deflection ratio of the face is as follows:

[0042] ,

[0043] Among them, Fhr represents the longitudinal deflection ratio of the face, b represents the midpoint of the line between the left corner of the mouth key point and the right corner of the mouth key point, c represents the foot point of the perpendicular line between the nose tip key point and the left corner of the mouth key point and the right corner of the mouth key point, and x3 represents the position of the nose tip key point;

[0044] S446: If the vertical deflection ratio of the face is within a preset vertical deflection range threshold, the vertical face feature is a vertical frontal face; otherwise, the vertical face feature is a vertical non-frontal face;

[0045] S447, taking horizontal face features and vertical face features as samples, and taking front face and non-front face as two labels of sample categories;

[0046] S448. Set a maximum margin hyperplane so that the classification result of the support vector machine SVM satisfies that if the horizontal face feature is a horizontal frontal face and the vertical face feature is a vertical frontal face, then the face classification result is a frontal face; otherwise, the face classification result is a non-frontal face.

[0047] The beneficial effect of adopting the above further scheme is: the present invention provides a method for classifying facial features according to the candidate windows corresponding to each facial image by using a support vector machine SVM to obtain a facial classification result. By distinguishing the horizontal and vertical deflection features, the frontal face image can be accurately identified, providing a basis for similarity judgment between the frontal face image and the facial image of the wearer.

[0048] Further, the S6 comprises the following steps:

[0049] S61, extracting key points of facial features in each frontal face image;

[0050] S62, aligning the facial feature key points in each frontal face image to preset standard frontal face key point positions through an affine transformation matrix, to obtain a plurality of face images with key point alignment;

[0051] The calculation expression of the affine transformation matrix is ​​as follows:

[0052] ,

[0053] in, Represents the horizontal coordinate of the key points of facial features in the face image after key point alignment, Represents the ordinate of the key points of facial features in the face image after key point alignment, represents the first transverse linear transformation parameter, represents the second transverse linear transformation parameter, represents the first longitudinal linear transformation parameter, represents the second longitudinal linear transformation parameter, represents the lateral translation parameter, represents the vertical translation parameter, x represents the horizontal coordinate of the key point of the facial feature in the frontal face image, and y represents the vertical coordinate of the key point of the facial feature in the frontal face image;

[0054] S63, extracting feature vectors from the face images aligned with each key point based on the face feature vector extraction model to obtain a number of face feature vectors;

[0055] S64, obtaining a facial image feature vector of the wearer according to a pre-stored facial image of the wearer corresponding to the locator;

[0056] S65, respectively calculating the second cosine similarity between each facial feature vector and the facial image feature vector of the wearer;

[0057] The calculation expression of the second cosine similarity is as follows:

[0058] ,

[0059] Among them, cos_similarity(P,P0) represents the second cosine similarity, P represents the face feature vector, P0 represents the wearer's face image feature vector, and || || represents the norm operation;

[0060] S66. If there is a facial feature vector whose second cosine similarity corresponding to the facial feature vector is greater than the second cosine similarity threshold, the recognition result of the current wearer is normal; otherwise, the recognition result of the current wearer is abnormal.

[0061] The beneficial effect of adopting the above further scheme is: the present invention provides a method for performing similarity judgment on each frontal face image according to the facial image of the wearer corresponding to the pre-stored locator, and after aligning the key points of facial features, extracting vector features and judging the similarity, the current wearer can be accurately identified, thereby ensuring the consistency of the person card positioning and providing a basis for continuous positioning and tracking of the wearer.

[0062] Furthermore, the S63 includes the following steps:

[0063] S631, using a facial feature vector extraction model to perform feature normalization processing on the facial images with key points aligned, to obtain a number of normalized facial image feature vectors;

[0064] S632, averaging all normalized facial image feature vectors to obtain a true category center vector;

[0065] S633, respectively calculating the first cosine similarity between each normalized facial image feature vector and the true category center vector;

[0066] The calculation expression of the first cosine similarity is as follows:

[0067] ,

[0068] in, represents the first cosine similarity, Table 1 shows the true category center vector, represents the normalized feature vector of the i-th face image;

[0069] S634: According to the first cosine similarity, based on the angle loss function, perform additive angle margin adjustment and cosine similarity scaling to obtain a scaled first cosine similarity;

[0070] S635 . According to the scaled first cosine similarities exceeding the first cosine similarity threshold, extract and obtain a number of facial feature vectors.

[0071] The beneficial effect of adopting the above further scheme is: the present invention provides a method for extracting feature vectors of face images with each key point aligned based on a face feature vector extraction model to obtain a number of face feature vectors. The number of face feature vectors are obtained by screening, which can ensure the accuracy of similarity judgment and improve the tolerance rate of similarity judgment through a sufficient number of frontal face images within the detection time.

[0072] Furthermore, the calculation expression of the angle loss function in S634 is as follows:

[0073] ,

[0074] Where L represents the angle loss, N represents the total number of normalized face image feature vectors, log represents logarithmic operation, e represents the exponential basis constant, s represents the scaling factor, cos() represents the cosine function, θ yi represents the angle between the normalized face image feature vector and the true category center vector, m represents the additive angle margin, j represents the jth non-true category center, n represents the total number of face image categories, yi represents the true category center, θ j Represents the angle between the normalized face image feature vector and the central feature vector of the jth non-real category.

[0075] The beneficial effect of adopting the above further scheme is: the angle loss function provided by the present invention effectively improves the quality of the screened facial feature vector through additive angle margin adjustment and cosine similarity scaling, and ensures the accuracy of similarity judgment.

[0076] On the other hand, the present invention also provides a smart hat sticker based on face recognition and positioning detection, including a locator arranged on the brim of the hat, and a face recognition camera for performing liveness recognition using the above-mentioned face recognition algorithm;

[0077] The locator is used to receive the positioning signal and feedback the real-time position information of the wearer;

[0078] The face recognition camera pre-stores a face image of the person wearing the locator corresponding to the locator;

[0079] The face recognition camera is used to take real-time photos of the wearer's face and perform live identification on the wearer based on the pre-stored face image of the wearer corresponding to the locator;

[0080] After the face recognition camera completes photographing the wearer's face, the locator immediately feeds back the wearer's real-time positioning information, and the face recognition camera performs liveness recognition on several face images photographed by the face recognition camera according to the face recognition algorithm to obtain the recognition result of the current wearer.

[0081] The beneficial effects of the present invention are as follows: the present invention forms a smart hat sticker that can carry out targeted and continuous tracking of the wearer by arranging a group of locators and face recognition cameras at the brim of the safety helmet. Based on the smart hat sticker, it is possible to timely feedback the wearer's position information after the wearer's face is photographed, and perform liveness detection on the wearer to ensure accurate detection of whether the wearer and the locator are separated, thereby ensuring continuous and effective positioning management of the wearer.

[0082] Furthermore, the face recognition camera performs liveness recognition on the wearer by means of timed detection or random detection, wherein the timed detection interval is not less than a preset detection interval.

[0083] The beneficial effects of adopting the above further scheme are: the timed detection method can effectively save computing processing resources and energy consumption of the smart cap sticker, and the random detection can more flexibly detect the wearer's card separation phenomenon, preventing the wearer from evading the security detection of liveness recognition based on the detection rules.

[0084] Other advantages of the present invention will be analyzed in more detail in subsequent embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0086] Figure 1 This is a flowchart of the steps of a face recognition algorithm in Example 1 of the present invention.

[0087] Figure 2 This is a block diagram of a smart hat sticker based on face recognition and positioning detection in Example 2 of the present invention. DETAILED DESCRIPTION

[0088] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present invention.

[0089] Example 1: Figure 1 As shown, in one embodiment of the present invention, the present invention provides a face recognition algorithm, comprising the following steps:

[0090] S1. Acquire a number of face images captured by a face recognition camera. In this embodiment, the face recognition camera extracts a number of video frames from nearby video images before performing liveness recognition to obtain a number of face images.

[0091] S2, decoding the face image and redistributing samples to obtain a face image training set;

[0092] The S2 comprises the following steps:

[0093] S21, decoding each face image into RGB format, obtaining a number of decoded face images as training samples; in this embodiment, the original encoding format of the face image taken by the face recognition camera is Base64 format, and the encoding format of the face image taken by cameras of different types or models is different, and adjusting to RGB format facilitates pixel-level processing of the image;

[0094] S22. Based on the SCRFD model, the training samples are redistributed to expand and increase the training samples to obtain a face image training set.

[0095] In this embodiment, sample redistribution is to add corresponding training samples to the training stage based on the decoded face image. For face detection, sample redistribution can effectively solve the problem of difficulty in detecting small faces. By increasing the training samples of small faces, the detection ability of such faces can be effectively improved. The method adopted by this scheme to implement sample redistribution includes expanding the random cropping range, rotating, scaling and flipping, wherein expanding the random cropping range can generate more training samples by filling the missing pixels beyond the size of the original image, thereby significantly increasing the number of small faces and improving the model's detection ability for small faces. Sample redistribution also helps to balance the data set to more comprehensively learn the characteristics of various samples, improve the generalization ability of the model, and enable the model to maintain high performance when processing unseen samples.

[0096] S3, optimizing the initial face recognition neural network according to the neural architecture search method to construct the target face recognition neural network;

[0097] In this embodiment, by introducing efficient convolution methods such as point-by-point convolution and dilated convolution, the computing resource allocation of the initial face recognition neural network model is optimized. While maintaining high precision, the amount of calculation can be significantly reduced and the detection speed can be improved. The feature pyramid network also helps to reduce redundant calculations, which can effectively improve the detection efficiency and accuracy of faces. Based on the feature pyramid network, the feature maps of different scales output by the backbone network are fused to form a richer and more comprehensive feature representation. Resnet18 extracts the features of the fused feature image through the residual block, and then performs dense sampling on the fused feature image.

[0098] The S3 comprises the following steps:

[0099] S31, selecting an initial face recognition neural network model;

[0100] In this embodiment, the neural network types that can be selected for the initial face recognition neural network model include convolutional neural network, BP neural network, FaceNet, MobielNet and ShuffleNet;

[0101] S32. According to the neural architecture search method, the convolution in the backbone network of the initial face recognition neural network model is replaced with point-by-point convolution and dilated convolution to obtain an optimized backbone network to extract multi-scale features corresponding to the input image;

[0102] In this embodiment, the point-by-point convolution uses a 1×1 convolution kernel and the hole convolution uses a 3×3 convolution kernel to capture a wider range of contextual information. By expanding the convolution kernel, the receptive field of the feature map can be increased, thereby extracting multi-scale feature representations.

[0103] S33, connecting the input end of the feature pyramid network to the output end of the optimized backbone network, so as to fuse the multi-scale feature maps using the feature pyramid network to obtain a fused feature image;

[0104] S34, connecting the input end of ResNet18 to the output end of the feature pyramid network, so as to use ResNet18 to perform feature extraction and dense sampling on the fused feature image to obtain a candidate window;

[0105] S35. Connect the input end of the support vector machine SVM to the output end of ResNet18 to complete the construction of the target face recognition neural network.

[0106] S4, training a target face recognition neural network based on a face image training set to obtain a trained target face recognition neural network;

[0107] The S4 comprises the following steps:

[0108] S41, inputting each training sample in the face image training set into the optimized backbone network to obtain multi-scale features corresponding to each face image;

[0109] S42, using a feature pyramid network to fuse the multi-scale features corresponding to each face image, to obtain a fused feature image corresponding to each face image;

[0110] S43, using ResNet18 to perform feature extraction and dense sampling on the fused feature images corresponding to each face image, to obtain a candidate window corresponding to each face image;

[0111] S44, classifying facial features using a support vector machine (SVM) according to the candidate windows corresponding to each facial image to obtain a facial classification result;

[0112] The S44 comprises the following steps:

[0113] S441, obtaining facial features based on candidate windows corresponding to each facial image;

[0114] S442, obtaining facial feature key points in the facial features, wherein the facial feature key points include a left pupil key point, a right pupil key point, a nose tip key point, a left corner of the mouth key point, and a right corner of the mouth key point;

[0115] S443, performing data mapping according to the left pupil key point, the right pupil key point and the nose tip key point, and calculating the lateral deflection ratio of the face;

[0116] The calculation expression of the lateral deflection ratio of the face is as follows:

[0117] ,

[0118] Where Pfr represents the lateral deflection ratio of the face, a represents the foot point of the perpendicular line from the nose tip key point to the left pupil key point and the right pupil key point, m represents the midpoint of the line between the left pupil key point and the right pupil key point, / represents the ratio, || || represents the vector distance calculation, x1 represents the position of the left pupil key point, and x2 represents the position of the right pupil key point;

[0119] S444, if the horizontal deflection ratio of the face is greater than the horizontal deflection threshold, the horizontal face feature is a horizontal non-frontal face, otherwise the horizontal face feature is a horizontal frontal face; in this embodiment, the horizontal deflection threshold is set to 0.5;

[0120] S445, performing data mapping according to the nose tip key point, the left corner of the mouth key point and the right corner of the mouth key point, and calculating the longitudinal deflection ratio of the face;

[0121] The calculation expression of the vertical deflection ratio of the face is as follows:

[0122] ,

[0123] Among them, Fhr represents the longitudinal deflection ratio of the face, b represents the midpoint of the line between the left corner of the mouth key point and the right corner of the mouth key point, c represents the foot point of the perpendicular line between the nose tip key point and the left corner of the mouth key point and the right corner of the mouth key point, and x3 represents the position of the nose tip key point;

[0124] S446: If the vertical deflection ratio of the face is within a preset vertical deflection range threshold, the vertical face feature is a vertical frontal face; otherwise, the vertical face feature is a vertical non-frontal face;

[0125] In this embodiment, the preset longitudinal deflection range threshold is [0.2, 0.7].

[0126] S447, taking horizontal face features and vertical face features as samples, and taking front face and non-front face as two labels of sample categories;

[0127] S448. Set a maximum margin hyperplane so that the classification result of the support vector machine SVM satisfies that if the horizontal face feature is a horizontal frontal face and the vertical face feature is a vertical frontal face, then the face classification result is a frontal face; otherwise, the face classification result is a non-frontal face.

[0128] S45, repeat S41-S44 until a preset number of training times is reached to obtain a trained target face recognition neural network.

[0129] S5, obtaining a number of images to be recognized taken by a face recognition camera, and using the trained target face recognition neural network to classify and recognize the images to be recognized, and screening out a number of frontal face images whose face classification results are frontal faces;

[0130] S6. Based on the pre-stored facial images of the wearer corresponding to the locator, similarity determination is performed on each frontal face image to obtain the recognition result of the current wearer.

[0131] The S6 comprises the following steps:

[0132] S61, extracting key points of facial features in each frontal face image;

[0133] S62, aligning the facial feature key points in each frontal face image to preset standard frontal face key point positions through an affine transformation matrix, to obtain a plurality of face images with key point alignment;

[0134] The calculation expression of the affine transformation matrix is ​​as follows:

[0135] ,

[0136] in, Represents the horizontal coordinate of the key points of facial features in the face image after key point alignment, Represents the ordinate of the key points of facial features in the face image after key point alignment, represents the first transverse linear transformation parameter, represents the second transverse linear transformation parameter, represents the first longitudinal linear transformation parameter, represents the second longitudinal linear transformation parameter, represents the lateral translation parameter, represents the vertical translation parameter, x represents the horizontal coordinate of the key point of the facial feature in the frontal face image, and y represents the vertical coordinate of the key point of the facial feature in the frontal face image;

[0137] In this embodiment, by aligning the facial feature key points in the frontal face image to the preset standard facial key point positions, the posture differences between the images can be effectively eliminated, and the geometric features of the face can be better preserved, so as to provide a guarantee for extracting useful feature vectors for similarity analysis;

[0138] S63, extracting feature vectors from the face images aligned with each key point based on a face feature vector extraction model to obtain a number of face feature vectors; in this embodiment, the face feature vector extraction model adopts an Arcface model;

[0139] The S63 comprises the following steps:

[0140] S631, using a facial feature vector extraction model to perform feature normalization processing on the facial images with key points aligned, to obtain a number of normalized facial image feature vectors;

[0141] S632, averaging all normalized facial image feature vectors to obtain a true category center vector;

[0142] S633, respectively calculating the first cosine similarity between each normalized facial image feature vector and the true category center vector;

[0143] The calculation expression of the first cosine similarity is as follows:

[0144] ,

[0145] in, represents the first cosine similarity, Table 1 shows the true category center vector, represents the normalized feature vector of the i-th face image;

[0146] S634: According to the first cosine similarity, based on the angle loss function, perform additive angle margin adjustment and cosine similarity scaling to obtain a scaled first cosine similarity;

[0147] The calculation expression of the angle loss function in S634 is as follows:

[0148] ,

[0149] Where L represents the angle loss, N represents the total number of normalized face image feature vectors, log represents logarithmic operation, e represents the exponential basis constant, s represents the scaling factor, cos() represents the cosine function, θ yi represents the angle between the normalized face image feature vector and the true category center vector, m represents the additive angle margin, j represents the jth non-true category center, n represents the total number of face image categories, yi represents the true category center, θ j Represents the angle between the normalized face image feature vector and the central feature vector of the jth non-real category.

[0150] S635 . According to the scaled first cosine similarities exceeding the first cosine similarity threshold, extract and obtain a number of facial feature vectors.

[0151] S64, obtaining a facial image feature vector of the wearer according to a pre-stored facial image of the wearer corresponding to the locator;

[0152] S65, respectively calculating the second cosine similarity between each facial feature vector and the facial image feature vector of the wearer;

[0153] The calculation expression of the second cosine similarity is as follows:

[0154] ,

[0155] Among them, cos_similarity(P,P0) represents the second cosine similarity, P represents the face feature vector, P0 represents the wearer's face image feature vector, and || || represents the norm operation;

[0156] S66. If there is a facial feature vector whose second cosine similarity corresponding to the facial feature vector is greater than the second cosine similarity threshold, the recognition result of the current wearer is normal; otherwise, the recognition result of the current wearer is abnormal.

[0157] The face recognition algorithm provided by the present invention can be used to perform liveness detection on face images captured by a face recognition camera arranged at a hat brim. By decoding the face images and redistributing samples, the face image sample size can be effectively expanded, thereby obtaining a face image data set. The initial face recognition neural network is optimized according to the neural architecture search method, and a target face recognition neural network can be constructed. After the target face recognition neural network is trained, a frontal face image can be quickly screened and recognized, so as to provide a basis for performing similarity judgment on each frontal face image according to the face image of the wearer corresponding to the pre-stored locator, and obtaining the recognition result of the current wearer. Combining the recognition result of the current wearer and the positioning capability of the locator, continuous tracking and positioning of the wearer of the hat patch in the scene can be achieved.

[0158] Example 2: Figure 2 As shown, on the basis of Example 1, the present invention further provides a smart hat sticker based on face recognition and positioning detection, including a locator arranged on the brim of the hat, and a face recognition camera for performing liveness recognition using the face recognition algorithm in Example 1;

[0159] The locator is used to receive positioning signals and feedback the real-time location information of the wearer; the locator can be a positioning card, and the real-time location information of the wearer fed back can be GPS positioning information, Bluetooth positioning information or Beidou positioning information of the location of the locator.

[0160] The face recognition camera pre-stores a face image of the person wearing the locator corresponding to the locator;

[0161] The face recognition camera is used to take real-time photos of the wearer's face and perform live identification on the wearer based on the pre-stored face image of the wearer corresponding to the locator;

[0162] After the facial recognition camera completes photographing the wearer's face, the locator immediately feeds back the wearer's real-time positioning information, and the facial recognition camera performs liveness recognition on several facial images photographed by the facial recognition camera according to the facial recognition algorithm to obtain the current wearer's recognition result, wherein the facial image is extracted from the video frame photographed by the facial recognition camera.

[0163] The face recognition camera performs liveness recognition on the wearer by means of timed detection or random detection, wherein the timed detection interval is not less than a preset detection interval.

[0164] The present invention sets a group of locators and face recognition cameras at the brim of the safety helmet to form a smart hat sticker that can continuously track the wearer. Based on the smart hat sticker, it is possible to timely feedback the wearer's position information after the wearer's face is photographed, and perform liveness detection on the wearer to ensure accurate detection of whether the wearer and the locator are separated. If the current wearer identification result is normal, the wearer is accurately positioned, and there is no person-card separation, and continuous tracking can be maintained. Otherwise, the current wearer identification result is abnormal, and the wearer is inaccurately positioned, and there is a person-card separation phenomenon, which needs to be corrected in time and required to be worn.

[0165] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A face recognition algorithm, characterized in that: The steps include: S1. Obtaining a number of face images taken by a face recognition camera; S2, decoding the face image and redistributing samples to obtain a face image training set; S3, optimizing the initial face recognition neural network according to the neural architecture search method to construct the target face recognition neural network; The S3 comprises the following steps: S31, selecting an initial face recognition neural network model; S32. According to the neural architecture search method, the convolution in the backbone network of the initial face recognition neural network model is replaced with point-by-point convolution and dilated convolution to obtain an optimized backbone network to extract multi-scale features corresponding to the input image; S33, connecting the input end of the feature pyramid network to the output end of the optimized backbone network, so as to fuse the multi-scale feature maps using the feature pyramid network to obtain a fused feature image; S34, connecting the input end of ResNet18 to the output end of the feature pyramid network, so as to use ResNet18 to perform feature extraction and dense sampling on the fused feature image to obtain a candidate window; S35, connecting the input end of the support vector machine SVM to the output end of ResNet18 to complete the construction of the target face recognition neural network; S4, training a target face recognition neural network based on a face image training set to obtain a trained target face recognition neural network; The S4 comprises the following steps: S41, inputting each training sample in the face image training set into the optimized backbone network to obtain multi-scale features corresponding to each face image; S42, using a feature pyramid network to fuse the multi-scale features corresponding to each face image, to obtain a fused feature image corresponding to each face image; S43, using ResNet18 to perform feature extraction and dense sampling on the fused feature images corresponding to each face image, to obtain a candidate window corresponding to each face image; S44, classifying facial features using a support vector machine (SVM) according to the candidate windows corresponding to each facial image to obtain a facial classification result; The S44 comprises the following steps: S441, obtaining facial features based on candidate windows corresponding to each facial image; S442, obtaining facial feature key points in the facial features, wherein the facial feature key points include a left pupil key point, a right pupil key point, a nose tip key point, a left corner of the mouth key point, and a right corner of the mouth key point; S443, performing data mapping according to the left pupil key point, the right pupil key point and the nose tip key point, and calculating the lateral deflection ratio of the face; The calculation expression of the lateral deflection ratio of the face is as follows: , in, Pf Indicates the lateral deflection ratio of the face. a Indicates the foot point of the perpendicular line from the nose tip key point to the left pupil key point and the right pupil key point. m represents the midpoint of the line between the left pupil key point and the right pupil key point, / represents the ratio, || || represents the vector distance calculation, x 1 represents the position of the left pupil key point, x 2 represents the position of the right pupil key point; S444: If the horizontal deflection ratio of the face is greater than the horizontal deflection threshold, the horizontal face feature is a horizontal non-frontal face; otherwise, the horizontal face feature is a horizontal frontal face; S445, performing data mapping according to the nose tip key point, the left corner of the mouth key point and the right corner of the mouth key point, and calculating the longitudinal deflection ratio of the face; The calculation expression of the vertical deflection ratio of the face is as follows: , in, F Indicates the vertical deflection ratio of the face. b Indicates the midpoint of the line between the left corner of the mouth key point and the right corner of the mouth key point, c Indicates the foot point of the perpendicular line from the nose tip key point to the left corner of the mouth key point and the right corner of the mouth key point, x 3 indicates the position of the key point of the nose tip; S446: If the vertical deflection ratio of the face is within a preset vertical deflection range threshold, the vertical face feature is a vertical frontal face; otherwise, the vertical face feature is a vertical non-frontal face; S447, taking horizontal face features and vertical face features as samples, and taking front face and non-front face as two labels of sample categories; S448, setting a maximum margin hyperplane so that the classification result of the support vector machine (SVM) satisfies that if the horizontal face feature is a horizontal frontal face and the vertical face feature is a vertical frontal face, then the face classification result is a frontal face, otherwise the face classification result is a non-frontal face; S45, repeating S41-S44 until a preset number of training times is reached to obtain a trained target face recognition neural network; S5, obtaining a number of images to be recognized taken by a face recognition camera, and using the trained target face recognition neural network to classify and recognize the images to be recognized, and screening out a number of frontal face images whose face classification results are frontal faces; S6. Based on the pre-stored facial images of the wearer corresponding to the locator, similarity determination is performed on each frontal face image to obtain the recognition result of the current wearer.

2. The face recognition algorithm according to claim 1, characterized in that: The S2 comprises the following steps: S21, decoding each face image into RGB format to obtain a number of decoded face images as training samples; S22. Based on the SCRFD model, the training samples are redistributed to expand and increase the training samples to obtain a face image training set.

3. The face recognition algorithm according to claim 1, characterized in that: The S6 comprises the following steps: S61, extracting key points of facial features in each frontal face image; S62, aligning the facial feature key points in each frontal face image to preset standard frontal face key point positions through an affine transformation matrix, to obtain a plurality of face images with key point alignment; The calculation expression of the affine transformation matrix is ​​as follows: , in, Represents the horizontal coordinate of the key points of facial features in the face image after key point alignment, Represents the ordinate of the key points of facial features in the face image after key point alignment, represents the first transverse linear transformation parameter, represents the second transverse linear transformation parameter, represents the first longitudinal linear transformation parameter, represents the second longitudinal linear transformation parameter, represents the lateral translation parameter, represents the longitudinal translation parameter, x Represents the horizontal coordinate of the key points of facial features in the frontal face image, y Represents the vertical coordinate of the key points of facial features in the frontal face image; S63, extracting feature vectors from the face images aligned with each key point based on the face feature vector extraction model to obtain a number of face feature vectors; S64, obtaining a facial image feature vector of the wearer according to a pre-stored facial image of the wearer corresponding to the locator; S65, respectively calculating the second cosine similarity between each facial feature vector and the facial image feature vector of the wearer; The calculation expression of the second cosine similarity is as follows: , Among them, cos_ similarity ( P , P 0) represents the second cosine similarity, P represents the face feature vector, P 0 represents the facial image feature vector of the wearer, and || || represents the norm operation; S66. If there is a facial feature vector whose second cosine similarity corresponding to the facial feature vector is greater than the second cosine similarity threshold, the recognition result of the current wearer is normal; otherwise, the recognition result of the current wearer is abnormal.

4. The face recognition algorithm according to claim 3, characterized in that: The S63 comprises the following steps: S631, using a facial feature vector extraction model to perform feature normalization processing on the facial images with key points aligned, to obtain a number of normalized facial image feature vectors; S632, averaging all normalized facial image feature vectors to obtain a true category center vector; S633, respectively calculating the first cosine similarity between each normalized facial image feature vector and the true category center vector; The calculation expression of the first cosine similarity is as follows: , in, represents the first cosine similarity, Table 1 shows the true category center vector, Indicates i A normalized face image feature vector; S634: According to the first cosine similarity, based on the angle loss function, perform additive angle margin adjustment and cosine similarity scaling to obtain a scaled first cosine similarity; S635 . According to the scaled first cosine similarities exceeding the first cosine similarity threshold, extract and obtain a number of facial feature vectors.

5. The face recognition algorithm according to claim 4, characterized in that: The calculation expression of the angle loss function in S634 is as follows: , in, L represents the angle loss, N represents the total number of normalized face image feature vectors, log represents logarithmic operation, e represents the exponential basis constant, s represents the scaling factor, cos() represents the cosine function, θ yi Represents the angle between the normalized face image feature vector and the true category center vector, m represents the additive angular margin, j Indicates j Non-real category centers, n represents the total number of face image categories, yi represents the true category center, θ j Represents the normalized face image feature vector and the j The angle between the feature vectors of the non-true class centers.

6. A smart hat sticker based on face recognition and positioning detection, characterized in that: It includes a locator arranged on the brim of a hat, and a face recognition camera for performing liveness recognition using the face recognition algorithm described in any one of claims 1 to 5; The locator is used to receive the positioning signal and feedback the real-time position information of the wearer; The face recognition camera pre-stores a face image of the person wearing the locator corresponding to the locator; The face recognition camera is used to take real-time photos of the wearer's face and perform live identification on the wearer based on the pre-stored facial image of the wearer corresponding to the locator; After the face recognition camera completes photographing the wearer's face, the locator immediately feeds back the wearer's real-time positioning information, and the face recognition camera performs liveness recognition on several face images photographed by the face recognition camera according to the face recognition algorithm to obtain the recognition result of the current wearer.

7. The smart hat sticker based on face recognition and positioning detection according to claim 6, characterized in that: The face recognition camera performs liveness recognition on the wearer by means of timed detection or random detection, wherein the timed detection interval is not less than a preset detection interval.

Citation Information

Patent Citations

  • Iterative positioning type face detection method based on deep neural network

    CN107784288A

  • Method, device, equipment and system for constructing figure image recognition system

    CN110472516A

  • Intelligent wheelchair face security authentication method and system

    CN117671762A

  • Methods and systems for determining user liveness and verifying user identities

    US20180046853A1

  • Human face detection method and human face detection system

    WO2019091271A1