Face detection model training method and device

CN116740783BActive Publication Date: 2026-09-11SPREADTRUM COMM (TIANJIN) INC
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310657810.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-02
Publication Date
2026-09-11
Estimated Expiration
2043-06-02

AI Technical Summary

Technical Problem

基于标签分配策略为输入图像分配标签时,在通过人脸矩形框生成正样本的同时,还使用人脸关键点信息生成集中包含人脸信息的正样本,并以人脸关键点信息作为评价标准对生成的正样本进行筛选,以解决现有技术中无法准确获取人脸信息进行模型训练的问题

Benefits of technology

[0041] The above approach aims to use image regions containing more facial information as target positive samples for training the face detection model, thereby improving classification accuracy and reducing the probability of false detections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116740783B_ABST
    Figure CN116740783B_ABST
Patent Text Reader

Abstract

The application relates to the field of machine vision, in particular to a face detection model training method and device. A face detection model training method, the method comprises the following steps: determining a face key point rectangular frame according to a labeled face key point in a first image; determining a target positive sample and a target negative sample in the first image according to the face key point rectangular frame and a preset face rectangular frame; and training a face detection model according to the target positive sample and the target negative sample. In the model training process, the face key point is combined, and as much as possible, an image region containing more face information is taken as the target positive sample for the face detection model to perform training, so that the classification precision is improved, and the false detection probability is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] This application relates to the field of machine vision, and in particular to a method and apparatus for training a face detection model. [Background Technology]

[0002] When performing face detection algorithms using a face detection model, the accuracy of the output results is related to interference factors in the input image. Factors such as pose, expression, skin color, brightness, occlusion, and scale transformation in the input image can all affect the recognition results. To overcome the influence of these interference factors, it is necessary to train a model with higher computing power to address these interference factors.

[0003] However, due to limitations in terminal device performance requirements and hardware, face detection models deployed on terminal devices often require lightweight network structures, making it difficult to improve face detection accuracy without increasing computational load. [Summary of the Invention]

[0004] In view of this, embodiments of the present invention provide a method and apparatus for training a face detection model. When assigning labels to input images based on a label allocation strategy, while generating positive samples using face bounding boxes, positive samples containing face information are also generated using face key point information. The generated positive samples are then filtered using face key point information as an evaluation criterion, thereby solving the problem in the prior art of not being able to accurately obtain face information for model training.

[0005] In a first aspect, embodiments of the present invention provide a method for training a face detection model, the method comprising:

[0006] Determine the facial landmark bounding box based on the facial landmarks marked in the first image;

[0007] Based on the facial key point bounding box and the preset facial bounding box, target positive samples and target negative samples are determined in the first image;

[0008] The face detection model is trained based on the target positive samples and the target negative samples.

[0009] Optionally, determining the target positive sample and target negative sample in the first image based on the facial key point bounding box and a preset facial bounding box includes:

[0010] Determine the first center point of the facial key point rectangle and the second center point of the facial rectangle;

[0011] The first positive sample and the first negative sample of the first image are determined based on the first center point, and the second positive sample and the second negative sample of the first image are determined based on the second center point;

[0012] The target positive sample is determined based on the first positive sample and the second positive sample, and the target negative sample is determined based on the target positive sample.

[0013] Optionally, determining the first positive sample and the first negative sample of the first image based on the first center point includes:

[0014] Based on the position coordinates of the first center point in the first image, the first grid cell where the first center point is located is determined from a plurality of preset grid cells in the first image.

[0015] Each preset anchor frame is determined as a preset anchor frame of the first grid;

[0016] Among the preset anchor frames, at least one anchor frame whose intersection-union ratio (IOU) with the face rectangle is higher than the first IOU threshold is determined as the first anchor frame;

[0017] The image region corresponding to the first anchor frame is determined as the first positive sample, and the image regions corresponding to other anchor frames besides the first anchor frame are determined as the first negative samples.

[0018] Optionally, determining the target positive sample based on the first positive sample and the second positive sample includes:

[0019] Based on the image regions corresponding to the first positive sample and the second positive sample, a number of second anchor boxes are determined on the first image;

[0020] In each of the second anchor frames, at least one anchor frame whose IOU ratio with the face rectangle is higher than the second IOU threshold is determined as the third anchor frame;

[0021] Based on the number of facial key points contained in each of the third anchor frames, a fourth anchor frame is determined from the third anchor frames;

[0022] The image region corresponding to the fourth anchor frame is determined as the target positive sample, and the image regions corresponding to the other anchor frames besides the fourth anchor frame are determined as the target negative samples.

[0023] Optionally, determining the fourth anchor frame from the third anchor frames based on the number of facial key points contained in each of the third anchor frames includes:

[0024] Based on the required number of fourth anchor frames, the third anchor frame containing more facial key points among all the third anchor frames is determined as the fourth anchor frame;

[0025] For any two third anchor frames that contain the same number of facial key points, the third anchor frame with the higher IOU ratio is determined as the fourth anchor frame.

[0026] Optionally, the method for determining the target positive sample based on the first positive sample and the second positive sample further includes:

[0027] The first positive sample and the second positive sample are jointly determined as the target positive sample.

[0028] Optionally, training the face detection model based on the target positive samples and the target negative samples includes:

[0029] When the face detection model includes a feature pyramid FPN+PAN structure, auxiliary detection heads are set for each network layer in the FPN network;

[0030] The target positive sample and the target negative sample are input into the auxiliary detection head to obtain the prediction result of the auxiliary detection head;

[0031] The classification task of the face detection model is supervised based on the prediction results of the auxiliary detection head.

[0032] Secondly, embodiments of the present invention provide a face detection model training device, comprising:

[0033] The first determining module determines the facial key point rectangle based on the facial key points marked in the first image;

[0034] The second determining module determines the target positive sample and the target negative sample in the first image based on the facial key point rectangle and the preset facial rectangle.

[0035] The training module trains the face detection model based on the target positive samples and the target negative samples.

[0036] Thirdly, embodiments of the present invention provide an electronic device, including:

[0037] At least one processor; and

[0038] At least one memory communicatively connected to the processor, wherein:

[0039] The memory stores program instructions that can be executed by the processor, which can invoke the program instructions to perform any of the methods described in the first aspect.

[0040] Fourthly, embodiments of the present invention provide a computer-readable storage medium comprising a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform any of the methods described in the first aspect.

[0041] The above approach aims to use image regions containing more facial information as target positive samples for training the face detection model, thereby improving classification accuracy and reducing the probability of false detections. [Attached Image Description]

[0042] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0043] Figure 1 A flowchart illustrating a face detection model training method provided in an embodiment of the present invention;

[0044] Figure 2 A schematic diagram of a first image provided for an embodiment of the present invention;

[0045] Figure 3 A schematic diagram of another first image provided for an embodiment of the present invention;

[0046] Figure 4 This is a schematic diagram of the structure of a face detection model training device provided in an embodiment of the present invention;

[0047] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.

Detailed Implementation Methods

[0048] To better understand the technical solution of the present invention, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0049] It should be understood that the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0050] Face detection algorithms are a type of object detection. When an image is input into a face detection model, the model performs a classification task to determine whether the input image contains a face, and if it determines that the image contains a face, it performs a regression task to output the coordinates of the face bounding box.

[0051] Current mainstream face detection models are based on convolutional neural networks (CNNs), trained by learning features from a large number of face images. In real-world scenarios, face detection models are often affected by numerous factors, including pose, facial expression, image brightness, scale variations, occlusion, and complex backgrounds, all of which can interfere with the accuracy of the recognition results. To achieve better face detection algorithms, larger, more computationally powerful CNN models are needed, trained to handle all these interfering factors and avoid their interference.

[0052] However, due to limitations in terminal device performance and hardware, face detection models deployed on terminal devices often require lightweight network structures. Lightweight network structures are difficult to directly meet the demands of various complex scenarios, while using larger convolutional neural network models increases computational load and complicates deployment on mobile phones and other terminal devices.

[0053] In some embodiments, to improve the accuracy of face detection algorithms without increasing computational load, a labeling strategy is used to assign positive and negative sample labels to different regions of the image, thus determining where the positive and negative samples are in the image. During the training process of the face detection model, features from both positive and negative samples in the image are learned in a concentrated manner to improve the accuracy of the face detection algorithm.

[0054] However, traditional labeling strategies do not consider the specific characteristics of faces, resulting in positive and negative samples that often fail to accurately reflect facial features in the image, potentially missing some important facial features. Furthermore, the evaluation criteria for positive and negative samples are not specifically designed for faces.

[0055] like Figure 1 The image shows a face detection model training method provided by an embodiment of the present invention. (See also...) Figure 1 The specific steps of this method include:

[0056] S101, Determine the facial key point rectangle based on the facial key points marked in the first image.

[0057] Specifically, the first image is the input image for the face detection model, used to train the model. Facial key points are pre-annotated in the first image. These key points are generally five points on the face: the pupils of both eyes, the tip of the nose, and the corners of the mouth on both sides. A bounding box is determined in the first image based on each facial key point, and this bounding box is then expanded outward by a factor of 1.2 to obtain the facial key point bounding box.

[0058] In addition to the facial landmark bounding boxes, the first image also includes ground truth bounding boxes, which are the bounding boxes of the faces.

[0059] like Figure 2 The image shown is a schematic diagram of a first image provided by an embodiment of the present invention. In the first image, five points—the pupils of both eyes, the tip of the nose, and the corners of the mouth on both sides—are defined as facial key points. The bounding rectangles of the five facial key points are expanded outward to obtain the facial key point rectangles. The first image also includes a preset facial rectangle based on the face position.

[0060] S102, Based on the facial key point bounding box and the preset facial bounding box, determine the target positive sample and the target negative sample in the first image.

[0061] Specifically, the first center point and the second center point of the facial landmark bounding box are determined. Based on the first center point, the first positive sample and the first negative sample of the first image are determined, and based on the second center point, the second positive sample and the second negative sample of the first image are determined. Then, based on the actual situation of the image, an appropriate determination method is selected, and the final target positive sample and target negative sample used for model training are determined based on the first positive sample and the second positive sample.

[0062] In determining the first positive sample and the first negative sample of the first image based on the first center point, it is necessary to determine the grid in the first image where the first center point is located, select the most suitable anchor frame from several preset anchor frames for the grid, and determine the image area corresponding to the anchor frame as the first positive sample.

[0063] Specifically, the first image is pre-divided into several regions by dividing it into grids. Each grid has several preset anchor frames of varying sizes. The center point of each preset anchor frame coincides with its corresponding grid frame, and the size of the enclosed image region can be larger or smaller than its corresponding grid frame.

[0064] Based on the position coordinates of the first center point in the first image, determine which grid cell the first center point is located in. Define the grid cell containing the first center point as the first grid cell. Identify the preset anchor frames for the first grid cell, and calculate the intersection-over-union (IOU) ratio between each preset anchor frame and the face rectangle, i.e., determine the overlap between each preset anchor frame and the face rectangle. Identify at least one anchor frame with an IOU ratio higher than a first IOU threshold as the first anchor frame, and define the region corresponding to the first anchor frame in the first image as the first positive sample. Identify the other anchor frames (excluding the first anchor frame), i.e., preset anchor frames in the first grid whose IOU ratio does not reach the first IOU threshold, or the regions corresponding to preset anchor frames in other grid cells in the first image as the first negative samples.

[0065] The method for determining the second positive sample and the second negative sample of the first image based on the second center point is the same as the method described above. It is also determined based on the grid where the second center point is located and the IOU ratio between each preset anchor frame and the face rectangle within the grid.

[0066] The higher the IOU ratio between the preset anchor box and the face rectangle, the higher the overlap between the preset anchor box and the face rectangle. This means that the preset anchor box contains more facial information and less invalid information, resulting in higher prediction accuracy of the face detection model trained by learning from the preset anchor box.

[0067] After determining the first positive sample, the first negative sample, the second positive sample, and the second negative sample, it is necessary to determine the final target positive sample and target negative sample to be used for training the face detection model.

[0068] Specifically, in order to increase the number of positive samples and reduce the impact of overfitting caused by the imbalance between positive and negative samples, the first and second positive samples can be directly determined as the target samples, and the first and second negative samples can be determined as the target negative samples.

[0069] Optionally, in order to further improve the accuracy of model training, the first and second positive samples that have been obtained can be further filtered to identify target positive samples that contain more facial information.

[0070] Based on the image regions corresponding to the already determined first and second positive samples, several second anchor boxes are redefined on the first image. These second anchor boxes are the combination of the anchor boxes used to determine the first and second positive samples. The Intersection over Union (IOU) ratio between each second anchor box and the face bounding box is determined sequentially. Anchor boxes with IOU ratios higher than a second IOU threshold are designated as third anchor boxes. Then, based on the order of the number of facial landmarks contained within the third anchor boxes from largest to smallest, the required number of fourth anchor boxes are determined. The image region corresponding to the fourth anchor box is designated as the target positive sample, and the image regions corresponding to all other anchor boxes are designated as target negative samples. At this point, the target negative samples include the first negative sample, the second negative sample, and the image regions corresponding to the filtered first and second positive samples.

[0071] Optionally, when the number of third anchor boxes that meet the second IOU threshold exceeds the required number, and the number of anchor boxes containing facial key points is the same, making it impossible to further filter based on the number of facial key points, one or more anchor boxes with a higher IOU ratio are identified as the fourth anchor box.

[0072] For example, if the final goal is to identify a target positive sample, i.e., to identify a fourth anchor box, but there are two third anchor boxes with an IOU ratio higher than the second IOU threshold, and both third anchor boxes contain 5 facial landmarks, then it is necessary to further filter based on the IOU ratio of these two third anchor boxes. If the IOU ratios of the two anchor boxes are 0.95 and 0.9 respectively, then the third anchor box with an IOU ratio of 0.95 is identified as the fourth anchor box.

[0073] In one specific embodiment, this is a schematic diagram of a first image provided for an embodiment of the present invention. For example... Figure 3 As shown, facial landmark rectangles are determined based on five points: the pupils of both eyes, the tip of the nose, and the corners of the mouth on both sides. A first center point is then determined within these facial landmark rectangles, and a second center point is determined within the pre-defined facial landmark rectangle. The first center point is located within the grid cell in the fifth row and third column, which is designated as the first grid cell. The first anchor frame is determined based on the Intersection over Union (IOU) between the pre-defined anchor frames of the first grid cell and the facial landmark rectangle, thus identifying the first positive sample. The second center point is located within the grid cell in the fifth row and fourth column. Similarly, the second anchor frame is determined based on the IOU between the pre-defined anchor frames of this grid cell and the facial landmark rectangle, thus identifying the second positive sample.

[0074] Furthermore, the first and second positive samples are filtered to determine the target positive sample. The IOU ratios of the second anchor boxes corresponding to the first and second positive samples are 0.7 and 0.75, respectively, both satisfying the second IOU threshold. However, the first positive sample contains 5 facial landmarks, while the second positive sample contains only 2 facial landmarks. Therefore, the first positive sample is selected as the target positive sample, and the second positive sample, along with the first and second negative samples, are selected as the target negative samples.

[0075] Alternatively, the first positive sample and the second positive sample can be directly determined as the target positive sample.

[0076] Because the face is tilted, the second positive sample determined based on the second center point contains most of the cheeks. Since facial information is mostly concentrated around the eyes, nose, and mouth, the second positive sample omits some key facial information compared to the first positive sample, resulting in a decrease in accuracy when training the face detection model. Therefore, in this embodiment, the first positive sample is used as the final target sample and input into the face detection model for training.

[0077] Optionally, in some embodiments, when the applied face detection algorithm is an anchor-free algorithm, although no preset anchor frame is preset for the grid of the first image, the corresponding grid is still directly assigned according to the center point or corner point of the face rectangle. Similarly, positive samples containing more face information can be determined by the first center point of the bounding rectangle of the face key points.

[0078] S103, train the face detection model based on the target positive sample and the target negative sample.

[0079] Specifically, the acquired positive and negative target samples are input into the face detection model. The face detection model learns features from the positive and negative target samples to perform classification and regression tasks, respectively.

[0080] Optionally, when the face detection model includes a feature pyramid network (FPN) + PANet structure, separate detection heads can be set for each network layer in the FPN network. Positive and negative target samples are input into the auxiliary detection heads of each layer. The auxiliary detection heads output prediction results, which are used to supervise the classification task of the face detection model.

[0081] In this embodiment of the invention, when assigning labels to input images, positive samples are generated not only using face bounding boxes but also using facial landmark information to generate a set of positive samples containing facial information. The generated positive samples are then filtered using facial landmark information as an evaluation criterion, aiming to select image regions containing as much facial information as possible as target positive samples for training the face detection model. Simultaneously, during training, a facial landmark-assisted classification loss is used to supervise the classification task of the face detection model, thereby improving classification accuracy and reducing the probability of false detections.

[0082] Corresponding to the above-described face detection model training method, this embodiment of the invention also provides a face detection model training device, which is applied to a terminal device. See also... Figure 4 This is a schematic diagram of the structure of a face detection model training device provided in an embodiment of the present invention. Figure 4 As shown, the device may include: a first determining module 401, a second determining module 402, and a training module 403.

[0083] The first determining module 401 determines the facial key point rectangle based on the facial key points marked in the first image.

[0084] The second determining module 402 determines the target positive sample and the target negative sample in the first image based on the face key point rectangle and the preset face rectangle.

[0085] Training module 403 trains the face detection model based on the target positive sample and the target negative sample.

[0086] Figure 4 The face detection model training device provided in the illustrated embodiment can be used to execute the technical solutions of the method embodiments shown in this specification. Its implementation principle and technical effects can be further referred to the relevant descriptions in the method embodiments.

[0087] Figure 5 This is a schematic diagram illustrating the structure of one embodiment of the electronic device described in this specification. The electronic device can be implemented as a terminal device that deploys a face detection model. Figure 5 As shown, the above-mentioned electronic device may include at least one processor; and at least one memory communicatively connected to the processing unit, wherein: the memory stores program instructions executable by the processing unit, and the processor can execute the face detection model training method provided in this embodiment by calling the program instructions.

[0088] The aforementioned electronic device can be a device capable of intelligent dialogue with the user, and the specific form of the electronic device is not limited in the embodiments of this specification. It is understood that the electronic device here is the machine mentioned in the method embodiments.

[0089] Figure 5 A block diagram of an exemplary electronic device suitable for implementing embodiments of this specification is shown. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments described in this specification.

[0090] like Figure 5 As shown, the electronic device is represented in the form of a general-purpose computing device. The components of the electronic device may include, but are not limited to: one or more processors 510, communication interface 520, memory 530, and communication bus 540 connecting different system components (including memory 530, communication interface 520 and processor 510).

[0091] The communication bus 540 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. Examples of these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.

[0092] Electronic devices typically include a variety of computer-readable media. These media can be any available media that can be accessed by the electronic device, including volatile and non-volatile media, and removable and non-removable media.

[0093] Memory 530 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. Memory 530 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments described herein.

[0094] A program / utility having a set (at least one) of program modules may be stored in memory 530. Such program modules include—but are not limited to—an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. The program modules typically perform the functions and / or methods described in the embodiments of this specification.

[0095] The processor 510 executes various functional applications and data processing by running programs stored in the memory 530, such as implementing the face detection model training method provided in the embodiments shown in this specification.

[0096] This specification provides a non-transitory computer-readable storage medium that stores computer instructions that cause the computer to execute the face detection model training method provided in the embodiments shown in this specification.

[0097] The aforementioned non-transitory computer-readable storage medium may be any combination of one or more computer-readable media. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or flash memory, optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in connection with an instruction execution system, apparatus, or device.

[0098] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of transmitting, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0099] The program code contained on a computer-readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0100] Computer program code for performing the operations described herein can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0101] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0102] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this specification, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0103] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this specification includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which the embodiments of this specification pertain.

[0104] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."

[0105] It should be noted that the terminals involved in the embodiments of this specification may include, but are not limited to, personal computers (hereinafter referred to as PCs), personal digital assistants (hereinafter referred to as PDAs), wireless handheld devices, tablet computers, mobile phones, MP3 players, MP4 players, etc.

[0106] In the embodiments provided in this specification, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0107] Furthermore, the functional units in the various embodiments of this specification can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in a combination of hardware and software functional units.

[0108] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this specification.

[0109] The above description is merely a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of protection of this specification.

Claims

1. A method for training a face detection model, characterized in that, The method includes: Determine the facial landmark bounding box based on the facial landmarks marked in the first image; Based on the facial key point bounding box and the preset facial bounding box, target positive samples and target negative samples are determined in the first image; The face detection model is trained based on the target positive samples and the target negative samples; The step of determining target positive samples and target negative samples in the first image based on the facial key point bounding box and a preset facial bounding box includes: Determine the first center point of the facial key point rectangle and the second center point of the facial rectangle; The first positive sample and the first negative sample of the first image are determined based on the first center point, and the second positive sample and the second negative sample of the first image are determined based on the second center point; The target positive sample is determined based on the first positive sample and the second positive sample, and the target negative sample is determined based on the target positive sample; Determining the target positive sample based on the first positive sample and the second positive sample includes: Based on the image regions corresponding to the first positive sample and the second positive sample, a plurality of second anchor boxes are determined on the first image; In each of the second anchor frames, at least one anchor frame whose IOU ratio with the face rectangle is higher than the second IOU threshold is determined as the third anchor frame; Based on the number of facial key points contained in each of the third anchor frames, a fourth anchor frame is determined from the third anchor frames; The image region corresponding to the fourth anchor frame is determined as the target positive sample, and the image regions corresponding to the other anchor frames besides the fourth anchor frame are determined as the target negative samples.

2. The method of claim 1, wherein, The step of determining the first positive sample and the first negative sample of the first image based on the first center point includes: Based on the position coordinates of the first center point in the first image, the first grid cell where the first center point is located is determined from a plurality of preset grid cells in the first image. The preset anchor frames are determined as preset for the first grid; Among the preset anchor frames, at least one anchor frame whose intersection-union ratio (IOU) with the face rectangle is higher than the first IOU threshold is determined as the first anchor frame; The image region corresponding to the first anchor frame is determined as the first positive sample, and the image regions corresponding to other anchor frames besides the first anchor frame are determined as the first negative samples.

3. The method of claim 1, wherein, The step of determining a fourth anchor frame from the third anchor frames based on the number of facial key points contained in each of the third anchor frames includes: Based on the required number of fourth anchor frames, the third anchor frame containing more facial key points among all the third anchor frames is determined as the fourth anchor frame; For any two third anchor frames that contain the same number of facial key points, the third anchor frame with the higher IOU ratio is determined as the fourth anchor frame.

4. The method of claim 1, wherein, The method for determining the target positive sample based on the first positive sample and the second positive sample further includes: The first positive sample and the second positive sample are jointly determined as the target positive sample.

5. The method of claim 1, wherein, The step of training the face detection model based on the target positive samples and the target negative samples includes: When the face detection model includes a feature pyramid FPN+PANet structure, auxiliary detection heads are set for each network layer in the FPN network; The target positive sample and the target negative sample are input into the auxiliary detection head to obtain the prediction result of the auxiliary detection head; The classification task of the face detection model is supervised based on the prediction results of the auxiliary detection head. 6.A device for training a face detection model, characterized in that, include: The first determining module determines the facial key point rectangle based on the facial key points marked in the first image; The second determining module determines the target positive sample and the target negative sample in the first image based on the facial key point rectangle and the preset facial rectangle. The training module trains the face detection model based on the target positive samples and the target negative samples; The step of determining target positive samples and target negative samples in the first image based on the facial key point bounding box and a preset facial bounding box includes: Determine the first center point of the facial key point rectangle and the second center point of the facial rectangle; The first positive sample and the first negative sample of the first image are determined based on the first center point, and the second positive sample and the second negative sample of the first image are determined based on the second center point; The target positive sample is determined based on the first positive sample and the second positive sample, and the target negative sample is determined based on the target positive sample; Determining the target positive sample based on the first positive sample and the second positive sample includes: Based on the image regions corresponding to the first positive sample and the second positive sample, a plurality of second anchor boxes are determined on the first image; In each of the second anchor frames, at least one anchor frame whose IOU ratio with the face rectangle is higher than the second IOU threshold is determined as the third anchor frame; Based on the number of facial key points contained in each of the third anchor frames, a fourth anchor frame is determined from the third anchor frames; The image region corresponding to the fourth anchor frame is determined as the target positive sample, and the image regions corresponding to the other anchor frames besides the fourth anchor frame are determined as the target negative samples.

7. An electronic device, comprising: include: At least one processor; as well as At least one memory communicatively connected to the processor, wherein: The memory stores program instructions that can be executed by the processor, and the processor can execute the method as described in any one of claims 1 to 5 by calling the program instructions.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the method of any one of claims 1 to 5.

Citation Information

Patent Citations

  • Human face detection method and apparatus, computer readable storage medium, and device

    CN107403141A