Face detection method and system, electronic equipment and storage medium
By using a single convolutional neural network in face detection and combining the backbone, neck and head networks for feature extraction and fusion, it is possible to simultaneously output face position and attribute information, solving the problem of heavy calculations in the existing technology. , improving the efficiency of face detection on mobile terminals.
Patent Information
- Application Number
- CN202410622989.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2024-08-30
AI Technical Summary
Existing face detection algorithms require a three-stage or two-stage method, resulting in a large amount of calculation. Especially when deployed on mobile terminals, it is difficult to process multiple face images, which increases computational overhead and time-consuming.
A single convolutional neural network algorithm is used to extract features through the backbone network, the neck network performs feature fusion, and the head network simultaneously performs face frame detection, attribute classification, and key point detection to reduce computational redundancy and reduce the amount of calculations.
It realizes the simultaneous output of face position, key point position and attribute information in a single convolutional neural network algorithm, reducing computational redundancy, reducing the amount of calculation, and improving the efficiency of mobile face detection.
Smart Images

Figure CN118570853A
Abstract
Description
Technical Field
[0001] The present application relates to the field of face detection, and in particular to a face detection method, system, electronic device and storage medium. Background Art
[0002] The purpose of the face detection algorithm is to find the corresponding positions of all faces in the image, the purpose of the face key point detection algorithm is to find the positions of the main key points such as the facial features in the face image, and the face attribute detection algorithm is to analyze the face and output the attribute information such as face occlusion, wearing glasses, gender, expression, etc. The related algorithms currently used are all based on convolutional neural networks for calculation, and if you want to obtain these three types of information from an image at the same time, generally a three-stage or two-stage method is required, that is, three or two different algorithms are required to detect the image. These staged methods will lead to an increase in the amount of calculation, and the more faces there are, the greater the amount of calculation, which increases the difficulty of deployment on some mobile terminals with insufficient computing power. Summary of the invention
[0003] The present application provides a face detection method, system, electronic device and storage medium, which use a single convolutional neural network algorithm to simultaneously output face position, face key point position and related attribute information, which helps to reduce computational redundancy and reduce the amount of calculation.
[0004] In a first aspect, the present application provides a face detection method, comprising:
[0005] Acquire the image to be detected;
[0006] Inputting the image to be detected into a backbone network in a pre-trained face detection model for feature extraction to generate multiple feature extraction graphs;
[0007] Inputting the multiple feature extraction graphs into the neck network in the face detection model for feature fusion to generate multiple feature fusion graphs;
[0008] The multiple feature fusion images are input into the head network in the face detection model. In the head network, face frame detection, attribute classification recognition and key point detection are performed simultaneously to obtain face position information, face attribute information and face key point information in the image to be detected.
[0009] In one possible implementation, the performing of attribute classification and recognition to obtain the face attribute information in the image to be detected includes:
[0010] Obtaining first feature information based on the multiple feature fusion images, where the first feature information is used to represent information about attributes of a human face;
[0011] Based on the first feature information, facial attribute classification and recognition are performed to obtain facial attribute information in the image to be detected.
[0012] In one possible implementation, the performing of attribute classification and recognition to obtain the face attribute information in the image to be detected includes:
[0013] Obtaining first feature information based on the multiple feature fusion images, where the first feature information is used to represent information about attributes of a human face;
[0014] Obtaining second feature information based on the multiple feature extraction images, where the second feature information is used to represent information related to key points of the face;
[0015] The first feature information and the second feature information are combined to perform facial attribute classification and recognition to obtain facial attribute information in the image to be detected.
[0016] In one possible implementation, obtaining the second feature information based on the multiple feature extraction graphs includes:
[0017] Extract multiple facial key points on each feature extraction map;
[0018] Extracting features in the vicinity of the plurality of facial key points;
[0019] Generate a first feature map based on features extracted from areas near the multiple facial key points;
[0020] The second feature information is generated based on the first feature map.
[0021] In one possible implementation, obtaining the second feature information based on the multiple feature extraction graphs includes:
[0022] Extract multiple facial key points on each feature extraction map;
[0023] Determine a target area, wherein the target area includes the plurality of facial key points;
[0024] Perform feature extraction in the target area to generate a first feature map;
[0025] The second feature information is generated based on the first feature map.
[0026] In one possible implementation manner, the row vector of the first feature map has the same size as the row vector of the first feature information.
[0027] In one possible implementation manner, the multiple feature extraction images are feature extraction images of different scales.
[0028] In one possible implementation, the facial attribute information includes at least: ethnicity, whether the person is wearing glasses, and whether the face is smiling;
[0029] The facial key point information includes multiple facial key point positions, and the multiple facial key point positions include at least: both sides of the left eye, both sides of the right eye, the tip of the nose, the left corner of the mouth, and the right corner of the mouth.
[0030] In a second aspect, the present application provides a face detection device, comprising:
[0031] An acquisition module, used for acquiring an image to be detected;
[0032] A feature extraction module is used to input the image to be detected into a backbone network in a pre-trained face detection model to extract features and generate multiple feature extraction graphs;
[0033] A feature fusion module, used for inputting the plurality of feature extraction graphs into the neck network in the face detection model for feature fusion to generate a plurality of feature fusion graphs;
[0034] The face detection module is used to input the multiple feature fusion images into the head network in the face detection model, and in the head network, face frame detection, attribute classification recognition and key point detection are performed simultaneously to obtain face position information, face attribute information and face key point information in the image to be detected.
[0035] In a third aspect, the present application provides an electronic device, comprising: a processor and a memory, the memory being used to store a computer program; the processor being used to run the computer program to implement the face detection method as described in the first aspect.
[0036] In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program. When the computer-readable storage medium is run on a computer, the computer implements the face detection method as described in the first aspect.
[0037] Compared with the prior art, this application has at least the following technical effects:
[0038] The present application provides a face detection method, which uses a backbone network to extract features from an image to be detected to obtain multiple feature extraction graphs, uses a neck network to fuse multiple feature extraction graphs to obtain multiple feature fusion graphs, and uses a head network to simultaneously perform face frame detection, attribute classification and recognition, and key point detection on the feature information of multiple feature fusion graphs to obtain face position information, face attribute information, and face key point information in the image to be detected. By sharing the feature information extracted from the backbone network and the neck network, face frame detection, attribute classification and recognition, and key point detection are performed simultaneously in the head network, and a single convolutional neural network algorithm is used to simultaneously output face position, face key point position, and related attribute information, which helps to reduce computational redundancy and reduce the amount of computation. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A schematic diagram of a face detection method according to an embodiment of the present invention;
[0040] Figure 2 Schematic diagram of the global picture of the input;
[0041] Figure 3 A schematic diagram of a network structure for a face detection model;
[0042] Figure 4 Based on Figure 1 Schematic diagram of detection results obtained by the face detection method shown;
[0043] Figure 5 This is another schematic diagram of the network structure of the face detection model;
[0044] Figure 6 A schematic diagram of the structure of the extracted features of the area near the key points of a face;
[0045] Figure 7 It is a schematic diagram of another structure of the features of the area near the key points of the face;
[0046] Figure 8 A flowchart of a method for training a face detection model provided in an embodiment of the present application;
[0047] Fig. 9 A schematic diagram of the structure of a face detection device provided in an embodiment of the present application;
[0048] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] In the embodiments of the present application, unless otherwise specified, the character " / " indicates that the objects before and after the association are in an or relationship. For example, A / B can represent A or B. "And / or" describes the association relationship of the associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone.
[0050] It should be pointed out that the words "first", "second", etc. involved in the embodiments of the present application are only used to distinguish the description purpose, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated, nor can they be understood as indicating or implying order.
[0051] In the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. In addition, "at least one of the following" or similar expressions refers to any combination of these items, which may include any combination of single items or plural items. For example, at least one of A, B, or C may represent: A, B, C, A and B, A and C, B and C, or A, B and C. Among them, each of A, B, and C may be an element itself, or a set containing one or more elements.
[0052] In the embodiments of the present application, "exemplary", "in some embodiments", "in another embodiment", etc. are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present concepts in a concrete way.
[0053] In the embodiments of the present application, "of", "corresponding", and "corresponding" can sometimes be used interchangeably. It should be noted that when the distinction between them is not emphasized, the meanings to be expressed are consistent. In the embodiments of the present application, communication and transmission can sometimes be used interchangeably. It should be noted that when the distinction between them is not emphasized, the meanings to be expressed are consistent. For example, transmission can include sending and / or receiving, which can be a noun or a verb.
[0054] The equal to involved in the embodiments of the present application can be used in conjunction with greater than, and is applicable to the technical solution adopted when greater than, and can also be used in conjunction with less than, and is applicable to the technical solution adopted when less than. It should be noted that when equal to is used in conjunction with greater than, it cannot be used in conjunction with less than; when equal to is used in conjunction with less than, it cannot be used in conjunction with greater than.
[0055] Face detection, face key point detection, and face attribute detection are the basic modules of mobile face algorithms. They directly affect the actual effects of basic camera functions such as beauty, Face 3A, and Face ID, and have a great impact on the user experience of mobile products. Therefore, the effects, performance, and power consumption of these tasks are the focus of attention.
[0056] There are three main technical solutions currently available:
[0057] (1) Face detection tasks, face key point detection tasks, and face attribute detection tasks are independent of each other
[0058] The three tasks of this solution are independent of each other. Based on the face detection task, the input is the global image taken by the camera, and the output is the location of the face in the image. The input of face key point detection is the detected face image. Generally, the face area is cropped from the global image based on the face detection result, and the location of the face key points on the face is output. The face attribute detection task is a multi-classification task. The input is also a face image, and the output is which attribute the face belongs to.
[0059] The main disadvantage of this solution is that the computational overhead is large, and three different algorithms are required for the three tasks. The current mainstream algorithms for such tasks are all based on convolutional neural networks (CNN). The network feature extraction part of such algorithms has certain similarities, but the three algorithms in this solution are independent of each other, and the network feature extraction has a large computational redundancy, which wastes computing resources. In addition, key point detection and attribute detection rely on the output of face detection as input, so the tasks must be arranged in series, which takes a long time. At the same time, key point detection and attribute detection both use a single face area image as input. If there are multiple faces in the global image, multiple calculations are required, which brings greater computational overhead.
[0060] (2) The face detection task and the face key point detection task use the same algorithm, and the face attribute detection task is independent
[0061] This solution combines the face detection task with the key point detection task. The CNN network directly outputs the face frame position and the coordinates of the face key points. Compared with solution (1), it can reduce the computational overhead. The attribute detection task is implemented in the same way as solution (1). A separate algorithm takes the face area image as input and outputs the face attribute category.
[0062] The main disadvantage of this scheme is that the two-stage scheme still has computational redundancy and cannot be calculated in parallel, and the computational overhead of the attribute detection task is affected by the number of faces.
[0063] (3) The face detection task is independent, and the face key point detection task and the face attribute detection task use the same algorithm
[0064] In this solution, the face detection task is independent, and the face key point detection and attribute detection are directly output as the same task. The disadvantage is still that the computational overhead is large and is affected by the number of faces.
[0065] Therefore, the related technology uses a two-stage or three-stage method to achieve face detection, face key point detection and face attribute detection, which has a large computational redundancy in the network feature extraction part, and the face key point detection task or face attribute detection task depends on the result of face detection. Therefore, the tasks must be arranged serially, which takes a long time.
[0066] Based on the above problems, an embodiment of the present application proposes a face detection method, which uses a single convolutional neural network algorithm to simultaneously output the face position, the face key point position and related attribute information, which helps to reduce computational redundancy and reduce the amount of calculation.
[0067] Now combined Figure 1-Figure 7 The face detection method provided in the embodiment of the present application is described.
[0068] Figure 1 The flowchart of the face detection method provided in the embodiment of the present application specifically includes the following steps:
[0069] Step S11, obtaining an image to be detected.
[0070] In some specific scenarios, the image to be detected may be a global image taken by a camera, including images of people and other objects. Figure 2 As shown, Figure 2 is a schematic diagram of the global picture of the input, Figure 2 A landscape image captured for the camera, including three people, mountains and white clouds.
[0071] Step S12: input the image to be detected into a backbone network in a pre-trained face detection model for feature extraction to generate a plurality of feature extraction graphs.
[0072] like Figure 3 As shown, Figure 3 A schematic diagram of a network structure of a face detection model. In this embodiment, the network structure of the pre-trained face detection model includes a backbone network (Backbone), a neck network (Neck) and a head network (Head). The image to be detected is input into the backbone network for feature extraction, and multiple feature extraction graphs are generated. For example, low-level features (such as edges, textures, etc.) and high-level features (such as object shape, structure, etc.) in the image to be detected are extracted, and the image is converted into a feature representation with rich semantic information. Optionally, multiple feature extraction graphs are feature extraction graphs of different scales.
[0073] Optionally, the backbone network can be ResNet (residual network), VGGNet (Visual Geometry Group network), MobileNet (lightweight network), EfficientNet, etc., and technicians in this field can choose according to task requirements.
[0074] Step S13: input the multiple feature extraction images into the neck network in the face detection model for feature fusion to generate multiple feature fusion images.
[0075] Specifically, feature fusion is further performed on the basis of the features extracted by the backbone network to obtain features with richer semantics. In this step, in the neck network, feature fusion is performed on multiple feature extraction graphs generated by the backbone network to generate multiple feature fusion graphs. The structure of the neck network usually includes convolutional layers, pooling layers, attention mechanisms, etc.
[0076] Optionally, the neck network can be FPN (Feature Pyramid Network), ASPP (Atrous Spatial Pyramid Pooling), SAM (Spatial Attention Module), etc., and technicians in this field can choose according to task requirements.
[0077] Step S14, inputting the multiple feature fusion images into the head network in the face detection model, in which face frame detection, attribute classification recognition and key point detection are performed simultaneously to obtain face position information, face attribute information and face key point information in the image to be detected.
[0078] like Figure 3 As shown, the head network of the present application includes a face frame detection module, an attribute classification module and a key point detection module. The feature information obtained according to the multiple feature fusion images generated in step S13 is respectively input into the face frame detection module, the attribute classification module and the key point detection module, and face frame detection, attribute classification recognition and key point detection are performed simultaneously to obtain the face position information, face attribute information and face key point information in the image to be detected. Considering the conflict between the classification task and the regression task of the head network, the detection head decoupling method is used so that different tasks have different branches in the head network.
[0079] In some optional embodiments, first feature information is obtained based on multiple feature fusion images, wherein the first feature information is used to characterize information about facial attributes; in an attribute classification module, facial attribute classification and recognition is performed based on the first feature information to obtain facial attribute information in the image to be detected.
[0080] Optionally, the facial attribute information includes: racial attributes, whether wearing glasses, whether smiling, whether wearing a mask, age, gender, etc.; the facial key point information includes multiple facial key point positions, and the multiple facial key point positions include: both sides of the left eye, both sides of the right eye, tip of the nose, left corner of the mouth and right corner of the mouth, left and right sides of the eyebrows, facial contour, etc., which are used to characterize the positions of the facial features.
[0081] like Figure 4 As shown, Figure 4 Based on Figure 1 The schematic diagram of the detection results obtained by the face detection method shown is a schematic diagram of the detection results obtained by the face detection method shown in the embodiment of the present application, which detects all face positions, face attributes and face key points in the global image. Figure 4 The face attribute information displayed in the detection result is attribute probability, for example, the probability that the person on the left belongs to the yellow race is 0.85, the probability of wearing glasses is 0.95, and the probability of smiling face is 0.45. The face attribute information can also be directly output according to the attribute probability, for example, the attributes of the person on the left are directly output as yellow race, wearing glasses, and smiling face.
[0082] This application uses the backbone network to extract features from the image to be detected to obtain multiple feature extraction graphs, uses the neck network to fuse multiple feature extraction graphs to obtain multiple feature fusion graphs, and uses the head network to simultaneously perform face frame detection, attribute classification and recognition, and key point detection on the feature information of multiple feature fusion graphs to obtain the face position information, face attribute information, and face key point information in the image to be detected. By sharing the feature information extracted from the backbone network and the neck network, face frame detection, attribute classification and recognition, and key point detection are performed simultaneously in the head network, and a single convolutional neural network algorithm is used to simultaneously output the face position, face key point position, and related attribute information, which helps to reduce computational redundancy and reduce the amount of computation.
[0083] Furthermore, based on the above embodiments, considering that there may be a high degree of similarity between facial information of different attributes, the prior information contained in the key points of the face can be used as an important basis for judging the attributes of the face. For example, the attribute of whether the face wears glasses can be judged based on the image features of the eye area, and whether the face wears a mask can be judged based on the features of the mouth and nose area. Therefore, in the present application, the attribute classification of the face can also be determined based on the feature information related to the key points of the face and the feature information of the facial attributes.
[0084] In some optional embodiments, such as Figure 5 As shown, Figure 5Another network structure diagram of a face detection model. Based on the multiple feature extraction graphs generated in the above step S12, the second feature information is obtained, and the second feature information is used to characterize the information related to the key points of the face; the second feature information is combined with the first feature information obtained in the above embodiment, and the face attribute classification and recognition is performed in the attribute classification module to obtain the face attribute information in the image to be detected. The present application jointly determines the attribute classification of the face based on the feature information related to the key points of the face and the feature information of the face attributes, so as to further improve the accuracy of the attribute classification and recognition.
[0085] Optionally, multiple facial key points are extracted from each feature extraction graph generated in step S12. Figure 2 Take the person on the left in the picture as an example. Figure 6 As shown, Figure 6 Schematic diagram of the structure of the extracted features of the area near the key points of the face. In each feature extraction graph, 7 key points of the face are extracted, and the area near each key point of the face ( Figure 6 The first feature map (shown in the figure as a rectangular area including key points) is generated based on the features extracted from the areas near the 7 facial key points. Figure 6 (not shown), that is, each feature extraction map generates a first feature map; and the second feature information is generated based on the first feature map.
[0086] Optionally, in practical applications, multiple key points can be taken as a whole to determine the target area according to the actual needs of the attribute classification task. For example, in order to detect whether a face is wearing glasses, auxiliary judgment can be made based on the image features of the face's eye area, so the four key points on both sides of the left eye and the right eye can be taken as a whole. Figure 7 As shown, Figure 7 FIG. 1 is a schematic diagram of another structure of extracting features of the area near the key points of the face. Four key points of the face on both sides of the left eye and the right eye are extracted from each feature extraction map. The four key points are taken as a whole to determine the target area S. The target area S includes the four key points. Feature extraction is performed in the target area to generate the first feature map ( Figure 6 (not shown), that is, each feature extraction map generates a first feature map; and the second feature information is generated based on the first feature map.
[0087] In order to meet the input requirements of the attribute classification module, the row vector of the first feature map has the same size as the row vector of the first feature information input to the attribute classification module. Specifically, the row vector in the first feature map can be convolved to align the size of the row vector input to the attribute classification module.
[0088] The face model training method corresponding to the face detection method provided in the embodiment of the present application is as follows Figure 8As shown, Figure 8 The flowchart of the training method of the face detection model provided in the embodiment of the present application specifically includes the following steps:
[0089] Step S81, obtaining the image to be trained and label data.
[0090] Specifically, obtain the image to be trained and the label data in the corresponding image, the label data including the face position label, the face attribute label and the face key point label. Among them, the face attribute is set as the corresponding label according to the category of the face attribute. In the present application, faces with different attributes are used as different targets in multi-target detection, for example, different races, whether wearing glasses, and whether smiling faces are used as different targets. Considering that some faces may belong to multiple targets at the same time, for example, a face wearing glasses may also be a smiling face, so the face attribute label in the present application is a multi-classification label.
[0091] Step S82: input the image to be trained into the backbone network for feature extraction to generate multiple feature extraction graphs.
[0092] Specifically, the network structure of the face detection model of the present application includes a backbone network (Backbone), a neck network (Neck) and a head network (Head). The image to be trained is input into the backbone network for feature extraction to generate multiple feature extraction graphs.
[0093] Step S83: input the multiple feature extraction images into the neck network for feature fusion to generate multiple feature fusion images.
[0094] Specifically, feature fusion is further performed on the basis of the features extracted by the backbone network to obtain features with richer semantics. In this step, in the neck network, feature fusion is performed on multiple feature extraction graphs generated by the backbone network to generate multiple feature fusion graphs.
[0095] Step S84, inputting the multiple feature fusion images into the head network, in which face frame detection, attribute classification recognition and key point detection are performed simultaneously to obtain face position information, face attribute information and face key point information in the image to be trained.
[0096] Specifically, the head network of the present application includes a face frame detection module, an attribute classification module and a key point detection module, and the feature information obtained according to the multiple feature fusion images generated in step S83 is respectively input into the face frame detection module, the attribute classification module and the key point detection module, and face frame detection, attribute classification recognition and key point detection are performed simultaneously to obtain the face position information, face attribute information and face key point information in the image to be detected. Considering the conflict between the classification task and the regression task of the head network, the detection head decoupling method is used so that different tasks have different branches in the head network.
[0097] Among them, facial attribute information includes: ethnic attributes, whether wearing glasses, whether smiling, whether wearing a mask, gender, age, etc.; facial key point information includes multiple facial key point positions, and multiple facial key point positions include: both sides of the left eye, both sides of the right eye, tip of the nose, left corner of the mouth and right corner of the mouth, left and right sides of the eyebrows, facial contour, etc., which are used to represent the positions of facial features.
[0098] The present application uses feature information extracted from a shared backbone network and a neck network to simultaneously perform face frame detection, attribute classification and recognition, and key point detection in the head network, thereby achieving the use of a single convolutional neural network algorithm to simultaneously output face position, face key point position, and related attribute information, thereby helping to reduce computational redundancy and lower the amount of computation.
[0099] Step S85, using the loss function to calculate the target box loss, classification loss and key point loss.
[0100] Specifically, the target box loss is calculated using the intersection over union (IOU) loss function; the classification loss is calculated using the binary cross entropy (BCE) loss function; and the key point loss is calculated using the wing (WING) loss function. Since the face attribute labels of this application are multi-classification labels, the softmax function is not used, but the binary cross entropy (BCE) loss function (using the sigmoid activation function) is used. This application uses the loss function to calculate the degree of difference between the detection results and the label data, and then optimizes the model parameters.
[0101] In some optional embodiments, multiple key points are extracted from each feature extraction map generated in step S82, and features are extracted from the areas near the multiple key point positions, or features are extracted from the areas near the key points according to the positions of the face key point labels to form a new feature map (each feature extraction map forms a new feature map), and the key point related feature information obtained from the new feature map is combined with the attribute feature information obtained from the feature fusion map generated in step S83, and face attribute classification and recognition is performed in the attribute classification module to obtain the face attribute information in the image to be trained. Furthermore, in order to meet the input requirements of the attribute classification module, the row vectors in the new feature map need to be convolved and aligned with the row vector size input by the attribute classification module.
[0102] In practical applications, according to the actual needs of the attribute classification task, multiple key points can be taken as a whole, the features of the nearby areas can be extracted, and the face attribute classification and recognition can be performed in combination with the feature fusion map.
[0103] The present application jointly determines the attribute classification of the face based on the feature information related to the key points of the face and the feature information of the face attributes, thereby further improving the accuracy of attribute classification recognition.
[0104] Fig. 9 A schematic diagram of the structure of a face detection device provided in an embodiment of the present application is shown in FIG. Fig. 9 As shown, the face detection device 90 may include:
[0105] An acquisition module 91 is used to acquire an image to be detected;
[0106] A feature extraction module 92 is used to input the image to be detected into a backbone network in a pre-trained face detection model to extract features and generate multiple feature extraction graphs;
[0107] A feature fusion module 93, used for inputting the plurality of feature extraction graphs into the neck network in the face detection model for feature fusion to generate a plurality of feature fusion graphs;
[0108] The face detection module 94 is used to input the multiple feature fusion images into the head network in the face detection model, and in the head network, face frame detection, attribute classification recognition and key point detection are performed simultaneously to obtain face position information, face attribute information and face key point information in the image to be detected.
[0109] In one possible implementation, the face detection module 94 may also be used to obtain first feature information based on the multiple feature fusion images, where the first feature information is used to represent information about face attributes;
[0110] Based on the first feature information, facial attribute classification and recognition are performed to obtain facial attribute information in the image to be detected.
[0111] In one possible implementation, the face detection module 94 may also be used to obtain first feature information based on the multiple feature fusion images, where the first feature information is used to represent information about face attributes;
[0112] Obtaining second feature information based on the multiple feature extraction images, where the second feature information is used to represent information related to key points of the face;
[0113] The first feature information and the second feature information are combined to perform facial attribute classification and recognition to obtain facial attribute information in the image to be detected.
[0114] In one possible implementation, obtaining the second feature information based on the multiple feature extraction graphs includes:
[0115] Extract multiple facial key points on each feature extraction map;
[0116] Extracting features in the vicinity of the plurality of facial key points;
[0117] Generate a first feature map based on features extracted from areas near the multiple facial key points;
[0118] The second feature information is generated based on the first feature map.
[0119] In one possible implementation, obtaining the second feature information based on the multiple feature extraction graphs includes:
[0120] Extract multiple facial key points on each feature extraction map;
[0121] Determine a target area, wherein the target area includes the plurality of facial key points;
[0122] Perform feature extraction in the target area to generate a first feature map;
[0123] The second feature information is generated based on the first feature map.
[0124] In one possible implementation manner, the row vector of the first feature map has the same size as the row vector of the first feature information.
[0125] In one possible implementation manner, the multiple feature extraction images are feature extraction images of different scales.
[0126] In one possible implementation, the facial attribute information includes at least: ethnicity, whether the person is wearing glasses, and whether the face is smiling;
[0127] The facial key point information includes multiple facial key point positions, and the multiple facial key point positions include at least: both sides of the left eye, both sides of the right eye, the tip of the nose, the left corner of the mouth, and the right corner of the mouth.
[0128] Fig. 9 The face detection device 90 provided in the illustrated embodiment can be used to execute the technical solution of the method embodiment shown in the present application. Its implementation principle and technical effects can be further referred to the relevant description in the method embodiment.
[0129] It should be understood that the above Fig. 9 The division of the modules of the face detection device 90 shown is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in the form of hardware. For example, the acquisition module can be a separately established processing element, or it can be integrated in a chip of an electronic device. The implementation of other modules is similar. In addition, all or part of these modules can be integrated together, or they can be implemented independently. In the implementation process, each step of the above method or each of the above modules can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
[0130] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more microprocessors (DSP), or one or more field programmable gate arrays (FPGA). For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0131] In the above embodiments, the processor involved may include, for example, a CPU, a DSP, a microcontroller or a digital signal processor, and may also include a GPU, an embedded neural network processor (Neural-network Process Units; hereinafter referred to as: NPU) and an image signal processor (Image Signal Processing; hereinafter referred to as: ISP). The processor may also include necessary hardware accelerators or logic processing hardware circuits, such as ASIC, or one or more integrated circuits for controlling the execution of the program of the technical solution of the present application. In addition, the processor may have the function of operating one or more software programs, and the software programs may be stored in a storage medium.
[0132] An embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the method provided by the embodiment shown in the present application.
[0133] An embodiment of the present application also provides a computer program product, which includes a computer program. When the computer program is run on a computer, it enables the computer to execute the method provided by the embodiment shown in the present application.
[0134] Combine the following Fig.10 The exemplary electronic device provided in the embodiments of the present application is further introduced. Fig.10 A schematic structural diagram of an electronic device 1000 is shown.
[0135] The electronic device 1000 may include: at least one processor; and at least one memory communicatively connected to the processor, wherein: the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the face detection method provided in the embodiment shown in the present application.
[0136] Fig.10 A block diagram of an exemplary electronic device 1000 suitable for implementing the embodiments of the present application is shown. Fig.10 The electronic device 1000 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0137] like Fig.10 As shown, the electronic device 1000 is in the form of a general computing device. The components of the electronic device 1000 may include, but are not limited to: one or more processors 1010, a memory 1020, a communication bus 1040 connecting different system components (including the memory 1020 and the processor 1010), and a communication interface 1030.
[0138] The communication bus 1040 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnection (PCI) bus.
[0139] The electronic device 1000 typically includes a variety of computer system readable media, which can be any available media that can be accessed by the electronic device, including volatile and nonvolatile media, removable and non-removable media.
[0140] The memory 1020 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory. The electronic device may further include other removable / non-removable, volatile / non-volatile computer system storage media. Fig.10 Not shown, a disk drive for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a compact disc read only memory (CD-ROM), a digital versatile disc read only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to the communication bus 1040 via one or more data medium interfaces. The memory 1020 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present application.
[0141] A program / utility having a set (at least one) of program modules may be stored in memory 1020, such program modules including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules generally perform the functions and / or methods of the embodiments described herein.
[0142] The electronic device 1000 may also communicate with one or more external devices (e.g., keyboard, pointing device, display, etc.), one or more devices that enable a user to interact with the electronic device, and / or any device that enables the electronic device to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed via the communication interface 1030. Furthermore, the electronic device 1000 may also communicate with the network adapter ( Fig.10 The network adapter can communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through the communication bus 1040. It should be understood that although Fig.10 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk arrays (Redundant Arrays of Independent Drives; hereinafter referred to as: RAID) systems, tape drives, and data backup storage systems.
[0143] The processor 1010 executes various functional applications and data processing by running the programs stored in the memory 1020, such as implementing the method provided in the embodiment of the present application.
[0144] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 1000. In other embodiments of the present application, the electronic device 1000 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0145] In the above embodiments, the processor involved may include, for example, a CPU, a DSP, a microcontroller or a digital signal processor, and may also include a GPU, an embedded neural network processor (Neural-network Process Units; hereinafter referred to as: NPU) and an image signal processor (Image Signal Processing; hereinafter referred to as: ISP). The processor may also include necessary hardware accelerators or logic processing hardware circuits, such as ASIC, or one or more integrated circuits for controlling the execution of the program of the technical solution of the present application. In addition, the processor may have the function of operating one or more software programs, and the software programs may be stored in a storage medium.
[0146] Those of ordinary skill in the art will appreciate that the various units and algorithm steps described in the embodiments disclosed herein can be implemented in a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0147] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0148] In several embodiments provided in the present application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory; hereinafter referred to as: ROM), random access memory (Random Access Memory; hereinafter referred to as: RAM), disk or optical disk, and other media that can store program codes.
[0149] The above is only a specific implementation of the present application. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. The protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A face detection method, It is characterized in that The method comprises: Acquire the image to be detected; Inputting the image to be detected into a backbone network in a pre-trained face detection model for feature extraction to generate multiple feature extraction graphs; Inputting the multiple feature extraction graphs into the neck network in the face detection model for feature fusion to generate multiple feature fusion graphs; The multiple feature fusion images are input into the head network in the face detection model. In the head network, face frame detection, attribute classification recognition and key point detection are performed simultaneously to obtain face position information, face attribute information and face key point information in the image to be detected.
2. The method according to claim 1, It is characterized in that The method of performing attribute classification and recognition to obtain face attribute information in the image to be detected includes: Obtaining first feature information based on the multiple feature fusion images, where the first feature information is used to represent information about attributes of a human face; Based on the first feature information, facial attribute classification and recognition are performed to obtain facial attribute information in the image to be detected.
3. The method according to claim 1, It is characterized in that The method of performing attribute classification and recognition to obtain face attribute information in the image to be detected includes: Obtaining first feature information based on the multiple feature fusion images, where the first feature information is used to represent information about attributes of a human face; Obtaining second feature information based on the multiple feature extraction images, where the second feature information is used to represent information related to key points of the face; The first feature information and the second feature information are combined to perform facial attribute classification and recognition to obtain facial attribute information in the image to be detected.
4. The method according to claim 3, It is characterized in that The second feature information is obtained based on the plurality of feature extraction graphs, include, Extract multiple facial key points on each feature extraction map; Extracting features in the vicinity of the plurality of facial key points; Generate a first feature map based on features extracted from areas near the multiple facial key points; The second feature information is generated based on the first feature map.
5. The method according to claim 3, It is characterized in that The second feature information is obtained based on the plurality of feature extraction graphs, include, Extract multiple facial key points on each feature extraction map; Determine a target area, wherein the target area includes the plurality of facial key points; Perform feature extraction in the target area to generate a first feature map; The second feature information is generated based on the first feature map.
6. The method according to claim 4 or 5, It is characterized in that The row vector of the first feature map has the same size as the row vector of the first feature information.
7. The method according to any one of claims 1 to 6, It is characterized in that The multiple feature extraction images are feature extraction images of different scales.
8. The method according to any one of claims 1 to 7, It is characterized in that The facial attribute information includes at least: ethnicity, whether the person is wearing glasses, and whether the face is smiling; The facial key point information includes multiple facial key point positions, and the multiple facial key point positions include at least: both sides of the left eye, both sides of the right eye, the tip of the nose, the left corner of the mouth, and the right corner of the mouth.
9. A face detection device, It is characterized in that include: An acquisition module, used for acquiring an image to be detected; A feature extraction module is used to input the image to be detected into a backbone network in a pre-trained face detection model to extract features and generate multiple feature extraction graphs; A feature fusion module, used for inputting the plurality of feature extraction graphs into the neck network in the face detection model for feature fusion to generate a plurality of feature fusion graphs; The face detection module is used to input the multiple feature fusion images into the head network in the face detection model, and in the head network, face frame detection, attribute classification recognition and key point detection are performed simultaneously to obtain face position information, face attribute information and face key point information in the image to be detected.
10. An electronic device, It is characterized in that include: A processor and a memory, wherein the memory is used to store a computer program; and the processor is used to run the computer program to implement the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed on a computer, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Face detection method, apparatus and electronic device
CN108229269A
Deep-learning-based face-pedestrian and attribute recognition network structure design method
CN109101915A
Multi-task network model, using method and device and storage medium
CN111325108A
Target detection method and device, electronic equipment and storage medium
CN112528977A
Face aesthetics evaluation and enhancement method based on structural reasoning
CN112699816A
Cited By
Modularized face attribute structure analysis method and device, equipment and medium
CN119580318A
