A method, device and terminal device for detecting a face wearing a mask based on a face skeleton

Through a method based on face skeleton detection, openpose and Transformer networks are used to extract facial skeleton features, combined with the graph convolution algorithm, to solve the problem of low accuracy of face recognition when wearing masks and achieve higher recognition accuracy.

CN116152869BActive Publication Date: 2024-10-29NANJING SHICHAZHE INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111355622.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-16
Publication Date
2024-10-29
Estimated Expiration
2041-11-16

AI Technical Summary

Technical Problem

The existing technology has insufficient accuracy and recall rate for face recognition when wearing a mask, making it difficult to effectively identify faces wearing masks.

Method used

Using a method based on facial skeleton detection, the facial skeleton key point features are extracted through the openpose skeleton extraction network and Transformer network, and combined with the graph convolution algorithm to weaken the impact of mask covering and improve the recognition accuracy.

Benefits of technology

It effectively improves the accuracy of face recognition when wearing a mask. By extracting facial skeleton regional features and node data features, it reduces the impact of mask occlusion on recognition and improves recognition accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FDA0005014313800000021
    Figure FDA0005014313800000021
Patent Text Reader

Abstract

The present invention discloses a method, device, and terminal device for detecting a face wearing a mask based on a face skeleton. The method comprises step 1, extracting base library features: extracting key points of the face skeleton through an openpose lightweight model, inputting the extracted key points into a Transformer to obtain features of the facial skeleton region, and finally using the data features of each skeleton node as a graph convolution operator, calculating the overall facial skeleton features according to the graph convolution algorithm, and storing them in a base library; step 2 extracting features of the face wearing a mask to be detected and identified, and step 3 matching the features of the face to be detected with the features of the base library, setting a similarity threshold, and judging whether the face picture to be detected is a target person. Using node data features based on the face skeleton to identify faces wearing masks can weaken the impact of masks covering the face and further improve the accuracy of face recognition wearing masks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image recognition and intelligent transportation research, and in particular to a method, an apparatus, and a terminal device for detecting a face wearing a mask based on a face skeleton. Background Art

[0002] Due to the impact of the epidemic, wearing masks when traveling has gradually become people's daily habit. In terms of face recognition, the existing face recognition technology is affected by it, and the recall rate and accuracy rate do not meet the expected values. How to improve the accuracy of face recognition when wearing masks has become a problem that needs to be solved urgently. Summary of the invention

[0003] In order to overcome the shortcomings of the prior art, the present invention provides a method, device, and terminal device for detecting faces wearing masks based on face skeletons. The method uses node data features based on face skeletons to identify faces wearing masks, which can weaken the impact of masks covering the face and improve the accuracy of face recognition of people wearing masks.

[0004] The technical solution is as follows:

[0005] A method for detecting a face wearing a mask based on a face skeleton, the method mainly comprising the following steps:

[0006] Step 1, extracting base database features;

[0007] Obtain the base database image, which is the front face photo of the target person;

[0008] The openpose skeleton extraction network is used to input the base image, scale the input base image to the specified size according to the set aspect ratio, call the trained and converged openpose skeleton network model parameters, execute the forward derivation function, process the input image, and output the facial skeleton key points K = [k0, k1, k2, ..., k n ], (n+1) is the number of facial skeleton key points, and the facial skeleton key points include a categories, that is, a facial skeleton areas, and each category contains the same or different number of key points.

[0009] The acquired facial skeleton key points K are converted into vector X, X = {x1, x2, x3, ..., x n}, according to the correspondence between the facial skeleton key points and each key point category, it is converted into the following key point vector matrix G = {g1, g2, g3, ..., g a}, where g j Representing a key point matrix of a key point category, j∈{1, 2, ...a} gives the key point matrix g j Each vector in plus the position feature, the position feature includes the coordinates of the skeleton key points and the fixed random code, that is, Mi =(x ki ,y ki , r i ), where (x ki ,y ki ) is the skeleton key point k i The coordinates of i is a random code that satisfies the following conditions: (1) i is an n-dimensional random vector that follows an n-dimensional Gaussian distribution, (2)r i The modulus length is fixed, (3) any two key points have different corresponding random codes.

[0010] The key point matrix g j The key point vectors and position features in are combined to obtain the input vector C of the Transformer network. i , C i =x i +M i ; C i Send it to the Transformer network to get a single facial skeleton region feature f j =T{Y1,Y2,Y3,...,Y q}, where q represents the key point matrix g j Finally, the whole facial skeleton region feature F is obtained, that is, F = {f1,f2,f3,…,f a}.

[0011] The obtained facial skeleton region features F are constructed into a graph, denoted as U, and the node set in U is denoted as D = {d1, d2, ..., d a}, element d in node set D j is the skeleton region feature set F j The corresponding eigenvector, the eigenmatrix of all nodes in U is denoted as H, H∈R n×w , where w is the feature vector dimension of the facial skeleton region position, and the nodes in U are connected in pairs to form an edge set E = {e1, e2, e3, ..., e s},s=a 2 ; Construct the adjacency matrix B of U, B∈R n×n , the elements in the adjacency matrix are denoted as B o,p , B o,p Represents node d o and node d p Different weights are assigned to the edges between them based on their locations and lengths, thereby obtaining the values ​​of each element in the adjacency matrix B.

[0012] Define a multi-layer graph convolutional neural network, the number of layers of the network is denoted as L, and the operation of each layer of graph convolution is defined as Hl+1 =σ(BH l W l ), B is the adjacency matrix of U, H l is the feature matrix of the lth layer, W l is the weight matrix of the lth layer, is the activation function, and preferably, the activation function adopts the ReLU function.

[0013] After U undergoes multi-layer convolution operations, we get the graph U′, which represents the overall facial skeleton feature G z , the facial skeleton features and the corresponding target person information are stored in the database as the basis for face recognition of people wearing masks.

[0014] Step 2, extracting the facial features of the person wearing a mask to be detected and identified;

[0015] Change the base image acquisition in step 1 to: obtain all the face images of people wearing masks to be detected and identified, obtain multiple face images to be detected, and obtain the feature G of the overall facial skeleton to be detected according to the method in step 1 z '.

[0016] The difference between step 2 and step 1 is that when outputting the facial skeleton key points K', K'=[k0',k1',k2',…,k n '], considering the influence of the mask, the key points of the nose and lips are inaccurate, and a smaller weight is given to the key points to weaken the key points of the nose and lips.

[0017] Step 3: The facial feature G to be detected z 'With all the facial skeleton features G in the base library z Perform one-to-one comparison, set a similarity threshold, and determine whether the face image to be detected is the target person. If the similarity is greater than the threshold, it is the target person. If the similarity is less than the threshold, it is not the target person.

[0018] Preferably, the facial skeleton key points in step 1 include 7 categories in total: facial contour F, left eyebrow LM, right eyebrow RM, left eye LE, right eye RE, nose N, and lip L.

[0019] Furthermore, the facial contour F includes 17 key points; the left eyebrow LM includes 5 key points; the right eyebrow RM includes 5 key points; the left eye LE includes 7 key points; the right eye RE includes 7 key points; the nose N includes 9 key points; and the lips L include 20 key points.

[0020] Preferably, the similarity calculation method in step 3 is: for each facial overall skeleton feature G in the base database Z , the facial feature G to be detected z With G z ' similarity S,

[0021] Compared with the prior art, one of the above technical solutions has the following beneficial effects: first, the key points of the human face skeleton are extracted through the openpose lightweight model, and the extracted key points are input into the Transformer to obtain the facial skeleton area features. Finally, the data features of each skeleton node are used as the graph convolution operator, and the overall facial skeleton features of the entire face are calculated according to the graph convolution algorithm; the advantage is that the original plane features are converted into spatial features, and the features such as the contour, size, and distribution of facial features are extracted to improve the accuracy of face recognition with masks. Using node data features based on the face skeleton to identify faces wearing masks can weaken the impact of masks covering the face and further improve the accuracy of face recognition with masks. DETAILED DESCRIPTION

[0022] In order to illustrate the technical solution and working principle of the present invention, the embodiments of the present invention will be described in further detail below. All the above optional technical solutions can be combined in any way to form optional embodiments of the present invention, which will not be described one by one here.

[0023] The terms "step 1", "step 2", "step 3", and the like in the specification and claims of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those described herein.

[0024] In the first aspect, the present disclosure provides a method for detecting a face wearing a mask based on a face skeleton, and the method mainly comprises the following steps:

[0025] Step 1, extracting base database features;

[0026] Obtain the base database image, which is the front face photo of the target person;

[0027] The openpose skeleton extraction network is used to input the base image, scale the input base image to the specified size according to the set aspect ratio, call the trained and converged openpose skeleton network model parameters, execute the forward derivation function, process the input image, and output the facial skeleton key points K = [k0, k1, k2, ..., k n], (n+1) is the number of facial skeleton key points, the facial skeleton key points include a categories, that is, a facial skeleton regions, each category contains the same or different number of key points; preferably, the facial skeleton key points include 7 categories: facial contour F, left eyebrow LM, right eyebrow RM, left eye LE, right eye RE, nose N, lip L. Further, the facial contour F includes 17 key points (corresponding to k0-k 16 ); The left eyebrow LM includes 5 key points (corresponding to k 17 -k 21 ); the right eyebrow RM includes 5 key points (corresponding to k 22 -k 26 ); the left eye LE includes 7 key points (corresponding to k 27 -k 33 ); the right eye RE includes 7 key points (corresponding to k 34 -k 40 ); the nose N includes 9 key points (corresponding to k 41 -k 49 ); the lip L includes 20 key points (corresponding to k 50 -k 69 ).

[0028] The acquired facial skeleton key points K are converted into vector X, X = {x1, x2, x3, ..., x n}, according to the correspondence between the facial skeleton key points and each key point category (facial contour, left eyebrow, right eyebrow, left eye, right eye, nose, lip) is converted into the following key point vector matrix G = {g1, g2, g3, ..., g a}, where g j The key point matrix representing a key point category, j∈{1, 2, ...a}, such as: facial contour g1, g1={x0,x1,x2,...,x 16 Compared with traditional human posture recognition methods, the lightweight version of Openpose adopts a bottom-up detection method to obtain human skeleton features, while removing redundant invalid data and improving detection accuracy.

[0029] Give the key point matrix g j Each vector in plus the position feature, the position feature includes the coordinates of the skeleton key points and the fixed random code, that is, M i =(x ki ,y ki , r i ), where (x ki ,y ki ) is the skeleton key point k i The coordinates of i is a random code that satisfies the following conditions: (1) iis an n-dimensional random vector (for example, n is 10) that obeys an n-dimensional Gaussian distribution, (2) r i The modulus length is fixed (for example, |r i |=1), (3) For any two key points, their corresponding random codes are different.

[0030] The key point matrix g j The key point vectors and position features in are combined to obtain the input vector C of the Transformer network. i , C i =x i +M i ; C i Send it to the Transformer network to get a single facial skeleton region feature f j =T{Y1,Y2,Y3,...,Y q}, where q represents the key point matrix g j Finally, the whole facial skeleton region feature F is obtained, that is, F = {f1,f2,f3,…,f a}; The transformer model is used to extract skeleton region features, and position features are added to each skeleton key point to preserve the relative position of each key point in the sequence.

[0031] The obtained facial skeleton region features F are constructed into a graph, denoted as U, and the node set in U is denoted as D = {d1, d2, ..., d a}, element d in node set D j is the skeleton region feature set F j The corresponding eigenvector, the eigenmatrix of all nodes in U is denoted as H, H∈R n×w , where w is the feature vector dimension of the facial skeleton region position, and the nodes in U are connected in pairs to form an edge set E = {e1, e2, e3, ..., e s},s=a 2 ; Construct the adjacency matrix B of U, B∈R n×n , the elements in the adjacency matrix are denoted as B o,p , B o,p Represents node d o and node d p Different weights are assigned to the edges between them based on their locations and lengths, thereby obtaining the values ​​of each element in the adjacency matrix B.

[0032] Define a multi-layer graph convolutional neural network, the number of layers of the network is denoted as L, and the operation of each layer of graph convolution is defined as H l+1 =σ(BH l W l ), B is the adjacency matrix of U, H lis the feature matrix of the lth layer, W l is the weight matrix of the lth layer, is the activation function, and preferably, the activation function adopts the ReLU function.

[0033] After U undergoes multi-layer convolution operations, we get the graph U′, which represents the overall facial skeleton feature G z , the facial skeleton features and the corresponding target person information are stored in the database as the basis for face recognition of people wearing masks;

[0034] Step 2, extracting the facial features of the person wearing a mask to be detected and identified;

[0035] Change the base image acquisition in step 1 to: obtain all the face images of people wearing masks to be detected and identified, obtain multiple face images to be detected, and obtain the feature G of the overall facial skeleton to be detected according to the method in step 1 z '.

[0036] The difference between step 2 and step 1 is that when outputting the facial skeleton key points K', K'=[k0',k1',k2',…,k n '], considering the influence of the mask, the key points of the nose and lips are inaccurate, and a smaller weight is given to the key points to weaken the key points of the nose and lips to reduce the influence of being blocked by the mask.

[0037] Step 3: The facial feature G to be detected z 'With all the facial skeleton features G in the base library z Perform one-to-one comparison, set a similarity threshold, and determine whether the face image to be detected is the target person. If the similarity is greater than the threshold, it is the target person. If the similarity is less than the threshold, it is not the target person.

[0038] Preferably, the similarity calculation method in step 3 is: for each facial overall skeleton feature G in the base database z , the facial feature G to be detected z With G z ' similarity S,

[0039] In a second aspect, an embodiment of the present disclosure provides a device for detecting a face wearing a mask based on a facial skeleton, and the device can implement a method for detecting a face wearing a mask based on a facial skeleton, any one of all possible implementation methods.

[0040] Preferably, the device comprises a base library extraction unit, a detection unit, and a matching unit.

[0041] The base library extraction unit is used to execute step 1 of a method for detecting a face wearing a mask based on a face skeleton, as described in any one of all possible implementation methods.

[0042] The detection unit is used to perform step 2 of a method for detecting a face wearing a mask based on a face skeleton, as described in any one of all possible implementation methods.

[0043] The matching unit is used to perform step 3 of a method for detecting a face wearing a mask based on a face skeleton, as described in any one of all possible implementations.

[0044] It should be noted that the device for detecting a face wearing a mask based on a face skeleton provided in the above embodiment is only illustrated by the division of the above functional modules when detecting a face wearing a mask based on a face skeleton. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device for detecting a face wearing a mask based on a face skeleton provided in the above embodiment and the method embodiment for detecting a face wearing a mask based on a face skeleton belong to the same concept. The specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0045] In a third aspect, an embodiment of the present disclosure provides a terminal device, which includes an apparatus for detecting a face wearing a mask based on a face skeleton as described in any one of all possible implementation methods.

[0046] The above is an exemplary description of the present invention. Obviously, the specific implementation of the present invention is not limited to the above-mentioned method. All non-substantial improvements made by adopting the method concept and technical solution of the present invention; or directly applying the above-mentioned concept and technical solution of the present invention to other occasions without improvement or equivalent replacement, are within the protection scope of the present invention.

Claims

1. A method for detecting a face wearing a mask based on a face skeleton, characterized in that: The method mainly includes the following steps: Step 1, extracting base database features; Obtain the base database image, which is the front face photo of the target person; The openpose skeleton extraction network is used to input the base image, scale the input base image to the specified size according to the set aspect ratio, call the trained and converged openpose skeleton network model parameters, execute the forward derivation function, process the input image, and output the facial skeleton key points K = [k0, k1, k2, ..., k n ], (n+1) is the number of facial skeleton key points, and the facial skeleton key points include a categories, that is, a facial skeleton regions, and each category contains the same or different number of key points; The acquired facial skeleton key points K are converted into vector X, X = {x1, x2, x3, ..., x n }, according to the correspondence between the facial skeleton key points and each key point category, it is converted into the following key point vector matrix G = {g1, g2, g3, ..., g a }, where g j Represents a key point matrix of a key point category, j∈{1, 2. ...a} Give the key point matrix g j Each vector in plus the position feature, the position feature includes the coordinates of the skeleton key points and the fixed random code, that is, M i =(x ki ,y ki , r i ), where (x ki ,y ki ) is the skeleton key point k i The coordinates of i is a random code that satisfies the following conditions: (1) i is an n-dimensional random vector that follows an n-dimensional Gaussian distribution, (2)r i The modulus length is fixed, (3) any two key points have different corresponding random codes; The key point matrix g j The key point vectors and position features in are combined to obtain the input vector C of the Transformer network. i , C i =x i +M i ; C i Send it to the Transformer network to obtain a single facial skeleton region feature f j =T{Y1,Y2,Y3,...,Y q }, where q represents the key point matrix g j Finally, the whole facial skeleton region feature F is obtained, that is, F = {f1,f2,f3,…,f a }; The obtained facial skeleton region features F are constructed into a graph, denoted as U, and the node set in U is denoted as D = {d1, d2, ..., d a }, element d in node set D j is the skeleton region feature set F j The corresponding eigenvector, the eigenmatrix of all nodes in U is denoted as H, H∈R n×w , where w is the feature vector dimension of the facial skeleton region position, and the nodes in U are connected in pairs to form an edge set E = {e1, e2, e3, ..., e s },s=a 2 ; Construct the adjacency matrix B of U, B∈R n×n , the elements in the adjacency matrix are denoted as B o,p , B o,p Represents node d o and node d p The edges between them are assigned different weights based on the positions and lengths of the edges, thus obtaining the values ​​of each element in the adjacency matrix B; Define a multi-layer graph convolutional neural network, the number of layers of the network is L, and the operation of each layer of graph convolution is defined as H l+1 =σ(BH l W l ), B is the adjacency matrix of U, H l is the feature matrix of the lth layer, W l is the weight matrix of the lth layer, is the activation function, preferably, the activation function adopts the ReLU function; After U undergoes multi-layer convolution operations, we get the graph U′, which represents the overall facial skeleton feature G Z , the facial skeleton features and the corresponding target person information are stored in the database as the basis for face recognition of people wearing masks; Step 2: Extract the facial features of the person wearing a mask to be detected and identified Change the base image acquisition in step 1 to: obtain all the face images of people wearing masks to be detected and identified, obtain multiple face images to be detected, and obtain the feature G of the overall facial skeleton to be detected according to the method in step 1 Z '; The difference between step 2 and step 1 is that when outputting the facial skeleton key point K', K'=[k0',k1',k2',…,k n '], considering the influence of the mask, the key points of the nose and lips are inaccurate, and a smaller weight is given to the key points, weakening the key points of the nose and lips; Step 3: The facial feature G to be detected Z 'With all the facial skeleton features G in the base library Z Perform one-to-one comparison, set a similarity threshold, and determine whether the face image to be detected is the target person. If the similarity is greater than the threshold, it is the target person. If the similarity is less than the threshold, it is not the target person.

2. The method for detecting a face wearing a mask based on a face skeleton according to claim 1, characterized in that: In step 1, the facial skeleton key points include 7 categories: facial contour F, left eyebrow LM, right eyebrow RM, left eye LE, right eye RE, nose N, and lip L.

3. The method for detecting a face wearing a mask based on a face skeleton according to claim 2, characterized in that: The facial contour F includes 17 key points; the left eyebrow LM includes 5 key points; the right eyebrow RM includes 5 key points; the left eye LE includes 7 key points; the right eye RE includes 7 key points; the nose N includes 9 key points; and the lips L includes 20 key points.

4. A method for detecting a face wearing a mask based on a face skeleton according to any one of claims 1 to 3, characterized in that: Step 3: The similarity calculation method is: for each facial overall skeleton feature G in the base database Z , the facial feature G to be detected Z With G Z ' similarity S, 5. A device for detecting a face wearing a mask based on a face skeleton, characterized in that: The device can implement the method for detecting a face wearing a mask based on a face skeleton as described in any one of claims 1 to 4.

6. The device for detecting a face wearing a mask based on a face skeleton according to claim 5, characterized in that: The device includes a base library extraction unit, a detection unit, and a matching unit. The base library extraction unit is used to perform step 1 of the method for detecting a face wearing a mask based on a face skeleton according to any one of claims 1 to 4; The detection unit is used to perform step 2 of the method for detecting a face wearing a mask based on a face skeleton according to any one of claims 1 to 4; The matching unit is used to execute step 3 of the method for detecting a face wearing a mask based on a face skeleton as described in any one of claims 1 to 4.

7. A terminal device, characterized in that: The terminal device includes a device for detecting a face wearing a mask based on a face skeleton as described in any one of claims 5 or 6.

Citation Information

Patent Citations

  • Face recognition method and system

    CN112418177A

  • Face clustering method, electronic equipment and related products

    CN112597942A