A face detection and recognition method based on convolutional wide network
By combining the deep network MTCNN and the convolutional width face recognition network, the problems of large parameters and long training time in deep neural network face detection and recognition are solved, real-time face detection and recognition is achieved, and recognition accuracy and efficiency are improved.
Patent Information
- Application Number
- CN202111610869.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-12-27
AI Technical Summary
Existing face detection and recognition methods are based on deep neural networks, which have large parameters, large resource consumption, and long training time, making it difficult to achieve real-time performance on devices with limited resources.
The face detection and recognition method based on the convolutional width network is adopted, the face detection is performed through the deep network MTCNN, and the convolutional width face recognition network is used to extract features, combined with the batch gradient descent algorithm to optimize parameters, reducing the amount of parameters and training time. Achieve real-time performance.
While ensuring recognition accuracy, it significantly reduces the amount of parameters and training time, achieving real-time face detection and recognition, and is fast and efficient.
Smart Images

Figure CN114373205B
Abstract
Description
Technical Field
[0001] This invention belongs to the field of face detection and recognition technology, specifically relating to a face detection and recognition method based on convolutional width networks. Background Technology
[0002] With the development of science and imaging technology, artificial intelligence has permeated all aspects of human life, and face detection and recognition is an important scenario. Due to its superior learning representation and recognition performance, deep learning is increasingly being researched in face detection and recognition. The face detection method based on cascaded residual networks proposed by Pang et al. showed the highest accuracy in binocular stereo matching. Furthermore, Faster-RCNN has also achieved good results in face detection while shortening the learning time. There is also a three-layer cascaded network designed by Zhang et al., with an accuracy exceeding 92%. Although current methods perform excellently in face detection and recognition, they are all based on deep neural networks, which have a large number of parameters, high resource consumption, and long training times. When deployed on resource-constrained devices, it is difficult to achieve real-time performance requirements. Summary of the Invention
[0003] The main objective of this invention is to overcome the shortcomings and deficiencies of the prior art and provide a face detection and recognition method based on convolutional width networks. This method ensures the accuracy of face detection and recognition while solving the problems of large number of parameters and long time consumption in deep learning, and can meet the requirements of real-time performance.
[0004] To achieve the above objectives, the present invention adopts the following technical solution:
[0005] A face detection and recognition method based on convolutional width networks includes the following steps:
[0006] S1. Use a camera to capture video and extract video frames at a certain frequency;
[0007] S2. Use the deep network MTCNN to detect faces in video frames;
[0008] S3. Input the detected face region into the convolutional width face recognition network and output the final general face features;
[0009] S4. Compare the obtained facial features with the facial features in the existing personnel database, calculate the difference value between each facial feature and the one in the personnel database, and output the facial recognition result according to the set threshold.
[0010] Furthermore, the deep network MTCNN includes three cascaded sub-networks: P-Net, R-Net, and Q-Net.
[0011] Furthermore, the specific structure of P-Net is as follows:
[0012] The P-Net network takes a 12×12×3 image as input and has three 3×3 convolutions in the middle. The first part of the network outputs a 1×1×2 vector to determine whether a face exists in the 12×12 image. The second part of the network outputs the offset of the current face bounding box relative to the perfect face bounding box position, with an output vector of 1×1×4, representing the relative offset of the horizontal coordinate of the top left corner, the relative offset of the vertical coordinate of the top left corner, the error of the width of the bounding box, and the error of the height of the bounding box. The third part of the network outputs the positions of five feature points of the face, corresponding to the positions of the left and right eyes, the nose, and the mouth. Each feature point needs to be represented in two dimensions, so the output is a vector of 1×1×10.
[0013] Furthermore, R-Net specifically refers to:
[0014] The R-Net network takes a 24×24×3 image as input and includes three convolutions of sizes 3×3, 3×3, and 2×2. After the three convolutions, a fully connected layer is connected. Its output is the same as that of P-Net, which consists of three parts: a 1×1×2 vector indicating whether a face exists, a 1×1×4 vector indicating the offset information of the face bounding box, and a 1×1×10 vector indicating the location of five face features.
[0015] Furthermore, the specific structure of Q-Net is as follows:
[0016] The Q-Net network takes a 48×48×3 image as input and consists of four convolutions of sizes 3×3, 3×3, 3×3 and 2×2. After the four convolutions, a fully connected layer is connected, which outputs the coordinate information of the bounding box and the feature point information.
[0017] Furthermore, in step S2, the face detection using the deep network MTCNN on the video frames is specifically as follows:
[0018] The image is transformed at different scales to construct an image pyramid to accommodate human faces at different scales;
[0019] In P-Net, a face classifier is used to determine whether the region is a face. At the same time, bounding box regression and a facial landmark locator are used to make preliminary proposals for face regions. This part will eventually output multiple face regions that may contain faces, and these regions will be input into R-Net for further processing.
[0020] In R-Net, the input is refined and erroneous inputs are discarded. Boundary regression and facial landmark locator are used again to perform bounding box regression and landmark localization of the face region, and finally a reliable face region is output.
[0021] Q-Net continues to perform face discrimination, face region bounding box regression, and face feature localization, and finally outputs the coordinate information of the face region and five feature points of the face region.
[0022] Furthermore, in step S3, the convolutional width face recognition network specifically includes:
[0023] S31. Initialize the convolutional width network parameters. The model parameters include the number of mapping feature groups n, the number of features within a group k, and the number of augmentation nodes m, as well as the convolutional kernel corresponding to each feature.
[0024] S32. Initialize the mapped feature node groups in the width learning using random convolution kernels; using the model input K, use randomly initialized convolution kernels. k (θ1) Calculate the feature mapping node Z n ≡[Z1,Z2,…,Z n ], where the i-th group of mapping features Z i The calculation is as shown in formula (1), and each set of features contains k mapping features;
[0025] Z i =X*Kernel k (θ1), i=1,2,…,n (1)
[0026] S33, by mapping node Z n Use randomly initialized convolutional kernels. m (θ2) Calculate the enhancement node H m ≡[H1,H2,…,H m ], where the enhanced feature H j The calculation is as shown in formula (2):
[0027] H j ≡Z n *Kernel m (θ2), j=1,2,…,m (2)
[0028] S34. Merge the mapping features and the enhanced node features into a feature layer A = α[Z|H], and connect it to the model output layer Y. The connection weight between the feature layer and the output layer is W; where α is a vector and all its elements sum to 1; the relationship between the true output Y and the feature layer A is as shown in formula (3):
[0029] Y=WA(3)
[0030] S35. Optimize its parameters using the batch gradient descent algorithm, including the connection weights of the last layer and the convolutional kernels of the feature layers, until the stopping condition is met; if the loss function of the convolutional width network is formula (4).
[0031]
[0032] Where N represents the number of data points, z i It is the predicted output corresponding to the i-th data;
[0033] Taking the partial derivative of the loss function represented by formula (4), we have:
[0034]
[0035] Where j = 1, 2, represents the feature layer parameter set;
[0036]
[0037] In each iteration, the parameters θ1, θ2, and W are updated using formulas (7) and (8);
[0038]
[0039]
[0040] Where α is the learning rate;
[0041] Repeat the above steps until the stopping condition is met. The stopping condition is that the value of the loss function does not change significantly during the 5 iterations.
[0042] S36. Obtain the face recognition feature A of the feature layer of the optimized model.
[0043] Furthermore, in step S4, the difference between the current face and each face feature in the personnel database is calculated using formula (9):
[0044]
[0045] Where i represents the number of people in the personnel database, A ij This represents the j-th feature corresponding to the i-th person;
[0046] Based on this difference value, the person corresponding to the smallest difference value is obtained, and it is determined whether the value is less than the set acceptable threshold. If it is less than the set threshold, the person's information is output; if it is greater than the threshold, the person is output as not existing.
[0047] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0048] 1. This invention enables width learning to fully utilize the features extracted by depth convolution and strengthens these features through enhancement layers, providing effective facial features for the subsequent face recognition module. Furthermore, due to the characteristics of width learning, this framework can achieve high recognition accuracy with relatively few parameters.
[0049] 2. This invention combines deep learning with wide learning and applies it to face detection and recognition, solving the problems of large number of parameters, high resource consumption, and long training time in existing face recognition models, and meeting the real-time requirements in practical applications.
[0050] 3. Compared with existing deep face recognition methods, the present invention is fast and effective. Attached Figure Description
[0051] Figure 1 This is a schematic diagram of the method flow of the present invention;
[0052] Figure 2 This is a schematic diagram of the P-Net structure in this invention;
[0053] Figure 3 This is a schematic diagram of the R-Net structure in this invention;
[0054] Figure 4 This is a schematic diagram of the Q-Net structure in this invention;
[0055] Figure 5 This is a schematic diagram of the convolutional width face recognition network structure in this invention. Detailed Implementation
[0056] The present invention will be further described in detail below with reference to the embodiments and accompanying drawings, but the embodiments of the present invention are not limited thereto.
[0057] Example
[0058] like Figure 1 As shown, this invention provides a face detection and recognition method based on convolutional width networks, comprising the following steps:
[0059] S1. Use a camera to capture video and extract video frames at a certain frequency;
[0060] S2. Use the deep network MTCNN to perform face detection on video frames. The deep network MTCNN consists of three cascaded sub-networks: P-Net, R-Net, and Q-Net. The specific steps are as follows:
[0061] The image is transformed at different scales to construct an image pyramid to accommodate human faces at different scales;
[0062] In P-Net, a face classifier is used to determine whether the region is a face. At the same time, bounding box regression and a facial landmark locator are used to make preliminary proposals for face regions. This part will eventually output multiple face regions that may contain faces, and these regions will be input into R-Net for further processing.
[0063] In R-Net, the input is refined and most of the erroneous inputs are discarded. Boundary regression and facial landmark locator are used again to perform boundary regression and landmark localization of the face region. Finally, a more reliable face region is output.
[0064] Q-Net has more input features, and at the end of the network structure is a larger 256 fully connected layer, which retains more image features. Then it performs face discrimination, face region bounding box regression and face feature localization, and finally outputs the coordinates of the top left and bottom right corners of the face region and five feature points of the face region.
[0065] Among them, such as Figure 2 As shown, the specific structure of P-Net is as follows: The P-Net network takes a 12×12×3 image as input and has three 3×3 convolutions in the middle. The first part of the network outputs a vector of size 1×1×2, which determines whether a face exists in the 12x12 image. The second part of the network outputs the offset of the current face bounding box relative to the perfect face bounding box position. The output vector is 1×1×4, representing the relative offset of the horizontal coordinate of the top left corner, the relative offset of the vertical coordinate of the top left corner, the error of the width of the bounding box, and the error of the height of the bounding box. The third part of the network outputs the positions of five feature points of the face, corresponding to the positions of the left and right eyes, the nose, and the mouth. Each feature point needs to be represented in two dimensions, so the output is a vector of size 1×1×10.
[0066] like Figure 3 As shown, the specific structure of R-Net is as follows: The input of R-Net network is a 24×24×3 image, which includes 3 convolutions with sizes of 3×3, 3×3 and 2×2 respectively. After the 3 convolutions, there is a fully connected layer. Its output is the same as that of P-Net, which contains three parts: a 1×1×2 vector indicating whether a face exists, a 1×1×4 vector indicating the offset information of the face box position, and a 1×1×10 vector indicating the positions of 5 face features.
[0067] like Figure 4 As shown, the specific structure of Q-Net is as follows: The input of Q-Net network is a 48×48×3 image, which includes 4 convolutions with sizes of 3×3, 3×3, 3×3 and 2×2 respectively. After the 4 convolutions, there is a fully connected layer, which outputs the coordinate information of the bounding box and the feature point information.
[0068] S3. Input the detected face regions into the convolutional width face recognition network for training, and output the final general face features, specifically:
[0069] S31. Initialize model parameters, including the number of mapping feature groups n, the number of features within a group k, and the number of augmentation nodes m; and the convolutional kernel corresponding to each feature.
[0070] S32. Randomly initialize the mapped feature node groups during width learning using convolutional kernels. Calculate the feature mapping nodes Z using the model input K and a randomly initialized convolutional kernel Kernel(k). n ≡[Z1,Z2,…,Z n ], where the i-th group of mapping features Z i The calculation is as shown in formula (1), and each set of features contains k mapping features;
[0071] Z i =X*Kernel(k),i=1,2,…,n (1)
[0072] S33, by mapping node Z n The augmentation node H is computed using a randomly initialized convolutional kernel Kernel(m). m ≡[H1,H2,…,H m ], where the enhanced feature H j The calculation is as shown in formula (2):
[0073] H j ≡Z n *Kernel(m),j=1,2,…,m (2)
[0074] S34. Merge the mapping features and the enhanced node features into a feature layer A = α[Z|H], and connect it to the model output layer Y. The connection weight between the feature layer and the output layer is W; where α is a vector and all its elements sum to 1; the relationship between the true output Y and the feature layer A is as shown in formula (3):
[0075] Y=WA(3)
[0076] S35. Optimize its parameters using the batch gradient descent algorithm, including the connection weights of the last layer and the convolutional kernels of the feature layers, until the stopping condition is met; if the loss function of the convolutional width network is formula (4).
[0077]
[0078] Where N represents the number of data points, z i It is the predicted output corresponding to the i-th data;
[0079] Taking the partial derivative of the loss function represented by formula (4), we have:
[0080]
[0081] Where j = 1, 2, represents the feature layer parameter set;
[0082]
[0083] In each iteration, the parameters θ1, θ2, and W are updated using formulas (7) and (8);
[0084]
[0085]
[0086] Where α is the learning rate;
[0087] Repeat the above steps until the stopping condition is met. The stopping condition is that the value of the loss function does not change significantly during the 5 iterations.
[0088] S36. Obtain the face recognition feature A of the optimized model feature layer.
[0089] like Figure 5 The diagram shown is a schematic of the convolutional width face recognition network structure.
[0090] S4. Compare the obtained facial features with the facial features in the existing personnel database, calculate the difference value between each facial feature in the personnel database, and output the facial recognition result according to the set threshold; the difference value between the current face and each facial feature in the personnel database is calculated by formula (9):
[0091]
[0092] Where i represents the number of people in the personnel database, A ij This represents the j-th feature corresponding to the i-th person;
[0093] Based on this difference value, the person corresponding to the smallest difference value is obtained, and it is determined whether the value is less than the set acceptable threshold. If it is less than the set threshold, the person's information is output; if it is greater than the threshold, the person is output as not existing.
[0094] In this embodiment, the publicly available dataset CASIA-WebFace images were used for model testing. This dataset contains 494,414 images of 10,575 individuals. The same data allocation was used when comparing the model with the deep learning method FaceNet, and the results are shown in Table 1 below. The experimental results show that the face detection and recognition model based on convolution width improves the training accuracy by 2.09% and the testing accuracy by 1.21% compared to the FaceNet model. Furthermore, it significantly reduces both training time and the number of parameters, and the time required to capture the same number of images is also reduced, which is significant for achieving real-time performance.
[0095]
[0096] Table 1
[0097] This invention combines deep and wide network models to propose a face detection and recognition system based on convolutional wide networks. This invention fully utilizes the feature extraction capabilities of deep learning while simultaneously taking advantage of the speed and efficiency of wide learning. The model based on this framework offers the advantages of high efficiency and good performance, making it highly suitable for real-time deployments of face recognition systems.
[0098] It should also be noted that, in this specification, terms such as "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0099] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A face detection and recognition method based on convolutional wide network, characterized in that: The following steps are involved: S1. Use a camera to capture video and intercept video frames at a certain frequency; S2, use the deep network MTCNN to detect faces in video frames; S3, input the detected face area into the convolutional width face recognition network, and output the final universal face features; In step S3, the convolution width face recognition network specifically includes: S31. Initialize the convolution width network parameters. The model parameters include the number of mapping feature groups n, the number of features in a group k, the number of enhancement nodes m, and the convolution kernel corresponding to each feature. S32, use random convolution kernel to initialize the mapping feature node group in width learning; use the model input X, use the randomly initialized convolution kernel Kernel k (θ1) Calculate the feature map node Z n ≡[Z1, Z2, ..., Z n ], where the i-th group mapping feature Z i The calculation of is as shown in formula (1), each set of features contains k mapping features; Z i =X*Kernel k (θ1),i=1,2,...,n (1) S33, by mapping node Z n Use randomly initialized convolution kernel m (θ2) Calculate the enhanced node H m ≡[H1, H2, ..., H m ], where the enhanced feature H j The calculation is as follows: H j ≡Z n *Kernel m (θ2),j=1,2,...,m (2) S34. Combine the mapping features and enhanced node features into a feature layer A = α[Z|H], which is connected to the model output layer Y. The connection weight between the feature layer and the output layer is W; where α is a vector whose elements sum to 1; the relationship between the true output Y and the feature layer A is as shown in formula (3): Y=WA(3) S35, use the batch gradient descent algorithm to optimize its parameters, including the last layer connection weights and feature layer convolution kernels, until the stopping condition is reached; if the loss function of the convolution width network is formula (4) Among them, N represents the number of data, z i is the predicted output corresponding to the i-th data; The partial derivative of the loss function represented by formula (4) is: Wherein, j=1, 2, represents the feature layer parameter group; In each iteration, the parameters θ1, θ2, and W are updated using formulas (7) and (8); Where α is the learning rate; Repeat the above steps until the stopping condition is reached. The stopping condition is that the value of the loss function does not change significantly during the 5 iterations. S36, obtaining face recognition features A of the feature layer of the optimization model; S4. Compare the acquired facial features with the facial features in the existing personnel database, calculate the difference value between the facial features and the facial features in the personnel database, and output the facial recognition result according to the set threshold; In step S4, the difference between the current face and each facial feature in the personnel database is calculated using formula (9): Among them, i represents the number of personnel in the database, A ij Indicates the jth feature corresponding to the i-th person; Based on the difference value, the person corresponding to the minimum difference value is obtained, and it is determined whether the difference value is less than the set acceptable threshold. If it is less than the set threshold, the person information is output; if it is greater than the threshold, it is output that the person does not exist.
2. A face detection and recognition method based on convolutional wide network according to claim 1, characterized in that: The deep network MTCNN consists of three cascaded sub-networks, namely P-Net, R-Net and Q-Net.
3. The face detection and recognition method based on convolutional wide network according to claim 2, characterized in that: The specific structure of P-Net is: The P-Net network input is a 12×12×3 image with three 3×3 convolutions in the middle. The output of the first part of the network is to determine whether there is a face in the 12×12×3 image, and the output vector size is 1×1×2; the second part of the network outputs the offset of the current face frame position relative to the perfect face frame position, and the output vector is 1×1×4, which represents the relative offset of the horizontal coordinate of the upper left corner, the relative offset of the vertical coordinate of the upper left corner of the frame, the error of the width of the frame, and the error of the height of the frame; the third part of the network outputs the positions of the five feature points of the face, corresponding to the left and right eye positions, nose position, and left and right mouth positions, respectively. Each feature point requires two dimensions to represent, so the output is a vector size of 1×1×10.
4. The face detection and recognition method based on convolutional wide network according to claim 2, characterized in that: R-Net is specifically: The R-Net network input is a 24×24×3 image, including three convolutions with sizes of 3×3, 3×3, and 2×2 respectively. The three convolutions are followed by a fully connected layer. Its output is the same as the P-Net output, consisting of three parts: a 1×1×2 vector indicating whether there is a face, a 1×1×4 vector indicating the position offset of the face box, and a 1×1×10 vector indicating the positions of the five facial features.
5. The face detection and recognition method based on convolutional wide network according to claim 2, characterized in that: The specific structure of Q-Net is: The Q-Net network input is a 48×48×3 image, including 4 convolutions with sizes of 3×3, 3×3, 3×3, and 2×2. The 4 convolutions are followed by a fully connected layer, which outputs the coordinate information of the bounding box and feature point information.
6. The face detection and recognition method based on convolutional wide network according to claim 2, characterized in that: In step S2, the deep network MTCNN is used to perform face detection on the video frame as follows: Transform the image to different scales and construct an image pyramid to accommodate faces of different scales; In P-Net, a face classifier is used to determine whether the image is a face. At the same time, bounding box regression and a facial landmark locator are used to make preliminary proposals for face regions. P-Net will eventually output multiple face regions where faces may exist, and these regions are input into R-Net for further processing. In R-Net, the input is refined and selected, and the wrong input is discarded. The bounding box regression and facial key point locator are used again to regress the bounding box and locate the key points of the face area, and finally a credible face area is output; Q-Net continues to perform face recognition, face area bounding box regression and face feature location, and finally outputs the coordinate information of the face area and the five feature points of the face area.
Citation Information
Patent Citations
Face detection method and system based on improved MTCNN model
CN110619319A
Intelligent business hall face recognition method based on lightweight deep learning
CN110781829A
Face detection method and device based on MTCNN network model, and terminal
CN112487855A
