Face detection method, device, electronic device and storage medium

By using a large model to generate images that meet image conditions for data enhancement, and using a phased loss function to adjust the face detection model, the shortcomings of face detection in the existing technology under high computational complexity and occlusion are solved, and efficient, real-time and robust face detection effects are achieved.

CN119785393APending Publication Date: 2025-04-08CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411705474.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-26
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

Existing face detection technology is difficult to achieve real-time operation under high computing complexity and memory requirements, especially in security monitoring and mobile application scenarios. In addition, face detection results in concealment situations (such as wearing masks).

Method used

By obtaining text instructions carrying image conditions, using the big model to generate images that meet image conditions for data augmentation and expand the training data set. Then, the face detection model is adjusted by using a phased loss function to generate the target face detection model. This model can run efficiently under limited computing resources and improves detection accuracy of occluded faces.

Benefits of technology

It realizes efficient operation of large models under limited computing resources, improving the real-time and robustness of face detection, especially when facing occlusion, which significantly improves detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119785393A_ABST
    Figure CN119785393A_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a face detection method, which is applied to the field of face detection, by obtaining a text instruction carrying an image condition, generating an image that meets the image condition according to the text instruction through a preset first large model, training a preset face detection model through a training data set after data enhancement, and in the training process, adjusting the face detection model using a preset staged loss function, generating a target face detection model, obtaining an image to be detected collected by a home security monitoring system, using the target face detection model, detecting the image to be detected, and obtaining a face detection result. The face detection model is trained through a training data set after data enhancement, which improves the richness of the training data and the comprehensiveness of the model training. When facing face recognition tasks under various conditions, the robustness of the model is greatly enhanced, and the accuracy of face detection is further improved through the introduction of a staged loss function.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of face detection technology, and in particular to a face detection method, device, electronic device and storage medium. Background Art

[0002] Face detection technology is an important task in the field of computer vision, which aims to automatically detect the position and bounding box of a face from an image or video. It is an essential link in technologies such as face recognition, face tracking, and facial expression recognition. This technology has a wide range of applications in security monitoring, face recognition, social media, human-computer interaction, and other fields. The goal of face detection is to find all possible faces in an image or video frame and determine their position and size. Usually, the face detection system outputs a rectangular box (bounding box) containing the face area, and sometimes also outputs the key points of the face (such as eyes, nose, mouth, etc.).

[0003] Applying large models to face detection tasks can fully utilize the advantages of large models in feature extraction and pattern recognition. However, this combination also faces many technical challenges. Large models usually have high computational complexity and memory requirements, while face detection has high real-time requirements, especially in scenarios such as security monitoring and mobile applications, which require the model to run quickly with limited computing resources. How to efficiently run large models with limited computing resources is a key issue.

[0004] In addition, in actual application scenarios, the face to be detected is often blocked. For example, in hospitals or crowded places, people need to wear masks to enter and exit. The mask blocks the collected face images or videos, which causes a large loss of face features, which will affect the face detection results. Therefore, occluded face detection has a very important research significance. Summary of the invention

[0005] In view of the above problems, a face detection method, device, electronic device and storage medium are proposed to overcome the above problems or at least partially solve the above problems, including:

[0006] In a first aspect of the implementation of the present application, a face detection method is first provided, characterized in that the method comprises:

[0007] Get text instructions that carry image conditions;

[0008] Generate an image satisfying the image condition according to the text instruction by using a preset first large model, so as to perform data enhancement on the training data set by using the image satisfying the image condition;

[0009] The preset face detection model is trained by using the training data set after data enhancement, and during the training process, the face detection model is adjusted by using a preset staged loss function to generate a target face detection model;

[0010] Acquire the image to be detected collected by the home security monitoring system;

[0011] In the case that the image to be detected is an image associated with the image condition, the target face detection model is used to detect the image to be detected to obtain a face detection result.

[0012] In an optional embodiment of the present application, the step of generating an image satisfying the image condition according to the text instruction by using a preset first large model includes:

[0013] In the case where the image condition is a non-face image, generating a non-face image set by using a preset first large model;

[0014] Generate a non-face data label for the non-face image set according to a preset label format.

[0015] In an optional embodiment of the present application, before training the preset face detection model using the training data set after data enhancement, the method includes:

[0016] Acquire an occluded face image set to perform data enhancement on a training data set through the occluded face image set, wherein the occluded face image set includes at least one of a mask occluded face image set, a glasses occluded face image set, and a hat occluded face image set;

[0017] Generate simulated reference labels for the occluded face image set through a preset second largest model.

[0018] In an optional embodiment of the present application, the preset face detection model is trained using the data-enhanced training data set, including:

[0019] Obtain a set of unobstructed face images;

[0020] Taking the unobstructed face image set and the obstructed face image set as positive sample data sets;

[0021] Using the non-face image set as a negative sample dataset;

[0022] The face detection model is trained using the positive sample data set and the negative sample data set.

[0023] In an optional embodiment of the present application, during the training process, a preset staged loss function is used to adjust the face detection model to generate a target face detection model, including:

[0024] Inputting the positive sample data set and the negative sample data set into the preset second largest model to obtain first data output by the second largest model, wherein the first data includes first face bounding box probability data and first face category probability data;

[0025] Inputting the positive sample data set and the negative sample data set into the face detection model to obtain second data and third data output by the face detection model, wherein the second data includes second face bounding box probability data and second face category probability data, and the third data includes face bounding box coordinate data and face key point coordinate data;

[0026] Acquire reference labels, wherein the reference labels include face bounding box reference labels and face key point reference labels;

[0027] Determine, according to the preset stage-by-stage loss function, a first difference between the first data and the second data, and a second difference between the reference label and the third data;

[0028] The face detection model is adjusted according to the first difference and the second difference to generate a target face detection model.

[0029] In an optional embodiment of the present application, the preset second largest model includes a backbone network, a neck network and a head network, and the face detection model also includes a backbone network, a neck network and a head network. During the training process, the preset staged loss function is used to adjust the face detection model to generate a target face detection model, including:

[0030] Inputting the positive sample data set and the negative sample data set into the preset second largest model, obtaining the first trunk output of the trunk network, the first neck output of the neck network, and the first head output of the head network in the preset second largest model;

[0031] Inputting the positive sample data set and the negative sample data set into the face detection model, obtaining a second trunk output of the trunk network, a second neck output of the neck network, and a second head output of the head network in the face detection model;

[0032] Adjusting the backbone network of the face detection model according to the difference between the first backbone output and the second backbone output;

[0033] Adjusting a neck network of the face detection model according to a difference between the first neck output and the second neck output;

[0034] Adjusting the head network of the face detection model according to a difference between the first head output and the second head output;

[0035] The adjusted face detection model is determined as the target face detection model.

[0036] In an optional embodiment of the present application, when the image to be detected is an image associated with the image condition, the target face detection model is used to detect the image to be detected to obtain a face detection result, including:

[0037] Extracting a face image from the image to be detected;

[0038] In the case where the face image is partially occluded, the target face detection model is used to detect the image to be detected to obtain a face detection result.

[0039] In a second aspect of the present application, a face detection device is provided, which is characterized by comprising:

[0040] A first acquisition module is used to acquire a text instruction carrying an image condition;

[0041] A data enhancement module, used to generate an image satisfying the image condition according to the text instruction by using a preset first large model, so as to perform data enhancement on the training data set by using the image satisfying the image condition;

[0042] A first adjustment module is used to train a preset face detection model using the training data set after data enhancement, and during the training process, use a preset staged loss function to adjust the face detection model to generate a target face detection model;

[0043] An image acquisition module, used to acquire the image to be detected collected by the home security monitoring system;

[0044] The face detection module is used to detect the image to be detected by using the target face detection model to obtain a face detection result when the image to be detected is an image associated with the image condition.

[0045] An embodiment of the present application also discloses an electronic device, including: a processor; and a memory, on which executable code is stored. When the executable code is executed, the processor executes the face detection method as described in one or more of the embodiments of the present application.

[0046] The embodiments of the present application also disclose one or more machine-readable media on which executable codes are stored. When the executable codes are executed, a processor executes the face detection method as described in one or more of the embodiments of the present application.

[0047] The embodiments of the present application also disclose a computer program product, including a computer program / instruction, which, when executed by a processor, implements the face detection method as described in one or more of the embodiments of the present application.

[0048] The embodiments of the present application have the following advantages:

[0049] A text instruction carrying an image condition is obtained, and an image satisfying the image condition is generated according to the text instruction through the preset first model, so as to enhance the training data set through the image satisfying the image condition, and the preset face detection model is trained through the data-enhanced training data set, and during the training process, the face detection model is adjusted using the preset staged loss function to generate a target face detection model, and the image to be detected collected by the home security monitoring system is obtained. When the image to be detected is an image associated with the image condition, the target face detection model is used to detect the image to be detected, and the face detection result is obtained. The face detection model is trained through the data-enhanced training data set, which greatly improves the richness of the training data and the comprehensiveness of the model training, thereby greatly enhancing the robustness of the model when facing face recognition tasks under various conditions, and further improves the accuracy of face detection through the introduction of the staged loss function. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0051] Figure 1 is a flowchart of the steps of a face detection method provided by some embodiments of the present application;

[0052] Figure 2 is a flowchart of another face detection model method provided by some embodiments of the present application;

[0053] Figure 3 It is a frame diagram of a face detection model architecture provided by some embodiments of the present application;

[0054] Figure 4 is a flow chart of implementing a face detection model method provided in some embodiments of the present application;

[0055] Figure 5 This is a structural block diagram of a face detection device provided in some embodiments of the present application. DETAILED DESCRIPTION

[0056] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0057] Reference Figure 1 , shows a flowchart of a face detection method provided by some embodiments of the present application, which is applied to a home security monitoring system and may specifically include the following steps:

[0058] Step 101: Obtain a text instruction carrying an image condition;

[0059] The text instructions refer to the text descriptions provided by the user or the system to guide the image generation process. The text instructions carrying image conditions mean that the text instructions contain the conditions or requirements required to generate the image, such as the content of the image, the style of the image, the number of images, etc.

[0060] After obtaining the text instruction, the text instruction may be parsed, and a corresponding image may be generated according to the requirements for generating the image obtained through the parsing.

[0061] Step 102: Generate an image satisfying the image condition according to the text instruction through the preset first large model, so as to perform data enhancement on the training data set through the image satisfying the image condition.

[0062] Among them, the preset first large model is a large generative model that has been trained. The large generative model can be specifically a large model of Vincent graph, which is used to generate images that meet the requirements according to the input text instructions. Vincent graph is a technology that generates images based on text instructions. Users provide text descriptions to guide the model to generate images that meet the descriptions. Vincent graph technology usually relies on generative models to generate high-quality images through text-to-image mapping. Data enhancement refers to improving the generalization ability and robustness of the model by generating new image data and expanding the training data set. The training data set is a data set used to train machine learning models. The training data set contains input data (such as images) and corresponding labels (such as face positions). The model improves its prediction ability by learning the relationship between these data and labels.

[0063] In some embodiments of the present application, Stable Diffusion (stable diffusion text generation image model) text model or other large models can be used to batch produce various different pictures. Stable Diffusion is a text-to-image generation model based on deep learning. Its main function is to generate detailed images based on text descriptions. It can also be used for other tasks, such as internal and external completion of images, and image style conversion under the guidance of specific prompt words. By generating batches of images for face detection and face recognition through the Stable Diffusion large model, it can save time for browsing, retrieving and screening pictures suitable for face detection and face recognition, and then enhance the training data set through a large number of images that meet the image conditions. In addition, the Stable Diffusion large model can also create interactive applications that allow users to modify various attributes of the detected face (e.g., hairstyle, glasses, expressions) and generate new images in real time; the large model can also effectively improve privacy protection. Before sharing pictures, face detection is used to identify faces, and the generation model is used to blur or replace them, thereby protecting personal privacy.

[0064] Step 103: training a preset face detection model using the data-enhanced training data set, and during the training process, adjusting the face detection model using a preset phased loss function to generate a target face detection model;

[0065] Among them, the preset face detection model is a trained face detection model, usually based on deep learning technology. The preset face detection model can detect faces in images and output the location of faces, such as bounding boxes. The staged loss function means that different loss functions are used in stages during the model training process to gradually improve the performance of the model. The loss function of each stage may be optimized for different training objectives. The target face detection model is the final face detection model generated through training, and the target face detection model is used to detect face images in actual use.

[0066] In some implementations of the embodiments of the present application, during the training process of training a preset face detection model to obtain a target face detection model, the face detection model can be adjusted through data enhancement and staged loss function to improve the detection accuracy and robustness of the target face detection model finally generated.

[0067] Step 104: Acquire the image to be detected collected by the home security monitoring system.

[0068] The home security monitoring system is a device and system for monitoring home security, and the image to be detected refers to image data collected from the home security monitoring system.

[0069] In some implementations of the embodiments of the present application, the home security monitoring system hardware device and the monitoring system, the hardware device includes components such as cameras and sensors, which are used to monitor the home environment in real time and detect abnormal situations. In the home security monitoring system, image or video data is obtained from the camera, and these image data are further detected and analyzed by the monitoring system to determine whether there are abnormal situations, such as strangers intruding.

[0070] Step 105: When the image to be detected is an image associated with the image condition, the target face detection model is used to detect the image to be detected to obtain a face detection result.

[0071] The image associated with the image condition refers to a face image with an occluder, and may also be a face image without an occluder.

[0072] When the security monitoring system collects an image to be detected, and the image to be detected is a face image with an obstruction, or when the image to be detected is any type of face image, the target face detection model trained in the above steps is used to detect the image to be detected to obtain the corresponding face detection result. Furthermore, it is also possible to determine whether there are only strangers in the image to be detected based on the face detection result, provide the user with the detection result, and improve home security.

[0073] The embodiment of the present application obtains a text instruction carrying an image condition, generates an image satisfying the image condition according to the text instruction through a preset first large model, and performs data enhancement on the training data set through the image satisfying the image condition, trains the preset face detection model through the data-enhanced training data set, and in the training process, uses a preset staged loss function to adjust the face detection model, generates a target face detection model, obtains the image to be detected collected by the home security monitoring system, and uses the target face detection model to detect the image to be detected when the image to be detected is an image associated with the image condition, and obtains the face detection result. The face detection model is trained through the data-enhanced training data set, which greatly improves the richness of the training data and the comprehensiveness of the model training, thereby greatly enhancing the robustness of the model when facing face recognition tasks under various conditions, and further improves the accuracy of face detection through the introduction of the staged loss function.

[0074] Reference Figure 2 , shows a flowchart of another face detection method provided by some embodiments of the present application, which may specifically include the following steps:

[0075] Step 201: Obtain a text instruction carrying an image condition.

[0076] In some implementations of this embodiment, in order to improve the accuracy of face detection, non-face images can be used to enhance the training data, especially in complex backgrounds and changing environments. By training the model to recognize non-face images, the model can be helped to better understand the background information, thereby improving the ability to accurately detect faces in complex backgrounds.

[0077] The text instructions carrying the image conditions may be specific as: "living room with fireplace and bookshelf", "living room with coffee table and TV", "kitchen equipped with electrical appliances", "home office with large windows and desk", and a series of different text instructions.

[0078] Step 202: when the image condition is a non-face image, generate a non-face image set by using a preset first large model.

[0079] The preset first large model may be a Stable Diffusion text graph model or other large models. The Stable Diffusion text graph model is a generative model based on a diffusion process, which is used to generate high-quality images according to the input text description. The Stable Diffusion text graph model combines the techniques of text generation and image generation, and generates images that meet the description of text instructions through the process of gradually adding and removing noise.

[0080] In a specific implementation, the text instructions in the above step 201 include not only a description of the type of image to be generated, but also the number of images to be generated and the image specifications, for example, "generate 10,000 images of a living room", "generate 5,000 images of a kitchen equipped with electrical appliances, each image is approximately 1M in size". When these image conditions are non-face images, a non-face image set matching the text instructions is generated through a Stable Diffusion text graph model or other large models. It should be noted that the image conditions in these text instructions need to ensure that the model will not be guided to generate images containing faces.

[0081] Step 203: Generate a non-face data label for the non-face image set according to a preset label format.

[0082] The preset label format refers to a predefined annotation file format. In order to generate faceless data labels for faceless image sets, we need to create an annotation file for each faceless image according to the preset label format. This annotation file can contain basic information about the image, including but not limited to the file name, image width, and image height, and clearly indicate whether there is a face in the image, as well as the bounding box and attribute information of the face, etc.

[0083] In a specific implementation, a script can be compiled according to the annotation specification of the Wide Face dataset (Wide Face Dataset) to automatically annotate reference labels for each image in the batch of generated non-face images, so as to build a negative sample dataset to train the face detection model. The annotation specification of the Wide Face dataset refers to the specific format and rules followed by the dataset when annotating faces. The main contents of the Wide Face dataset annotation specification include file structure, annotation file format, and annotation file content. The file structure includes a dataset, which can be divided into multiple subsets (such as training sets, validation sets, and test sets), each of which contains an image directory and an annotation file. The annotation file is a text file, usually stored in .txt format, each annotation file corresponds to an image subset, and the file name can be the same as the name of the image subset. Each line of annotation information in the annotation file corresponds to an image. Each line of annotation information can include but is not limited to the following information: image file name, number of faces in the image, bounding box coordinates (x, y, width, height) of each face, attributes of each face (such as occlusion, blur, posture, etc.), occlusion indicates whether the face is occluded, blur indicates whether the face is blurred, and posture indicates the posture of the face (such as front, side, etc.). For images without faces, the number of faces in the annotation file should be 0, and there is no corresponding bounding box and attribute information.

[0084] Step 204: Obtain an occluded face image set to perform data enhancement on the training data set through the occluded face image set, wherein the occluded face image set includes at least one of a mask occluded face image set, a glasses occluded face image set, and a hat occluded face image set.

[0085] Among them, the occluded face image set refers to a set of images that contain faces but are partially or completely occluded. These occluders may include masks, glasses, hats, scarves, etc. It is not difficult to understand that these occluders will affect the performance of the face detection model.

[0086] The embodiment of the present application obtains an occluded face image set and performs data enhancement on the training data set through the occluded face image set, with the ultimate goal of training and improving the performance of the face detection model under occlusion conditions. Therefore, the occluded face image set in the present application includes at least one of a mask occluded face image set, a glasses occluded face image set, and a hat occluded face image set. By collecting face images containing various occlusions, it is ensured that the data set is diverse, covering different occlusion types, occlusion degrees, and lighting conditions.

[0087] In some implementations of this embodiment, the MAFA mask dataset and the UFDD multi-environment occlusion dataset can be obtained. MAFA (Masked Faces in the Wild) is a dataset specifically used to study mask occlusion of human faces. The dataset contains a large number of face images with mask occlusion; the MAFA mask occlusion dataset covers mask occlusion of human faces under different races, ages, genders and lighting conditions, and also includes various types of masks (such as medical masks, cloth masks, N95 masks, etc.). UFDD (UFace Dataset for Occlusion Detection) is a multi-environment occlusion face dataset. The dataset contains a variety of occlusion types, such as glasses, hats, scarves, etc., as well as different lighting and background conditions. The UFDD multi-environment occlusion dataset covers a variety of occlusion types and environmental conditions, and the occlusion types include glasses, hats, scarves, masks, etc.

[0088] Step 205: Generate simulated reference labels for the occluded face image set using a preset second largest model.

[0089] Among them, the preset second largest model is used to generate simulated reference labels for the occluded face image set. Simulated reference labels refer to simulated annotation information generated during the data set generation or processing to facilitate subsequent model training and evaluation. Simulated reference labels are used to replace real annotations when the data set lacks annotations or the annotations are incomplete. Simulated reference labels are generated for the occluded face image set collected in the above steps. The simulated reference labels may include the bounding box of the face, the type and location of the occluder, etc. The labels follow the preset label format to ensure consistency and usability.

[0090] In some implementations of this embodiment, the preset second largest model may be, but is not limited to, a SCRFD-34g (Scale-Aware and Rotation-Aware Face Detector) model. The SCRFD-34g model with high precision and light weight is used to generate corresponding simulated reference labels for the MAFA mask dataset and the UFDD multi-environment occlusion dataset. This strategy not only enriches the types of face datasets, increases the complexity of model training, but also helps to further improve the accuracy of the model in face detection tasks. Specifically, the SCRFD-34g model can be used to mark the bounding box of the face, the bounding box of the mask, and the key points of the face for each mask-occluded face image; the SCRFD-34g model can also be used to mark the bounding box of the face, the bounding box of the occluder, and the type of the occluder for each face image occluded by glasses, hats, and scarves. This application combines the large model generated by Wenshengtu and the simulation label generated by the large model, which expands the diversity and coverage of the training data set in the face detection process.

[0091] Step 206: Train the preset face detection model using the data-enhanced training data set, and during the training process, use a preset staged loss function to adjust the face detection model to generate a target face detection model.

[0092] In a specific implementation, the preset face detection model can be an untrained SCRFD-10g model. During the training of the SCRFD-10g model, the SCRFD-34g model can be selected as the teacher model, and the knowledge distillation of the SCRFD-34g model is performed to obtain the final trained SCRFD-10g model, which is used as the target face detection model. The complex teacher model SCRFD-34g performs well on the target task, but the teacher model SCRFD-34g usually has high computing resource requirements and a large model size.

[0093] Among them, knowledge distillation is a model compression technology that can transfer the knowledge of a complex model (such as the SCRFD-34g model) to a smaller student model (such as the SCRFD-10g model), so that the student model has smaller computing resource requirements while maintaining high performance.

[0094] In some implementations of this embodiment, training the student model SCRFD-10g, i.e., an untrained preset face detection model, under the guidance of the teacher model SCRFD-34g can make the generated target face detection model as close to the performance of the teacher model as possible while maintaining a small computing resource requirement.

[0095] In some embodiments of the present application, in step 206, “training a preset face detection model using the data-enhanced training data set” includes the following sub-steps:

[0096] Step 11: Obtain a set of unobstructed face images;

[0097] Step 12: taking the unobstructed face image set and the obstructed face image set as positive sample data sets;

[0098] Step 13: taking the non-face image set as a negative sample data set;

[0099] Step 14: Use the positive sample data set and the negative sample data set to train the face detection model.

[0100] The unobstructed face image set refers to a set of images that contain faces but do not contain any occlusions. These images are usually used to train and evaluate models such as face detection, face recognition, and facial expression analysis. This application uses the unobstructed face image set to ensure that the model can accurately recognize and locate faces under ideal conditions.

[0101] In some implementations of this embodiment, a Wider face dataset may be used as an unobstructed face dataset, where the Wider face dataset includes a normal standard face dataset that is not covered by occlusions.

[0102] Positive sample data refers to data samples used to train and evaluate models in machine learning and deep learning. These samples belong to target categories or target events. In the face detection method of this application, positive sample data refers to images containing faces. The quality and quantity of positive sample data have an important impact on the performance of the target face detection model finally generated.

[0103] Negative sample data refers to data samples used to train and evaluate models in machine learning and deep learning. These samples do not belong to the target category or target event. In the face detection method of the present application, negative sample data refers to images that do not contain faces. The quality and quantity of negative sample data also have an important impact on the performance of the target face detection model finally generated, especially in preventing model misdetection (i.e. mistaking non-face areas for faces).

[0104] In some implementations of this embodiment, the occluded face image set in the aforementioned steps and the obtained unoccluded face image set are used as positive sample data sets, and the non-face images generated in the aforementioned steps are used as negative sample data sets, and these positive sample data sets and negative sample data sets are used to train the face detection model.

[0105] In some embodiments of the present application, in step 206, “in the process of training, using a preset staged loss function to adjust the face detection model to generate a target face detection model” may include the following sub-steps:

[0106] Sub-step 21: inputting the positive sample data set and the negative sample data set into the preset second largest model to obtain first data output by the second largest model, wherein the first data includes first face bounding box probability data and first face category probability data;

[0107] Sub-step 22: inputting the positive sample data set and the negative sample data set into the face detection model to obtain second data and third data output by the face detection model, wherein the second data includes second face bounding box probability data and second face category probability data, and the third data includes face bounding box coordinate data and face key point coordinate data;

[0108] Sub-step 23: Obtain reference labels, where the reference labels include face bounding box reference labels and face key point reference labels;

[0109] Sub-step 24: determining a first difference between the first data and the second data, and a second difference between the reference label and the third data respectively according to the preset stage-by-stage loss function;

[0110] Sub-step 25: adjusting the face detection model according to the first difference and the second difference to generate a target face detection model.

[0111] In some implementations of the present embodiment, the positive sample data set and the negative sample data set are input into a preset second largest model to obtain first data output by the second largest model, and the first data includes first face bounding box probability data and first face category probability data; at the same time, the positive sample data set and the negative sample data set are input into a face detection model to obtain second data output by the face detection model, and the second data includes second face bounding box probability data and second face category probability data.

[0112] Among them, the preset second largest model can be specifically a SCRFD-34g model, and the face detection model can be specifically a SCRFD-10g model. The SCRFD-34g model is used as a teacher model, and the SCRFD-10g model is used as a student model corresponding to the teacher model. The teacher model is learned through knowledge distillation to obtain the final target face detection model. The embodiment of the present application effectively transforms the computational advantages of the large model (SCRFD-34g model) into the small model (SCRFD-10g model), which not only adapts to the operating environment with limited resources, but also maintains the high accuracy of face detection.

[0113] Specifically, a soft target loss function can be introduced in the knowledge distillation learning step of SCRFD-10g. The positive sample data set and the negative sample data set of the above steps are simultaneously input into the SCRFD-34g model and the SCRFD-10g model to obtain the face bounding box probability distribution and face category score distribution output by the SCRFD-34g model, that is, the soft target logical value of the teacher model. In addition, it is also necessary to obtain the bounding box probability distribution and category score distribution output by SCRFD-10g, that is, the soft target logical value of the student model. Among them, in the face detection task, the bounding box probability distribution is a probability value generated by the model for each candidate region in the image to be detected, indicating the confidence that the region contains a face. For example, the model may output: candidate region A: 95% probability is a face, candidate region B: 80% probability is a face, candidate region C: 5% probability is a face. In the face recognition task, the category score distribution is a category score vector generated by the model for each candidate region in the image to be detected, indicating the confidence that the region belongs to different people. For example, the model might say: Candidate region A: 90% probability is "Zhang San", 5% probability is "Li Si", 3% probability is "Wang Wu", and 2% probability is "others".

[0114] Specifically, the first difference between the first data output by the teacher model (the face bounding box probability data and the face category probability data output by the teacher model) and the second data output by the student model (the face bounding box probability data and the face category probability data output by the student model) can be determined according to the preset stage-by-stage loss function, and the face detection model is adjusted according to the first difference to generate the target face detection model. At this time, the preset stage-by-stage loss function can be a soft target loss function, and the soft target loss function can be, but is not limited to, the Kullback-Leibler divergence (KL divergence).

[0115] Ldistill=KL(pteacher,pstudent)

[0116] Among them, pteacher is the output probability distribution of the teacher model, pstudent is the output probability distribution of the student model, the output probability distribution of the teacher model includes the first face bounding box probability data and the first face category probability data, and the output probability distribution of the student model includes the second face bounding box probability data and the second face category probability data.

[0117] In some implementations of the present embodiment, the positive sample data set and the negative sample data set can also be input into the face detection model to obtain third data output by the face detection model, the third data including face bounding box coordinate data and face key point coordinate data; obtain reference labels, the reference labels including face bounding box reference labels and face key point reference labels; determine the second difference between the reference labels and the third data based on a preset staged loss function, adjust the face detection model based on the second difference, and generate a target face detection model.

[0118] Among them, the reference label (Ground Truth Labels) refers to the real label information of each sample in the training data set. The face bounding box reference label refers to the real position information of the face in each face image in the training data set. A rectangular box (bounding box) is usually used to represent the position of the face. The coordinates of the bounding box include the coordinates of the upper left corner and the lower right corner. The face key point reference label refers to the real position information of the face key points in each face image in the training data set. The face key points usually include the feature points of the face, such as the positions of the eyes, nose, mouth, etc. The preset staged loss function can be specifically a hard target loss function. The hard target loss function refers to the loss function used to measure the difference between the model prediction result and the true label during the training process. The hard target loss function usually directly compares the output of the model with the true label and calculates the difference between them. The hard target loss function can be a cross entropy loss or a hinge loss, etc.

[0119] Specifically, the SCRFD-10g model training may include the calculation of the hard target loss function, and the third data output by the SCRFD-10g model includes face bounding box coordinate data and face key point coordinate data, and the second difference between the bounding box (Bounding Box, bbox) and key point (Key Points, kps) coordinates in the reference label and the third data output by the SCRFD-10g model is determined according to the hard target loss function, and the face detection model is adjusted and optimized according to the second difference. This ensures that while SCRFD-10g imitates the teacher model SCRFD-34g, its learning results gradually approach the real reference label value, so that it can accurately detect the position and key points of the face.

[0120] In some embodiments of the present application, the preset second largest model includes a backbone network, a neck network and a head network, and the face detection model also includes a backbone network, a neck network and a head network. In step 206, "during the training process, using a preset staged loss function to adjust the face detection model to generate a target face detection model" may also include the following sub-steps:

[0121] Sub-step 31: inputting the positive sample data set and the negative sample data set into the preset second largest model, obtaining the first trunk output of the trunk network, the first neck output of the neck network and the first head output of the head network in the preset second largest model;

[0122] Sub-step 32: inputting the positive sample data set and the negative sample data set into the face detection model to obtain a second trunk output of the trunk network, a second neck output of the neck network, and a second head output of the head network in the face detection model;

[0123] Sub-step 33: adjusting the backbone network of the face detection model according to the difference between the first backbone output and the second backbone output;

[0124] Sub-step 34: adjusting the neck network of the face detection model according to the difference between the first neck output and the second neck output;

[0125] Sub-step 35: adjusting the head network of the face detection model according to the difference between the first head output and the second head output;

[0126] Sub-step 36: Determine the adjusted face detection model as the target face detection model.

[0127] Among them, the structures of the SCRFD-34g model and the SCRFD-10g model both include a backbone network, a neck network, and a head network. The backbone network is the core part of the SCRFD model and is responsible for extracting features from the input image. The backbone network is a pre-trained convolutional neural network that gradually extracts high-level features of the image through multi-layer convolution and pooling operations. The output of the backbone network is usually a feature map that contains the semantic information and spatial information of the image. The neck network is the middle part of the SCRFD model that connects the backbone network and the head network. It is responsible for further processing the feature map output by the front backbone network. The neck network usually includes structures such as feature pyramid networks or path aggregation networks, which are used to fuse features of different scales and enhance the multi-scale detection capabilities of the model. The output of the neck network is feature maps of multiple scales, which are used for subsequent detection tasks. The head network is the final part of the SCRFD model, responsible for detecting faces from the feature map output by the neck network. The head network usually includes multiple detection heads, which are used for classification and regression tasks respectively. The classification head is used to predict whether each candidate region contains a face, and the regression head is used to predict the position of the bounding box of the face. The output of the head network is the detection result, including the bounding box and confidence of the face.

[0128] In some implementations of this embodiment, the positive sample data set and the negative sample data set are input into the SCRFD-34g model, and the corresponding first trunk output is obtained from the backbone network therein, the corresponding first neck output is obtained from the neck network, and the corresponding first head output is obtained from the head network; at the same time, the positive sample data set and the negative sample data set are input into the SCRFD-10g model, and the corresponding second trunk output is obtained from the backbone network therein, the corresponding second neck output is obtained from the neck network, and the corresponding second head output is obtained from the head network.

[0129] This application sets process loss functions for the outputs of the backbone network, neck network and head network of the SCRFD model respectively, determines the differences between the outputs of the three networks of the two models in the backbone network, neck network and head network, and then adjusts the backbone network, neck network and head network in the SCRFD-10g model to achieve precise alignment of the outputs of the SCRFD-10g model with the SCRFD-34g "teacher" model in the corresponding parts.

[0130] Among them, the process loss function can be but is not limited to mean squared error loss (MSE) and Huber loss. Mean squared error loss MSE is very sensitive to outliers because the square of the error will amplify the impact of outliers. Mean squared error loss MSE is a smooth convex function that is easy to optimize. Huber loss is a loss function that combines mean squared error loss and absolute error loss, aiming to reduce the impact of outliers. Huber loss uses squared error when the error is small and linear error when the error is large, thereby reducing the impact of outliers. Huber loss is smooth and easy to optimize when the error is small. Huber loss uses linear error when the error is large, avoiding the gradient explosion problem.

[0131] like Figure 3 As shown, it is a model framework diagram provided by some embodiments of the present application, including data enhancement and knowledge distillation. The data enhancement stage includes: 1. Non-face images of the Vincent image large model as negative sample data set; 2. Mask data set, multi-condition occlusion data set combined with simulated reference labels; 3. Standard face data set. In the process of knowledge distillation, not only the soft target loss function is used to calculate the difference between soft target logical values, and the hard target loss function is used to calculate the difference between the target detection model and the data label, but also the staged loss function is set in the backbone network, neck network and head network to further optimize the face detection model.

[0132] like Figure 4As shown, it is an implementation diagram of the face detection method provided by some embodiments of the present application. The first step is data enhancement, including 1. Obtaining a negative sample data set from a Wensheng graph, using a pre-trained large model SCRFD34g model to make simulated reference labels for a mask data set and a multi-condition occlusion data set, and also using a standard face data set in different scenes; these data are used as negative sample data sets and positive sample data sets as training data input to the face detection model, and in the training process of the face detection model, the knowledge distillation method is used to learn from the teacher model SCRFD34g to obtain a streamlined target face detection model with a small footprint. In the process of knowledge distillation, not only soft target loss function and hard target loss function are used, but also process loss functions are set respectively in the backbone network, the neck network and the head network, so that SCRFD-10g is prompted to continuously learn from SCRFD-34g, and the face detection model after the final adjustment is determined as the target face detection idol, so that the SCRFD-10g model is gradually aligned with the output of the SCRFD-34g "teacher" model in the corresponding part to promote the refined learning and imitation process.

[0133] From the above content, it can be seen that the embodiment of the present application applies knowledge distillation technology in the process of generating the target face detection model SCRFD-10g, and ensures that the SCRFD-10g model significantly improves the detection performance while maintaining a lightweight architecture by accurately calculating the loss functions of soft targets and hard targets. This knowledge distillation learning method is superior to the traditional strategy of improving performance by increasing model parameters, deepening network depth and increasing complexity, and shows greater innovation and efficiency.

[0134] Step 207: extracting a face image from the image to be detected.

[0135] The image to be detected refers to image data collected from a home security monitoring system, which needs to be further detected and analyzed to determine whether there is an abnormality. The face image is a partial image containing a face in the image to be detected. Through the face detection method of the present application, an image area containing a face can be extracted from the image to be detected.

[0136] In some implementations of this embodiment, Figure 4 As shown in the figure, the target face detection model SCRFD-10g trained in the above steps can be deployed in the home security monitoring system to detect face images in the home security monitoring system. It is not difficult to understand that the trained target face detection model can also be deployed in the hospital monitoring system to achieve accurate detection of small-sized faces and faces covered by masks in hospital scenes.

[0137] Step 208: When the face image is partially occluded, the target face detection model is used to detect the image to be detected to obtain a face detection result.

[0138] Partial occlusion refers to the situation where part of the face image is blocked, such as by glasses, masks, hats, etc. Partial occlusion will affect the accuracy of face detection and needs to be handled by a more robust detection model.

[0139] The target face detection model generated by training through the above steps of the present application can detect occluded face images and obtain detection results.

[0140] like Figure 4 As shown, the target face detection model SCRFD-10g model trained by this application can also be deployed in practical applications, so that it can accurately detect faces of different sizes, regions, races, ages, genders and different facial expressions. In face detection with occlusion, it can effectively handle various complex scenarios including wearing masks, glasses, scarves, hats, etc. It is not difficult to understand that through data enhancement of training data with batches of non-face image sets, this application can also realize face detection applications in mist, sunlight, out of focus, etc. In addition, it can also accurately detect faces in various complex scenes such as blur, rain and snow cover.

[0141] The embodiment of the present application obtains a text instruction carrying an image condition, generates an image satisfying the image condition according to the text instruction through a preset first large model, and performs data enhancement on the training data set through the image satisfying the image condition, trains the preset face detection model through the data enhanced training data set, and in the training process, uses a preset staged loss function to adjust the face detection model, generates a target face detection model, obtains the image to be detected collected by the home security monitoring system, and uses the target face detection model to detect the image to be detected when the image to be detected is an image associated with the image condition, and obtains the face detection result. The face detection model is trained with the data enhanced training data set, which greatly improves the richness of the training data and the comprehensiveness of the model training, thereby greatly enhancing the robustness of the model when facing face recognition tasks under various conditions, and further improves the accuracy of face detection through the introduction of the staged loss function. The target face detection model obtained by the knowledge distillation method further improves the performance of face detection on the basis of maintaining the computational efficiency of the large model, saving time resources and space resources.

[0142] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described order of actions, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.

[0143] Reference Figure 5 , shows a schematic diagram of the structure of a face detection device provided in some embodiments of the present application, which may specifically include the following modules:

[0144] A first acquisition module 501 is used to acquire a text instruction carrying an image condition;

[0145] A data enhancement module 502 is used to generate an image satisfying the image condition according to the text instruction by using a preset first large model, so as to perform data enhancement on the training data set by using the image satisfying the image condition;

[0146] The first adjustment module 503 is used to train a preset face detection model using the data-enhanced training data set, and during the training process, use a preset staged loss function to adjust the face detection model to generate a target face detection model;

[0147] An image acquisition module 504 is used to acquire the image to be detected collected by the home security monitoring system;

[0148] The face detection module 505 is used to detect the image to be detected by using the target face detection model to obtain a face detection result when the image to be detected is an image associated with the image condition.

[0149] In an optional embodiment of the present application, the data enhancement module 502 includes:

[0150] A first enhancement submodule, configured to generate a non-face image set by using a preset first large model when the image condition is a non-face image;

[0151] The second enhancement submodule is used to generate a non-face data label for the non-face image set according to a preset label format.

[0152] In an optional embodiment of the present application, the device further includes:

[0153] A second acquisition module is used to acquire an occluded face image set, so as to perform data enhancement on the training data set through the occluded face image set, wherein the occluded face image set includes at least one of a mask occluded face image set, a glasses occluded face image set, and a hat occluded face image set;

[0154] The first labeling module is used to generate simulated reference labels for the occluded face image set by using a preset second large model.

[0155] In an optional embodiment of the present application, the first adjustment module 503 includes:

[0156] The second acquisition submodule is used to acquire a set of unobstructed face images;

[0157] A first training submodule is used to use the unobstructed face image set and the obstructed face image set as positive sample data sets;

[0158] A second training submodule is used to use the non-face image set as a negative sample data set;

[0159] The third training submodule is used to train the face detection model using the positive sample data set and the negative sample data set.

[0160] In an optional embodiment of the present application, the first adjustment module 503 includes:

[0161] A first input submodule, configured to input the positive sample data set and the negative sample data set into the preset second large model to obtain first data output by the second large model, wherein the first data includes first face bounding box probability data and first face category probability data;

[0162] A second input submodule, used to input the positive sample data set and the negative sample data set into the face detection model to obtain second data and third data output by the face detection model, wherein the second data includes second face bounding box probability data and second face category probability data, and the third data includes face bounding box coordinate data and face key point coordinate data;

[0163] A third reference label acquisition submodule is used to acquire reference labels, wherein the reference labels include face bounding box reference labels and face key point reference labels;

[0164] A first difference determination module, configured to determine a first difference between the first data and the second data, and a second difference between the reference label and the third data, respectively, according to the preset stage-by-stage loss function;

[0165] The first adjustment submodule is used to adjust the face detection model according to the first difference and the second difference to generate a target face detection model.

[0166] In an optional embodiment of the present application, the preset second large model includes a backbone network, a neck network and a head network, the face detection model also includes a backbone network, a neck network and a head network, and the first adjustment module 503 includes:

[0167] A third input submodule is used to input the positive sample data set and the negative sample data set into the preset second large model to obtain the first trunk output of the trunk network, the first neck output of the neck network and the first head output of the head network in the preset second large model;

[0168] a fourth input submodule, configured to input the positive sample data set and the negative sample data set into the face detection model, and obtain a second trunk output of the trunk network, a second neck output of the neck network, and a second head output of the head network in the face detection model;

[0169] A backbone network adjustment submodule, used for adjusting the backbone network of the face detection model according to the difference between the first backbone output and the second backbone output;

[0170] a neck network adjustment submodule, configured to adjust the neck network of the face detection model according to a difference between the first neck output and the second neck output;

[0171] A head network adjustment submodule, used for adjusting the head network of the face detection model according to the difference between the first head output and the second head output;

[0172] The target model determination submodule is used to determine the adjusted face detection model as the target face detection model.

[0173] In an optional embodiment of the present application, the face detection module 505 includes:

[0174] A first extraction submodule, used to extract a face image from the image to be detected;

[0175] The first detection submodule is used to detect the image to be detected using the target face detection model to obtain a face detection result when the face image is partially occluded.

[0176] An embodiment of the present application also provides an electronic device, which may include a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and when the computer program is executed by the processor, the above-mentioned face detection method is implemented.

[0177] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the above face detection method is implemented.

[0178] The embodiment of the present application also discloses a computer program product, including a computer program / instruction, which implements the above face detection method when executed by a processor.

[0179] 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.

[0180] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0181] 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.

[0182] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the embodiments of the present application may adopt 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.

[0183] The embodiments of the present application 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 application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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 1A device that provides the functions specified in a block or multiple blocks.

[0184] 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.

[0185] 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 executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0186] Although the preferred embodiments of the present application 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 application.

[0187] 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 "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the above elements.

[0188] The provided face method, device, electronic device, and storage medium are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, 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 application.

Claims

1. A face detection method, characterized in that: Applied to a home security monitoring system, the method comprises: Get text instructions that carry image conditions; Generate an image satisfying the image condition according to the text instruction by using a preset first large model, so as to perform data enhancement on the training data set by using the image satisfying the image condition; The preset face detection model is trained by using the training data set after data enhancement, and during the training process, the face detection model is adjusted by using a preset staged loss function to generate a target face detection model; Acquire the image to be detected collected by the home security monitoring system; In the case that the image to be detected is an image associated with the image condition, the target face detection model is used to detect the image to be detected to obtain a face detection result.

2. The method according to claim 1, characterized in that The step of generating an image satisfying the image condition according to the text instruction by using the preset first large model includes: In the case where the image condition is a non-face image, generating a non-face image set by using a preset first large model; Generate a non-face data label for the non-face image set according to a preset label format.

3. The method according to claim 2, before training the preset face detection model with the training data set after data enhancement, comprises: Acquire an occluded face image set to perform data enhancement on a training data set through the occluded face image set, wherein the occluded face image set includes at least one of a mask occluded face image set, a glasses occluded face image set, and a hat occluded face image set; Generate simulated reference labels for the occluded face image set through a preset second largest model.

4. The method according to claim 3, characterized in that The preset face detection model is trained using the data-enhanced training data set, including: Obtain a set of unobstructed face images; Taking the unobstructed face image set and the obstructed face image set as positive sample data sets; Using the non-face image set as a negative sample dataset; The face detection model is trained using the positive sample data set and the negative sample data set.

5. The method according to claim 4, characterized in that In the training process, the face detection model is adjusted by using a preset staged loss function to generate a target face detection model, including: Inputting the positive sample data set and the negative sample data set into the preset second largest model to obtain first data output by the second largest model, wherein the first data includes first face bounding box probability data and first face category probability data; Inputting the positive sample data set and the negative sample data set into the face detection model to obtain second data and third data output by the face detection model, wherein the second data includes second face bounding box probability data and second face category probability data, and the third data includes face bounding box coordinate data and face key point coordinate data; Acquire reference labels, wherein the reference labels include face bounding box reference labels and face key point reference labels; Determine, according to the preset stage-by-stage loss function, a first difference between the first data and the second data, and a second difference between the reference label and the third data; The face detection model is adjusted according to the first difference and the second difference to generate a target face detection model.

6. The method according to claim 4, characterized in that The preset second largest model includes a backbone network, a neck network and a head network, and the face detection model also includes a backbone network, a neck network and a head network. During the training process, the face detection model is adjusted using a preset staged loss function to generate a target face detection model, including: Inputting the positive sample data set and the negative sample data set into the preset second largest model, obtaining the first trunk output of the trunk network, the first neck output of the neck network, and the first head output of the head network in the preset second largest model; Inputting the positive sample data set and the negative sample data set into the face detection model, obtaining a second trunk output of the trunk network, a second neck output of the neck network, and a second head output of the head network in the face detection model; Adjusting the backbone network of the face detection model according to the difference between the first backbone output and the second backbone output; Adjusting a neck network of the face detection model according to a difference between the first neck output and the second neck output; Adjusting the head network of the face detection model according to a difference between the first head output and the second head output; The adjusted face detection model is determined as the target face detection model.

7. The method according to claim 3, characterized in that In the case where the image to be detected is an image associated with the image condition, the target face detection model is used to detect the image to be detected to obtain a face detection result, including: Extracting a face image from the image to be detected; In the case where the face image is partially occluded, the target face detection model is used to detect the image to be detected to obtain a face detection result.

8. A face detection device, characterized in that: The device comprises: A first acquisition module is used to acquire a text instruction carrying an image condition; A data enhancement module, used to generate an image satisfying the image condition according to the text instruction by using a preset first large model, so as to perform data enhancement on the training data set by using the image satisfying the image condition; A first adjustment module is used to train a preset face detection model using a data-enhanced training data set, and during the training process, use a preset staged loss function to adjust the face detection model to generate a target face detection model; An image acquisition module, used to acquire the image to be detected collected by the home security monitoring system; The face detection module is used to detect the image to be detected by using the target face detection model to obtain a face detection result when the image to be detected is an image associated with the image condition.

9. An electronic device, characterized in that: The invention comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the face detection method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the face detection method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Urban rail station abnormal event detection method and system

    CN122346796A