Face detection method and device, electronic device

By using a multi-module face model including face detection network, key point detection network and pose angle detection network, the detection face image is detected, and the problem of low accuracy in the face detection system in the prior art when dealing with skewed or side face states is solved, and a higher accuracy of face detection is achieved.

CN112560705BActive Publication Date: 2025-03-18BEIJING SINOVOICE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011504477.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-17
Publication Date
2025-03-18
Estimated Expiration
2040-12-17

AI Technical Summary

Technical Problem

When the existing face detection system handles the face to be identified or is in a side face state compared to the detection system, the detection results are less accurate, and even the detection results cannot be given.

Method used

A face model including a face detection network module, a key point detection network module and a pose angle detection network module is adopted to detect the detected face images, obtain the face pose angle, face key points and face target frame, and display these information in the current interface to correct the face target frame.

Benefits of technology

Through the comprehensive utilization of multi-dimensional detection information, the accuracy of face detection is improved, and face detection in skewed or side face state can be handled more accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112560705B_ABST
    Figure CN112560705B_ABST
Patent Text Reader

Abstract

The present invention provides a face detection method and device and an electronic device, wherein the face detection method comprises: inputting a face image to be detected into a pre-trained face model, wherein the face model comprises: a face detection network module, a key point detection network module and a posture angle detection network module; obtaining the face posture angle, face key points and face target frame output by the face model; and displaying the face posture angle, face key points and face target frame in the current interface. The face detection method provided by the present invention can improve the accuracy of face detection results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of face detection, and in particular to a face detection method and device, and electronic equipment. Background Art

[0002] The two most common scenarios in OCR (Optical Character Recognition) are text recognition in scanned documents and text recognition in natural scenes taken in photos. The text in scanned documents and text in photos are very different in terms of fonts, backgrounds and other factors. Generally speaking, text recognition in natural scenes is much more difficult than text in scanned documents. In order to cater to the huge differences in fonts and backgrounds, the recognition rate of the text line recognition model is currently mainly ensured by increasing the amount of training sample data and increasing the size of the recognition model. However, when the amount of training sample data reaches a certain order of magnitude, the incremental effect of the text recognition rate brought about by simply increasing the size of the text line recognition model will become smaller and smaller, and increasing the size of the text line recognition model will cause its performance to seriously deteriorate.

[0003] It can be seen that the existing text line recognition model cannot take into account both recognition rate and performance.

[0004] In an era where people are connected, the first thing to solve in providing services around people is to identify people. For this reason, people have invented many cards and certificates as the basis for identifying people. This kind of identity recognition is essentially "seeing objects as seeing people, recognizing objects but not people". It ignores people's most essential needs. While solving old problems, it also brings some new problems. In line with the trend of the times, we should make full use of face recognition technology, emphasize the sharing and openness of face big data, and build a portrait database and face card system. Face recognition technology can be widely used in smart policing and smart city construction, providing smart face services for the whole society.

[0005] Face recognition is a biometric technology that identifies people based on their facial features. It can be widely used in public security, finance, airports, subways, border ports and other important fields for natural comparison and identification of people's identities. For example: face payment, face attendance, face gate, visitor registration, face access control, face withdrawal and other specific scenarios.

[0006] Face detection is an essential step before face recognition, and the result of face detection directly affects the accuracy of face recognition. At present, face detection solutions are mainly aimed at the scene where the face to be recognized faces the detection system directly. However, when the face to be recognized is tilted to the detection system or is in profile, the detection result given by the face detection system is inaccurate or even impossible to give a detection result. Summary of the invention

[0007] In view of the above problems, embodiments of the present invention are proposed to provide a face detection method and device, electronic device and storage medium that overcome the above problems or at least partially solve the above problems.

[0008] In a first aspect, an embodiment of the present invention discloses a face detection method, wherein the method comprises: inputting a face image to be detected into a pre-trained face model, wherein the face model comprises: a face detection network module, a key point detection network module, and a posture angle detection network module;

[0009] Obtaining the face pose angle, face key points and face target frame output by the face model;

[0010] The face posture angle, face key points and face target frame are displayed in the current interface.

[0011] Optionally, the step of displaying the face posture angle, face key points and face target frame in the current interface includes:

[0012] According to the face posture angle and the face key points, the face target frame is corrected to obtain a corrected face target frame;

[0013] The face image to be detected is displayed in the current interface, and the corrected face target frame is marked in the face image to be detected.

[0014] Optionally, before the step of inputting the face image to be detected into a pre-trained face model, the method further includes:

[0015] The face image to be tested is adjusted to a color image of a first preset size.

[0016] Optionally, before the step of inputting the face image to be detected into a pre-trained face model, the method further includes:

[0017] Acquire a first preset number of sample images, wherein the sample images are face images, and the number of sample images with face angles greater than a preset angle is greater than a second preset number, and the first preset number is greater than the second preset number;

[0018] Adjusting each of the sample images to a color image of a second preset size;

[0019] For each of the adjusted sample images, adding a face pose angle label and a face key point label to the sample image;

[0020] For each of the adjusted sample images, adjusting the sample image to a first preset size;

[0021] Transforming the sample image adjusted to a first preset size according to a preset rule to obtain a plurality of transformed sample images;

[0022] The preset face model is trained based on the sample images adjusted to the first preset size and the multiple transformed sample images corresponding to the sample images.

[0023] Optionally, the step of transforming the sample image adjusted to the first preset size according to a preset rule to obtain a plurality of transformed sample images includes:

[0024] Randomly masking a part of the sample image adjusted to a first preset size to generate a plurality of transformed sample images, wherein each random masking generates a transformed sample image; and / or,

[0025] Adjusting preset parameters of the sample image adjusted to a first preset size to generate a plurality of transformed sample images, wherein each adjustment of the preset parameters generates a transformed sample image, and the preset parameters include: at least one of chromaticity and brightness;

[0026] The sample image adjusted to a first preset size is blurred to generate a plurality of transformed sample images.

[0027] In a second aspect, an embodiment of the present invention discloses a face detection device, wherein the device comprises:

[0028] An input module, used for inputting a face image to be detected into a pre-trained face model, wherein the face model includes: a face detection network module, a key point detection network module and a posture angle detection network module;

[0029] A first acquisition module is used to acquire the face pose angle, face key points and face target frame output by the face model;

[0030] The display module is used to display the face posture angle, face key points and face target frame in the current interface.

[0031] Optionally, the display module includes:

[0032] A correction submodule, used for correcting the face target frame according to the face posture angle and the face key points to obtain a corrected face target frame;

[0033] The display submodule is used to display the face image to be detected in the current interface and mark the corrected face target frame in the face image to be detected.

[0034] Optionally, the device further comprises:

[0035] The first adjustment module is used to adjust the face image to be tested into a color image of a first preset size before the input module inputs the face image to be tested into a pre-trained face model.

[0036] Optionally, the device further comprises:

[0037] A second acquisition module is used for acquiring a first preset number of sample images before the input module inputs the face image to be detected into the pre-trained face model, wherein the sample images are face images, and the number of sample images with face angles greater than a preset angle is greater than a second preset number, and the first preset number is greater than the second preset number;

[0038] A second adjustment module, used for adjusting each of the sample images to a color image of a second preset size;

[0039] A label adding module, used for adding a face pose angle label and a face key point label to each of the adjusted sample images;

[0040] A third adjustment module, configured to adjust each of the adjusted sample images to a first preset size;

[0041] An image transformation module, used for transforming the sample image adjusted to a first preset size according to a preset rule to obtain a plurality of transformed sample images;

[0042] The model training module is used to train a preset face model based on each of the sample images adjusted to a first preset size and a plurality of transformed sample images corresponding to each of the sample images.

[0043] Optionally, the image transformation module includes:

[0044] A first transformation submodule is configured to randomly block a portion of the sample image adjusted to a first preset size to generate a plurality of transformed sample images, wherein each random block generates a transformed sample image; and / or,

[0045] A second transformation submodule is configured to adjust preset parameters of the sample image adjusted to the first preset size to generate a plurality of transformed sample images, wherein each preset parameter adjustment generates a transformed sample image, and the preset parameters include: at least one of chromaticity and brightness; and / or,

[0046] The third transformation submodule is used to perform blur processing on the sample image adjusted to the first preset size to generate a plurality of transformed sample images.

[0047] In a third aspect, an embodiment of the present invention discloses an electronic device, comprising: one or more processors; and one or more machine-readable media having instructions stored thereon; when the instructions are executed by the one or more processors, the processors execute a face detection method as described in any one of the above items.

[0048] In a fourth aspect, an embodiment of the present invention discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the face detection method as described in any one of the above items.

[0049] The face detection scheme provided in the embodiment of the present invention inputs the face image to be detected into a pre-trained face model. Since the face model includes a face detection network module, a key point detection network module and a posture angle detection network module, the detection information of three dimensions, namely face posture angle, face key points and face target frame, can be obtained after the face image to be detected is detected. The system finally determines the face detection result based on the detection information of the three dimensions. Compared with the prior art that determines the face detection result based on only one dimension of detection information, the determined detection result has higher accuracy. It can be seen that the face detection scheme provided in the embodiment of the present invention can improve the accuracy of face detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 is a flowchart of the steps of a face detection method according to an embodiment of the present invention;

[0051] Figure 2 is a flowchart of the steps of another face detection method according to an embodiment of the present invention;

[0052] Figure 3 It is a structural block diagram of a face detection device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0053] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0054] Reference Figure 1 , shows a step flow chart of a face detection method according to an embodiment of the present invention.

[0055] The face detection method of the embodiment of the present invention may include the following steps:

[0056] Step 101: Input the face image to be detected into a pre-trained face model.

[0057] Among them, the face model includes: face detection network module, key point detection network module and posture angle detection network module.

[0058] The face detection network model is an existing model, which uses RFBNet for face detection. It is a general target detection network based on anchor. The network can directly output the detection box position, target type and target score confidence of the target. RFBNet network is used for target detection, which can achieve good results while taking into account speed. The face detection network model mainly introduces RFB, i.e. Receptive FieldBlock, into the SSD, i.e. Single Shot MultiBox Detector network. The starting point of introducing RFB is to enhance the feature extraction ability of the network by simulating the receptive field of human vision. In terms of structure, RFB draws on the idea of ​​the existing model, i.e. the initial model, mainly adding an expansion convolution layer on the basis of the initial module, thereby effectively increasing the receptive field. The face network model is set as a model based on the SSD network, and the detection speed and detection result accuracy are relatively stable. Among them, RFBNet is a general target detection network; Anchor is the target detection anchor box preset in the target detection network. SSD is a single-stage multi-scale prediction detector, a deep learning general target detection network.

[0059] The present invention optimizes the original face detection network architecture, modifies the face detection network architecture, and opens two new network branches as auxiliary supervision networks on the basis of the original face detection network module, namely the backbone network. One is a fully connected layer with an output value of 68 key points (128 position coordinate values), namely the key point detection network module, and the other is a fully connected layer with an output value of 3 posture angles of the face, namely the posture angle detection network module. The two network branches are trained together with the backbone network to play a role in assisting face detection.

[0060] In an embodiment of the present invention, by optimizing the original face detection network architecture, using an auxiliary network to obtain face posture angle and face key point information, and using the auxiliary network to supervise the main detection network during training, the adverse effects of face posture angle can be reduced, the robustness of the face detection model can be improved, and the information of angles and face key points can be effectively utilized in natural scenes with large angles to improve the detection rate of faces.

[0061] In an optional embodiment, before the face image to be detected is input into a pre-trained face model, the face image to be detected is adjusted to a color image of a first preset size.

[0062] The first preset size can be set by those skilled in the art according to actual needs, and no specific limitation is imposed on this in the embodiments of the present application. The first preset size needs to match the training sample size of the face model.

[0063] Step 102: Obtain the facial pose angle, facial key points and facial target frame output by the facial model.

[0064] Face posture angle: refers to the three angles of the head in three-dimensional space, including but not limited to: shaking head, nodding head and tilting head;

[0065] The key points of the face may represent the key points of specific parts of the face, such as the corners of the mouth, the tip of the nose, the corners of the eyes, etc. The key points of the face may be set by a person skilled in the art according to actual needs, and no specific limitation is made in the embodiments of the present application.

[0066] In the actual implementation process, after the face image to be detected is input into the face detection model, the face detection network module, the key point detection network module and the posture angle detection network module respectively predict the face to be detected, the face detection network module outputs the face target frame, the key point detection network module outputs the face key point information, and the posture angle detection network module outputs the face posture angle information. The three modules in the face detection model are executed independently and in parallel without interfering with each other.

[0067] Step 103: Displaying the face posture angle, face key points and face target frame in the current interface.

[0068] The displayed facial posture angle, facial key points and facial target frame facilitate the subsequent related programs to accurately identify the face.

[0069] An optional face detection process is as follows Figure 2 As shown, the optional face detection process includes the following steps:

[0070] Step 201: input the face image to be detected into a pre-trained face model.

[0071] Step 202: Obtain the facial pose angle, facial key points and facial target frame output by the facial model.

[0072] Step 203: Correct the face target frame according to the face posture angle and the face key points to obtain a corrected face target frame.

[0073] Step 204: Display the face image to be detected in the current interface, and mark a corrected face target frame in the face image to be detected.

[0074] In this optional embodiment, when the face posture angle, face key points and face target frame are displayed in the current interface, the face target frame can be corrected according to the face posture angle and face key points to obtain a corrected face target frame; the face image to be detected is displayed in the current interface, and the corrected face target frame is marked in the face image to be detected. In this optional embodiment, the face detection system corrects the face target frame, and there is no need for subsequent systems to modify it. Therefore, there is no need to transmit the displayed face posture angle and face key points between systems, which can save time and resources consumed by data transmission.

[0075] The face detection method provided by the embodiment of the present invention inputs the face image to be detected into a pre-trained face model. Since the face model includes a face detection network module, a key point detection network module, and a posture angle detection network module, the detection information of three dimensions, namely, face posture angle, face key points, and face target frame, can be obtained after the face image to be detected is detected. The system finally determines the face detection result based on the detection information of the three dimensions. Compared with the prior art that determines the face detection result based on only one dimension of detection information, the determined detection result has higher accuracy. It can be seen that the face detection method provided by the embodiment of the present invention can improve the accuracy of face detection. In an optional embodiment, before the step of inputting the face image to be detected into the pre-trained face model, it also includes the following face model training process, and the face model training process includes the following steps:

[0076] Step 1: Acquire a first preset number of sample images;

[0077] Among them, the sample images are face images, and the number of sample images with face angles greater than the preset angle is greater than the second preset number, and the first preset number is greater than the second preset number; an angle greater than the preset angle can be subsequently referred to as a large angle.

[0078] For example, 50,000 natural scene images containing human faces are prepared, of which 40,000 images may contain human face images with large face angles.

[0079] Step 2: adjusting each sample image to a color image of a second preset size;

[0080] Adjusting the sample images to a uniform second preset size is actually normalizing each sample image. The second preset size can be set to: 640 pixels*640 pixels*3 pixels.

[0081] Step 3: For each adjusted sample image, add a face pose angle label and a face key point label to the sample image;

[0082] For each sample image, if there are no facial pose angles and facial key point labels in the sample image, existing relevant open source software such as OpenFace can be used to calculate relevant parameter information for the sample image, and facial pose angle labels and facial key point labels can be added to the sample image based on the calculation results.

[0083] Step 4: for each adjusted sample image, adjust the sample image to a first preset size;

[0084] The first preset size can be set by those skilled in the art according to actual needs, and no specific limitation is imposed on this in the embodiments of the present application. For example, the first preset size can be set to 640 pixels*640 pixels.

[0085] Step 5: transforming the sample image adjusted to the first preset size according to a preset rule to obtain a plurality of transformed sample images;

[0086] This step is to transform and expand the sample image.

[0087] Step six: Based on the sample images adjusted to the first preset size and the multiple transformed sample images corresponding to the sample images, the preset face model is trained.

[0088] In the actual implementation process, the tensorflow framework can be used for model training, the optimizer uses adam, the initial learning rate is 0.01, and the learning rate decays by one tenth every 1000 rounds.

[0089] In an optional embodiment, the step of transforming the sample image adjusted to the first preset size according to a preset rule to obtain a plurality of transformed sample images includes:

[0090] Randomly occlude a part of the area in the sample image adjusted to a first preset size to generate a plurality of transformed sample images, wherein each random occlusion generates a transformed sample image; and / or, adjust the preset parameters of the sample image adjusted to the first preset size to generate a plurality of transformed sample images, wherein each preset parameter adjustment generates a transformed sample image, and the preset parameters include: at least one of chromaticity and brightness; and / or, blur the sample image adjusted to the first preset size to generate a plurality of transformed sample images.

[0091] The method of transforming the sample images can quickly obtain more reliable sample images. Compared with the method of manually screening and marking sample images one by one, it can save human resources and the sampling efficiency of sample images.

[0092] Reference Figure 3 , shows a structural block diagram of a face detection device according to an embodiment of the present invention.

[0093] The face detection device of the embodiment of the present invention may include the following modules:

[0094] An input module 301 is used to input a face image to be detected into a pre-trained face model, wherein the face model includes: a face detection network module, a key point detection network module and a posture angle detection network module;

[0095] The first acquisition module 302 is used to acquire the face pose angle, face key points and face target frame output by the face model;

[0096] The display module 303 is used to display the face posture angle, face key points and face target frame in the current interface.

[0097] Optionally, the display module includes:

[0098] A correction submodule, used for correcting the face target frame according to the face posture angle and the face key points to obtain a corrected face target frame;

[0099] The display submodule is used to display the face image to be detected in the current interface and mark the corrected face target frame in the face image to be detected.

[0100] Optionally, the device further comprises:

[0101] The first adjustment module is used to adjust the face image to be tested into a color image of a first preset size before the input module inputs the face image to be tested into a pre-trained face model.

[0102] Optionally, the device further comprises:

[0103] A second acquisition module is used for acquiring a first preset number of sample images before the input module inputs the face image to be detected into the pre-trained face model, wherein the sample images are face images, and the number of sample images with face angles greater than a preset angle is greater than a second preset number, and the first preset number is greater than the second preset number;

[0104] A second adjustment module, used for adjusting each of the sample images to a color image of a second preset size;

[0105] A label adding module, used for adding a face pose angle label and a face key point label to each of the adjusted sample images;

[0106] A third adjustment module, configured to adjust each of the adjusted sample images to a first preset size;

[0107] An image transformation module, used for transforming the sample image adjusted to a first preset size according to a preset rule to obtain a plurality of transformed sample images;

[0108] The model training module is used to train a preset face model based on each of the sample images adjusted to a first preset size and a plurality of transformed sample images corresponding to each of the sample images.

[0109] Optionally, the image transformation module includes:

[0110] A first transformation submodule is configured to randomly block a portion of the sample image adjusted to a first preset size to generate a plurality of transformed sample images, wherein each random block generates a transformed sample image; and / or,

[0111] A second transformation submodule is configured to adjust preset parameters of the sample image adjusted to the first preset size to generate a plurality of transformed sample images, wherein each preset parameter adjustment generates a transformed sample image, and the preset parameters include: at least one of chromaticity and brightness; and / or,

[0112] The third transformation submodule is used to perform blur processing on the sample image adjusted to the first preset size to generate a plurality of transformed sample images.

[0113] The face detection device provided by the embodiment of the present invention inputs the face image to be detected into a pre-trained face model. Since the face model includes a face detection network module, a key point detection network module and a posture angle detection network module, detection information of three dimensions, namely face posture angle, face key points and face target frame, can be obtained after detecting the face image to be detected. The system finally determines the face detection result based on the detection information of the three dimensions. Compared with the prior art that determines the face detection result based on only one dimension of detection information, the determined detection result has higher accuracy. It can be seen that the face detection device provided by the embodiment of the present invention can improve the accuracy of face detection.

[0114] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0115] In an embodiment of the present invention, an electronic device is also provided. The electronic device may include one or more processors, and one or more machine-readable media storing instructions thereon, the instructions being, for example, application programs. When the instructions are executed by the one or more processors, the processors execute the above-mentioned face detection method.

[0116] In an embodiment of the present invention, a non-temporary computer-readable storage medium is also provided, on which a computer program is stored, and the program can be executed by a processor of an electronic device to complete the above-mentioned face detection method. For example, the non-temporary computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0117] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0118] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0119] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0120] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0121] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable terminal device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0122] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0123] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0124] The above is a detailed introduction to a face detection method and device, an electronic device and a storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for a person skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A face detection method, characterized in that: The method comprises: Acquire a first preset number of sample images, wherein the sample images are face images, and the number of sample images with face angles greater than a preset angle is greater than a second preset number, and the first preset number is greater than the second preset number; Adjusting each of the sample images to a color image of a second preset size; For each of the adjusted sample images, adding a face pose angle label and a face key point label to the sample image; For each of the adjusted sample images, adjusting the sample image to a first preset size; Transforming the sample image adjusted to a first preset size according to a preset rule to obtain a plurality of transformed sample images; Training a preset face model based on each of the sample images adjusted to a first preset size and a plurality of transformed sample images corresponding to each of the sample images; Inputting a face image to be detected into a pre-trained face model, wherein the face model comprises: a face detection network module, a key point detection network module and a posture angle detection network module; the face detection network module is used to output a face target frame, the key point detection network module is used to output face key point information, the posture angle detection network module is used to output face posture angle information, and the face detection network module, the key point detection network module and the posture angle detection network module are executed in parallel and independently; Obtaining the face pose angle, face key points and face target frame output by the face model; The face posture angle, face key points and face target frame are displayed in the current interface.

2. The method according to claim 1, characterized in that The step of displaying the face posture angle, face key points and face target frame in the current interface includes: According to the face posture angle and the face key points, the face target frame is corrected to obtain a corrected face target frame; The face image to be detected is displayed in the current interface, and the corrected face target frame is marked in the face image to be detected.

3. The method according to claim 1, characterized in that Before the step of inputting the face image to be detected into the pre-trained face model, the method further includes: The face image to be detected is adjusted to a color image of a first preset size.

4. The method according to claim 1, characterized in that: The step of transforming the sample image adjusted to a first preset size according to a preset rule to obtain a plurality of transformed sample images comprises: Randomly masking a part of the sample image adjusted to a first preset size to generate a plurality of transformed sample images, wherein each random masking generates a transformed sample image; and / or, Adjusting preset parameters of the sample image adjusted to a first preset size to generate a plurality of transformed sample images, wherein each preset parameter adjustment generates a transformed sample image, and the preset parameters include: at least one of chromaticity and brightness; and / or, The sample image adjusted to a first preset size is blurred to generate a plurality of transformed sample images.

5. A face detection device, characterized in that: The device comprises: A second acquisition module is used to acquire a first preset number of sample images before the input module inputs the face image to be detected into the pre-trained face model, wherein the sample images are face images, and the number of sample images with face angles greater than a preset angle is greater than a second preset number, and the first preset number is greater than the second preset number; A second adjustment module, used for adjusting each of the sample images to a color image of a second preset size; A label adding module, used for adding a face pose angle label and a face key point label to each of the adjusted sample images; A third adjustment module, configured to adjust each of the adjusted sample images to a first preset size; An image transformation module, used for transforming the sample image adjusted to a first preset size according to a preset rule to obtain a plurality of transformed sample images; A model training module, used for training a preset face model based on each of the sample images adjusted to a first preset size and a plurality of transformed sample images corresponding to each of the sample images; An input module is used to input a face image to be detected into a pre-trained face model, wherein the face model includes: a face detection network module, a key point detection network module and a posture angle detection network module; the face detection network module is used to output a face target frame, the key point detection network module is used to output face key point information, the posture angle detection network module is used to output face posture angle information, and the face detection network module, the key point detection network module and the posture angle detection network module are executed in parallel and independently; A first acquisition module is used to acquire the face pose angle, face key points and face target frame output by the face model; The display module is used to display the face posture angle, face key points and face target frame in the current interface.

6. The device according to claim 5, characterized in that The display module comprises: A correction submodule, used for correcting the face target frame according to the face posture angle and the face key points to obtain a corrected face target frame; The display submodule is used to display the face image to be detected in the current interface and mark the corrected face target frame in the face image to be detected.

7. The device according to claim 5, characterized in that The device also includes: The first adjustment module is used to adjust the face image to be detected into a color image of a first preset size before the input module inputs the face image to be detected into a pre-trained face model.

8. An electronic device, characterized in that: include: one or more processors; and one or more machine-readable media having instructions stored thereon; When the instructions are executed by the one or more processors, the processors are enabled to execute the face detection method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Face-alignment detection method, device and storage medium

    CN109034095A

  • Image augmentation and neural network training method and device, equipment and storage medium

    CN111797264A