A face feature weight mapping method, face recognition method and device

Through the face feature weight mapping method, the offset vector is calculated and iterated to generate the mapping relationship between the feature weight vector and the mask, which solves the problem that the existing technology cannot rely on a single database to accurately identify faces wearing or not wearing masks, and achieves the face recognition effect with high accuracy and low storage requirements.

CN114445872BActive Publication Date: 2025-03-25CHINA TELECOM CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111577817.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-22
Publication Date
2025-03-25
Estimated Expiration
2041-12-22

AI Technical Summary

Technical Problem

The prior art cannot rely on a single database to accurately identify faces wearing or not wearing masks, resulting in a decrease in recognition accuracy and an increase in storage space demand.

Method used

Through the face feature weight mapping method, the offset vector between the normal face image and the feature vector corresponding to a specific mask is calculated, multiple offset vectors are obtained iteratively, the feature weight vector of a specific mask is calculated, and the mapping relationship between the feature weight vector and the mask is generated, which is used to identify the masked face.

Benefits of technology

It realizes the detection of any position in the image being occluded through a single database, improves the accuracy and efficiency of face recognition, and reduces the storage space requirement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114445872B_ABST
    Figure CN114445872B_ABST
Patent Text Reader

Abstract

The present invention discloses a facial feature weight mapping method, a facial recognition method and a device thereof, wherein the facial feature weight mapping method comprises: obtaining a first feature vector of a normal facial image and a second feature vector corresponding to a specific mask; calculating an offset vector according to the first feature vector and the second feature vector; performing iterative training according to a plurality of normal facial images to obtain a plurality of offset vectors; calculating a feature weight vector of a specific mask according to the plurality of offset vectors, and generating a mapping relationship between the feature weight vector and the specific mask. The facial feature weight mapping method disclosed in the present invention converts the difference of the masked part into offset information by calculating the offset vector, which is convenient for machine recognition. By performing iterative training, the error can be reduced and underfitting can be prevented. Through the mapping relationship, the feature weight of the masked part can be reduced separately when the image is masked, so that the masking of any position in the image can be detected through a single database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of artificial intelligence image recognition, and in particular to a facial feature weight mapping method, a facial recognition method and a device thereof. Background Art

[0002] At present, there are generally two methods of face recognition for people wearing masks in the industry:

[0003] Follow the normal face recognition steps, such as Figure 1 As shown in the figure, a face recognition model is used to extract face features, and then feature comparison is performed with the face feature library to find the face identification number with the greatest similarity and greater than the set threshold. This method requires adding face data wearing masks to the offline learning stage of face recognition for learning, and is compatible with the changes in face features caused by wearing masks. However, adding face data wearing masks to train the face recognition model weakens the features of the obscured part of the face, and indirectly weakens the features of the lower half of the normal face without a mask, reducing the feature expression ability of the face recognition model and affecting the accuracy of normal face recognition without a mask.

[0004] Use two face recognition models, such as Figure 2 As shown in the figure, first detect whether the face is wearing a mask. If not, use the normal face recognition model for recognition. Otherwise, use another face recognition model for recognition. This method requires the use of two face recognition models, and needs to establish a face feature database of people wearing masks and a normal face feature database of people not wearing masks, which requires more storage space. Summary of the invention

[0005] Therefore, the technical problem to be solved by the present invention is to overcome the defect in the prior art that a single database cannot be used to accurately identify faces wearing or not wearing masks, thereby providing a facial feature weight mapping method, a face recognition method and a device thereof.

[0006] According to a first aspect, the present invention discloses a facial feature weight mapping method, including: obtaining a first feature vector of a normal facial image and a second feature vector corresponding to a specific mask; calculating an offset vector based on the first feature vector and the second feature vector; performing iterative training based on multiple normal facial images to obtain multiple offset vectors; calculating a feature weight vector of the specific mask based on the multiple offset vectors, and generating a mapping relationship between the feature weight vector and the specific mask.

[0007] Optionally, obtaining the first feature vector of a normal face image and the second feature vector corresponding to a specific mask includes: generating a specific mask for a normal face image of any size according to a preset rule; obtaining the first feature vector of the normal face image; and obtaining the second feature vector after multiplying the normal face image by the specific mask.

[0008] According to a second aspect, the present invention discloses a face recognition method, comprising: obtaining a face image to be recognized; extracting a face feature vector based on the face image to be recognized; performing cover detection on the face image to be recognized based on a preset detection model, and generating a face image mask to be recognized of the face image to be recognized; obtaining a weight vector of the face image to be recognized based on the mapping relationship between the face image mask to be recognized and the face feature weight mapping method described in the first aspect; and recognizing the face image to be recognized based on the weight vector and the face feature vector.

[0009] Optionally, extracting a facial feature vector based on the facial image to be identified includes: extracting facial features according to preset extraction rules based on the facial image to be identified; and extracting a facial feature vector according to preset rules based on the facial features.

[0010] Optionally, the mask detection is performed on the face image to be identified based on a preset detection model to generate a face image mask to be identified for the face image to be identified, including: performing image segmentation on the face image to be identified according to preset rules; obtaining the image area where the mask is located based on the image segmentation result; generating a binary image based on the image area where the mask is located; the foreground of the binary image is the mask area, and the background is the non-mask area; performing image size transformation on the binary image to generate a standard binary image; marking corresponding pixel points in the standard binary image to generate a face image mask to be identified for the face image to be identified.

[0011] Optionally, obtaining the weight vector of the face image to be identified based on the mask of the face image to be identified includes: obtaining a specific mask corresponding to the number of marked pixels based on the mask of the face image to be identified; obtaining a feature weight vector corresponding to the number of marked pixels based on the specific mask and the mapping relationship; and obtaining the weight vector of the face image to be identified based on the feature weight vector.

[0012] Optionally, the identifying the face image to be identified based on the weight vector and the face feature vector includes: obtaining a standard feature vector from a face feature library; multiplying the face feature vector and the standard feature vector by the weight vector respectively to obtain a weighted face feature vector and a weighted standard feature vector; calculating similarity based on the weighted face feature vector and the weighted standard feature vector; traversing the face feature library to find the face identification number corresponding to the standard feature vector with the maximum similarity and greater than a preset value; when the face identification number exists, matching the face to be identified with the face identification number; when the face identification number does not exist, reporting an error and stopping the face recognition process.

[0013] According to a third aspect, the present invention discloses a facial feature weight mapping device, comprising: an acquisition module, used to acquire a first feature vector of a normal facial image and a second feature vector corresponding to a specific mask; a calculation module, used to calculate an offset vector based on the first feature vector and the second feature vector; an iteration module, used to perform iterative training based on multiple normal facial images to obtain multiple offset vectors; a mapping module, used to calculate the feature weight vector of the specific mask based on the multiple offset vectors, and generate a mapping relationship between the feature weight vector and the specific mask.

[0014] According to a fourth aspect, the present invention discloses a face recognition device, comprising: an acquisition module, used to acquire a face image to be recognized; a face recognition module, used to extract a face feature vector based on the face image to be recognized; a cover detection module, used to perform cover detection on the face image to be recognized based on a preset detection model, and generate a face image mask to be recognized of the face image to be recognized; a feature weight mapping module, used to obtain a weight vector of the face image to be recognized based on the mapping relationship between the face image mask to be recognized and the face feature weight mapping method described in the first aspect and any optional implementation manner of the first aspect; and a face feature comparison module, used to recognize the face image to be recognized based on the weight vector and the face feature vector.

[0015] According to the fifth aspect, the present invention discloses an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps of the facial feature weight mapping method described in the first aspect and any optional embodiment of the first aspect or the facial recognition method described in the second aspect and any optional embodiment of the second aspect.

[0016] According to the sixth aspect, the present invention discloses a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the facial feature weight mapping method described in the first aspect and any optional embodiment of the first aspect or the facial recognition method described in the second aspect and any optional embodiment of the second aspect are implemented.

[0017] The technical solution of the present invention has the following advantages:

[0018] 1. The facial feature weight mapping method disclosed in the present invention converts the difference between the normal face and the masked face from image information to offset information by calculating the offset vector between the first feature vector of the normal face image and the second feature vector corresponding to the specific mask, so as to facilitate machine recognition. Iterative training is performed on multiple normal face images to obtain multiple offset vectors, which can reduce the error rate and error of the mapping result, improve the accuracy of the mapping result, and prevent underfitting. The feature weight vector of the specific mask is calculated by the offset vector to obtain the mapping relationship between the feature weight vector and the specific mask, so that when any part of the image is masked, the feature weight of the masked part can be reduced separately without affecting the recognition accuracy of other parts, so that the situation where any position in the image is masked can be detected through a single database, which solves the defect that the prior art cannot rely on a single database for accurate recognition.

[0019] 2. The face recognition method disclosed in the present invention introduces a face feature weight vector to weight the face features to be recognized and the face features in the database respectively, thereby reducing the feature weights of the parts blocked by the mask and improving the similarity when comparing correct face features. Only a feature database of normal faces needs to be established, and there is no need to establish an additional feature database of faces wearing masks. The method is compatible with face recognition with and without masks without reducing the accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0021] Figure 1 A flowchart of a specific example of a single database face recognition method in the prior art;

[0022] Figure 2 A flowchart of a specific example of a multi-database face recognition method in the prior art;

[0023] Figure 3 This is a flowchart of a specific example of a method for mapping facial feature weights in an embodiment of the present invention;

[0024] Figure 4 is a flowchart of a specific example of a face recognition method in an embodiment of the present invention;

[0025] Figure 5 is a structural block diagram of a specific example of a facial feature weight mapping device in an embodiment of the present invention;

[0026] Figure 6 is a structural block diagram of a specific example of a face recognition device in an embodiment of the present invention;

[0027] Figure 7 FIG. 4 is a specific example diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0028] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0029] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0030] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, it can also be the internal connection of two components, it can be a wireless connection, or it can be a wired connection. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0031] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0032] The present invention discloses a method for weight mapping of facial features. Figure 3 As shown, the following steps are included:

[0033] Step S11, obtaining a first eigenvector of a normal face image and a second eigenvector corresponding to a specific mask.

[0034] Among them, a normal face image refers to a face image without a mask, or a face image that is not blocked.

[0035] Specifically, firstly, a specific mask of a normal face image of any size is generated according to a preset rule; then, a first feature vector of the normal face image is obtained; and finally, the normal face image is multiplied by the specific mask to obtain a second feature vector.

[0036] The specific mask is determined by the image size. If any pixel in the image mask of size m×m is set to 0 and the other pixels are set to 1, the mask generated at this time is the specific mask. In particular, the image mask of size m×m can generate a total of m×m specific masks.

[0037] Among them, the first feature vector represents an n-dimensional feature vector obtained by the image feature extraction technology of the normal face image. Image feature extraction refers to processing and analyzing the information in the image, and extracting the characteristic information that is not easily interfered by random factors as the feature information of the image. By extracting n feature information from the image and outputting them as a whole, an n-dimensional feature vector can be obtained. Exemplarily, the first feature vector of the normal face image can be obtained by extracting facial features according to the image and then extracting the facial feature vector in the prior art, and the present invention is not limited to this.

[0038] Exemplarily, by multiplying a normal face image with a specific mask, a masked face image can be generated, and the masked position is the position of the pixel set to 0.

[0039] Similarly, the second feature vector represents an n-dimensional feature vector obtained by the image feature extraction technology of the masked face image. Exemplarily, the second feature vector of the masked face image can also be obtained by extracting face features from the image and then extracting the face feature vector in the prior art, and the present invention is not limited to this.

[0040] Step S12: Calculate an offset vector according to the first eigenvector and the second eigenvector.

[0041] Specifically, the offset vector is obtained by subtracting each dimension of the first eigenvector from the second eigenvector and taking the absolute value. Exemplarily, the process can be expressed by the following formula:

[0042] B1=|F1-F2|=[b1,b2,b3,...,b n ]

[0043] Among them, B1 represents the offset vector, F1 represents the first eigenvector, F2 represents the second eigenvector, and b n Indicates the offset value between the nth dimension of F1 and the nth dimension of F2.

[0044] Step S13, performing iterative training based on multiple normal face images to obtain multiple offset vectors.

[0045] Specifically, iterative training is to obtain k n-dimensional offset vectors B1, B2, B3, ..., B by processing k different normal face images. k .

[0046] Step S14, calculating a feature weight vector of a specific mask according to the multiple offset vectors, and generating a mapping relationship between the feature weight vector and the specific mask.

[0047] Specifically, the average offset vector is calculated based on k n-dimensional offset vectors The average offset vector B is normalized to the range [0,1] to obtain the normalized average offset vector B'. After inverting the normalized average offset vector B' and adding 1, the feature weight vector corresponding to the mask can be obtained. For example, the process can be expressed by the following formula:

[0048] Q1=1-B'

[0049] Among them, Q1 is the feature weight vector corresponding to the mask.

[0050] Furthermore, by repeating the above steps S11-S14 after replacing the specific mask, m×m feature weight vectors Q1, Q2, Q3, ..., Q corresponding to the m×m specific masks can be obtained. m×m After one-to-one correspondence between m×m specific masks and m×m feature weight vectors, the mapping relationship between the feature weight vector and the specific mask can be generated.

[0051] The facial feature weight mapping method disclosed in the present invention converts the difference between a normal face and a masked face from image information to offset information by calculating the offset vector between the first feature vector of a normal face image and the second feature vector corresponding to a specific mask, so as to facilitate machine recognition. Iterative training is performed on multiple normal face images to obtain multiple offset vectors, which can reduce the error rate and error of the mapping result, improve the accuracy of the mapping result, and prevent underfitting. The feature weight vector of a specific mask is calculated by the offset vector to obtain the mapping relationship between the feature weight vector and the specific mask, so that when any part of the image is masked, the feature weight of the masked part can be reduced separately without affecting the recognition accuracy of other parts, so that the situation where any position in the image is masked can be detected through a single database, solving the defect in the prior art that accurate recognition cannot be relied on a single database.

[0052] The present invention also discloses a face recognition method, such as Figure 4 As shown, including:

[0053] Step S21, obtaining a face image to be recognized.

[0054] Exemplarily, the facial image to be recognized may be acquired using existing image acquisition technology, which is not limited in the present invention.

[0055] Step S22, extracting a facial feature vector based on the face image to be identified.

[0056] Specifically, firstly, according to the face image to be identified, the face features are extracted according to the preset extraction rules; then, according to the face features, the face feature vector is extracted according to the preset rules. For example, the scale-invariant feature transform (SIFT) and other methods in the prior art can be used to extract features and extract feature vectors from the face image, and the present invention is not limited to this.

[0057] Step S23, based on the preset detection model, a mask detection is performed on the face image to be identified, and a face image mask to be identified is generated for the face image to be identified. The mask can be a mask formed by a mask, or sunglasses, a scarf, etc. The mask formed by wearing a mask is used as an example for explanation.

[0058] Specifically, firstly, the face image to be identified is segmented according to preset rules; then, according to the image segmentation result, the image area where the mask is located is obtained; then, according to the image area where the mask is located, a binary image is generated; wherein the foreground of the binary image is the mask area, and the background is the non-mask area; then, the binary image is resized to generate a standard binary image; finally, the corresponding pixel points in the standard binary image are marked to generate a face image mask to be identified of the face image to be identified.

[0059] Among them, the process of resizing the binarized image can process the collected images of different sizes into standard sizes, so that images of different sizes can be processed using masks of the same size, which is convenient for image recognition. Exemplarily, the process of resizing the binarized image can use methods such as image resizing algorithms in the prior art, and the present invention is not limited to this.

[0060] Among them, the process of marking the pixels in the standard binary image includes: setting the pixel values ​​in the mask area to 0, setting the pixel values ​​that do not belong to the mask area to 1, and generating a mask of the face image to be identified.

[0061] Exemplarily, the process of image segmentation of the face image to be identified can be implemented by using the threshold segmentation technology, edge detection technology, histogram technology, deep learning image segmentation model and other methods in the prior art, and the present invention does not limit this. Further, the process of obtaining the image area where the mask is located according to the image segmentation result can be implemented by using the color model and other methods in the prior art, and the present invention does not limit this.

[0062] Step S24, obtaining a weight vector of the face image to be identified according to the mask of the face image to be identified and the mapping relationship obtained by the face feature weight mapping method according to the embodiment of the present invention.

[0063] Specifically, first, according to the mask of the face image to be identified, a specific mask corresponding to the number of marked pixels is obtained; then, according to the specific mask and the mapping relationship, a feature weight vector corresponding to the number of marked pixels is obtained; finally, according to the feature weight vector, a weight vector of the face image to be identified is obtained.

[0064] Exemplarily, the mask of the face image to be identified can be a mask of size m×m, which includes s pixels with a value of 0. At this time, each pixel with a value of 0 is output separately as a specific mask, and a total of s specific masks can be obtained. According to the mapping relationship obtained by a facial feature weight mapping method in an embodiment of the present invention, s n-dimensional feature weight vectors corresponding to the s specific masks are obtained. Furthermore, the s n-dimensional feature weight vectors are constructed into a vector matrix with s rows and n columns, and the maximum value of each column of the vector matrix is ​​taken to obtain the n-dimensional weight vector Q of the face image to be identified. final .

[0065] Step S25, identifying the face image to be identified according to the weight vector and the face feature vector.

[0066] Specifically, the face image to be identified can be identified by using the geometric feature method, template method, model method, etc. in the prior art, and the present invention does not limit this. Exemplarily, first obtain the standard feature vector in the face feature library; then multiply the face feature vector and the standard feature vector by the weight vector respectively to obtain the weighted face feature vector and the weighted standard feature vector; next, calculate the similarity based on the weighted face feature vector and the weighted standard feature vector; then traverse the face feature library to find the face identification number corresponding to the standard feature vector with the largest similarity and greater than the preset value; when it is determined that the face identification number exists, the face to be identified is matched with the face identification number; when it is determined that the face identification number does not exist, report an error and stop the face recognition process.

[0067] In one embodiment, when the face recognition method in the embodiment of the present invention is used to recognize a normal face without a mask, the following steps are included:

[0068] After mask detection on the face image, a binary image is obtained. Since the face is not wearing a mask, there is no foreground area in the binary image. The binary image is resized to m×m size and a mask is generated. At this time, all pixel values ​​of the mask are 1.

[0069] For the case where all pixel values ​​of the input mask are 1, the n-dimensional weight vector Q output by the feature weight mapping module isfinal The value of each dimension of is also 1, that is, the feature weight of each dimension in the face feature vector will remain unchanged.

[0070] After the feature vector of the face to be identified and the feature vector in the face feature library are multiplied by the weight vector respectively, the value will remain unchanged. At this time, face recognition will be performed on each pixel in the face image.

[0071] In one embodiment, when the face recognition method in the embodiment of the present invention is used to identify a face covered by a mask, the following steps are included:

[0072] After mask detection on the face image, a binary image is obtained. Since the face is wearing a mask, the foreground of the binary image is the mask area and the background is the non-mask area. The binary image is resized to m×m size and a mask is generated. At this time, the pixel value of the mask area in the mask is 0, and the other pixel values ​​are 1.

[0073] For the case where the pixel values ​​of the input mask are not all 1, the n-dimensional weight vector Q output by the feature weight mapping module is final The dimension that is more affected by the mask area is closer to 0. On the contrary, the dimension that is less affected by the mask area is closer to 1. That is, the more relevant the feature in the face feature vector is to the mask area, the lower its weight is.

[0074] After the feature vector of the face to be identified and the feature vector in the face feature library are multiplied by the weight vector respectively, the feature expression ability of the mask area is reduced and the feature values ​​of other areas are highlighted. At this time, it is equivalent to focusing on face recognition on the pixels in the non-mask area of ​​the face image.

[0075] The face recognition method disclosed by the present invention introduces a face feature weight vector to weight the face features to be recognized and the face features in a database respectively, thereby reducing the feature weights of the parts blocked by the mask and improving the similarity when comparing correct face features. Moreover, only a feature database of normal faces needs to be established, and no additional feature database of faces wearing masks is required. Therefore, the face recognition method is compatible with faces wearing masks and faces not wearing masks without reducing the accuracy.

[0076] The present invention also discloses a facial feature weight mapping device, such as Figure 5 As shown, including:

[0077] The acquisition module 101 is used to acquire a first feature vector of a normal face image and a second feature vector corresponding to a specific mask; for details, please refer to the corresponding part of step S11 in the above method embodiment, which will not be repeated here.

[0078] The calculation module 102 is used to calculate the offset vector according to the first eigenvector and the second eigenvector; for details, please refer to the corresponding part of step S12 in the above method embodiment, which will not be repeated here.

[0079] The iteration module 103 is used to perform iterative training according to multiple normal face images to obtain multiple offset vectors; the specific content refers to the corresponding part of step S13 in the above method embodiment, which will not be repeated here.

[0080] The mapping module 104 is used to calculate the feature weight vector of the specific mask according to multiple offset vectors, and generate a mapping relationship between the feature weight vector and the specific mask; for specific content, please refer to the corresponding part of step S14 in the above method embodiment, which will not be repeated here.

[0081] The functional description of the facial feature weight mapping device provided in the embodiment of the present invention is detailed in the description of the facial feature weight mapping method in the above embodiment, which will not be repeated here.

[0082] The face feature weight mapping device disclosed in the present invention converts the difference between the normal face and the masked face from image information to offset information by calculating the offset vector between the first feature vector of the normal face image and the second feature vector corresponding to the specific mask, so as to facilitate machine recognition. Iterative training is performed on multiple normal face images to obtain multiple offset vectors, which can reduce the error rate and error of the mapping result, improve the accuracy of the mapping result, and prevent underfitting. The feature weight vector of the specific mask is calculated by the offset vector to obtain the mapping relationship between the feature weight vector and the specific mask, so that when any part of the image is masked, the feature weight of the masked part can be reduced separately without affecting the recognition accuracy of other parts, so that the situation where any position in the image is masked can be detected through a single database, which solves the defect in the prior art that it cannot rely on a single database for accurate recognition.

[0083] The present invention also discloses a facial feature weight mapping device, such as Figure 6 As shown, including:

[0084] The acquisition module 201 is used to acquire the face image to be recognized; for details, please refer to the corresponding part of step S21 in the above method embodiment, which will not be repeated here.

[0085] The face recognition module 202 is used to extract a face feature vector according to the face image to be recognized; the specific content is shown in the corresponding part of step S22 in the above method embodiment, which will not be repeated here.

[0086] The mask detection module 203 is used to perform mask detection on the face image to be identified based on a preset detection model to generate a face image mask for the face image to be identified; for details, please refer to the corresponding part of step S23 in the above method embodiment, which will not be repeated here.

[0087] The feature weight mapping module 204 is used to obtain the weight vector of the face image to be identified based on the mapping relationship between the face image mask to be identified and the face feature weight mapping method of the embodiment of the present invention; for the specific content, please refer to the corresponding part of step S24 in the above method embodiment, which will not be repeated here.

[0088] The facial feature comparison module 205 is used to identify the facial image to be identified based on the weight vector and the facial feature vector; the specific content can be found in the corresponding part of step S25 in the above method embodiment, which will not be repeated here.

[0089] The functional description of the face recognition device provided in the embodiment of the present invention is detailed in the description of the face recognition method in the above embodiment, which will not be repeated here.

[0090] The face recognition device disclosed in the present invention introduces a face feature weight vector to weight the face features to be recognized and the face features in the database respectively, thereby reducing the feature weights of the parts blocked by the mask and improving the similarity when comparing the correct face features. Moreover, only a feature database of normal faces needs to be established, and there is no need to establish an additional feature database of faces wearing masks. Therefore, the face recognition device is compatible with faces wearing masks and faces not wearing masks without reducing the accuracy.

[0091] The embodiment of the present invention further provides an electronic device, such as Figure 7 As shown, the electronic device may include a processor 301 and a memory 302, wherein the processor 301 and the memory 302 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.

[0092] The processor 301 may be a central processing unit (CPU). The processor 301 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0093] The memory 302, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the face feature weight mapping method and / or face recognition method in the embodiments of the present invention. The processor 301 executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory 302, that is, implementing the face feature weight mapping method and / or face recognition method in the above method embodiments.

[0094] The memory 302 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created by the processor 301, etc. In addition, the memory 302 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 302 may optionally include a memory remotely arranged relative to the processor 301, and these remote memories may be connected to the processor 301 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0095] One or more modules are stored in the memory 302, and when executed by the processor 301, the execution is as follows: Figure 3 and Figure 4 The facial feature weight mapping method and / or the facial recognition method in the illustrated embodiments.

[0096] Although the exemplary embodiments and their advantages have been described in detail, those skilled in the art may make various changes, substitutions and modifications to these embodiments without departing from the spirit of the present invention and the scope of protection defined by the appended claims, and such modifications and variations all fall within the scope defined by the appended claims. For other examples, those of ordinary skill in the art should readily understand that the order of the process steps may be changed while maintaining the scope of protection of the present invention.

[0097] In addition, the scope of application of the present invention is not limited to the processes, mechanisms, manufactures, material compositions, means, methods and steps of the specific embodiments described in the specification. From the disclosure of the present invention, it will be easily understood by those skilled in the art that the processes, mechanisms, manufactures, material compositions, means, methods or steps that currently exist or will be developed in the future, which perform substantially the same functions as the corresponding embodiments described in the present invention or obtain substantially the same results, can be applied according to the present invention. Therefore, the claims attached to the present invention are intended to include these processes, mechanisms, manufactures, material compositions, means, methods or steps within their scope of protection.

Claims

1. A facial feature weight mapping method, characterized in that: include: Obtaining a first eigenvector of a normal face image and a second eigenvector corresponding to a specific mask; Calculating an offset vector according to the first eigenvector and the second eigenvector; Perform iterative training based on multiple normal face images to obtain multiple offset vectors; Calculating a feature weight vector of the specific mask according to the multiple offset vectors, and generating a mapping relationship between the feature weight vector and the specific mask; The step of obtaining a first feature vector of a normal face image and a second feature vector corresponding to a specific mask includes: Generate a specific mask for a normal face image of any size according to preset rules; Obtain the first eigenvector of a normal face image; After multiplying the normal face image by the specific mask, a second feature vector is obtained; Calculating a feature weight vector of the specific mask according to the multiple offset vectors includes: Calculate the average offset vector based on k n-dimensional offset vectors Iterative training is to obtain k n-dimensional offset vectors B1, B2, B3, ..., B by processing k different normal face images. k , normalize the average offset vector B to the value range [0,1] to obtain the normalized average offset vector B', negate the normalized average offset vector B' and add 1 to obtain the feature weight vector corresponding to the mask. The process is expressed by the following formula: Q1=1-B' Among them, Q1 is the feature weight vector corresponding to the mask; The specific mask is determined according to the image size. If any pixel in the image mask of size m×m is set to 0 and the remaining pixels are set to 1, the mask generated at this time is the specific mask. The image mask of size m×m can generate a total of m×m specific masks. After the m×m specific masks are matched one by one with the m×m feature weight vectors, the mapping relationship between the feature weight vector and the specific mask can be generated.

2. A face recognition method, characterized in that: include: Obtaining a face image to be recognized; Extracting a facial feature vector according to the face image to be identified; Performing mask detection on the face image to be identified based on a preset detection model to generate a face image mask for the face image to be identified; Obtaining a weight vector of the face image to be identified according to the mask of the face image to be identified and the mapping relationship obtained by the face feature weight mapping method according to claim 1; Identify the face image to be identified according to the weight vector and the face feature vector; Obtaining a weight vector of the face image to be identified according to the mask of the face image to be identified and the mapping relationship obtained by the face feature weight mapping method according to claim 1, comprising: Get s n-dimensional feature weight vectors corresponding to s specific masks, form a vector matrix with s rows and n columns from the s n-dimensional feature weight vectors, and take the maximum value of each column of the vector matrix to obtain the n-dimensional weight vector Q of the face image to be recognized final ; According to the weight vector and the face feature vector, the face image to be identified is identified, including: obtaining a standard feature vector in a face feature library; then multiplying the face feature vector and the standard feature vector with the weight vector respectively to obtain a weighted face feature vector and a weighted standard feature vector; next, calculating the similarity according to the weighted face feature vector and the weighted standard feature vector; then traversing the face feature library to find the face identification number corresponding to the standard feature vector with the maximum similarity and greater than a preset value; judging when the face identification number exists, matching the face to be identified with the face identification number; judging when the face identification number does not exist, reporting an error and stopping the face recognition process.

3. The method according to claim 2, characterized in that The step of extracting a facial feature vector according to the face image to be identified includes: Extracting facial features according to the facial image to be identified according to a preset extraction rule; Based on the facial features, a facial feature vector is extracted according to preset rules.

4. The method according to claim 2, characterized in that: The step of performing cover detection on the face image to be identified based on a preset detection model to generate a face image mask to be identified of the face image to be identified includes: Performing image segmentation on the face image to be identified according to preset rules; According to the image segmentation result, obtaining the image area where the mask is located; Generate a binary image according to the image area where the mask is located; the foreground of the binary image is the mask area, and the background is the non-mask area; Performing image size transformation on the binarized image to generate a standard binarized image; The corresponding pixel points in the standard binary image are marked to generate a face image mask for the face image to be identified.

5. The method according to claim 4, characterized in that The step of obtaining a weight vector of the face image to be identified according to the mask of the face image to be identified includes: According to the mask of the face image to be identified, a specific mask corresponding to the number of marked pixels is obtained; According to the specific mask and the mapping relationship, obtaining a feature weight vector corresponding to the number of marked pixels; Obtaining a weight vector of the face image to be recognized according to the feature weight vector; Obtaining a weight vector of the face image to be recognized according to the feature weight vector includes: The mask of the face image to be identified is a mask of size m×m, which includes s pixels with a value of 0. At this time, each pixel with a value of 0 is output as a specific mask, and a total of s specific masks are obtained. The s n-dimensional feature weight vectors corresponding to the s specific masks are obtained, and the s n-dimensional feature weight vectors are formed into a vector matrix with s rows and n columns. The maximum value of each column of the vector matrix is ​​taken to obtain the n-dimensional weight vector Q of the face image to be identified. final .

6. A face recognition device, characterized in that: include: An acquisition module, used to acquire a face image to be recognized; A face recognition module, used for extracting a face feature vector according to the face image to be recognized; A mask detection module, used for performing mask detection on the face image to be identified based on a preset detection model, and generating a face image mask to be identified of the face image to be identified; A feature weight mapping module, used to obtain a weight vector of the face image to be identified based on the mask of the face image to be identified and the mapping relationship obtained by the face feature weight mapping method according to claim 1; A facial feature comparison module, used for identifying the facial image to be identified based on the weight vector and the facial feature vector; Obtaining a weight vector of the face image to be identified according to the mask of the face image to be identified and the mapping relationship obtained by the face feature weight mapping method according to claim 1, comprising: Get s n-dimensional feature weight vectors corresponding to s specific masks, form a vector matrix with s rows and n columns from the s n-dimensional feature weight vectors, and take the maximum value of each column of the vector matrix to obtain the n-dimensional weight vector Q of the face image to be recognized final ; According to the weight vector and the face feature vector, the face image to be identified is identified, including: obtaining a standard feature vector in a face feature library; then multiplying the face feature vector and the standard feature vector with the weight vector respectively to obtain a weighted face feature vector and a weighted standard feature vector; next, calculating the similarity according to the weighted face feature vector and the weighted standard feature vector; then traversing the face feature library to find the face identification number corresponding to the standard feature vector with the maximum similarity and greater than a preset value; judging when the face identification number exists, matching the face to be identified with the face identification number; judging when the face identification number does not exist, reporting an error and stopping the face recognition process.

7. An electronic device, characterized in that: include: at least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor performs the steps of the facial feature weight mapping method as described in claim 1 or the facial recognition method as described in any one of claims 2-5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the facial feature weight mapping method according to claim 1 or the facial recognition method according to any one of claims 2 to 5 are implemented.

Citation Information

Patent Citations

  • Face image restoration method and system

    CN112001859A

  • Facial recognition method and apparatus, electronic device, and storage medium

    WO2019011165A1