Face detection methods, devices, computer equipment and storage media
By combining the feature vectors of small and large network models, the target loss function value is generated to optimize the training parameters, which solves the problems of slow face detection speed and low accuracy in existing technologies, and achieves fast and accurate face recognition.
Patent Information
- Application Number
- CN201910100400.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-01-31
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2039-01-31
AI Technical Summary
Existing face detection technologies have low recognition rates when dealing with occluded, blurred, or small faces in the image, while large network-based methods are slow and have long training times.
Face detection is performed using a small network model. The feature vector output by the first network model is input into the second network model. The target loss function value is generated using preset rules, and the training parameters are optimized to improve the recognition accuracy and speed.
While maintaining recognition speed, it improves the accuracy of face detection and reduces training time and computational complexity.
Smart Images

Figure CN111507135B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of facial recognition technology, and more specifically, to a facial detection method, apparatus, computer device, and storage medium. Background Technology
[0002] With the development of computer technology, more and more services and testing projects are adopting automatic detection methods to save labor costs. In particular, automatic identification methods are used for human identification when checking tickets or handling related business.
[0003] In existing technologies, facial recognition is often used to identify human identities. Since faces are not easily altered, facial images are captured and processed to determine identity. However, in practical applications, existing face detection technologies suffer from low recognition rates for faces that are occluded, severely blurred, or occupy a small portion of the image. High-accuracy methods in current technologies rely on large networks, but these methods are slow and require long training times. Summary of the Invention
[0004] This application addresses the problems of slow speed when using large networks and low accuracy when using small networks by proposing a face detection method, device, computer equipment, and storage medium.
[0005] On the one hand, this application discloses a face detection method, including
[0006] Obtain the image of the target face to be identified;
[0007] The target face image is input into a first network model to output a first prediction result, wherein the first prediction result includes a first feature vector representing the predicted position of the target feature points;
[0008] The first feature vector is input into the second network model to obtain the target loss function value according to a preset rule;
[0009] The target face image is input into the second network model so that the second network model outputs the face recognition result based on the target loss function value.
[0010] Optionally, the method of inputting the target face image into the first network model to output a first prediction result includes:
[0011] Obtain the feature layer of the target face image in the first network model;
[0012] Obtain the predicted position of the target feature point in the feature layer;
[0013] Output the first feature vector representing the predicted location.
[0014] Optionally, the preset rule includes substituting the first feature vector of the target feature point into the original loss function of the second network model to generate the target loss function value.
[0015] Optionally, the method of inputting the first feature vector into the second network model to obtain the target loss function value according to a preset rule includes:
[0016] Obtain a second feature vector representing the predicted position of the target feature point in the second network model;
[0017] Obtain the initial loss function of the second network model;
[0018] The target loss function value is obtained by adding the initial loss function value based on the second feature vector to the initial function value based on the first feature vector.
[0019] Optionally, the method of adding the initial loss function value based on the second feature vector to the initial function value based on the first feature vector to obtain the target loss function value includes: matching the initial function value of the first feature vector with a preset weight value and then adding it to the second target loss function value.
[0020] Optionally, the expression for the original loss function value is:
[0021]
[0022] Among them, S 2 The size of the target image is represented by xi, yi, wi, hi, and Ci, which represent the calibration values of the target object, respectively. and These represent the predicted values of the target object's position.
[0023] Optionally, the expression for the target loss function value is:
[0024]
[0025] Among them, S 2 The size of the target image is represented by xi, yi, wi, hi, and Ci, which represent the calibration values of the target object, respectively. and These represent the predicted values of the target object's position; and This represents the predicted value of the large network model.
[0026] On the other hand, this application also discloses a face detection device, including
[0027] Acquisition module: Configured to acquire the target face image to be identified;
[0028] The first processing module is configured to input the target face image into a first network model to output a first prediction result, wherein the first prediction result includes a first feature vector representing the predicted position of the target feature points;
[0029] The second processing module is configured to input the first feature vector into the second network model and obtain the target loss function value according to a preset rule.
[0030] Execution module: configured to input the target face image into the second network model so that the second network model outputs the face recognition result based on the target loss function value.
[0031] Optionally, the first processing module further includes:
[0032] Feature acquisition module: configured to acquire the feature layer of the target face image in the first network model;
[0033] Predicted location acquisition module: configured to acquire the predicted location of the target feature point in the feature layer;
[0034] First output module: configured to output a first feature vector representing the predicted location.
[0035] Optionally, the preset rule includes substituting the first feature vector of the target feature point into the original loss function of the second network model to generate the target loss function value.
[0036] Optionally, the second processing module includes:
[0037] Feature vector acquisition module: configured to acquire a second feature vector representing the predicted position of the target feature point in the second network model;
[0038] Loss function acquisition module: configured to acquire the initial loss function of the second network model;
[0039] The target loss function processing module is configured to add the initial loss function value based on the second feature vector to the initial function value based on the first feature vector to obtain the target loss function value.
[0040] Optionally, the target loss function processing module further includes a weight matching module: configured to match the initial function value of the first feature vector with a preset weight value and then add it to the second target loss function value.
[0041] Optionally, the expression for the original loss function value is:
[0042]
[0043] Among them, S 2 The size of the target image is represented by xi, yi, wi, hi, and Ci, which represent the calibration values of the target object, respectively. and These represent the predicted values of the target object's position.
[0044] Optionally, the expression for the target loss function value is:
[0045]
[0046] Among them, S 2 The size of the target image is represented by xi, yi, wi, hi, and Ci, which represent the calibration values of the target object, respectively. and These represent the predicted values of the target object's position; and This represents the predicted value of the large network model.
[0047] According to a third aspect, embodiments of this application also provide a computer device including a memory and a processor, wherein the memory stores computer-readable instructions, which, when executed by the processor, cause the processor to perform the steps of the face detection method described above.
[0048] According to a fourth aspect, embodiments of this application also provide a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the face detection method described above.
[0049] The beneficial effects of the embodiments of this application are:
[0050] The second network model disclosed in this application is smaller in size compared to the first network model. The first network model is a large network model with extensive training techniques and high face detection accuracy. However, due to its large training sample size, it requires a longer time and is more complex to perform face recognition. The second network model, on the other hand, is a small network model. Small network models require fewer training variables (weights), a smaller model size, or only a small number of training sample images to train to convergence. It has a smaller training sample size and faster face recognition speed, but its accuracy is lower than that of the first network model. To accelerate recognition speed while maintaining accuracy, a first feature vector is obtained from the first network model. This first feature vector is then input into the second network model to obtain a target loss function value according to preset rules. The second network model uses this target loss function to calculate the loss and backpropagates it to optimize training parameters, thereby improving the recognition accuracy of the second network model. Attached Figure Description
[0051] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:
[0052] Figure 1 Here is a flowchart of a face detection method for this application;
[0053] Figure 2 This is a flowchart illustrating the method for selecting a target face image from a video file according to this application.
[0054] Figure 3 Here is a flowchart of the training process for the convolutional neural network model in this application:
[0055] Figure 4 Flowchart of the method for outputting the first prediction result for this application;
[0056] Figure 5 This is a flowchart illustrating the method for obtaining the target loss function in this application.
[0057] Figure 6 This is a block diagram of the applicant's face detection device;
[0058] Figure 7 This is a basic structural block diagram of a computer device according to an embodiment of this application. Detailed Implementation
[0059] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0060] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the word “comprising” as used in the specification of this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0061] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0062] Please see Figure 1 This embodiment discloses a face detection method, including:
[0063] S1000: Obtain the target face image to be identified;
[0064] The target face image includes currently captured or uploaded images containing faces, or images containing faces obtained from currently captured or uploaded video files. The sources of these images and videos can be public image databases, proprietary image databases, or data crawled from the internet. It should be noted that images obtained from video files are frames from the video. Frames containing faces are identified from multiple frames, and through comparison, one of these identical or similar frames is selected as the target face image for further identification.
[0065] For further details, please refer to Figure 2 Methods for selecting one image from a video file as the target face image include:
[0066] S1100. Input the video file into the classification neural network model;
[0067] S1200: Identify target face images containing human faces using a classification neural network model.
[0068] The classification neural network model here can be any neural network model capable of image recognition, such as convolutional neural networks (CNN), deep neural networks (DNN), recurrent neural networks (RNN), or variations of the above three network models. In this application, a convolutional neural network model is preferably used to recognize target face images in video files.
[0069] It's important to note that the target face image is a keyframe image from the video file. The concept of a keyframe comes from IPB frames in the open-source video software platform FFmpeg. An I-frame represents a keyframe, preserving the complete image of a single frame. A P-frame represents the difference between this frame and a previous keyframe. Decoding requires overlaying the previously cached images with the differences defined in this frame to generate the final image, also known as a difference frame. A P-frame doesn't contain complete image data, only data showing the difference from the previous frame. A B-frame is a bidirectional difference frame; it records the difference between the current frame and the frames before and after it. In other words, decoding a B-frame requires not only retrieving the previously cached images but also decoding the subsequent images. The final image is obtained by overlaying the data from the previous and subsequent images with the current frame's data. B-frames have a high compression ratio, but decoding them requires a large amount of data processing by the CPU.
[0070] Keyframes store key information about a particular frame in the encoded video and can provide some prediction information to P-frames and B-frames. B-frames and P-frames represent forward prediction and bidirectional prediction frames, respectively. Their data depends on I-frames, but they can save video file size and improve video file quality.
[0071] Convolutional neural network (CNN) models can identify the specific categories of objects from keyframe images, thereby extracting the location and style of faces. The style recognition of each object in the CNN model is obtained through training on training samples containing classification information. For details, please refer to [link to relevant documentation]. Figure 3 Its training process includes:
[0072] S1210. Obtain training sample data labeled with classification judgment information; the training sample data includes available feature extraction judgment information of frame images;
[0073] Training sample data is the building block of the entire training set, which consists of several training sample data.
[0074] The training sample data includes available feature extraction and judgment information for frame images.
[0075] Classification judgment information refers to the subjective judgments people make on training sample data based on the training direction of the input convolutional neural network model, using universally applicable judgment criteria and factual states. In other words, it represents people's expected target for the output value of the convolutional neural network model. For example, if a person manually identifies an image in a training sample as the same as a pre-stored target image, then the image is classified as identical to the pre-stored target image.
[0076] S1220. Input the training sample data into a preset convolutional neural network model to obtain the model classification reference information of the training sample data;
[0077] The training sample set is sequentially input into the convolutional neural network model, and the model classification reference information output by the penultimate fully connected layer of the convolutional neural network model is obtained.
[0078] The classification reference information is the activation data output by the convolutional neural network model based on the input image information. Before the convolutional neural network model is trained to convergence, the classification reference information is a highly discrete value. After the convolutional neural network model is trained to convergence, the classification reference information is relatively stable data.
[0079] S1230. Compare the model classification reference information and the classification judgment information of different samples in the training sample data using the loss function to see if they are consistent.
[0080] The loss function is used to detect whether the classification reference information in a convolutional neural network (CNN) model is consistent with the expected classification judgment. When the output of the CNN model is inconsistent with the expected result of the classification judgment, the weights in the CNN model need to be corrected to make the output of the CNN model the same as the expected result of the classification judgment.
[0081] S1240. When the model classification reference information is inconsistent with the classification judgment information, the weights in the convolutional neural network model are updated iteratively until the comparison result is consistent with the classification judgment information, and the training of the image recognition model is completed.
[0082] When the output of a convolutional neural network model is inconsistent with the expected result of the classification information, the weights in the convolutional neural network model need to be corrected so that the output of the convolutional neural network model is the same as the expected result of the classification information.
[0083] Using the methods described above, we determine whether the keyframes extracted from the video file contain images of faces, and then extract the frames containing images of faces for further analysis.
[0084] S2000, Input the target face image into the first network model to output a first prediction result, wherein the first prediction result includes a first feature vector representing the predicted position of the target feature points;
[0085] The target face image disclosed here is an image with a face obtained through the above step S1000, which is identified by a classification neural network model. The classification neural network model in step S1000 can be a convolutional neural network model, a deep neural network, a recurrent neural network, or a variant of the above three network models. Similarly, the first network model in this application is also a neural network model, which can be any one of a convolutional neural network model, a deep neural network, a recurrent neural network, or a variant of the above three network models. Therefore, it can identify the input target face image.
[0086] In this application, the output of the first network model is required to be a first feature vector representing the predicted location of the target feature points. The target feature points are the points in the target face image that need to be identified. Taking the YOLO (You Only Look Once) series network structure as an example, YOLO solves object detection as a regression problem. Based on a single end-to-end network, it completes the process from inputting the original image to outputting the object location and category. YOLO training and detection are both performed in a separate network. YOLO does not explicitly obtain a region proposal process. YOLO solves object detection as a regression problem; after one inference iteration, the input image can obtain the location of all objects in the image, their category, and the corresponding confidence probability. YOLO divides the input image into SxS grids, with each grid responsible for detecting objects 'falling into' that grid. If the center coordinates of an object fall into a certain grid, then that grid is responsible for detecting that object. For example, in a picture containing a dog, if the center of the dog falls within the cell in the 5th row and 2nd column of a network that divides the image according to certain rules, that cell is responsible for predicting the dog in the image. Each cell outputs B bounding boxes (rectangular regions containing the object) and C probability information of the object belonging to a certain category.
[0087] The bounding box information contains five data values: x, y, w, h, and c (confidence). x and y refer to the coordinates of the center position of the bounding box predicted from the current cell. w and h are the width and height of the bounding box. Note: During actual training, the values of w and h are normalized to the [0,1] interval using the image width and height; x and y are the offset values of the bounding box center position relative to the current cell position, and are also normalized to [0,1].
[0088] C (confidence) reflects whether the current bounding box contains an object and the accuracy of the object's position. It is calculated as follows:
[0089] confidence = P(object)
[0090] *IOU, where P(object) = 1 if the bounding box contains an object, and 0 otherwise. IOU (intersection over union) is the area of intersection between the predicted bounding box and the ground truth region of the object (in pixels, normalized to the [0,1] interval using the pixel area of the ground truth region). Therefore, the output dimension of the final fully connected layer of the YOLO network is S*S*(B*5+C). YOLO uses the mean squared error as the loss function to optimize the model parameters, which is the mean squared error between the network output S*S*(B*5+C) dimensional vector and the corresponding S*S*(B*5+C) dimensional vector of the ground truth image.
[0091] Based on the above principles, the target feature points in this application are the grid at the center position of the object disclosed above. Further details can be found in the following documents. Figure 4 The method of inputting the target face image into the first network model to output a first prediction result includes:
[0092] S2100: Obtain the feature layer of the target face image in the first network model;
[0093] S2200: Obtain the predicted position of the target feature point in the feature layer;
[0094] S2300, Output the first feature vector representing the predicted location.
[0095] The YOLO network outputs three loss layers, each corresponding to the loss of a feature map layer. For each feature map layer, each point corresponds to a region in the original image. Therefore, the feature map layer predicts the confidence level of each point as a face and the deviation of the predicted location. The loss layer calculates the loss based on the Euclidean distance between the predicted and labeled locations and feeds it back to optimize the training parameters.
[0096] In the first network model, the feature layer of the target face image is obtained. Taking the YOLO network as an example, based on the above working principle, the predicted position of the target feature point in the feature layer can be obtained. This position can obtain a bounding box (a rectangular area containing the object). Each bounding box includes five data types: x, y, w, h, and c. These data are combined to form the first feature vector of the predicted position.
[0097] S3000: Input the first feature vector into the second network model to obtain the target loss function value according to the preset rules;
[0098] The second network model is also a neural network model, which can be a convolutional neural network, a deep neural network, a recurrent neural network, or any of the above three network models. It should be noted that the second network model in this application is smaller in size than the first network model. That is, the first network model is a large network model with a large training technique and high face detection accuracy. However, due to its large training base, it takes a long time and is relatively complex in the face recognition process. The second network model, on the other hand, is a small network model. A small network model is a neural network model that can be trained to convergence with a small number of free variables (weights) and a small model size, or with only a small number of training sample images. It has a smaller training base and can recognize faces quickly, but its accuracy is lower than that of the first network model. In order to speed up the recognition speed while ensuring the accuracy of the recognition results, an auxiliary training model is needed for training. Furthermore, in this embodiment, the auxiliary training model participating in the training is the first network model. The first network model has a high recognition accuracy. The first feature vector is obtained through the first network model. The first feature vector is combined with the second feature vector obtained in the second network model due to the same target face image as input. A target loss function value that can obtain more accurate recognition results is generated through preset rules. The loss is calculated in the second network model through the target loss function and the training parameters are back-propagated to optimize the training parameters, so as to improve the recognition accuracy of the second network model.
[0099] For further details, please refer to Figure 5The method of inputting the first feature vector into the second network model to obtain the target loss function value according to a preset rule includes:
[0100] S3100: Obtain a second feature vector representing the predicted position of the target feature point in the second network model;
[0101] S3200, Obtain the initial loss function of the second network model;
[0102] S3300: The initial loss function value based on the second feature vector is added to the initial function value based on the first feature vector to obtain the target loss function value.
[0103] In this embodiment, the second feature vector is extracted by the second network model. When the second network model outputs the final recognition result, it calculates the loss using a loss function and feeds it back to optimize the training parameters. In this embodiment, the loss function used by the second network model to output the second feature vector is called the original loss function, and the expression for the value of the original loss function is:
[0104]
[0105] Among them, S 2 The size of the target image is represented by xi, yi, wi, hi, and Ci, which represent the calibration values of the target object, respectively. and These represent the predicted values of the target object's position, i.e., the second feature vector. The calibration value of the target object is the actual vector value representing the center position of the target object in the target face image.
[0106] The method of adding the initial loss function value based on the second feature vector to the initial function value based on the first feature vector to obtain the target loss function value includes: matching the initial function value of the first feature vector with a preset weight value and then adding it to the second target loss function value.
[0107] In this embodiment, the first feature vector is substituted into the original loss function, and after matching with a preset weight value, it is added to the second target loss function value obtained by substituting the second feature vector to obtain the target loss function value. Further, the expression for the target loss function value is:
[0108]
[0109] Among them, S 2 The size of the target image is represented by xi, yi, wi, hi, and Ci, which represent the calibration values of the target object, respectively. and These represent the predicted values of the target object's position; and This represents the predicted value of the large network model. Here, α is a fixed value, the specific value of which is obtained by comparing it with the true value during the previous training. It represents a fixed parameter.
[0110] It should be noted that, as described above, inputting the first feature vector into the original loss function yields the Euclidean distance between the first feature vector and the calibration value, and inputting the second feature vector into the original loss function yields the Euclidean distance between the second feature vector and the calibration value. The weight value α is used to balance the importance of the two distances. Since both distances are based on the same calibration value, the data returned by the target loss function composed of the two distance values is more accurate than the calculated value obtained by the original loss function.
[0111] S4000: Input the target face image into the second network model so that the second network model outputs the face recognition result according to the target loss function value.
[0112] Once the target loss function is obtained, the target face image is processed using this loss function to output the face recognition result. After testing on the publicly available face detection dataset FDDB (Face Detection Data Set and Benchmark), with 100 false positives, the first network model achieved a detection rate of 90%, the second network model alone achieved 80%, and the second network model trained under the supervision of the first network model achieved a detection rate of 88%. This demonstrates that the second network model trained under the supervision of the first network model not only maintains the same speed and computational complexity as the second network model alone during testing, but also improves the testing accuracy of the second network model.
[0113] On the other hand, please see Figure 6 This application also discloses a face detection device, including
[0114] Module 1000: Configured to acquire the target face image to be identified;
[0115] First processing module 2000: configured to input the target face image into a first network model to output a first prediction result, wherein the first prediction result includes a first feature vector representing the predicted position of the target feature points;
[0116] The second processing module 3000 is configured to input the first feature vector into the second network model to obtain the target loss function value according to a preset rule.
[0117] Execution module 4000: is configured to input the target face image into the second network model so that the second network model outputs a face recognition result based on the target loss function value.
[0118] Optionally, the first processing module further includes:
[0119] Feature acquisition module: configured to acquire the feature layer of the target face image in the first network model;
[0120] Predicted location acquisition module: configured to acquire the predicted location of the target feature point in the feature layer;
[0121] First output module: configured to output a first feature vector representing the predicted location.
[0122] Optionally, the preset rule includes substituting the first feature vector of the target feature point into the original loss function of the second network model to generate the target loss function value.
[0123] Optionally, the second processing module includes:
[0124] Feature vector acquisition module: configured to acquire a second feature vector representing the predicted position of the target feature point in the second network model;
[0125] Loss function acquisition module: configured to acquire the initial loss function of the second network model;
[0126] The target loss function processing module is configured to add the initial loss function value based on the second feature vector to the initial function value based on the first feature vector to obtain the target loss function value.
[0127] Optionally, the target loss function processing module further includes a weight matching module: configured to match the initial function value of the first feature vector with a preset weight value and then add it to the second target loss function value.
[0128] Optionally, the expression for the original loss function value is:
[0129]
[0130] Among them, S 2 The size of the target image is represented by xi, yi, wi, hi, and Ci, which represent the calibration values of the target object, respectively. and These represent the predicted values of the target object's position.
[0131] Optionally, the expression for the target loss function value is:
[0132]
[0133] Among them, S 2 The size of the target image is represented by xi, yi, wi, hi, and Ci, which represent the calibration values of the target object, respectively. and These represent the predicted values of the target object's position; and This represents the predicted value of the large network model.
[0134] Since the above face detection methods and face detection devices are implemented on the same principle, the specific descriptions based on the face detection devices will not be repeated here.
[0135] Please refer to the basic structural block diagram of the computer device provided in this embodiment of the invention. Figure 7 .
[0136] The computer device includes a processor, a non-volatile storage medium, a memory, and a network interface connected via a system bus. The non-volatile storage medium stores an operating system, a database, and computer-readable instructions. The database may store a sequence of control information. When executed by the processor, the computer-readable instructions enable the processor to implement a face detection method. The processor provides computational and control capabilities, supporting the operation of the entire computer device. The memory stores computer-readable instructions, which, when executed by the processor, enable the processor to perform a face detection method. The network interface is used for communication with a terminal. Those skilled in the art will understand that… Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0137] The computer device receives status information about the prompting behavior from associated clients, indicating whether the associated terminal has enabled prompts and whether the borrower has disabled the prompting task. By verifying whether these task conditions are met, the device sends a corresponding preset instruction to the associated terminal, enabling the terminal to perform the appropriate operation, thus achieving effective monitoring of the associated terminal. Simultaneously, if the prompting information status differs from the preset status instruction, the server controls the associated terminal to continuously ring, preventing the prompting task from automatically terminating after a period of time.
[0138] The present invention also provides a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the face detection method described in any of the above embodiments.
[0139] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0140] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0141] The above description is only a partial embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A face detection method, characterized in that, include: Obtain the image of the target face to be identified; The target face image is input into a first network model to output a first prediction result, wherein the first prediction result includes a first feature vector representing the predicted position of the target feature points; The first feature vector is input into the second network model to obtain the target loss function value according to a preset rule; The target face image is input into the second network model so that the second network model outputs the face recognition result based on the target loss function value; The method of inputting the first feature vector into the second network model to obtain the target loss function value according to a preset rule includes: Obtain a second feature vector representing the predicted position of the target feature point in the second network model; Obtain the original loss function of the second network model; the original loss function is the loss function used when the second network model outputs the second feature vector; The first feature vector is substituted into the original loss function and matched with a preset weight, and then added to the second target loss function value obtained after substituting the second feature vector to obtain the target loss function value.
2. The face detection method according to claim 1, characterized in that, The method of inputting the target face image into the first network model to output a first prediction result includes: Obtain the feature layer of the target face image in the first network model; Obtain the predicted position of the target feature point in the feature layer; Output the first feature vector representing the predicted location.
3. The face detection method according to claim 1, characterized in that, The expression for the original loss function value is: Among them, S 2 The size of the target image is represented by xi, yi, wi, hi, and Ci, which represent the calibration values of the target object, respectively. and These represent the predicted values of the target object's position.
4. The face detection method according to claim 1, characterized in that, The expression for the target loss function value is: Among them, S 2 The size of the target image is represented by xi, yi, wi, hi, and Ci, which represent the calibration values of the target object, respectively. and These represent the predicted values of the target object's position; and This represents the predicted value of the large network model.
5. A face detection device, characterized in that, include: Acquisition module: Configured to acquire the target face image to be identified; The first processing module is configured to input the target face image into a first network model to output a first prediction result, wherein the first prediction result includes a first feature vector representing the predicted location of the target feature points; The second processing module is configured to input the first feature vector into the second network model and obtain the target loss function value according to a preset rule. Execution module: configured to input the target face image into the second network model so that the second network model outputs a face recognition result based on the target loss function value; The method of inputting the first feature vector into the second network model to obtain the target loss function value according to a preset rule includes: Obtain a second feature vector representing the predicted position of the target feature point in the second network model; Obtain the original loss function of the second network model; the original loss function is the loss function used when the second network model outputs the second feature vector; The first feature vector is substituted into the original loss function and matched with a preset weight, and then added to the second target loss function value obtained after substituting the second feature vector to obtain the target loss function value.
6. A computer device comprising a memory and a processor, the memory storing computer-readable instructions which, when executed by the processor, cause the processor to perform the steps of the face detection method as claimed in any one of claims 1 to 4.
7. A storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the face detection method as claimed in any one of claims 1 to 4.