Training method, detection method, device and equipment for face detection model
By dividing the training set into three types of images and performing model training in batches, the problem of low recognition accuracy of face detection models in the prior art is solved, and more efficient face detection accuracy is achieved.
Patent Information
- Application Number
- CN202311766835.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-20
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2043-12-20
AI Technical Summary
The prior art has low computing efficiency and low model recognition accuracy in face detection, especially in vivo detection and synthetic detection, which is difficult to effectively distinguish false attributes.
The training set is divided into three types of images: the first image that meets the preset conditions, the second image that can detect false attributes through low-order image features, and the third image that cannot detect false attributes through low-order image features, and the third image that cannot detect false attributes through low-order image features, and is carried out in batches. Model training is performed first, the model is trained based on the second image and the first image, and then further training is performed based on the first image and the third image to improve the accuracy of the face detection model.
It improves the accuracy and recognition efficiency of the face detection model, can more effectively distinguish real faces from synthetic images, and improves the accuracy of face detection.
Smart Images

Figure CN117746482B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, specifically to technical fields such as computer vision, deep learning, and face recognition, and can be applied to scenarios such as smart cities and smart finance; in particular, it relates to a training method, detection method, device, and equipment for a face detection model. Background Art
[0002] Currently, in different scenarios such as security and finance, it is necessary to collect face images in real time to verify user identity. During the face detection process, the current image will be checked to see if it is shot based on a real person (i.e., face liveness detection) and whether the current image is tampered with (i.e., face synthesis detection) to ensure the authenticity of the acquired face image.
[0003] Therefore, how to accurately detect faces is a problem that needs to be solved urgently. Summary of the invention
[0004] The present invention provides a training method, a detection method, a device and equipment for a face detection model to improve the accuracy of face detection and recognition results.
[0005] According to a first aspect of the present disclosure, a method for training a face detection model is provided, comprising:
[0006] Acquire a training set; wherein the training set includes: at least one first image, at least one second image, and at least one third image; the first image is an image that meets the preset conditions; the second image has a false attribute, and the false attribute of the second image can be detected by low-order image features; the third image has a false attribute, and the false attribute of the third image cannot be detected by low-order image features; the false attribute is an attribute that does not meet the preset conditions;
[0007] Training a first model according to the first image and the second image to obtain a second model;
[0008] The second model is trained according to the first image and the third image to obtain a face detection model.
[0009] According to a second aspect of the present disclosure, a method for detecting a face image is provided, comprising:
[0010] Acquire the image to be detected;
[0011] According to the face detection model, face detection processing is performed on the image to be detected to obtain a detection result; wherein the face detection model is trained according to the method described in the first aspect; and the detection result is used to characterize whether the image to be detected meets preset conditions.
[0012] According to a third aspect of the present disclosure, a training device for a face detection model is provided, comprising:
[0013] A first acquisition unit is used to acquire a training set; wherein the training set includes: at least one first image, at least one second image, and at least one third image; the first image is an image that meets the preset conditions; the second image has a false attribute, and the false attribute of the second image can be obtained by low-order image feature detection; the third image has a false attribute, and the false attribute of the third image cannot be obtained by low-order image feature detection; the false attribute is an attribute that does not meet the preset conditions;
[0014] A first training unit, configured to train a first model according to the first image and the second image to obtain a second model;
[0015] The second training unit is used to train the second model according to the first image and the third image to obtain a face detection model.
[0016] According to a fourth aspect of the present disclosure, a facial image detection device is provided, comprising:
[0017] A second acquisition unit, used for acquiring an image to be detected;
[0018] A processing unit is used to perform face detection processing on the image to be detected according to a face detection model to obtain a detection result; wherein the face detection model is obtained by training according to the device described in the third aspect; and the detection result is used to characterize whether the image to be detected meets a preset condition.
[0019] According to a fifth aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the first aspect; or, so that the at least one processor can execute the method described in the second aspect.
[0020] According to a sixth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the first aspect; or, the computer instructions are used to cause the computer to execute the method described in the second aspect.
[0021] According to a seventh aspect of the present disclosure, a computer program product is provided, comprising: a computer program, wherein the computer program is stored in a readable storage medium, and at least one processor of an electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program so that the electronic device executes the method described in the first aspect; or, the at least one processor executes the computer program so that the electronic device executes the method described in the second aspect.
[0022] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0024] Figure 1 A flowchart of a method for training a face detection model provided in an embodiment of the present disclosure;
[0025] Figure 2 A flowchart of another method for training a face detection model provided in an embodiment of the present disclosure;
[0026] Figure 3 A flowchart of another method for training a face detection model provided in an embodiment of the present disclosure;
[0027] Figure 4 A schematic diagram of a model training provided in an embodiment of the present disclosure;
[0028] Figure 5 A schematic diagram of a flow chart of a facial image detection method provided by an embodiment of the present disclosure;
[0029] Figure 6 A schematic diagram of the structure of a training device for a face detection model provided in an embodiment of the present disclosure;
[0030] Figure 7 A schematic diagram of the structure of another face detection model training device provided in an embodiment of the present disclosure;
[0031] Figure 8 A schematic diagram of the structure of a facial image detection device provided by an embodiment of the present disclosure;
[0032] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure;
[0033] Fig.10It is a block diagram of an electronic device used to implement the training method of the face detection model or the detection method of the face image according to the embodiment of the present disclosure. DETAILED DESCRIPTION
[0034] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0035] In the related art, when detecting the authenticity of a face, two models are usually trained. One model is used to determine whether the currently acquired image is taken by a real person. The other model is used to detect whether the current image is a tampered synthetic image. When the image to be detected passes the detection of the above two models, it is considered that the image to be detected is a real image taken by a real person. However, the above method has low computational efficiency.
[0036] In one example, the training sets used for liveness detection and synthetic detection are mixed together to train the same model. However, the direct mixed training set training method is likely to result in lower recognition accuracy of the final model.
[0037] In order to avoid at least one of the above technical problems, the inventors of the present disclosure have obtained the inventive concept of the present disclosure through creative work: the training set is divided into three categories, one of which is the first image that meets the preset conditions; the remaining images that do not meet the preset conditions (i.e., have false attributes) are further divided into second images and third images. The difference between the second image and the third image is whether it is possible to determine whether the image has false attributes based on the low-order image features corresponding to itself. Furthermore, after the above distinction is made, the model training can be performed in batches, that is, first based on the second image and the first image, and then, based on the model obtained by the first batch training, the model training is performed based on the first image and the third image to improve the accuracy of the face detection model.
[0038] The present invention discloses a training method, a detection method, a device and equipment for a face detection model, which are applied to technical fields such as computer vision, deep learning, and face recognition in artificial intelligence technology, and can be applied to scenarios such as smart cities and smart finance to improve the accuracy of face detection.
[0039] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0040] Figure 1 A flow chart of a method for training a face detection model provided in an embodiment of the present disclosure is shown in FIG. Figure 1 As shown, the method includes:
[0041] S101, obtaining a training set; wherein the training set includes: at least one first image, at least one second image and at least one third image; the first image is an image that meets preset conditions; the second image has a false attribute, and the false attribute of the second image can be obtained by low-order image feature detection; the third image has a false attribute, and the false attribute of the third image cannot be obtained by low-order image feature detection; the false attribute is an attribute that does not meet the preset conditions.
[0042] Exemplarily, the executing entity of this embodiment may be a training device for a face detection model. The training device for the face detection model may be a server (such as a local server or a cloud server), a computer, a processor, a chip, etc., which is not limited in this embodiment.
[0043] In this embodiment, the images included in the training set are classified. The face images that meet the preset conditions are used as the first images. Furthermore, the face images that do not meet the preset conditions are further divided, that is, divided into the category to which the second image belongs and the category to which the third image belongs.
[0044] Among them, both the second image and the third image are images that do not meet the preset conditions (that is, have false attributes). However, the false attributes of the second image can be identified based on the low-order image features corresponding to the second image. The false attributes of the third image cannot be identified by the low-order image features corresponding to the third image. Among them, low-order image features can be understood as features that can be automatically extracted from the image without the need for shape information (information on spatial relationships) in the image, such as edge features, contour features, colors, textures, and shape features corresponding to the image. In other words, it is relatively easy to identify the false attributes of the second image, while it is relatively easy to identify the false attributes of the third image, that is, it is necessary to use high-order image features corresponding to the image to determine the false attributes corresponding to the image.
[0045] It should be noted that the high-order image features in this embodiment can be understood as semantic features corresponding to the image.
[0046] Furthermore, the preset conditions in this embodiment can be determined according to the purpose of face detection. If the face detection model is a model that needs to perform liveness detection, the preset condition can be a face image taken from a live body. If the face detection model is a model that needs to detect whether the face image is a synthetic image, the preset condition is a non-synthetic face image. In this embodiment, there is no specific limitation on the above preset conditions.
[0047] S102: Train the first model according to the first image and the second image to obtain a second model.
[0048] Exemplarily, in this embodiment, the face detection model is divided into two stages. In the first stage, the first model is trained so that the trained second model can accurately identify the false attributes of the second image.
[0049] That is, in this embodiment, the first image and the second image in the training set are used as the training set for training the first model in this stage.
[0050] In one example, during the training of the first model, the loss function corresponding to the first model can be determined based on the detection results output by the first model and the category to which the image currently input into the first model belongs (i.e., whether it meets the preset conditions), and the parameters contained in the first model are continuously adjusted until the model converges or reaches the preset training stop condition, thereby obtaining the second model.
[0051] S103: Train the second model according to the first image and the third image to obtain a face detection model.
[0052] Illustratively, in this embodiment, after obtaining the second model, the ability of the second model to recognize the false attributes of the third image can be further trained based on the first image and the third image in the training set.
[0053] In one example, during the training of the second model, the parameters contained in the second model can be adjusted based on the image category to which the image currently input into the second model belongs (for example, the image category here may be whether it meets preset conditions) and the detection result corresponding to the current output of the second model, until the model converges or reaches the preset training stop condition, so as to obtain the final face detection model.
[0054] In one example, the face detection model obtained in this embodiment can be used to detect which of the above image categories the input image can be classified into. The image category here can be understood as the category corresponding to the first image, the category corresponding to the second image, and the category corresponding to the third image.
[0055] It can be understood that in this embodiment, the model is first trained using the first image and the second image so that the model obtained at this stage has a higher detection ability in determining whether an image has false attributes based on low-order image features. After that, the model is trained in combination with the first image and the third image so that the model further has the ability to detect the false attributes of the third image with higher recognition difficulty. Furthermore, through the above-mentioned division method of the training set and the two-stage training method, the accuracy of the face detection result of the obtained model can be improved.
[0056] Figure 2 A flowchart of another method for training a face detection model provided in an embodiment of the present disclosure is shown in FIG. Figure 2 As shown, the method includes:
[0057] S201, obtaining a training set; wherein the training set includes: at least one first image, at least one second image and at least one third image; the first image is an image that meets preset conditions; the second image has a false attribute, and the false attribute of the second image can be obtained by low-order image feature detection; the third image has a false attribute, and the false attribute of the third image cannot be obtained by low-order image feature detection; the false attribute is an attribute that does not meet the preset conditions.
[0058] Exemplarily, the executing entity of this embodiment may be a training device for a face detection model. The training device for the face detection model may be a server (such as a local server or a cloud server), a computer, a processor, a chip, etc., which is not limited in this embodiment.
[0059] The technical principle of step S201 can be found in step S101 and will not be repeated here.
[0060] In an example, X convolutional layers are provided in the first model; the first K convolutional layers among the X convolutional layers serve as the first extraction module; the last Y convolutional layers among the X convolutional layers serve as the second extraction module; wherein X, K, and Y are all positive integers, and the value of X is greater than or equal to the sum of K and Y; the first extraction module is used to extract low-order image features of the image; and the second extraction module is used to extract high-order image features of the image.
[0061] Exemplarily, in this embodiment, a first extraction module and a second extraction module are provided in the first model. The first extraction module can be understood as a model component in the first model for extracting low-order image features of an image input into the model. The second extraction module can be understood as a model component in the first model for extracting high-order image features of an image input into the first model.
[0062] Furthermore, in this embodiment, X sequentially connected convolutional layers may be provided, wherein the first K convolutional layers among the X convolutional layers may be used as the first extraction module in the first model. Afterwards, the last Y convolutional layers among the X convolutional layers may be used as the second extraction module for extracting high-order image features.
[0063] It can be understood that in this embodiment, the first K convolutional layers in a plurality of convolutional layers connected in series are used as the first extraction module, and the last Y convolutional layers in a plurality of convolutional layers connected in series are used as the second extraction module, so that the detection result corresponding to the image can be determined by analyzing the high-order image features and low-order image features in the image, and the above network structure is relatively simple and easy to implement.
[0064] S202: According to the first image and the second image, the parameters of the first extraction module are trained and modified to obtain a second model. The first model includes a first extraction module; the first extraction module is used to extract low-order image features of the image.
[0065] Exemplarily, in this embodiment, when the first model is trained according to the first image and the second image, since the second image is an image that can identify false attributes based on low-order image features, in this embodiment, the parameters corresponding to the first extraction module for extracting low-order image features in the first model can be continuously corrected during the training phase until the preset model training stop condition is met. It should be noted that in this embodiment, there is no need to adjust the model parameters for extracting the remaining image features in the first model.
[0066] In one example, when executing the above step S202, the detection result output by the first model and the category corresponding to the image currently input to the first model can be directly used to determine the loss function, so as to continuously adjust the parameters corresponding to the first extraction module to obtain the second model.
[0067] It can be understood that, in this embodiment, during the process of training the first model, only the parameters of the first extraction module in the first model are adjusted to improve the accuracy of the first extraction module in identifying low-order image features.
[0068] In one example, step S202 includes the following steps:
[0069] The first step of step S202: selecting an image to be trained from the first image and the second image.
[0070] Illustratively, in this embodiment, when the first model is trained in combination with the first image and the second image, firstly, an image to be trained may be selected from the first image and the second image included in the training set.
[0071] The second step of step S202: input the image to be trained into the first model to obtain a first detection result and a first feature extraction result; the first detection result represents whether the image to be trained meets the preset conditions; the first feature extraction result is the feature in the image to be trained identified by the first extraction module.
[0072] Exemplarily, after the image to be trained is input into the first model, the result output by the first model for determining whether the image to be trained meets the preset condition can be used as the first detection result. Furthermore, since the first model is also provided with a first extraction module for extracting low-order image features of the image, the processing result obtained when the first extraction module extracts low-order image features from the image to be trained can be further used as the first feature extraction result.
[0073] The third step of step S202: extracting the second feature extraction result of the image to be trained; the second feature extraction result is a low-order image feature determined based on a preset feature extractor.
[0074] Exemplarily, in this embodiment, low-order image feature processing is also performed on the image to be trained based on the preset feature extractor to obtain a second feature extraction result corresponding to the image to be trained. It should be noted that the preset feature extractor in this embodiment is independent of the model in this embodiment. For example, the preset feature extractor can be an edge feature extraction operator provided in the relevant technology.
[0075] The fourth step of step S202: according to the first detection result, the first feature extraction result and the second feature extraction result, modify the parameters of the first extraction module to obtain the second model.
[0076] Exemplarily, after obtaining the first detection result, the first feature extraction result, and the second feature extraction result, the parameters corresponding to the first extraction module can be adjusted in combination with the above content, thereby obtaining the adjusted second model. For example, the first loss function can be determined in combination with the first detection result and the category corresponding to the image to be trained (i.e., whether it meets the preset conditions). And the second loss function is obtained based on the first feature extraction result and the second feature extraction result. Afterwards, the first loss function and the second loss function are combined to correct the parameters of the first extraction module.
[0077] It can be understood that in this embodiment, in the stage of training the first model, a preset feature extractor is introduced to perform low-order image feature extraction on the training image, so that the second feature extraction result obtained can be combined with the first feature extraction result and the first detection result obtained in the model training process to jointly adjust the parameters of the first model, so as to make the low-order image features extracted by the first extraction module in the first model more accurate and improve the accuracy of the final model.
[0078] In one example, the fourth step of step S202 can be implemented as follows: perform sampling processing on the first feature extraction result to obtain a first processing result; wherein the matrix dimension of the first processing result is the same as the matrix dimension of the second feature extraction result; and perform parameter correction on the first extraction module according to the first processing result, the second feature extraction result and the first detection result to obtain a second model.
[0079] Exemplarily, in this embodiment, in order to avoid the difference in matrix dimensions corresponding to the first feature extraction result and the second feature extraction result obtained based on the first model, that is, the different data sizes corresponding to the two feature extraction results, after obtaining the first feature extraction result, the first feature extraction result will also be sampled, for example, down-sampling and / or up-sampling, so that the first processing result obtained after the sampling process has the same size as the second feature extraction result, so as to subsequently construct the loss function. After obtaining the first processing result, the first extraction module of the first model can be further adjusted in combination with the first detection result and the second feature extraction result to obtain the second module.
[0080] It can be understood that in this embodiment, the first feature extraction result can be sampled to ensure that the final first processing result and the second feature extraction result have the same size, which is beneficial to improving the accuracy of model parameter adjustment.
[0081] In one example, a first feature extraction result is sampled to obtain a first processing result, including: based on N preset convolutional layers, down-sampling the first feature extraction result to obtain a second processing result; based on M preset convolutional layers, according to the first feature extraction result, up-sampling the second processing result in sequence to obtain the first processing result; wherein N, M, and K are all positive integers.
[0082] Exemplarily, in this embodiment, when sampling the first feature extraction result obtained by the first extraction module, the first feature extraction result can first be downsampled in sequence based on N preset convolutional layers to obtain a second processing result. Afterwards, the second processing result is upsampled in sequence according to the obtained second processing result and the first feature extraction result, so as to obtain a first processing result with the same matrix dimension as the second feature extraction result. It should be noted that in this embodiment, when upsampling the second processing result, it will also be combined with the first feature extraction result obtained previously to perform upsampling processing, so as to improve the accuracy of the sampling result. In addition, it should be noted that the preset convolutional layer in this embodiment is not a model component included in the face detection model, but is only the remaining processing structure introduced in the model training process to assist model training.
[0083] It is understandable that, in this embodiment, the first feature extraction result can be adjusted to a first processing result of the same size as the second feature extraction result by combining downsampling and upsampling processing. Moreover, in the upsampling process, the matrix dimension corresponding to the result output by each preset convolution layer is continuously expanded in combination with the first feature extraction result obtained previously, so as to improve the accuracy of the first processing result finally obtained.
[0084] In one example, the third step of step S202 can be implemented by the following steps:
[0085] The image to be trained is subjected to image size transformation processing to obtain a transformed image to be trained; based on a preset feature extractor, feature extraction processing is performed on the transformed image to be trained to obtain a second feature extraction result.
[0086] Exemplarily, in this embodiment, in order to ensure that the matrix dimensions of the first feature extraction result and the second feature extraction result are the same, in this embodiment, before feature extraction is performed based on the preset feature extractor, the image size conversion process can be performed on the training image, and then feature extraction is performed on the transformed image based on the preset feature extractor to obtain the final second feature extraction result.
[0087] It can be understood that in this embodiment, the image size of the training image can be converted and then the low-order image features corresponding to the converted training image can be extracted to ensure that the second feature extraction result and the first feature extraction result have the same size, so that a loss function can be constructed based on the first feature extraction result and the second feature extraction result, and the model parameters can be adjusted in combination with the obtained loss function.
[0088] S203, according to the first image and the third image, the parameters of the second extraction module in the second model are trained and modified to obtain a face detection model; the face detection model is used to identify whether the image meets the preset conditions. Wherein, the first model also includes a second extraction module; the second extraction module is used to extract high-order image features of the image.
[0089] Exemplarily, in this embodiment, when the second model is trained in combination with the first image and the third image, the parameters of the second extraction module for extracting high-order image features contained in the second model will be adjusted, that is, the parameters of the first extraction module contained in the first model will not be adjusted in this stage, but only the parameters of the second extraction module for extracting high-order image features in the model will be adjusted and trained, thereby improving the accuracy of the face detection model in extracting high-order image features, and further improving the accuracy of the face detection model finally obtained. It should be noted that the first model is provided with a first extraction module and a second extraction module. The second model obtained by training the first model also includes the trained first extraction module and the second extraction module. Moreover, this step is trained on the basis of the second model. Moreover, the face detection model obtained by the above-mentioned training method in this embodiment can be specifically used to identify whether the image input into the model meets the preset conditions.
[0090] In this embodiment, during the training of the first model, only the parameters of the first extraction module in the first model are adjusted to improve the accuracy of the first extraction module in identifying low-order image features. In addition, in the second stage of training, the first image and the third image can be combined to train the second model, and the parameters of the second extraction module for extracting high-order image features included in the second model are adjusted to improve the accuracy of the face detection image finally obtained.
[0091] Figure 3 A flowchart of another method for training a face detection model provided in an embodiment of the present disclosure is shown in FIG. Figure 3 As shown, the method includes:
[0092] S301, obtaining a training set; wherein the training set includes: at least one first image, at least one second image and at least one third image; the first image is an image that meets preset conditions; the second image has a false attribute, and the false attribute of the second image can be obtained by low-order image feature detection; the third image has a false attribute, and the false attribute of the third image cannot be obtained by low-order image feature detection; the false attribute is an attribute that does not meet the preset conditions.
[0093] Exemplarily, the executing entity of this embodiment may be a training device for a face detection model. The training device for the face detection model may be a server (such as a local server or a cloud server), a computer, a processor, a chip, etc., which is not limited in this embodiment.
[0094] In one example, before the images contained in the training set are used for model training, the images contained in the training set can also be preprocessed. For example, the face area corresponding to the face in the image is first determined. Then, the face key points of the corresponding face in the face area are performed to obtain the key point coordinate values of the face contained in the image. Then, the face alignment processing can be performed on the face of the image according to the key point coordinate values of the face to straighten the face in the image. At the same time, based on the affine transformation processing, the straightened face image containing the face can be intercepted so that the intercepted face image meets the input data requirements of the model. In addition, the intercepted face image can also be normalized to reduce the amount of calculation in the subsequent model processing process.
[0095] In one example, the preset condition is a face image that is captured from a living body and has not been synthesized.
[0096] The preset condition in this embodiment is that the face image is obtained by taking a live shot and has not been tampered with or synthesized. That is, the face detection model trained in this embodiment can be used to identify whether the image is taken by a live shot and whether the image has been synthesized or tampered with.
[0097] Further, under the above preset conditions, the second image may include: a first type of second image and a second type of second image. The first type is an image taken by a non-living body, for example, the first type of second image may be: an image of an electronic screen containing edges (i.e., an image obtained by photographing a face in a display device), a face image obtained by photographing a face on paper, a face image obtained by photographing a paper mask, an image obtained by photographing an ID photo, etc., which can be identified as a live shot based on low-order image features such as obvious edge features of the image background, that is, whether it does not meet the preset conditions. The second type is a synthetically forged image, for example, the second type of second image may be: a face image obtained by deducting face A and pasting it on face B through image synthesis software, etc., which can be identified as a pseudo-synthesized image based on low-order image features.
[0098] In addition, the third image may include: a third image of the first type and a third image of the second type. Among them, the third image of the second type may be a synthetic image obtained by a Deepfake face-changing method such as FaceSwap, Face2Face, etc., and needs to be combined with high-order image feature attacks to identify whether it is a forged image. The third image of the first type may be: obtained by a three-dimensional head model, a three-dimensional mask, etc., and needs to be combined with high-dimensional image features to identify whether it is an image taken from a living body.
[0099] It can be understood that, in combination with the above-mentioned preset conditions and the setting method of the training set, the trained face detection model can perform face liveness detection and face synthesis detection. Compared with the method of using two models for detection in the related technology, the same model can be used for image detection in this embodiment, and the combination of the subsequent two stages of training can also improve the accuracy of model training.
[0100] S302. According to the first image, the second image and the third image, the first model is trained to obtain the trained first model; the trained first model is obtained after adjusting the parameters of the first extraction module and the second extraction module in the first model; the first extraction module is used to extract low-order image features of the image; the second extraction module is used to extract high-order image features of the image.
[0101] Exemplarily, in this embodiment, before training the first model in combination with the first image and the second image, the first model can also be trained and parameter adjusted in combination with images of various categories included in the training set (i.e., the first image, the second image, and the third image), and in this stage, the parameters corresponding to the first extraction module and the second extraction module in the first model can be adjusted in combination with the training results.
[0102] After adjusting the overall parameters of the first extraction module and the second extraction module in the first model, in subsequent steps S303 and S304, based on the model obtained in step S302, the model can be trained in stages in combination with different images to improve the accuracy of model training.
[0103] It can be understood that in this embodiment, before using different training images to train the model in stages, images of various categories in the training set can be first trained, and based on the model obtained in step S302, the training process of step S303 can be performed to improve the training efficiency of the subsequent model training stage.
[0104] S303: Train the trained first model according to the first image and the second image to obtain a second model.
[0105] S304. According to the first image and the third image, the second model is trained to obtain a face detection model; the face detection model is used to identify whether the image meets the preset conditions.
[0106] For example, steps S303-S304 provided in this embodiment can refer to Figure 1 Steps S102-S103 in, or, Figure 2 Steps S202-S203 in the embodiment will not be repeated in this embodiment.
[0107] In this embodiment, the training process of the face detection model can be divided into three stages. Before the first extraction module and the second extraction module in the model are trained respectively, the parameters of the first extraction module and the second extraction module in the model can be adjusted in combination with the images of each category in the training set. After that, the subsequent extraction modules can be independently trained to improve the accuracy of the obtained face detection model.
[0108] For example, Figure 4 A schematic diagram of a model training provided in an embodiment of the present disclosure. Figure 4 As shown, the model training process in this embodiment can be divided into three stages. And a plurality of convolutional layers are provided in the first model. The first K convolutional layers in the first model serve as the first extraction module in the model. The last Y convolutional layers in the first model serve as the second extraction module in the model. Optionally, the above-mentioned first model can adopt the network structure of ResNet-18.
[0109] In the first stage, the first image, the second image and the third image in the training set are used as the training set 1 corresponding to the first training stage. After performing face region detection, face key point detection, face alignment and image preprocessing on the images in the training set 1 in sequence, the preprocessed images are input into the first model provided with the first extraction module and the second extraction module, and the parameters of the first extraction module and the second extraction module of the first model are adjusted to obtain the trained first model.
[0110] In the second stage, the first image and the second image in the training set are used as the training set 2 corresponding to the second stage. After performing face region detection, face key point detection, face alignment, and image preprocessing on the images in the training set 1 in sequence, the preprocessed images are input into the trained first model obtained by the first stage training. In this training stage, the parameters of the second extraction module are fixed, and only the parameters in the first extraction module are adjusted to obtain the second model. In addition, during the training process, it is also possible to set N preset convolutional layers to sequentially perform downsampling processing on the final output of the ground extraction module in sequence, and then, based on M preset convolutional layers, the second processing results are sequentially upsampled according to the first feature extraction results, thereby obtaining the first processing results. Afterwards, low-order image feature extraction processing is performed on the images in the training set 2 based on the preset feature extractor to obtain the second feature extraction results. Afterwards, the first extraction module is adjusted in combination with the second feature extraction results, the first processing results, and the detection results output by the model.
[0111] For example, in actual applications, the K convolutional layers in the first extraction module, the N preset convolutional layers for downsampling, and the M preset convolutional layers for upsampling can be connected and processed using the UNet network architecture to obtain the above-mentioned first processing result.
[0112] In the third stage, the first image and the third image in the training set can be used as the training set 3 corresponding to the first training stage. After performing face region detection, face key point detection, face alignment, and image preprocessing on the images in the training set 3 in sequence, the preprocessed images are input into the second model, and the parameters of the second extraction module in the second model are adjusted to obtain a face detection model.
[0113] Figure 5 The following is a flow chart of a method for detecting a face image provided by an embodiment of the present disclosure. Figure 5 As shown, the method includes:
[0114] S501: Acquire an image to be detected.
[0115] S502. Perform face detection processing on the image to be detected according to the face detection model to obtain a detection result; wherein the face detection model is trained according to the method in any of the above embodiments; the detection result is used to indicate whether the image to be detected meets the preset conditions.
[0116] Exemplarily, in this embodiment, the image to be detected may be input into a face detection model, and the result output by the face detection model may be used as the face detection result to determine whether the current image to be detected meets a preset condition.
[0117] It can be understood that the face detection model obtained by the model training method in the above embodiment performs face detection on the image to be detected so as to improve the accuracy of the face detection result.
[0118] Figure 6 A structural diagram of a training device for a face detection model provided in an embodiment of the present disclosure is shown in FIG. Figure 6 As shown, the training device 600 of the face detection model includes:
[0119] The first acquisition unit 601 is used to acquire a training set; wherein the training set includes: at least one first image, at least one second image, and at least one third image; the first image is an image that meets the preset conditions; the second image has a false attribute, and the false attribute of the second image can be detected by low-order image features; the third image has a false attribute, and the false attribute of the third image cannot be detected by low-order image features; the false attribute is an attribute that does not meet the preset conditions;
[0120] A first training unit 602 is used to train the first model according to the first image and the second image to obtain a second model;
[0121] The second training unit 603 is used to train the second model according to the first image and the third image to obtain a face detection model.
[0122] The device provided in this embodiment is used to implement the technical solution provided by the above method. Its implementation principle and technical effect are similar and will not be described in detail.
[0123] Figure 7 A structural diagram of another face detection model training device provided in an embodiment of the present disclosure is shown in FIG. Figure 7 As shown, the training device 700 of the face detection model includes:
[0124] The first acquisition unit 701 is used to acquire a training set; wherein the training set includes: at least one first image, at least one second image, and at least one third image; the first image is an image that meets the preset conditions; the second image has a false attribute, and the false attribute of the second image can be detected by low-order image features; the third image has a false attribute, and the false attribute of the third image cannot be detected by low-order image features; the false attribute is an attribute that does not meet the preset conditions;
[0125] A first training unit 702 is used to train the first model according to the first image and the second image to obtain a second model;
[0126] The second training unit 703 is used to train the second model according to the first image and the third image to obtain a face detection model.
[0127] In one example, the first model includes a first extraction module; the first extraction module is used to extract low-order image features of the image; and a first training unit is specifically used to:
[0128] According to the first image and the second image, the parameters of the first extraction module are trained and corrected to obtain a second model.
[0129] In one example, the first training unit 702 includes:
[0130] A selection module 7021, used for selecting an image to be trained from the first image and the second image;
[0131] The first determination module 7022 is used to input the image to be trained into the first model to obtain a first detection result and a first feature extraction result; the first detection result indicates whether the image to be trained meets the preset conditions; the first feature extraction result is the feature in the image to be trained identified by the first extraction module;
[0132] The acquisition module 7023 is used to extract the second feature extraction result of the image to be trained; the second feature extraction result is a low-order image feature determined based on a preset feature extractor;
[0133] The second determination module 7024 is used to modify the parameters of the first extraction module according to the first detection result, the first feature extraction result and the second feature extraction result to obtain the second model.
[0134] In one example, the second determination module 7024 includes:
[0135] A first processing submodule is used to perform sampling processing on the first feature extraction result to obtain a first processing result; wherein the matrix dimension of the first processing result is the same as the matrix dimension of the second feature extraction result;
[0136] The correction submodule is used to correct the parameters of the first extraction module according to the first processing result, the second feature extraction result and the first detection result to obtain the second model.
[0137] In one example, the processing submodule is specifically used to:
[0138] Based on N preset convolutional layers, down-sampling the first feature extraction result is performed to obtain a second processing result;
[0139] Based on M preset convolutional layers, the second processing results are sequentially upsampled according to the first feature extraction results; wherein N and M are both positive integers.
[0140] In one example, the acquisition module 7023 includes:
[0141] A transformation submodule is used to perform image size transformation processing on the training image to obtain a transformed training image;
[0142] The second processing submodule is used to perform feature extraction processing on the transformed image to be trained based on a preset feature extractor to obtain a second feature extraction result.
[0143] In one example, the first model further includes a second extraction module; the second extraction module is used to extract high-order image features of the image; the second training unit 703 is specifically used to:
[0144] According to the first image and the third image, the parameters of the second extraction module in the second model are trained and corrected to obtain a face detection model.
[0145] In one example, the device further includes:
[0146] The third training unit 704 is used to train the first model according to the first image and the second image in the first training unit, and before obtaining the second model, train the first model according to the first image, the second image and the third image to obtain the trained first model; the trained first model is obtained after adjusting the parameters of the first extraction module and the second extraction module in the first model; the first extraction module is used to extract low-order image features of the image; the second extraction module is used to extract high-order image features of the image.
[0147] In an example, X convolutional layers are provided in the first model; the first K convolutional layers among the X convolutional layers serve as the first extraction module; the last Y convolutional layers among the X convolutional layers serve as the second extraction module; wherein X, K, and Y are all positive integers, and the value of X is greater than or equal to the sum of K and Y; the first extraction module is used to extract low-order image features of the image; and the second extraction module is used to extract high-order image features of the image.
[0148] In one example, the preset condition is a face image that is captured from a living body and has not been synthesized.
[0149] In one example, a face detection model is used to identify whether an image meets preset conditions.
[0150] The device provided in this embodiment is used to implement the technical solution provided by the above method. Its implementation principle and technical effect are similar and will not be described in detail.
[0151] Figure 8 A structural diagram of a facial image detection device provided by an embodiment of the present disclosure is shown in FIG. Figure 8 As shown, the training device 800 of the face detection model includes:
[0152] The second acquisition unit 801 is used to acquire the image to be detected;
[0153] The processing unit 802 is used to perform face detection processing on the image to be detected according to the face detection model to obtain a detection result; wherein the face detection model is obtained by training according to any of the above-mentioned devices; the detection result is used to indicate whether the image to be detected meets the preset conditions.
[0154] The device provided in this embodiment is used to implement the technical solution provided by the above method. Its implementation principle and technical effect are similar and will not be described in detail.
[0155] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0156] The present disclosure provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method provided by any of the above embodiments.
[0157] Fig. 9 The structure diagram of an electronic device provided by the embodiment of the present disclosure is shown in FIG. Fig. 9 As shown, the electronic device 900 in the present disclosure may include: a processor 901 and a memory 902 .
[0158] The memory 902 is used to store programs; the memory 902 may include a volatile memory (English: volatile memory), such as a random access memory (English: random-access memory, abbreviated: RAM), such as a static random access memory (English: static random-access memory, abbreviated: SRAM), a double data rate synchronous dynamic random access memory (English: Double Data Rate Synchronous Dynamic Random Access Memory, abbreviated: DDR SDRAM), etc.; the memory may also include a non-volatile memory (English: non-volatile memory), such as a flash memory (English: flash memory). The memory 902 is used to store computer programs (such as applications, functional modules, etc. that implement the above method), computer instructions, etc., and the above computer programs, computer instructions, etc. can be partitioned and stored in one or more memories 902. And the above computer programs, computer instructions, data, etc. can be called by the processor 901.
[0159] The above-mentioned computer programs, computer instructions, etc. may be stored in one or more memories 902 in partitions. And the above-mentioned computer programs, computer instructions, etc. may be called by the processor 901.
[0160] The processor 901 is used to execute the computer program stored in the memory 902 to implement each step of the method involved in the above embodiment.
[0161] For details, please refer to the relevant description in the previous method embodiment.
[0162] The processor 901 and the memory 902 may be independent structures or integrated structures. When the processor 901 and the memory 902 are independent structures, the memory 902 and the processor 901 may be coupled and connected via a bus 903 .
[0163] The electronic device of this embodiment can execute the technical solution in the above method, and its specific implementation process and technical principle are the same, which will not be repeated here.
[0164] The present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method provided by any of the above embodiments.
[0165] According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, which includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.
[0166] Fig.10 A schematic block diagram of an example electronic device 1000 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0167] like Fig.10 As shown, the device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0168] A number of components in the device 1000 are connected to the I / O interface 1005, including: an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0169] The computing unit 1001 may be a variety of general and / or special processing units with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1001 performs the various methods and processes described above, such as a training method for a face detection model, or a method for detecting a face image. For example, in some embodiments, the training method for a face detection model, or the method for detecting a face image may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded into the RAM 1003 and executed by the computing unit 1001, one or more steps of the training method for the face detection model or the method for detecting a face image described above may be executed. Alternatively, in other embodiments, the computing unit 1001 may be configured to execute a training method for a face detection model or a detection method for a face image by any other appropriate means (eg, by means of firmware).
[0170] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0171] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0172] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0173] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0174] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0175] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0176] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0177] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A training method for a face detection model, comprising: Acquire a training set; wherein the training set includes: at least one first image, at least one second image, and at least one third image; the first image is an image that meets the preset conditions; the second image has a false attribute, and the false attribute of the second image can be detected by low-order image features; the third image has a false attribute, and the false attribute of the third image cannot be detected by low-order image features; the false attribute is an attribute that does not meet the preset conditions; According to the first image and the second image, a first model is trained to obtain a second model; X convolutional layers are provided in the first model; the first K convolutional layers of the X convolutional layers are used as a first extraction module; the last Y convolutional layers of the X convolutional layers are used as a second extraction module; wherein X, K, and Y are all positive integers, and the value of X is greater than or equal to the sum of K and Y; the first extraction module is used to extract low-order image features of an image; and the second extraction module is used to extract high-order image features of an image; The second model is trained according to the first image and the third image to obtain a face detection model.
2. The method according to claim 1, wherein: The first model includes a first extraction module; the first extraction module is used to extract low-order image features of the image; the first model is trained according to the first image and the second image to obtain a second model, including: According to the first image and the second image, the parameters of the first extraction module are trained and corrected to obtain a second model.
3. The method according to claim 2, wherein: According to the first image and the second image, the parameters of the first extraction module are modified to obtain a second model, including: Selecting an image to be trained from the first image and the second image; Input the image to be trained into the first model to obtain a first detection result and a first feature extraction result; the first detection result indicates whether the image to be trained meets the preset condition; the first feature extraction result is a feature in the image to be trained identified by the first extraction module; Extracting a second feature extraction result of the image to be trained; the second feature extraction result is a low-order image feature determined based on a preset feature extractor; According to the first detection result, the first feature extraction result and the second feature extraction result, parameters of the first extraction module are modified to obtain a second model.
4. The method according to claim 3, wherein: According to the first detection result, the first feature extraction result and the second feature extraction result, the first extraction module is parameterized to obtain a second model, including: Performing sampling processing on the first feature extraction result to obtain a first processing result; wherein the matrix dimension of the first processing result is the same as the matrix dimension of the second feature extraction result; According to the first processing result, the second feature extraction result and the first detection result, parameters of the first extraction module are modified to obtain a second model.
5. The method according to claim 4, wherein: The first feature extraction result is sampled to obtain a first processing result, including: Based on N preset convolutional layers, down-sampling the first feature extraction result to obtain a second processing result; Based on M preset convolutional layers, the second processing results are sequentially upsampled according to the first feature extraction results; wherein N and M are both positive integers.
6. The method according to claim 3, wherein: Extracting a second feature extraction result of the image to be trained includes: Performing image size conversion processing on the image to be trained to obtain a converted image to be trained; Based on a preset feature extractor, feature extraction processing is performed on the transformed image to be trained to obtain the second feature extraction result.
7. The method according to any one of claims 2 to 6, wherein: The first model also includes a second extraction module; the second extraction module is used to extract high-order image features of the image; the second model is trained according to the first image and the third image to obtain a face detection model, including: According to the first image and the third image, the parameters of the second extraction module in the second model are trained and corrected to obtain a face detection model.
8. The method according to any one of claims 1 to 6, wherein: Before training the first model according to the first image and the second image to obtain the second model, the method further includes: According to the first image, the second image and the third image, the first model is trained to obtain the trained first model; the trained first model is obtained after adjusting the parameters of the first extraction module and the second extraction module in the first model; the first extraction module is used to extract low-order image features of the image; the second extraction module is used to extract high-order image features of the image.
9. The method according to any one of claims 1 to 6, wherein: The preset condition is a face image that is captured from a living body and has not been synthesized.
10. The method according to any one of claims 1 to 6, wherein: The face detection model is used to identify whether an image meets the preset condition.
11. A method for detecting a face image, comprising: Acquire the image to be detected; According to the face detection model, face detection processing is performed on the image to be detected to obtain a detection result; wherein the face detection model is trained according to the method described in any one of claims 1-10; and the detection result is used to characterize whether the image to be detected meets preset conditions.
12. A training device for a face detection model, comprising: A first acquisition unit is used to acquire a training set; wherein the training set includes: at least one first image, at least one second image, and at least one third image; the first image is an image that meets the preset conditions; the second image has a false attribute, and the false attribute of the second image can be obtained by low-order image feature detection; the third image has a false attribute, and the false attribute of the third image cannot be obtained by low-order image feature detection; the false attribute is an attribute that does not meet the preset conditions; A first training unit is used to train a first model according to the first image and the second image to obtain a second model; wherein the first model is provided with X convolutional layers; the first K convolutional layers of the X convolutional layers are used as first extraction modules; and the last Y convolutional layers of the X convolutional layers are used as second extraction modules; wherein X, K, and Y are all positive integers, and the value of X is greater than or equal to the sum of K and Y; the first extraction module is used to extract low-order image features of an image; and the second extraction module is used to extract high-order image features of an image; The second training unit is used to train the second model according to the first image and the third image to obtain a face detection model.
13. The device according to claim 12, wherein: The first model includes a first extraction module; the first extraction module is used to extract low-order image features of the image; and a first training unit is specifically used to: According to the first image and the second image, the parameters of the first extraction module are trained and corrected to obtain a second model.
14. The device according to claim 13, wherein: The first training unit includes: A selection module, used for selecting an image to be trained from the first image and the second image; A first determination module is used to input the image to be trained into the first model to obtain a first detection result and a first feature extraction result; the first detection result indicates whether the image to be trained meets the preset condition; the first feature extraction result is a feature in the image to be trained identified by the first extraction module; An acquisition module, used for extracting a second feature extraction result of the image to be trained; the second feature extraction result is a low-order image feature determined based on a preset feature extractor; The second determination module is used to modify the parameters of the first extraction module according to the first detection result, the first feature extraction result and the second feature extraction result to obtain a second model.
15. The device according to claim 14, wherein: The second determination module includes: A first processing submodule, configured to perform sampling processing on the first feature extraction result to obtain a first processing result; wherein the matrix dimension of the first processing result is the same as the matrix dimension of the second feature extraction result; A correction submodule is used to correct the parameters of the first extraction module according to the first processing result, the second feature extraction result and the first detection result to obtain a second model.
16. The device according to claim 15, wherein: Processing submodules, specifically used for: Based on N preset convolutional layers, down-sampling the first feature extraction result to obtain a second processing result; Based on M preset convolutional layers, the second processing results are sequentially upsampled according to the first feature extraction results; wherein N and M are both positive integers.
17. The device according to claim 16, wherein: Get modules, including: A transformation submodule, used for performing image size transformation processing on the image to be trained to obtain a transformed image to be trained; The second processing submodule is used to perform feature extraction processing on the transformed image to be trained based on a preset feature extractor to obtain the second feature extraction result.
18. The device according to any one of claims 13 to 17, wherein: The first model further includes a second extraction module; the second extraction module is used to extract high-order image features of the image; and a second training unit is specifically used to: According to the first image and the third image, the parameters of the second extraction module in the second model are trained and corrected to obtain a face detection model.
19. The device according to any one of claims 12 to 17, wherein: The device also includes: A third training unit is used to train the first model according to the first image and the second image in the first training unit, and before obtaining the second model, train the first model according to the first image, the second image and the third image to obtain a trained first model; the trained first model is obtained after adjusting parameters of the first extraction module and the second extraction module in the first model; the first extraction module is used to extract low-order image features of the image; the second extraction module is used to extract high-order image features of the image.
20. The device according to any one of claims 12 to 17, wherein: The preset condition is a face image that is captured from a living body and has not been synthesized.
21. The device according to any one of claims 12 to 17, wherein: The face detection model is used to identify whether an image meets the preset condition.
22. A facial image detection device, comprising: A second acquisition unit, used for acquiring an image to be detected; A processing unit, used to perform face detection processing on the image to be detected according to a face detection model to obtain a detection result; wherein the face detection model is obtained by training the device according to any one of claims 12-21; and the detection result is used to characterize whether the image to be detected meets preset conditions.
23. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 11.
24. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-11.
25. A computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Face living body detection method and device, model training method and device, equipment and medium
CN116863521A
