Masked Face Recognition Algorithm for a Contactless Distribution Cabinet

A contactless delivery cabinet is an important courier self-pickup device, for the reason that COVID-19 can be transmitted by human contact. During the pandemic period of COVID-19, wearing a mask to take delivery is a common application scenario, which makes the study of masked face recognition algorithm greatly significant. A masked face recognition algorithm based on attention mechanism is proposed in this paper in order to improve the recognition rate of masked face images. First, the masked face image is separated by the local constrained dictionary learning method, and the face image part is separated.)en, the dilated convolution is used to reduce the resolution reduction in the subsampling process. Finally, according to the important feature information of the face image, the attention mechanism neural network is used to reduce the information loss in the subsampling process and improve the face recognition rate. In the experimental part, the RMFRD and SMFRD databases of Wuhan University were selected to compare the recognition rate. )e experimental results show that the proposed algorithm has a better recognition rate.


Introduction
e contactless delivery scene is becoming increasingly normal, since COVID-19 can be transmitted by contact. In the scene of contactless express delivery, a self-pickup cabinet is an important piece of terminal express delivery equipment, and face recognition is one of the effective way to achieve contactless express delivery. During the pandemic of COVID-19, nearly everyone wears masks, which makes the traditional face recognition technology almost ineffective on face recognition self-pickup cabinets. erefore, it is greatly urgent to improve the performance of existing face recognition technology for face mask recognition.
In recent years, face recognition technology has made great breakthroughs in both theoretical progress and practical applications. It has become a frontier research direction in the field of pattern recognition. However, the recognition problem of occluded face images, such as mask, hairstyle, sunglasses, and hat occlusions, often appears in the process of face processing. ese occlusions greatly interfere with the correct recognition of human faces. e low-rank representation [1], however, can quickly solve the occlusion problem. A new iterative method is used to effectively improve the recognition rate and the robustness of largearea image occlusion recognition. Literature [2] proposed a method combining structured occlusion coding and sparse representation-based classifier [2], which cleverly used structured sparse coding to deal with image occlusion problems. In addition, the long and short-term memory network autoencoder [3] was also commonly used to solve the problem of facial occlusion, which better improved the robustness of image noise reduction. However, the occlusion problem has not been completely solved.
Face recognition with occlusion has attracted extensive attention in academic circles. Occlusion processing methods are generally divided into video occlusion processing and image occlusion processing methods. Object tracking is usually used to deal with the occlusion problem in dynamic video. For example, a tracking method based on video monitoring is proposed in literature [4], which can automatically detect and process occlusion objects. Literature [5] proposed a new object tracking technology, which can track people's dynamic behaviors and actions and maintain pixel tracking allocation even under large shielding. It has been used in different experiments of indoor human behavior supervision due to its robustness. e methods for processing occluded images can be divided into five categories: low-rank representation, image restoration, fuzzy analysis, robust principal component analysis, and structural occlusion coding. Literature [6] proposed a robust low-rank representation method to solve the problem of face recognition with occlusion. is method mainly combines robust representation and low error estimation. At present, the multiscale fractal coding and reconstruction method of image restoration has been proposed in literature [7], which has a good effect on texture images and images with large holes. Literature [8] proposed a method based on fuzzy principal component analysis to detect the occlusion area and restore the face area. However, the fuzzy principal component analysis has a large amount of computation and is not ideal for large-area occlusion processing.
Low-rank robust principal component analysis is a mainstream occlusion face feature extraction method, which combines structural occlusion coding with sparse representation classification. Literature [9] proposed a new nonnegative sparse representation method for robust face recognition in large-scale databases. However, this algorithm has a large amount of computation and a complex structure. Literature [10] proposed an occlusion dictionary method, which plays an increasingly important role in face recognition and can effectively deal with various occlusion objects. It can distinguish the features of nonoccluded and occluded regions and encode the corresponding parts of the dictionary, respectively. e occlusion problem is resolved by using detection/mask scores in literature [11]. And it introduced a plug-and-play occlusion handling algorithm to deal with the occlusion between different object instances. Occlusion face recognition problem is the most critical step towards the practical face recognition technology.
Face recognition systems must solve the problem of occlusion. Objects like hats, scarves, and sunglasses are very common. Sometimes, a large area of occlusion will seriously destroy the information of the original image, resulting in the failure of large image recognition. Literature [12] proposed the method of sparse error and graphical model to continuously overlap and finally display the mask. e Markov random field model is transformed into the calculation of the sparse representation of the training image, so as to find the occlusion area accurately. erefore, great research significance lies in how to separate the blocked face images from blocking images.
A masked face recognition algorithm based on attention mechanism is proposed in the paper, in order to improve the face recognition rate of masks. First, the masked image is separated by local constrained dictionary learning method; that is, the mask and the face image are separated. en, dilated convolution is adopted to reduce the problem of resolution reduction in the process of subsampling, and an attention mechanism is designed to reduce information loss in the process of subsampling. Finally, according to the important feature information of the face image, the attention mechanism neural network algorithm is used for face recognition.

Relevant Work.
In recent years, researchers have been devoted to the study of effective face recognition with occlusion [10] and proposed many effective algorithms. It mainly includes three methods: the generation model of the occlusion problem, the discriminant model, and robust feature extraction. ese three methods will be introduced in the following paragraphs.

Generation Model.
In the robust learning process of occluded face image data, dictionary atom, low-rank structure of face image, and occluded structure are used to represent the occluded part of the image to be recognized. e local feature loss in face image is processed by reconstruction of noise such as occlusion to correct its influence on recognition performance. By fully understanding the content of the occlusion part, the recognition efficiency is improved. Generating models mainly include robust subspace regression and robust structured error coding.
Robust subspace regression is established by projecting the high-dimensional feature data of different categories of face images into the low-dimensional subspace in a linear or nonlinear way. en, an independent subspace is established for the occlusion part, and the existing dictionary atoms are used to represent the occlusion in the face image, which can achieve robust recognition effect for the occlusion face. At present, robust subspace solutions to occlusion face recognition mainly include sparse representation, collaborative representation, and occlusion dictionary learning.
(1) Sparse Representation. e study in [12] first applies the sparse representation to the field of face recognition and proposes a method based on sparse representation classification (SRC). e sparsity nonzero principle is used to select the most appropriate sparse matrix to represent the image to be recognized more flexibly and comprehensively.
us, face image classification can be achieved, and the error caused by occlusion and damage can be handled uniformly.
(2) Collaborative Representation Classification. e essence is to use training samples from all categories to jointly represent the image to be recognized. e study in [13] through the analysis of the SRC method can effectively enhance the capacity of classification difference, on the basis of classification based on collaborative said method for face recognition.
(3) Occlusion Dictionary Learning. e purpose is to learn a new set of dictionaries from the original training samples, which can well represent the ability of the original training samples. en, it is used for image processing and classification. e study in [14] uses low-rank matrix restoration to train relatively clean face images from face images to be recognized as a new feature dictionary. en, the feature dictionary is learned using Fisher's criterion dictionary learning method. Ensure that subdictionaries of the pending class in the new dictionary are well represented for samples in the same category, but not for samples in other categories.
is method can effectively reduce the reconstruction error and improve the performance of face recognition with occlusion.
Because of the spatial continuity and locality of occlusion, the error caused by occlusion region has its specific spatial structure, and occlusion will destroy the low-rank structure of face image. erefore, it is crucial to improve the performance of occluded face recognition to effectively and accurately reconstruct the low-rank structure of the face image from the data damaged by occlusion. And robust structured error coding is to use the low-rank structure of face image to recognize face. Face images in natural environments are affected by different kinds of occlusion noises, leading to great differences between actual low-rank structures of face images and low-rank structures processed by PCA. In order to improve the robustness of occlusion face recognition, the study in [15] proposed robust principal component analysis (RPCA). After decomposition of all training sample matrix Y by low-rank matrix, low-rank content matrix Z and sparse content matrix E were obtained.
us, the recovery of the low-rank subspace of the training sample is realized. e method takes into account how to recover the low-rank structure from the training samples with large errors but sparse structure, so the effect of sparse noise is effectively suppressed and has strong robustness. To increase the interclass information between low-rank matrices of different categories of faces, literature [16] expressed all training samples as an observation matrix D. After matrix D is decomposed, the low-rank matrix A without occlusion and the sparse error matrix E are obtained. RPCA is applied to the low-rank matrix A, and the subspace obtained is used as the occlusion dictionary of face images. en, the image reconstruction was identified and the error size was classified according to the sparse representation classification and occlusion dictionary.

Discriminant Model.
ere are two error indexes that are used as the main discriminant model to estimate the occlusion location. One is the local similarity error between the occlusion image and the original image, and the other is the spatial local error caused by the occlusion. e occluded face image is regarded as the Mosaic of occluded area and unoccluded area, and the unoccluded area is given a larger weight to code. In the process of recognition, the occlusion area may be directly discarded or the image reconstruction may be carried out according to the occlusion area. e key consideration is how to accurately detect the occlusion position, without understanding the content of the occlusion area, so as to eliminate or suppress the impact of occlusion on face recognition. Compared with the generation model, the discriminant model can save a lot of reconstruction time and avoid the introduction of new noise and other problems during reconstruction. e discriminant models mainly include error weight measurement based on local similarity and occlusion error support estimation. e error weight measurement based on local similarity is to obtain the error information of the occluded image and its original image by comparing the local similarity. e error is given different weights to measure the occlusion position. When human eyes judge the similarity of two images, they only judge their similar areas and directly ignore the contents of nonsimilar areas. For the recognition of occluded face image, the local similarity between the occluded image and its original image is compared first. en, the error information obtained is weighted with different weights to code the error, and the occlusion location is estimated. us, the occluded area can be detected and only the unoccluded area can be identified.
e error weight measurement model based on robust sparse coding and the error weight measurement model based on correlation entropy are used to measure the occlusion region through the local similar errors of the two images. en, the weight of occlusion features is allocated adaptively to suppress or eliminate the influence of occlusion on the performance of face recognition. However, both of these algorithms have some shortcomings. For example, the two algorithms give different weights adaptively according to the error caused by occlusion, but neither of them provides any technology to guarantee that the error caused by occlusion must be large. Moreover, a new noise is introduced in the iterative weighting process, which reduces the efficiency of occlusion face recognition.
Occlusion error support estimation is used to estimate the occlusion position for the spatial local error structure caused by occlusion. In practical face recognition applications, the original images with occluded images may not always exist, so most methods need to reconstruct the original unoccluded images for the occluded face images to be recognized.
is will lead to uncertain reconstruction errors in the reconstructed image, resulting in poor detection effect of occluded areas. erefore, in order to accurately and directly detect the occlusion region, it is necessary to make full use of the spatial local continuity of occlusion error.

Robust Feature Extraction.
Robust face image feature extraction is low-order function, such as color, texture, brightness and expression, age, and gender. Such multiscale decomposition features more orientation to avoid interference between various features. To extract image features, suppress or eliminate the impact of obstacle features on recognition performance and achieve robust recognition effect. Existing robust feature extraction methods for occlusion face recognition mainly include "shallow" feature extraction and "deep" feature extraction.
Shallow robust feature extraction is the traditional robust feature extraction method applied to the occlusion case. e most effective and representative features unrelated to occlusion are extracted, so as to achieve robust feature extraction from occlusion face images. Based on image gradient direction (IGD), feature extraction shaded face images can be measured between the relationships. In order to solve the actual occlusion face recognition problem, literature [17] proposed a low-order model based on adaptive sparse gradient direction. e generalized gradient direction is used to extract effective features and enhance the continuity of the model to maintain the robustness of face recognition. Literature [18] proposed the subspace learning framework of image gradient direction. e occluded test samples and training samples are mapped into the gradient face space. e image gradient feature is robust to the image noise in the gradient face space. It can extract robust face features without the effect of occlusion to a large extent. Mapping the test samples into the image gradient PCA subspace will result in a reconstructed image with almost no occlusion. us, robust feature extraction can be realized for occluded face images, and the extracted features can be used for recognition and classification.
is method is implemented under the condition that the difference of the occlusion region of two completely different images approximately obeying the uniform distribution. In practice, the difference between the occluded image and its original image is not uniformly distributed.
is method is not suitable for face image recognition with arbitrary occlusion because of its poor performance in the real environment.
Deep learning has the characteristics of automatic learning features, and the extracted "deep" features are more expressive and stable than those designed manually. erefore, deep learning is used to acquire more abstract and expressive deep features. It is expected that the abstract semantic information of data can be represented by multilevel high-order features to obtain robust features. It was considered a good way to overcome the limitations of artificially designed "shallow" features. A robust "depth" feature should both minimize intraclass differences and maximize interclass differences in the image. In order to identify whether multiple face images belong to the same person, the DeepID2 neural network structure was proposed in literature [19]. e convolutional neural network is used for feature learning. Different face features are extracted through face recognition signals, and the interclass differences between different face images are increased. And through the face verification signal to extract the features of the same face, reduce the intraclass differences, so as to learn the strong ability to distinguish features. However, literature [20] adopted forward and backward greedy algorithms to select some effective complementary DeepID2 vectors due to the large number of features to be learned. e features after dimensionality reduction are input into the joint Bayesian model for face classification and recognition. Although the network structure is not designed to distinguish between occluded and nonoccluded faces, the features of deep learning are adaptively robust to occluding. In order to further extract better facial features, literature [21] improved the DeepID2 network and proposed the DeepID2+ network structure. Supervised signals are added in each convolution layer, and the 512-dimension features of the final output are binarized by using threshold values. erefore, it not only ensures the accuracy of recognition but also improves the speed of face retrieval. e results show that DeepID2+ is robust to mask human face from bottom to top and black blocks of different sizes. When the occlusion is less than 20% and the block is less than 30 × 30, the validation accuracy of the output of DeepID2+ is almost unchanged. Furthermore, it provides a new way to deal with the occlusion face recognition.

Mask Separation with Locality Constraint Dictionary
Learning Method. Local constraint dictionary (LCD) means that, given the dictionary Q H , x i can be approximately represented by a linear combination of the atoms q j in the dictionary; that is, x i � k j�1 c ji q j . e embedded y i � p(x i ) in the d-dimensional space can be represented by the insertion of q j in a low-dimensional space of p(q i ) nearly linear; that is, x j � k j�1 c ji p(q j ). According to the l 2 distance, in order to minimize the errors of the above two linear representations, the following two expressions should be minimized simultaneously with respect to Q H and (1) To ensure choice invariance, constraints ∀ i , K j�1 c ji � 1, 1, 2, . . . , N), c ij is equal to 0. If q j is in the neighborhood of x i , then c ji ≠ 0. e corresponding function is shown as where I T c i � 0, c ji � 0, ∀ i � 1, 2, . . . , N, and q j ∉ Ω τ (x i ) . And i is the column vector with 1 entry. Ω τ (x i ) ∈ R n×τ is the τ neighborhood of x i , which contains τ nearest neighbors of x i . λ is the parameter, λ < 0. e form of a face image y blocked by an occlusion object v is u � y + v, which violates the low-dimensional linear lighting model and leads to SOC classification error. Occlusion categories in real scenes are predictable and can be collected in advance. Inspired by literature [22], the algorithm in this paper constructs a subdictionary of occlusion object B � [B 1 , B 2 , . . . , B S ], and different subscripts represent different categories. en, add it to the original dictionary as R � [Q, B]. e mask v belonging to class t is then represented by the corresponding subdictionary V t .
Specifically, if a face of the r-th object is occluded by the occlusion of the t-th category, then u is represented linearly by Q r and B t as u � y + v � Q r X r + B t C t . By looking for appropriate sparse solutions, a series of coefficients, whose nonzero terms represent faces and occluded objects, can be obtained. e specific form is as follows: 0, x r,1 , x r,2 , . . . , x r,n , 0, . . . , 0, c r,1 , c r,2 , . . . , c r,n t , 0, . . . , 0 T .

(3)
It can be seen that a well-constructed dictionary can deal with all kinds of occlusion effectively and is highly robust in the actual scene. e equation for occlusion identification problem is as follows: When the data are gradually increasing, it is not feasible to solve problem (4), so l 1 normal form is used to replace Al 0 normal form in problem (4), so problem (4) becomes the following problem: Calculate the error between y and y i , where y i � Qδ i (x). Even with occlusion, the minimum residual difference can be allocated to sample u. It makes up the occlusion dictionary and the clean face dictionary. e two dictionaries obtained are of considerable use for subsequent occlusion work, as Figure 1 shows. is separates the mask from the face. Compared with the original face, the pixel value of the separated face does not decrease, and the face dictionary composed is more conducive to the subsequent classification. In this paper, the recognition results are presented in a subsequent experiment.

Face Recognition Algorithm Using Attention
Mechanism.
e overall network structure proposed in this paper uses two paths for secondary sampling, rather than the traditional U-shaped structure. Dilated convolution is used to obtain more detailed information. ResNet is used to extract features from feature context information, so as to obtain a larger sensory field of vision. Meanwhile, attention modules are designed to improve accuracy by imitating human visual mechanism [23]. Finally, a feature fusion module is designed to integrate the collected features of different sensory fields to obtain better results.
(1) Dilated Convolution. In order to improve the resolution while maintaining a fixed field of view, the algorithm in this paper uses dilated convolution in the spatial information path. e expression of ordinary convolution is as follows: In the equation, P (x, y) is the pixel value of the original image at the point (x, y) and M (x, y) is the convolution kernel multiplied by it with the size of ω × m.
e dilated convolution is calculated as follows: where l is the expansion factor and M ′ (x, y) is the dilated convolution kernel. It can be seen from equations (6) and (7) that the dilated convolution is essentially 0 filling of the convolution kernel. It can increase the perception field of the convolution kernel, while retaining the original pixel information, thus increasing the resolution. If the size of the convolution kernel is k and the expansion rate is l, then the actual effective size of the dilated convolution is k + (k − 1) × (l − 1). Compared with ordinary convolution of the same size, expansive convolution not only expands the perception field but also maintains the same resolution as ordinary convolution.
(2) Attention Mechanism. An attention mechanism is adopted in this paper in order to make up for the loss of details caused by subsampling and better guide model training. It can enhance the target features and suppress the background through the weighted processing of feature map [24]. e target features here are the contour and texture information of the eyes, eyebrows, and face due to the features of the face of the mask. e attention mechanism is mainly composed of spatial attention mechanism, channel attention mechanism, and pyramid attention mechanism, as shown in Figure 2.
(3) Spatial Attention Mechanism. e mechanism of spatial attention is mainly put forward by imitating human visual mechanism. When the human eye sees an image, it automatically gives greater attention to key locations. When you see a rabbit, for example, you pay more attention to the rabbit's ears. erefore, different parts of the image feature map should have different weights [25]. e spatial attention mechanism proposed in this paper is shown in Figure 3. e resulting feature graph uses maximum and mean global pooling on the channel dimensions. e feature information of different positions on the feature map is compared and extracted, and the feature weight of each position is obtained. e maximum global pooling expression is where I t (i, j) is the eigenvalue of the feature graph on channel t-th at position (i, j), P(i, j) is the feature graph after maximum pooled, and c is the number of channels. e global pooling of the mean value is expressed as

Mathematical Problems in Engineering
In the equation, T n (i, j) is the eigenvalue of the nth channel feature graph at the position (i, j). Q n (i, j) is the feature graph after averaging pooling, and d is the number of channels.
e two feature maps are connected in channel dimension by means of channel connection. In order to better integrate the information extracted by the two methods, the size of 1 × 1 convolution kernel is used for learning. e final weight of attention of the obtained feature map was calculated by sigmoid function [26], so as to avoid errors caused by excessive weight coefficient. e sigmoid function is expressed as follows: where SF (x) is the response of the output and x is the input. Spatial attention mechanism can effectively extract salient information of each position in the feature map. Based on this, a weight is assigned to the eigenvalue of each position to extract the main feature of the target effectively.
(4) Channel Attention Mechanism. Each channel of the feature map extracted by convolutional neural network (CNN) represents an image feature, such as texture and shape. e target features here are the contour and texture information of the eyes, eyebrows, and face due to the features of the face of the mask. In the image, each feature contains different information, and its contribution to image segmentation is also different. erefore, different attention should be paid to each different feature [27] and different weights should be assigned. Channel attention mechanism is designed to assign weight to features so that the network can focus on important features, as shown in Figure 4.
By using global maximum pooling and global average pooling, the channel information is modeled in spatial dimension and the characteristic information of each channel is obtained. e calculation process of maximum pooling is In the equation, i ∈ (1, h), j ∈ (1, ω), c represents c-th feature graph, and Q c represents the output of the feature graph after maximum pooling. e calculation process of average pooling is In the equation, i ∈ (1, h), j ∈ (1, ω), t represents the mth feature graph, and Q t represents the output of the feature graph after average pooling.
In order to use less computation to integrate the feature graphs obtained by global pooling, the two feature graphs are, respectively, passed through a convolution kernel of size 1 × 1. en, nonlinear components are added through BN layer and ReLU layer to make the model fit better. is method can prevent the occurrence of overfitting phenomenon to a certain extent. Finally, the two feature graphs obtained are fused and the final weight is obtained through the sigmoid function.
(5) Pyramid Attention Mechanism. Human vision tends to integrate a variety of information when discriminating objects. For example, distinguishing a rabbit from a cat pays more attention to the shape of its ears, and distinguishing a panda from a bear pays more attention to its color. It can be seen that different features in different positions on the feature map should receive different attention. In order to obtain different information of different position of image better, a pyramid type attention model is proposed. By extracting the feature map of different perceptual field, the image information under different perceptual field is obtained. is information was fused to obtain the final weight coefficient, as shown in Figure 5. e feature graphs are, respectively, passed through 3 × 3, 1 × 1, and 5 × 5 convolution kernels. Because these convolution kernels are used in low-resolution high-level feature maps, there is not much computational burden. en the feature images are collected by convolution kernels of different sizes. In this way, contextual information can be better integrated and feature information can be obtained at different scales. rough these convolution kernels of different sizes, the characteristic information under different perceptual fields is obtained. Based on the above feature information, the feature weights of different positions are obtained through a 1 × 1 convolution kernel. Finally, the obtained feature graphs are added for fusion, and the final weight is obtained through the sigmoid function.
(6) Feature Fusion Module. For different types of objects, the importance of vision perception is different. For larger objects, the features acquired from the larger visual field are more important. For smaller objects, the features of larger visual field will collect too much peripheral information and lead to errors. e traditional feature fusion methods are generally cascade or addition, which does not take into account the different sensory field of different feature graphs and ignores the specificity of features. In view of this, the feature fusion module designed in this paper assigns different weights to feature images with different perception fields to achieve better feature fusion, as shown in Figure 6. First, the two input feature maps are linked at the channel dimension level. Secondly, the cascaded feature image is fused by a 3 × 3 convolution kernel to realize the preliminary fusion of feature image information. Global pooling operation is carried out to extract the information of each feature map. en, the obtained feature image is passed through the convolution kernel of size of 1 × 1, so that the network learns the weight according to the overall information of each feature image. Finally, the sigmoid function is used to get the final weight, which is multiplied by the original feature graph. rough the feature fusion module, weight is assigned to the feature images under different perceptual fields, so that the feature specificity under different perceptual fields can be reflected, and the features can be fused better.

Results and Discussion
In this paper, the RMFRD (real-world face recognition dataset) and SMFRD (simulated face recognition dataset) [28] opened by Wuhan University are selected as the experimental databases. RMFRD and SMFRD are the first real face mask dataset in the world, and the simulated masked image data in SMFRD are based on LFW [29] and Webface [30] datasets. e experiment in this paper is carried out on a 16 GB memory NVIDIA GeForce GTX1080TI GPU workstation.

Experiment on SMFRD Dataset.
e SMFRD database simulates wearing a mask on the existing public large-scale face dataset to obtain a large number of face images. Among them, public large-scale face datasets include commonly used LFW and Webface datasets. In this way, a simulated masked face dataset was constructed, covering 500,000 face images from 10,000 subjects. Figure 7 shows multiple pairs of face images.
In the training process, 5000 people were randomly selected from 10000 people as the training set. Among them, a normal image without a mask was selected as the baseline image for recognition. During the training process, other normal images without masks were first selected for training. en, all face images wearing masks were selected for training.
In the test phase, the remaining 5000 people were selected as the test set. During the test, a normal image without a mask was selected as the baseline image for recognition. During the test, other normal images without masks were selected for identification tests. en, all faces wearing masks were selected for recognition tests.
In this paper, the PCA + SVM [31], SRC [32], CNN, and DCGAN + CNN [33] are selected for comparison. In the DCGAN + CNN method, DCGAN is used to fill the occlusion face image, and CNN is also a fine-tuned VGGFACE model for face recognition. All methods were tested on the RMFRD dataset, and the results are shown in Table 1. It can be seen that the expression recognition accuracy of the proposed method in this paper is high, regardless of whether the face image is covered by a mask or not. In the deep learning method, although DCGAN + CNN method also fills the face image, the consistency of the image obtained is poor, which affects the accuracy of expression recognition. e proposed algorithm in this paper has already separated the mask part before face recognition and then extracted the important features such as eyes and eyebrows by using the attention mechanism, so the algorithm in this paper has higher stability. en, the unreasonable face images were manually removed and a tagging tool was experimented with to crop the exact face areas. e dataset consisted of 5,000 photos of 525 people wearing masks and 90,000 photos of 525 people not wearing masks. Figure 8 shows multiple pairs of face images.
In the training process, 300 people were randomly selected from 525 people as the training set. Among them, a normal image without a mask was selected as the baseline image for recognition. During the training process, other normal images without masks were first selected for training. en, all face images wearing masks were selected for training.
In the test phase, the remaining 325 people were selected as the test set. During the test, a normal image without a Table 1: Comparison of recognition rates with different algorithms.

Methods
Image without mask Image with mask PCA + SVM [31] 91.22 68.63 SRC [32] 92.80 72.42 CNN [33] 97.52 69.63 DCGAN + CNN [33] 97  mask was selected as the baseline image for recognition. During the test, other normal images without masks were selected for identification tests. en, all faces wearing masks were selected for recognition tests. PCA + SVM, SRC, CNN, and DCGAN + CNN algorithms were selected, and experiments were carried out on RMFRD dataset at the same time as the proposed algorithm.
e recognition results are shown in Table 2. It can be seen that the expression recognition accuracy of the method presented in this paper is higher than other methods.

e Algorithm Efficiency.
In order to compare the efficiency of the algorithm, the time consumption of the recognition process is compared. e time consumption of different face recognition methods is compared, which is as shown in Table 3. It can be seen from the table that the recognition time of the algorithm in this paper is less than 1 second, which can meet the experiment of actual use scenarios.

Conclusions
Since COVID-19 can be spread by contact, contactless delivery cabinets are becoming increasingly normal. e self-delivery cabinet is an important piece of terminal express delivery equipment in the contactless express delivery scenario, and the masked face recognition is one of the effective way to achieve the contactless express delivery. In this paper, the local constrained dictionary learning method firstly is used to separate the masked face image, and the parts of the mask are separated to reduce the impact on the recognition algorithm. en, the dilated convolution method is used to reduce the impact of resolution reduction in the sampling process. According to the important features of face images, such as eyes and eyebrows, multiple features are extracted by using attention machine neural network. Finally, the algorithm comparison experiment is carried out through the simulation face masked image database and the real face masked image database. Experimental results show that the proposed algorithm has a better recognition rate and also has important application value in contactless express delivery scenarios.

Data Availability
e RMFRD (real-world face recognition dataset) and SMFRD (simulated face recognition dataset) opened by Wuhan University are selected as the experimental databases. e data can be downloaded from https://github.com/ X-zhangyang/Real-World-Masked-Face-Dataset. Because of the programmer's reason, the source code of this algorithm is not convenient to provide directly. e readers can program if interested, according to the idea of the paper.

Conflicts of Interest
e author declares no conflicts of interest.