A face recognition method in a mask-occluded scene
By improving the ResNet50 network and using Dlib face detection technology, the problem of false recognition of faces when wearing masks was solved, thereby improving recognition accuracy and the security of the access control system.
Patent Information
- Application Number
- CN202111662759.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-12-31
AI Technical Summary
Existing facial recognition methods are prone to misidentification and failure to recognize faces when wearing masks, which reduces the security of access control systems.
An improved ResNet50 network is used to replace the softmax layer with an A-softmax layer. Facial key points are extracted using the Dlib face detection and localization method to generate RGB and HSV images. The H layer information of the HSV image is used to obtain the mask occlusion position, and the importance of feature vectors is adjusted by the occlusion dictionary to perform face recognition.
It improves the accuracy of facial recognition when people are wearing masks, and enhances the security of access control systems.
Smart Images

Figure CN114373210B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine learning technology, and in particular to a face recognition method in the field of machine learning image processing technology. Background Art
[0002] Affected by the virus, wearing masks has become a prerequisite for public travel. However, masks can seriously block the face, so some applications cannot effectively recognize faces in scenarios that require face recognition support, such as unlocking phones, making payments, and checking tickets at stations.
[0003] In existing face recognition methods, face recognition with masks often results in misidentification or failure to recognize faces. Some existing face recognition schemes cannot recognize faces with masks, while others reduce the recognition threshold, making the security of the access control system less secure. Therefore, it is urgent to design an accurate face recognition scheme with masks. Summary of the invention
[0004] The present invention discloses a face recognition method in a face mask occlusion scenario, comprising the following steps:
[0005] 1. Obtain face image data from the existing database;
[0006] 2. Replace the softmax function of the softmax layer in the resnet50 network with the A-softmax function, named A-softmax layer, and use face image data to train the improved resnet50 network;
[0007] 3. Use Dlib face detection and positioning method to extract facial key points in the normal mask occlusion area from the face image;
[0008] 4. Add mask occlusion at the above key points to generate RGB images and HSV images, and obtain the H layer information of the HSV image;
[0009] 5. Use the H layer information of the HSV image to obtain the position information of the mask occlusion, and classify the image according to the occlusion key points;
[0010] 6. The RGB images with and without masks are respectively passed into the trained resnet50 network, and the output difference of the fully connected layer is calculated. The network weights and the importance of each item of the feature vector under occlusion are adjusted according to the difference. The data obtained from each classified image are recorded in the occlusion dictionary respectively.
[0011] 7. When in use, the input occluded image is converted through the HSV conversion technology to obtain the H layer information of the HSV image, obtain the occlusion position information, determine the occluded key points, and then query the occlusion dictionary, adjust the importance weight of the feature information affected by the occlusion content, and perform face recognition based on the adjusted features. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 Flowchart for training the occlusion dictionary;
[0013] Figure 2 This is the mask face recognition flow chart after training is completed; DETAILED DESCRIPTION
[0014] 1. Obtain facial image data from the existing database, including:
[0015] In order to meet the domestic needs of mask face recognition, the famous domestic face database CASIA-WebFace is used to pre-process the face images in the database and adjust the image size to meet the requirements of subsequent network processing.
[0016] 2. Replace the softmax function of the softmax layer in the resnet50 network with the A-softmax function, named A-softmax layer, and use face image data to train the improved resnet50 network, including:
[0017] The resnet50 network consists of an input layer, an output layer, and six hidden layers. The hidden layers are a 7*7 convolution layer, a 3*3 maximum pooling layer, a 16-group 1*1, 3*3, 1*1 convolution layer with different numbers of convolution kernel channels, an average pooling layer, and a fully connected layer. The final output layer implements regression through the softmax function; in order to increase the distinction between different faces, the softmax regression of the last layer is changed to A-softmax regression. The A-softmax formula is as follows:
[0018]
[0019] in,
[0020] ψ(θ yi,i )=(-1) k cos(mθ j,i )-2k,
[0021] θ yi,i Represents the angle between the weight coefficient of the yi class representative and the xi vector
[0022] The improved resnet50 network is trained using the preprocessed face image data. After multiple rounds of training, a resnet50 network that can recognize faces without mask occlusion is obtained.
[0023] 3. Use Dlib face detection and positioning method to extract facial key points in the normal mask occlusion area from the face image, including:
[0024] First, the Dlib face detection and positioning method finds the position of the face in a picture through detection, and then uses the regression tree-based face alignment algorithm GBDT to obtain 68 feature points of the face; finally, the facial key points in the area that would normally be blocked when wearing a mask are filtered out from the 68 feature points.
[0025] 4. Add mask occlusion at the key points of the face to generate RGB images and HSV images, and obtain the H layer information of the HSV image, including:
[0026] Select a variety of styles of masks, including medical surgical masks and N95 masks, and use opencv to process them to get transparent mask materials. Then adjust the mask image size according to the size of the face image, and then add the mask image to the corresponding positions of the mouth and nose of the face image. The top position of the mask is set to a random height of 1 / 3 to 1 from the key point of the bridge of the nose to the key point of the tip of the nose, and the bottom position covers the key point of the lowest point of the chin. For the generated RGB image, extract the H layer information after converting to the HSV image. The conversion formula is
[0027]
[0028] Where, Δ=Cmax-Cmin; Cmax=max(R`,G`,B`); Cmin=min(R`,G`,B`);
[0029]
[0030] 5. Use the H layer information of the HSV image to obtain the position information of the mask occlusion, and classify the image according to the occlusion key points, including:
[0031] The H layer image is subjected to mean filtering and binarization to obtain the mask mask map, determine the position of the mask, and obtain the set of key points of the area blocked by the mask. The image is classified according to the set of blocked key points.
[0032] 6. The RGB images with and without masks are passed into the trained resnet50 network respectively, and the output difference of the fully connected layer is calculated. The network weights and the importance of each feature vector under occlusion are adjusted according to the difference. The obtained data are recorded in the occlusion dictionary according to the image category, including:
[0033] For the occluded images after the above classification, take out all images of the same category and obtain the corresponding original unoccluded RGB images. Pass the two contrasting images into resnet50 respectively to obtain the output difference in the last fully connected layer. Establish an occlusion dictionary, each item of which stores the occlusion weight under a type of occlusion. For feature items whose output changes are not large, set their corresponding occlusion weights to 1. For feature items with relatively large differences, map their occlusion weights to values between 0 and 1. For particularly large feature items, directly record their weights as 0. Each pair of images will get an occlusion weight vector. After traversing all combinations of images in this category, take the average of all the occlusion weights obtained and count them into the corresponding position of the occlusion dictionary.
[0034] 7. When in use, the input occluded image is converted through HSV technology to obtain the H layer information of the HSV image, obtain the occlusion position information, determine the occluded key points, and then query the occlusion dictionary to adjust the importance weight of the feature information affected by the occlusion content, and perform face recognition based on the adjusted features. Specifically including:
[0035] For an image to be recognized, first convert it into an HSV image and obtain the occlusion position and the set of occluded key points based on the H layer information. The acquisition method is the same as 4. Query the occlusion dictionary based on the obtained key point set to obtain the occlusion vector. Then, send the image to be recognized to the trained resnet50 network, multiply the output of the network's fully connected layer by the occlusion vector, and then pass it to the A-softmax layer for classification and regression to obtain the face recognition result.
Claims
1. A face recognition method in a mask-occluded scene, characterized in that: The implementation process of the method is as follows: S1, obtaining face image data from an existing database; S2, replace the softmax function of the softmax layer in the resnet50 network with the A-softmax function, named A-softmax layer, and use the face image data to train the improved resnet50 network; S3, using Dlib face detection and positioning method to extract facial key points in the normal mask occlusion area from the face image; S4, adding mask occlusion at the above key points, generating RGB image and HSV image, and obtaining H layer information of HSV image; S5, using the H layer information of the HSV image to obtain the position information of the mask occlusion, and classifying the image according to the occlusion key points; S6, respectively passing the RGB image with mask occlusion and the RGB image without mask occlusion into the trained resnet50 network, calculating the output difference of the fully connected layer, adjusting the network weights and the importance of each item of the feature vector under occlusion according to the difference, and recording the obtained data into the occlusion dictionary according to the image category; The occlusion dictionary is established as follows: each item stores an occlusion weight under a type of occlusion; for feature items with little output change, the corresponding occlusion weight is set to 1; for feature items with relatively large differences, the occlusion weight is mapped to a value between 0 and 1; for particularly large feature items, the weight is directly recorded as 0; each pair of images will obtain an occlusion weight vector, and after traversing all image combinations of this type, all the obtained occlusion weights are averaged and counted into the corresponding position of the occlusion dictionary; S7. When in use, the input occluded image is converted through the HSV conversion technology to obtain the H layer information of the HSV image, obtain the occlusion position information, determine the occluded key points, and then query the occlusion dictionary, adjust the importance weight of the feature information affected by the occlusion content, and perform face recognition based on the adjusted features.
