A face detection method, apparatus, device, medium and product
By using feature extraction and local feature enhancement in a multi-task face detection model, the problem of uneven detection accuracy caused by mask and glasses occlusion in face recognition systems is solved, achieving high-accuracy multi-task detection.
Patent Information
- Application Number
- CN202210471348.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-28
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2042-04-28
AI Technical Summary
In existing technologies, facial recognition systems struggle to maintain a balance in accuracy between face detection and mask/glasses detection when faced with complex situations such as mask or glasses obstruction.
A multi-task face detection model is adopted. Through the first feature extraction module, the local feature attention module, and the local feature prediction module, the model extracts features from face images and enhances local features, thereby independently completing face detection and local feature detection. An attention mechanism is added to improve the detection accuracy.
It achieves high accuracy in face detection, mask detection, and glasses detection, with each task operating independently without increasing the computational load of the model.
Smart Images

Figure CN114913578B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of face recognition, and in particular to a face detection method, device, equipment, medium and product. BACKGROUND
[0002] Face recognition technology is a new biometric technology, and is a high-precision technology in the current international scientific and technological field. It is also a key link in an automatic face recognition system. Although face recognition technology is currently very mature, in actual application scenarios, due to the quite complex details of a face, such as the influence of partial accessories such as mask occlusion and glasses occlusion, changes in these external factors make face detection a complex and challenging pattern detection problem in a face recognition system.
[0003] In the prior art, a model for mask detection or glasses detection based on face recognition has appeared, but it only focuses on the accuracy of the single task of mask detection or glasses detection, and it is difficult to maintain the balance in accuracy between the face detection task and the mask detection task and the glasses detection task. SUMMARY
[0004] The present application provides a face detection method, device, equipment, medium and product to solve the above problems.
[0005] The present application provides a face detection method, comprising:
[0006] obtaining a face picture to be detected;
[0007] inputting the face picture to be detected into a pre-trained face detection model, the pre-trained face detection model performing first local part detection on the face picture to be detected to obtain a first local part detection result;
[0008] The pre-trained face detection model comprises a first feature extraction module, a first local part feature attention module and a first local part feature prediction module.
[0009] The first feature extraction module extracts features from the face picture to be detected to obtain a first reduced-dimension face feature map, the first local part feature attention module strengthens first local part features in the first reduced-dimension face feature map to obtain first strengthened local part features, and the first local part feature prediction module predicts the first local part detection result based on the first strengthened local part features.
[0010] According to the face detection method provided by the application, the face detection module also performs second local part detection on the face picture to be detected to obtain a second local part detection result, wherein the face detection module further comprises a second feature extraction module, a second local part feature attention module and a second local part feature prediction module;
[0011] The second feature extraction module extracts features from the first reduced face feature map to obtain a second reduced face feature map, the second local part feature attention module strengthens the second local part feature in the second reduced face feature map to obtain a second strengthened local part feature, and the second local part feature prediction module predicts the second local part detection result based on the second strengthened local part feature.
[0012] According to the face detection method provided by the application, the second local part detection is mask detection;
[0013] Correspondingly, the second local part feature attention module is a mask attention module, and the second local part feature prediction module is a mask prediction module;
[0014] The second local part feature attention module strengthens the second local part feature in the second reduced face feature map to obtain a second strengthened local part feature, and the second local part feature prediction module predicts the second local part detection result based on the second strengthened local part feature, including:
[0015] The mask attention module strengthens the mask part feature in the second reduced face feature map to obtain a strengthened mask part feature, and the mask prediction module predicts the mask detection result based on the strengthened mask part feature.
[0016] According to the face detection method provided by the application, the first local part detection is glasses detection;
[0017] Correspondingly, the first local part feature attention module is a glasses attention module, and the first local part feature prediction module is a glasses prediction module;
[0018] The first local part feature attention module strengthens the first local part feature in the first reduced face feature map to obtain a first strengthened local part feature, and the first local part feature prediction module predicts the first local part detection result based on the first strengthened local part feature, including:
[0019] The glasses attention module strengthens the glasses part feature in the first reduced dimension face feature map to obtain a strengthened glasses part feature, and the glasses prediction module predicts the glasses detection result based on the strengthened glasses part feature.
[0020] According to the face detection method provided by the application, the size of the face picture to be detected is 32 times the size of the second reduced dimension face feature map.
[0021] The size of the face picture to be detected is 8 times the size of the first reduced dimension face feature map.
[0022] According to the face detection method provided by the application, the pre-trained face detection model also performs face detection and face key point detection on the face picture to be detected to obtain a face frame prediction frame and face key points.
[0023] The face frame prediction module predicts a face frame prediction frame based on the second reduced dimension face feature map.
[0024] The face key point acquisition module acquires face key points from the second reduced dimension face feature map.
[0025] The application further provides a face detection device, comprising:
[0026] A picture acquisition module is configured to acquire a face picture to be detected.
[0027] A first local part detection module is configured to input the face picture to be detected into a pre-trained face detection model, and the pre-trained face detection model performs first local part detection on the face picture to be detected to obtain a first local part detection result.
[0028] The pre-trained face detection model comprises a first feature extraction module, a first local part feature attention module and a first local part feature prediction module.
[0029] The first feature extraction module extracts features from the face picture to be detected to obtain a first reduced dimension face feature map, the first local part feature attention module strengthens first local part features in the first reduced dimension face feature map to obtain first strengthened local part features, and the first local part feature prediction module predicts the first local part detection result based on the first strengthened local part features.
[0030] The application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the face detection method according to any one of the preceding embodiments when executing the program.
[0031] The application further provides a non-transitory computer-readable storage medium, which stores a computer program, and the computer program is executable on a processor to implement the face detection method according to any one of the preceding embodiments.
[0032] The application further provides a computer program product, which comprises a computer program, and the computer program is executable on a processor to implement the face detection method according to any one of the preceding embodiments.
[0033] The face detection method, device, equipment, medium and product provided by the application, the first feature extraction module is used for extracting features of the face picture to be detected to obtain a first face feature map after dimension reduction, the first local part feature attention module is used for strengthening the first local part feature in the first face feature map after dimension reduction to obtain a first strengthened local part feature, and the first local part feature prediction module is used for predicting the first local part detection result based on the first strengthened local part feature, so that the local part detection task and the face detection task are independent and do not interfere with each other, the accuracy of the main task of face detection is ensured, and the first local part detection also has high accuracy due to the attention mechanism of the local part detection, so that each task in the multi-task face detection has high accuracy. BRIEF DESCRIPTION OF DRAWINGS
[0034] In order to more clearly illustrate the technical solutions of the present application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0035] Figure 1 is a flowchart of the face detection method provided by the embodiment of the present application;
[0036] Figure 2 is a structural diagram of the face detection model provided by the embodiment of the present application;
[0037] Figure 3 is a structural diagram of the face detection device provided by the embodiment of the present application;
[0038] Figure 4 is a structural diagram of the electronic device provided by the embodiment of the present application. DETAILED DESCRIPTION
[0039] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below in combination with the drawings in the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the protection scope of the present application.
[0040] Figure 1 is a flowchart of a face detection method provided by an embodiment of the present application. As shown in Figure 1 , a face detection method comprises the following steps:
[0041] S101, obtaining a face picture to be detected.
[0042] In this step, the face picture to be detected can be obtained by collecting the face of a user on site, can be a picture obtained from the Internet and requiring face detection, or can be obtained from a face picture database to be verified. In addition, the scene corresponding to the face picture to be detected is various scenes requiring face recognition, such as automatic driving, mobile phone unlocking, mobile payment, attendance clocking, etc.
[0043] S102, inputting the face picture to be detected into a pre-trained face detection model, performing first local part detection on the face picture to be detected by the pre-trained face detection model, and obtaining a first local part detection result.
[0044] The pre-trained face detection model comprises a first feature extraction module, a first local part feature attention module and a first local part feature prediction module.
[0045] The first feature extraction module extracts features from the face picture to be detected to obtain a first reduced dimension face feature map, the first local part feature attention module strengthens the first local part feature in the first reduced dimension face feature map to obtain a first strengthened local part feature, and the first local part feature prediction module predicts the first local part detection result based on the first strengthened local part feature.
[0046] In this step, the pre-trained face detection model is a multi-task face detection model, which needs to detect not only the face but also the local part of the ornament worn in the face, such as a mask, glasses, etc., so as to obtain a face frame prediction frame corresponding to the face detection task and a face key point, and a local part detection result corresponding to the local part detection task.
[0047] In a case that the local part detection result is that the face to be detected wears a mask or glasses, which is an occlusion to the face key point, the local part detection result is a local part prediction box, and is also a prediction box of the mask or glasses, which is an occlusion to the face key point; in a case that the local part detection result is that there is no mask or glasses, the local part detection result has no display on the face picture to be detected. In other embodiments of the present application, in a case that the local part detection result is that there is no mask or glasses, the local part detection result prompts in a text form that there is no mask or glasses, which is an occlusion to the face key point.
[0048] The pre-trained face detection model specifically includes a first feature extraction module as a backbone network and a first local part feature attention module and a first local part feature prediction module as branch networks.
[0049] The face picture to be detected is continuously subjected to feature extraction through a plurality of convolutional layers in the first feature extraction module, so as to obtain a plurality of scale-reduced face feature maps,
[0050] Based on the detection target of the first local part detection, a scale-fitted scale-reduced face feature map is input into the first local part feature attention module as a first scale-reduced face feature map, the first local part feature in the scale-reduced face feature map is strengthened, and a first strengthened local part feature is obtained.
[0051] Taking the first local part detection as glasses detection as an example, since the proportion of glasses in the whole face is small, the glasses can be detected in a scale-reduced face feature map with a larger scale, so the scale-reduced face feature map with a larger scale is input into a glasses attention module corresponding to the glasses detection, so as to strengthen the feature of the glasses in the scale-reduced face feature map, and then the result of whether the glasses are worn is predicted based on the strengthened glasses feature.
[0052] In addition, it should be noted that the pre-trained face detection model is trained based on face training data and labels corresponding to the face training data.
[0053] The face detection method provided by the embodiment of the present application can support face detection, first local part detection and second local part detection, realize multi-task detection, and ensure the accuracy of each detection task, especially the accuracy of the first local part detection and the second local part detection.
[0054] Further, the face detection module also performs second local part detection on the face picture to be detected to obtain a second local part detection result, wherein the face detection module further comprises a second feature extraction module, a second local part feature attention module and a second local part feature prediction module; the second feature extraction module performs feature extraction on the first reduced face feature map to obtain a second reduced face feature map, the second local part feature attention module strengthens a second local part feature in the second reduced face feature map to obtain a second strengthened local part feature, and the second local part feature prediction module predicts the second local part detection result based on the second strengthened local part feature.
[0055] In the embodiment, in addition to the main task face detection, the first local part detection task and the second local part detection task are also included, the process of the second local part detection is similar to the process of the first local part detection, but the corresponding face regions are different, for example, the regions of glasses and masks.
[0056] The face detection method provided by the embodiment of the present application can support face detection, first local part detection and second local part detection, realize multi-task detection, and ensure the accuracy of each detection task, especially the accuracy of the first local part detection and the second local part detection.
[0057] Further, the second local part detection is mask detection; correspondingly, the second local part feature attention module is a mask attention module, and the second local part feature prediction module is a mask prediction module.
[0058] The second local part feature attention module strengthens the second local part feature in the second reduced dimension face feature map to obtain a second strengthened local part feature, and the second local part feature prediction module predicts the second local part detection result based on the second strengthened local part feature.
[0059] Figure 2 is a structural schematic diagram of a face detection model provided by an embodiment of the present application.
[0060] As shown in Figure 2 The feature extraction module includes a first feature extraction module and a second feature extraction module, and both the first feature extraction module and the second feature extraction module include multiple convolution layers.
[0061] Specifically, the second feature extraction module completes the face detection task as a backbone network, and the mask attention module and the mask prediction module constitute a branch network to complete the mask detection task.
[0062] The multiple convolution layers in the second feature extraction module convolve the face picture to be detected, and each convolution layer outputs a reduced dimension face feature map with different scales. The mask attention module is connected to the corresponding convolution layer according to the scale of the face feature map output by the convolution layer. The mask attention module strengthens the mask part feature of the second reduced dimension face feature map output by the convolution layer to obtain a strengthened mask part feature, and the mask prediction module predicts the detection result of whether there is a mask in the face picture to be detected based on the strengthened mask part feature.
[0063] It should be noted that the face training data includes face training pictures with masks and face training pictures without masks. The number of convolution layers included in the first feature extraction module and the second feature extraction module is different.
[0064] The face detection method provided by the embodiment of the present application can ensure that the face detection task corresponding to the backbone network and the mask detection task corresponding to the branch network do not interfere with each other, and can strengthen the mask feature through the mask attention module to improve the detection accuracy of the mask detection, so as to ensure that each task has high accuracy without increasing the calculation amount of the model.
[0065] Further, the first local part detection is a glasses detection; accordingly, the first local part feature attention module is a glasses attention module, and the first local part feature prediction module is a glasses prediction module.
[0066] The first local part feature attention module strengthens the first local part feature in the first reduced dimension face feature map to obtain a first strengthened local part feature, and the first local part feature prediction module predicts the first local part detection result based on the first strengthened local part feature, including that the glasses attention module strengthens the glasses part feature in the first reduced dimension face feature map to obtain a strengthened glasses part feature, and the glasses prediction module predicts the glasses detection result based on the strengthened glasses part feature.
[0067] In the embodiment, the first local part detection is a glasses detection, and at this time, the glasses attention module and the glasses prediction module constitute a branch network to complete the glasses detection task.
[0068] Specifically, the plurality of convolution layers in the first feature extraction module convolve the face picture to be detected, and each convolution layer outputs a reduced dimension face feature map with different scales. The glasses attention module is connected to the corresponding convolution layer according to the scale size (i.e., the proportion size of the glasses in the face) of the face feature map output by the convolution layer. The glasses attention module strengthens the feature of the glasses part of the reduced dimension face feature map output by the convolution layer to obtain a strengthened glasses part feature, and the glasses prediction module predicts the detection result of whether there are glasses in the face picture to be detected based on the strengthened glasses part feature.
[0069] It should be noted that the face training data includes a face training picture with glasses and a face training picture without glasses.
[0070] The face detection method provided by the embodiment of the application can ensure that the face detection task corresponding to the main network and the glasses detection task corresponding to the branch network do not interfere with each other, and the glasses feature can be strengthened by the glasses attention module to improve the detection accuracy of the glasses detection, so that each task has a high accuracy without increasing the calculation amount of the model.
[0071] Further, the size of the face picture to be detected is 32 times the size of the second reduced dimension face feature map, and the size of the face picture to be detected is 8 times the size of the first reduced dimension face feature map.
[0072] The face detection method provided by the embodiment of the present application can improve the accuracy of mask detection and the accuracy of glasses detection, and can ensure that the mask detection task, the glasses detection task and the face detection task do not interfere with each other.
[0073] Further, the pre-trained face detection model also performs face detection and face key point detection on the face picture to be detected to obtain a face frame prediction frame and face key points, wherein the pre-trained face detection model further comprises a face frame prediction module and a face key point acquisition module.
[0074] The face frame prediction module predicts a face frame prediction frame based on the second reduced face feature map;
[0075] The face key point acquisition module acquires face key points from the second reduced face feature map.
[0076] Specifically, the face frame prediction module predicts a face frame prediction frame from the second reduced face feature map output by the last convolution layer of the second feature extraction module, and the face key point acquisition module acquires face key points in the face to be detected from the down-sampled feature map output by the last convolution layer, for subsequent face recognition.
[0077] The face detection method provided by the embodiment of the present application can improve the accuracy of mask detection and the accuracy of glasses detection, and can ensure that the mask detection task, the glasses detection task and the face detection task do not interfere with each other.
[0078] The face detection device provided by the present application is described below, and the face detection device described below can be referred to in conjunction with the face detection method described above.
[0079] Figure 3 The face detection device provided by the embodiment of the present application is described below, and the face detection device described below can be referred to in conjunction with the face detection method described above. Figure 3 As shown in the structure schematic diagram of the face detection device provided by the embodiment of the present application,
[0080] The picture acquisition module 301 is configured to acquire a face picture to be detected.
[0081] In this module, the face picture to be detected can be obtained by collecting the face of a user on site, can be a picture requiring face detection obtained from the Internet, or can be obtained from a face picture database to be verified. In addition, the scene corresponding to the face picture to be detected is various scenes requiring face recognition, such as automatic driving, mobile phone unlocking, mobile payment, attendance clock-in, etc.
[0082] The first local part detection module 302 is configured to input the face picture to be detected into a pre-trained face detection model, and the pre-trained face detection model performs first local part detection on the face picture to be detected to obtain a first local part detection result.
[0083] The pre-trained face detection model comprises a first feature extraction module, a first local part feature attention module and a first local part feature prediction module.
[0084] The first feature extraction module extracts features from the face picture to be detected to obtain a first reduced-dimension face feature map, the first local part feature attention module strengthens first local part features in the first reduced-dimension face feature map to obtain first strengthened local part features, and the first local part feature prediction module predicts the first local part detection result based on the first strengthened local part features.
[0085] In the module, the pre-trained face detection model is a multi-task face detection model, which needs to detect not only the face but also the local part of the face wearing accessories such as masks and glasses, so as to obtain a face frame prediction frame corresponding to the face detection task and face key points, and a local part detection result corresponding to the local part detection task.
[0086] When the local part detection result is that the face to be detected wears a mask or glasses that shield the face key points, the local part detection result is a local part prediction frame, which is also a prediction frame of the mask or glasses that shield the face key points; when the local part detection result is that there is no mask or glasses, the local part detection result has no display on the face picture to be detected. In other embodiments of the application, when the local part detection result is that there is no mask or glasses, the local part detection result prompts in the form of text that there is no mask or glasses that shield the face key points.
[0087] The pre-trained face detection model specifically comprises a first feature extraction module as a backbone network and a first local part feature attention module and a first local part feature prediction module as branch networks.
[0088] The pre-trained face detection model specifically comprises a first feature extraction module as a backbone network and a first local part feature attention module and a first local part feature prediction module as branch networks.
[0089] Based on the first local part detection, a scale-adapted reduced dimension face feature map is input into the first local part feature attention module as the first reduced dimension face feature map, and the first local part feature in the reduced dimension face feature map is strengthened, so as to obtain the first strengthened local part feature.
[0090] Taking the first local part detection as an example of glasses detection, since the proportion of glasses in the whole face is small, the glasses can be detected in the reduced dimension face feature map with a larger scale, so the reduced dimension face feature map with a larger scale is input into the glasses attention module corresponding to the glasses detection, so as to strengthen the feature of the glasses in the reduced dimension face feature map, and then the result of whether wearing glasses is predicted based on the strengthened glasses feature.
[0091] In addition, it should be noted that the pre-trained face detection model is trained based on face training data and labels corresponding to the face training data.
[0092] The face detection device provided by the embodiment of the application can perform feature extraction on the face picture to be detected by the first feature extraction module to obtain a first reduced dimension face feature map, the first local part feature attention module can strengthen the first local part feature in the first reduced dimension face feature map to obtain a first strengthened local part feature, and the first local part feature prediction module can predict the first local part detection result based on the first strengthened local part feature, so that the local part detection task and the face detection task are independent and do not interfere with each other, the accuracy of the main task of face detection is ensured, and since the local part detection increases the attention mechanism, the first local part detection also has high accuracy, and each task in the multi-task face detection can have high accuracy without increasing the calculation amount of the model.
[0093] Figure 4 An entity structure diagram of an electronic device provided by the embodiment of the application is shown in FIG. 1. Figure 4 As shown in FIG. 1, the electronic device can include a processor 410, a communications interface 420, a memory 430 and a communications bus 440, wherein the processor 410, the communications interface 420 and the memory 430 can complete mutual communication through the communications bus 440. The processor 410 can call the logical instructions in the memory 430 to execute a face detection method, and the face detection method includes acquiring a face picture to be detected.
[0094] Input the face picture to be detected into a pre-trained face detection model, and the pre-trained face detection model performs first local part detection on the face picture to be detected to obtain a first local part detection result.
[0095] The pre-trained face detection model comprises a first feature extraction module, a first local part feature attention module, and a first local part feature prediction module.
[0096] The first feature extraction module extracts features from the face picture to be detected to obtain a first reduced-dimension face feature map, the first local part feature attention module strengthens first local part features in the first reduced-dimension face feature map to obtain first strengthened local part features, and the first local part feature prediction module predicts the first local part detection result based on the first strengthened local part features.
[0097] In addition, the logic instructions in the memory 430 described above can be implemented in the form of a software function unit and sold or used as an independent product, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the embodiments of the method of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read.Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0098] On the other hand, the present application also provides a computer program product, which comprises a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program is executed by a processor, and the computer can execute a face detection method provided by each method. The face detection method comprises: acquiring a face picture to be detected.
[0099] Input the face picture to be detected into a pre-trained face detection model, and the pre-trained face detection model performs first local part detection on the face picture to be detected to obtain a first local part detection result.
[0100] The pre-trained face detection model comprises a first feature extraction module, a first local part feature attention module, and a first local part feature prediction module.
[0101] The first feature extraction module extracts features from the face picture to be detected to obtain a first reduced-dimension face feature map, the first local part feature attention module strengthens a first local part feature in the first reduced-dimension face feature map to obtain a first strengthened local part feature, and the first local part feature prediction module predicts the first local part feature detection result based on the first strengthened local part feature.
[0102] In another aspect, the present application also provides a non-transitory computer readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the face detection method provided by the above method, the face detection method comprising: obtaining a face picture to be detected.
[0103] The face picture to be detected is input into a pre-trained face detection model, the pre-trained face detection model performs first local part detection on the face picture to be detected to obtain a first local part detection result.
[0104] The pre-trained face detection model comprises a first feature extraction module, a first local part feature attention module and a first local part feature prediction module.
[0105] The first feature extraction module extracts features from the face picture to be detected to obtain a first reduced-dimension face feature map, the first local part feature attention module strengthens a first local part feature in the first reduced-dimension face feature map to obtain a first strengthened local part feature, and the first local part feature prediction module predicts the first local part feature detection result based on the first strengthened local part feature.
[0106] The device embodiments described above are only schematic, wherein the units shown as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place or distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the present embodiment scheme. Those skilled in the art can understand and implement without creative labor.
[0107] Those skilled in the art can clearly understand the implementation of the various embodiments by means of software and necessary general hardware platforms through the description of the above embodiments, and of course, the implementation can also be through hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods of the various embodiments or some parts of the embodiments.
[0108] Finally, it should be noted that: the above examples are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing examples, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing examples, or make equivalent replacement for some technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present application.
Claims
1. A face detection method, characterized by, The method comprises: obtaining a face picture to be detected; inputting the face picture to be detected into a pre-trained face detection model, wherein the pre-trained face detection model performs first local part detection on the face picture to be detected to obtain a first local part detection result; wherein the pre-trained face detection model comprises a main network for implementing a main task and a branch network for implementing local part detection, the main network comprises a first feature extraction module, a second feature extraction module and a face frame prediction module, and the branch network comprises a first local part feature attention module, a first local part feature prediction module, a second local part feature attention module and a second local part feature prediction module; the first feature extraction module extracts features from the face picture to be detected to obtain a first reduced dimension face feature map, the first local part feature attention module strengthens first local part features in the first reduced dimension face feature map to obtain first strengthened local part features, and the first local part feature prediction module predicts the first local part detection result based on the first strengthened local part features; the second feature extraction module extracts features from the first reduced dimension face feature map to obtain a second reduced dimension face feature map, the second local part feature attention module strengthens second local part features in the second reduced dimension face feature map to obtain second strengthened local part features, and the second local part feature prediction module predicts the second local part detection result based on the second strengthened local part features; the face frame prediction module predicts a face frame prediction box based on the second reduced dimension face feature map.
2. The face detection method of claim 1, wherein, The second local part detection is mask detection; correspondingly, the second local part feature attention module is a mask attention module, and the second local part feature prediction module is a mask prediction module; the second local part feature attention module strengthens second local part features in the second reduced dimension face feature map to obtain second strengthened local part features, and the second local part feature prediction module predicts the second local part detection result based on the second strengthened local part features, comprising: the mask attention module strengthens mask part features in the second reduced dimension face feature map to obtain strengthened mask part features, and the mask prediction module predicts the mask detection result based on the strengthened mask part features.
3. The face detection method of claim 1 or 2, wherein, The first local part detection is glasses detection; correspondingly, the first local part feature attention module is a glasses attention module, and the first local part feature prediction module is a glasses prediction module; the first local part feature attention module strengthens first local part features in the first reduced dimension face feature map to obtain first strengthened local part features, and the first local part feature prediction module predicts the first local part detection result based on the first strengthened local part features, comprising: The glasses attention module strengthens the glasses part feature in the first reduced dimension face feature map to obtain a strengthened glasses part feature, and the glasses prediction module predicts the glasses detection result based on the strengthened glasses part feature.
4. The face detection method of claim 1 or 2, wherein, The size of the face picture to be detected is 32 times the size of the second reduced dimension face feature map. The size of the face picture to be detected is 8 times the size of the first reduced dimension face feature map.
5. The face detection method of claim 1, wherein, The pre-trained face detection model also detects face key points of the face picture to be detected to obtain face key points, wherein the pre-trained face detection model further comprises a face key point acquisition module. The face key point acquisition module acquires face key points from the second reduced dimension face feature map.
6. A face detection apparatus characterized by comprising: Comprise: A picture acquisition module is configured to acquire a face picture to be detected; A first local part detection module is configured to input the face picture to be detected into a pre-trained face detection model, and the pre-trained face detection model detects a first local part of the face picture to be detected to obtain a first local part detection result; The pre-trained face detection model comprises a main network for implementing a main task and a branch network for implementing local part detection, the main network comprises a first feature extraction module, a second feature extraction module and a face frame prediction module, and the branch network comprises a first local part feature attention module, a first local part feature prediction module, a second local part feature attention module and a second local part feature prediction module; The first feature extraction module extracts features of the face picture to be detected to obtain a first reduced dimension face feature map, the first local part feature attention module strengthens first local part features in the first reduced dimension face feature map to obtain first strengthened local part features, and the first local part feature prediction module predicts the first local part detection result based on the first strengthened local part features; The second feature extraction module extracts features of the first reduced dimension face feature map to obtain a second reduced dimension face feature map, the second local part feature attention module strengthens second local part features in the second reduced dimension face feature map to obtain second strengthened local part features, and the second local part feature prediction module predicts the second local part detection result based on the second strengthened local part features; The face frame prediction module predicts a face frame prediction frame based on the second reduced dimension face feature map.
7. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to realize the face detection method of any one of claims 1-5.
8. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the face detection method of any one of claims 1-5.
9. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to realize the face detection method of any one of claims 1-5.
Citation Information
Patent Citations
Human face detection method, device and system, and storage medium
CN108875521A
Face mask detection method and device, electronic equipment and storage medium
CN111523480A