A face image detection method and device, electronic equipment and storage medium
By performing multi-path feature learning based on the importance of pixel features during the training of the face liveness detection model, the problems of poor model optimization and low generalization ability are solved, achieving higher accuracy in image detection and cross-domain adaptation.
Patent Information
- Application Number
- CN202111650667.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2041-12-30
AI Technical Summary
Existing face liveness detection models are difficult to optimize because the difference between real and fake faces is not essential, making it hard to find optimization directions. This results in limited model performance improvement and poor generalization ability, making them unable to cope with cross-data domain face attacks.
By performing multi-path feature learning based on the importance of pixel features during training, a synchronous model training path is established, including training on images generated by preprocessing and occlusion strategies, thereby improving the model's ability to learn image features with varying degrees of influence on detection results.
It improves the model's feature learning and generalization abilities, enabling it to output more accurate detection results during face image detection and enhancing its detection capabilities in cross-domain environments.
Smart Images

Figure CN116434287B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the technical field of artificial intelligence, and particularly relate to a face image detection method and device, an electronic device, and a storage medium. BACKGROUND
[0002] At present, in the face living body detection technology, the features of the living body face image are learned in depth through a convolutional neural network model, and a face living body detection model is obtained through pre-training. Then, the model obtained through training is used to identify the living body face image.
[0003] However, in the model optimization process, the difference between the real and fake faces is not an essential difference in the classification subject, and it is not easy to find the direction of model optimization, which leads to the fact that the model performance cannot be improved, and the model generalization ability is poor and cannot cope with cross-data domain face attacks. SUMMARY
[0004] Embodiments of the present disclosure provide a face image detection method and device, an electronic device, and a storage medium, which use a face detection model that learns features in multiple paths according to the importance of pixel features during training, can improve the feature learning ability in the image recognition process, and thus improve the generalization ability of the preset face image detection model.
[0005] In a first aspect, embodiments of the present disclosure provide a face image detection method, which includes:
[0006] obtaining a face image to be detected;
[0007] inputting the face image to be detected into a preset face detection model to obtain a face image detection result;
[0008] The preset face detection model is generated through a synchronous model training path that is trained based on a first image obtained by preprocessing a training sample image according to the influence of pixels in the training sample image on the image detection result and a second image generated by occluding the training sample image according to a preset occlusion strategy.
[0009] In a second aspect, embodiments of the present disclosure also provide a face image detection device, which includes:
[0010] an image obtaining module configured to obtain a face image to be detected;
[0011] an image detection module configured to input the face image to be detected into a preset face detection model to obtain a face image detection result;
[0012] The preset face detection model is generated by a synchronous model training path training based on a first image obtained by preprocessing a training sample image according to an influence degree of a pixel in the training sample image on an image detection result and a second image generated by occluding the training sample image according to a preset occlusion strategy.
[0013] In a third aspect, the present disclosure also provides an electronic device, which comprises:
[0014] one or more processors;
[0015] a storage device configured to store one or more programs,
[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the face image detection method according to any of the embodiments of the present disclosure.
[0017] In a fourth aspect, the present disclosure also provides a storage medium containing computer executable instructions for performing the face image detection method according to any of the embodiments of the present disclosure when executed by a computer processor.
[0018] The technical solution of the embodiments of the present disclosure is that a face image to be detected is obtained, the face image to be detected is input into a preset face detection model, and a face image detection result is obtained. The preset face detection model is generated by a synchronous model training path training based on a first image obtained by preprocessing a training sample image according to an influence degree of a pixel in the training sample image on an image detection result and a second image generated by occluding the training sample image according to a preset occlusion strategy in a training process. The model can fully learn image features with different influence degrees on the detection result, thereby improving the feature learning ability of the model. The technical solution disclosed in the embodiments of the present disclosure solves the problem of poor optimization effect and low generalization ability of the existing face image detection model, improves the learning ability of the model for image features in the process of face image detection, obtains a face image detection result with higher monitoring accuracy, and improves the generalization ability of the target training model. BRIEF DESCRIPTION OF DRAWINGS
[0019] The above and other features, advantages, and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the original and elements are not necessarily drawn according to the scale.
[0020] Figure 1 A flowchart of a face image detection method provided by the first embodiment of the present disclosure is shown in FIG. 1.
[0021] Figure 2 A flowchart of a face image detection method provided by Embodiment Two of the present disclosure is shown in FIG. 2.
[0022] Figure 3 A schematic diagram of a face detection model training process provided by Embodiment Two of the present disclosure is shown in FIG. 3.
[0023] Figure 4 A structural schematic diagram of a face image detection device provided by Embodiment Three of the present disclosure is shown in FIG. 4.
[0024] Figure 5 A structural schematic diagram of an electronic device provided by Embodiment Four of the present disclosure is shown in FIG. 5. DETAILED DESCRIPTION
[0025] Embodiments of the present disclosure will be described in more detail by referring to the drawings. Although certain embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein, but rather the embodiments are provided to make the present disclosure more thorough and complete. It is understood that the drawings and embodiments of the present disclosure are for exemplary purposes only and are not intended to limit the scope of the present disclosure.
[0026] It should be understood that each of the steps recited in the method embodiments of the present disclosure can be executed in different orders and / or in parallel. In addition, the method embodiments can include additional steps and / or omit the execution of the steps shown. The scope of the present disclosure is not limited in this respect.
[0027] As used herein, the term "comprises" and its variations are open-ended, meaning "includes but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Related definitions of other terms will be given in the following description.
[0028] It should be noted that the terms "first", "second", and the like used in the present disclosure are only used to distinguish different devices, modules or units, and are not intended to limit the order or interdependence of the functions performed by these devices, modules or units.
[0029] It should be noted that the terms "one", "multiple" used in the present disclosure are illustrative and not limiting, and those skilled in the art should understand that unless otherwise explicitly stated in the context, it should be understood as "one or more".
[0030] Embodiment One
[0031] Figure 1A flowchart of a face image detection method provided by Embodiment One of the present disclosure is provided. The present disclosure is applicable to the process of recognizing and classifying face images, and is particularly applicable to the case of recognizing live face images. The method can be executed by a face image detection device, which can be implemented in the form of software and / or hardware. The device can be configured in an electronic device, such as a mobile terminal or a server device.
[0032] As shown in Figure 1 The face image detection method provided by the present embodiment includes:
[0033] S110, obtaining a face image to be detected.
[0034] The face image to be detected can be a live face image, which is an image collected in a scenario requiring identity recognition and authentication. For example, in scenarios such as account login or transaction information determination, facial recognition verification is required, and the face image of the target object is collected in real time by the image collection function module of the terminal device where the application client is located. The face image to be detected can also be a non-live face image, such as a pre-stored face image in the terminal device or an image of a collected face image. Therefore, it is necessary to further identify whether the collected image is a live face image and whether it is a target live face image. Of course, the technical solution of the present embodiment is also applicable to the detection of non-live face images in other scenarios requiring image recognition.
[0035] S120, inputting the face image to be detected into a preset face detection model to obtain a face image detection result.
[0036] In a scenario requiring face image detection, the client of the related application program will call the face image detection device after obtaining the face image to be detected to execute the process of face image detection. Specifically, the face image to be detected is input into the preset face detection model, and the corresponding detection result is output by the preset face detection model. In particular, in the present embodiment, the preset face detection model is generated by training the synchronous model training path based on the first image obtained by preprocessing the training sample image according to the influence degree of the pixel in the training sample image on the image detection result and the second image generated by occluding the training sample image according to a preset occlusion strategy.
[0037] It is considered that the difference between real or fake live face images is not the difference of entities, and a general face detection model cannot learn the key features in the face image to be detected that can indicate the difference between real and fake live face images and determine the direction of model optimization. In addition, due to the limitation of the amount of model training data collected, when the user collects the face image to be detected through the terminal device, the user may be in various image collection environments. The changes in color, shape, frame or light in the image may be considered by the model as identification information about real and fake live face images. The features corresponding to these prompt information have made the loss function of the model low, and the weight update of the model has also slowed down, so that the model is difficult to detect the cheap in the new scene. For example, in some scenarios, when collecting images, there are obvious landmark features near the face, which may be identified as image features, affecting the results of face image detection. In the scene without the same landmark features, accurate image detection results cannot be obtained. Therefore, the adaptability and generalization ability of the face image detection model are also the difficulties that need to be broken through in the model optimization process.
[0038] The preset face detection model in the embodiment will perform feature learning on the first image obtained by preprocessing the training sample image according to the influence degree of the pixel on the image detection result during training. In a face image, the contribution of each pixel point to the detection result is not the same. Among them, some features with high influence on the detection result are the key to distinguishing real and fake live face images, which makes the model more likely to obtain accurate image detection results. Some features with low influence on the detection result cannot directly provide effective identification information for the model. After the influence degree of each pixel in the image on the image detection result is determined in advance, the initial face detection model to be trained can be directed to mine and learn the features with high influence on the detection result. For example, according to the influence degree of each pixel point on the model monitoring result determined in advance, the pixel points with high influence in the training sample image can be erased, that is, a first image obtained by preprocessing is obtained. The first image is input into the initial face detection model to be trained, thereby improving the difficulty of image detection of the face detection model, so that the preset face detection model obtained by training can still output accurate detection results when important prompt feature information is lost in the image. The importance of the pixel point to the model detection result can be determined by a pre-trained pixel scoring model or a pixel scoring algorithm.
[0039] In addition, the first image affects the model classification result after important pixels with a high degree of influence on the detection result are erased, so the preset face detection model is trained based on the second image while the initial face detection model is trained based on the first image, that is, another model training path for the initial face detection model to explore clues is set. However, if the training sample image is directly input into the initial face detection model on the path, the above model training operation based on the first image loses its meaning. Therefore, in the training path of the face detection model, a random occlusion training sample image is used to process the image to increase the difficulty of image feature learning of the trained model. In the training process, the weight parameters of the initial face detection model to be trained in the two training paths are updated synchronously. Through the double-path training process, the preset face detection model with optimized performance is finally obtained, which can extract features of the to-be-detected image and learn the features even if important feature information is missing, and finally output an accurate face image detection result under different face attacks.
[0040] The technical scheme of the embodiment of the present disclosure can obtain a to-be-detected face image, input the to-be-detected face image into a preset face detection model, and obtain a face image detection result. The preset face detection model is generated by a synchronous model training path trained based on a first image obtained by preprocessing a training sample image according to an influence degree of a pixel in the training sample image on an image detection result and a second image generated by occluding the training sample image according to a preset occlusion strategy in a training process. The preset face detection model can sufficiently learn image features with different degrees of influence on the detection result, thereby improving the feature learning ability of the model. The technical scheme disclosed in the embodiment of the present disclosure solves the problem of poor optimization effect and low model generalization ability of the existing face image detection model, improves the learning ability of the model for image features in the process of face image detection, obtains an image detection result with higher monitoring accuracy, and improves the generalization ability of the target training model.
[0041] Embodiment Two
[0042] The embodiment of the present disclosure can be combined with each optional scheme of the face image detection method provided in the above embodiments. The face image detection method provided in the embodiment is optimized on the basis of the above embodiments, and the training process of the preset face detection model is further described.
[0043] Figure 2 A flowchart of a face image detection method provided in Embodiment Two of the present disclosure is shown in FIG. 2. As shown in FIG. 2, the face image detection method provided in the embodiment includes the following steps. Figure 2
[0044] S210, input the training sample image into the preset convolutional neural network, perform first stage training of the target face detection model, and obtain an initial face detection model.
[0045] The training sample image can be a live face image and a non-live face image, and then the target convolutional neural network model is used for recognizing a live face image and is suitable for a scene of identity recognition and authentication, for example, account login, transaction information determination, or other scenes requiring live face image recognition. In this embodiment, the type of the preset convolutional neural network model is not limited, that is, the number of convolutional layers of the convolutional neural network and the number of convolution kernels in each convolutional layer are not limited, which can be adjusted according to the face image detection effect, or the model parameters can be initialized according to related experience.
[0046] Generally, in the model training process, the initialized preset convolutional neural network is continuously trained for multiple rounds until the final model training target is achieved. One round refers to the process of inputting all model training sample images into the trained model for model training in turn. In the first stage training process, the preset convolutional neural network can be trained for 2-3 rounds to obtain an initial face detection model as a starting point for the second stage model training. Of course, according to the setting of the model training parameters, the number of rounds in the first stage training process is not limited.
[0047] S220, input the training sample image into the initial face detection model embedded with the pixel scoring function module, and score the influence degree of each pixel in the training sample image on the image detection result.
[0048] Specifically, the pixel scoring function module can be an algorithm for pixel scoring, for example, a Deep LIFT (Deep Learning Important Features) algorithm, which is a feature scoring algorithm based on back propagation. It obtains the output of the initial face detection model, and then scores each pixel point in the training sample image based on the model parameters. After obtaining the scoring results of each pixel point, their importance scores can be normalized to (0, 1).
[0049] Further, according to the importance score and the set score threshold, the pixels are divided into clues and hints. Among them, the pixel points with a score higher than the preset score threshold can be considered as hints, and the pixel points with a score lower than the preset score threshold can be considered as clues. Essentially, both the clues and the hints are the basis for the trained face detection model to infer, except that the hints are more likely to reflect the non-living face detection image, so as to improve the accuracy of the model detection result. Compared with the non-living face detection image, the hints of the living face image are very similar to the clues. Therefore, in the training process of the target face detection model, the target of scoring the pixels is to obtain the pixels that are important for the classification result of the non-living face image. Moreover, the Deep LIFT algorithm is an algorithm related to the weight and structure of the trained face detection model, which is equivalent to calling the Deep LIFT algorithm in the running process of the initial face detection model. The algorithm scores the pixels based on the parameters and output results of the model.
[0050] Step S220 is equivalent to a preparation step in the second stage model training. The model training process in the second stage is as indicated by the process of the curve arrow of the middle black solid line. Figure 3 The training sample image is input into the pixel scoring function module to score the pixels and determine the influence degree of the training sample image on the output result of the model.
[0051] S230, erasing the pixel points with a score greater than the preset score threshold in the training sample image to obtain the first image.
[0052] After determining the scores of the pixels of the training sample image, the pixel points with a score greater than the preset score threshold are erased, that is, the hints in the training sample image are erased. The average value of the sum of the pixel values of all pixels can be used to replace the pixel values of all pixel points with a score greater than the preset score threshold. Alternatively, other numerical values can also be used to replace the pixel values of all pixel points with a score greater than the preset score threshold to erase the hints. Thus, the feature learning difficulty of the initial face detection model to be trained in the second stage is improved. Figure 3 In the foregoing, after the pixel scoring by the pixel scoring function module, the training sample image after erasing the high-score pixels is obtained based on the score, that is, the first image, and the image processing process of one training path in the second stage model training process is completed.
[0053] S240, inputting the first image and a second image generated by occluding the training sample image according to a preset occlusion strategy into the initial face detection model respectively to establish two synchronous model training paths and perform second stage training on the target face detection model.
[0054] In the step S220 and S230, the pre-processing of the training sample image is also performed to obtain the second image, which is the input image of another model training path for the second stage model training process. This is because the first image will affect the model classification result after the important pixels which have a high degree of influence on the detection result are erased. Therefore, while the initial face detection model is trained based on the first image, the preset face detection model is also trained based on the second image, that is, another model training path for the initial face detection model to explore clues is set. However, if the training sample image is directly input into the initial face detection model on this path, the above model training based on the first image will lose its meaning. Therefore, the training sample image is processed by random occlusion, for example, a preset dimension of a black pixel matrix is used to randomly occlude the pixel points in the training sample image to obtain the second image. The area position, area size and shape of the occlusion region can be set or randomly generated.
[0055] Further, after the image pre-processing of the two training paths, the first image and the second image can be input into the same initial face detection model, and the feature extraction and learning are performed by the corresponding initial face detection model. The parameters of the initial face detection model in the two synchronous model training paths are the same and are updated synchronously. Specifically, in this process, the parameters of the trained initial face detection model are updated once every batch. A batch refers to that in a round, the training sample images are divided into multiple groups, and each group of images is input into the trained face detection model once to complete a batch of model training. In a model training round, multiple training batches are included.
[0056] It can be understood that steps S220, S230 and S240 complete the second stage of the training process of the target face detection model as a whole, which is equivalent to scoring the pixel points in the training sample image by using the initial face detection model trained in the first stage and combining the pixel scoring algorithm. Then, based on the training sample image processed according to the scoring result and the training sample image processed by random occlusion, the initial face detection model is trained in double paths. In the process of model training, the parameters of the initial face detection model in the two training paths are shared and updated synchronously. This process enables the face detection model to learn more clues by learning features on the processed image. In addition, the output features of the two paths are constrained simultaneously during the training process. Multiple loss functions are combined in the model training process. First, the results output by the two paths respectively satisfy the corresponding cross-entropy loss function, and are simultaneously constrained by the mean square error loss function, so that the learned features of the two training paths are as close as possible. Further, in the model training process of this stage, the constraints of the triplet loss and the center loss are also added. Each loss function corresponds to a preset weight value. When the output result of the model being trained is the weighted sum value of each loss function, it satisfies the preset condition. The purpose of the triplet loss is to reduce the distance between the positive (predicted positive sample) and the training sample, and to expand the distance between the negative (predicted negative sample) and the training sample. The center loss can make the distance within the class more compact by learning the class center of each class. By combining various constraints, the model is well optimized, so for cross-domain face attacks, even if the input image has no simple prompt, the model can use the obtained clues to correctly detect the false face.
[0057] In a preferred embodiment, in the second stage of model training, the initial face detection model with the pixel score function module embedded therein is also trained for multiple rounds, for example, for ten rounds or even more. In the second stage of training, the parameters of the initial face detection model with the pixel score function module embedded therein are also updated with each round of model training. Specifically, in the second stage of training of the preset face detection model, after each round of model training, the parameter values of the initial face detection model that are updated are synchronously updated to the initial face detection model with the pixel score function module embedded therein, until the second stage of training reaches the preset number of training rounds. This is because, in the second stage of training, the model is expected to explore more clues. After several rounds of training, the initial face detection model in the training process begins to fit to some simple patterns, and the high-score pixels at this time are more in line with the definition of hints. However, if the parameters of the initial face detection model with the pixel score function module embedded therein are always updated, the trained model will have difficulty learning new clues. Therefore, after several rounds of training, the updating of the parameters of the initial face detection model with the pixel score function module embedded therein is stopped. In subsequent rounds of model training, the initial face detection model with the pixel score function module embedded therein that is updated last time is still used to obtain the scores of the pixels in the training sample images, and the hints are erased according to the score results. In the second stage of training, in the rounds of training after the parameters of the initial face detection model with the pixel score function module embedded therein are stopped from being updated, the high-score hints are stably and continuously erased, so that the trained face detection model can explore more clues.
[0058] S250, inputting the training sample images directly into the face detection model trained in the second stage of training to perform third stage training of the target face detection model, and obtaining the target face detection model.
[0059] In the third training stage of the target face detection model, that is, in the later stage of model training, the operation of erasing the hints is removed, the training sample is directly input into the model trained in the previous stage of model training, and the conventional model training process is started, so that the trained model can regain the hints for detecting and classifying the results. The third stage of training process usually lasts for several rounds of training, and the model recovers the advantages of the hints. That is, the target face detection model learns the difficult image detection patterns in the second stage of training, and in the third stage, it adapts to the simple image detection patterns again, so that the detection of the simple patterns can be successfully completed, the detection ability of the model is improved, and more cross-domain data can be coped with. Figure 3 The dashed curve arrow in the figure indicates that the third stage of model training process directly inputs the training sample images into the face detection model trained in the second stage.
[0060] S260, acquire a face image to be detected.
[0061] The face image to be detected can be a face living body image, which is an image collected in a scenario requiring identity recognition and authentication, for example, in a scenario of account login or transaction information determination, face recognition verification is required, and the face image of the target object is collected in real time through the image acquisition function module of the terminal device where the application client is located. The face image to be detected can also be a non-living body face image, such as a pre-stored face image in the terminal device or an image of a collected face image.
[0062] S270, input the face image to be detected into the target face detection model to acquire a face image detection result.
[0063] After acquiring the face image to be detected, the face image to be detected can be input into the target face detection model trained through the above steps to acquire the final detection result, and it is judged whether the face image to be detected is a living body face image or a non-living body face image.
[0064] The technical scheme of the embodiment of the present disclosure trains three models in three stages, and in the second model training stage, the initial face detection model trained by the first order class is combined with the pixel scoring algorithm to score the pixels in the training sample image, and the high-score prompt information is erased. Further, based on the training sample image after erasing the prompt information and the training sample image after random occlusion processing, double-path synchronous training is performed to improve the feature exploration ability of the face detection model; finally, through the third stage of training, the model recovers the ability to recognize the prompt information, and the target face detection model is trained. Further, when face image detection is required, the face image to be detected can be input into the target face detection model to obtain the corresponding detection result. The technical scheme disclosed in the embodiment of the present disclosure solves the problem of poor optimization effect of the existing face image detection model and low model generalization ability, and can improve the learning ability of the model to image features in the process of face image detection, obtain image detection results with higher monitoring accuracy, and improve the generalization ability of the target training model.
[0065] Embodiment three
[0066] Figure 4 A structure schematic diagram of a face image detection device provided by the third embodiment of the present disclosure. The face image detection device provided by the present embodiment is suitable for detecting and classifying face image categories, and is particularly suitable for living body face detection.
[0067] As shown in Figure 4 The face image detection device includes an image acquisition module 310 and an image detection module 320.
[0068] The image acquisition module 310 is configured to acquire a face image to be detected; and the image detection module 320 is configured to input the face image to be detected into a preset face detection model to acquire a face image detection result. The preset face detection model is generated by a synchronous model training path training based on a first image obtained by preprocessing a training sample image according to an influence degree of a pixel in the training sample image on an image detection result and a second image generated by occluding the training sample image according to a preset occlusion strategy.
[0069] The technical scheme of the embodiment of the present disclosure can acquire a face image to be detected, input the face image to be detected into a preset face detection model, and acquire a face image detection result. The preset face detection model is generated by a synchronous model training path training based on a first image obtained by preprocessing a training sample image according to an influence degree of a pixel in the training sample image on an image detection result and a second image generated by occluding the training sample image according to a preset occlusion strategy in a training process. The face detection model can sufficiently learn image features with different influence degrees on a detection result, thereby improving the feature learning ability of the model. The technical scheme disclosed in the embodiment of the present disclosure solves the problem of poor optimization effect and low generalization ability of an existing face image detection model, can improve the learning ability of the model for image features in the process of face image detection, obtain an image detection result with higher monitoring accuracy, and improve the generalization ability of the target training model.
[0070] In some optional implementations, the face image detection apparatus further includes a model training module configured to train the preset face detection model. The model training module includes a first-stage training submodule, a second-stage training submodule, and a third-stage training submodule.
[0071] The first-stage training submodule is configured to input a training sample image into a preset convolutional neural network to perform first-stage training of the preset face detection model to obtain an initial face detection model.
[0072] The second-stage training submodule is configured to input the first image and the second image into the initial face detection model respectively to establish two synchronous model training paths, perform second-stage training of the preset face detection model, and synchronize the parameters of the initial face detection model in the two synchronous model training paths.
[0073] The third-stage training submodule is configured to input the training sample image into the face detection model obtained by the second-stage training to perform third-stage training of the preset face detection model to obtain the preset face detection model.
[0074] In some optional implementation manners, the second stage training submodule is further configured to:
[0075] input the training sample image into the initial face detection model embedded with the pixel score function module, score the influence degree of each pixel in the training sample image on the image detection result, and
[0076] erasing the pixel points in the training sample image with a score result greater than a preset score threshold to obtain the first image.
[0077] In some optional implementation manners, the second stage training submodule is further configured to:
[0078] In the second stage training process of the preset face detection model, after each model training round, the parameter value of the initial face detection model updated by the training is synchronously updated to the initial face detection model embedded with the pixel score function module, until the second stage training process reaches a preset model training round.
[0079] In some optional implementation manners, the second stage training submodule is further configured to:
[0080] adopt a preset dimension of a full black pixel matrix to randomly occlude the pixel points in the training sample image.
[0081] In some optional implementation manners, in the second stage training process of the preset face detection model, the loss function of the model output result in the two synchronous model training paths is a combined loss function including a cross-entropy loss function, a mean square error loss function, a ternary loss function and / or a center loss function.
[0082] In some optional implementation manners, the training sample image includes a live face image and a non-live face image.
[0083] The face image detection apparatus provided by the embodiments of the present disclosure can execute the face image detection method provided by any of the embodiments of the present disclosure, and has the corresponding function modules and beneficial effects of the execution method.
[0084] It should be noted that each unit and module included in the above apparatus is only divided according to the function logic, and is not limited to the above division, as long as the corresponding function can be implemented; in addition, the specific names of each functional unit are only for convenient distinction, and do not limit the protection scope of the embodiments of the present disclosure.
[0085] Embodiment Four
[0086] The following reference is made to Figure 5It illustrates an electronic device suitable for implementing embodiments of the present disclosure (e.g., Figure 5 The diagram below shows the structure of the terminal device or server 400. The terminal device in this embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and vehicle terminals (e.g., vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0087] like Figure 5 As shown, electronic device 400 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 402 or a program loaded from storage device 406 into random access memory (RAM) 403. RAM 403 also stores various programs and data required for the operation of electronic device 400. The processing unit 401, ROM 402, and RAM 403 are interconnected via bus 404. Input / output (I / O) interface 405 is also connected to bus 404.
[0088] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic device 400 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 An electronic device 400 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0089] In particular, according to embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for executing the method shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from the network through the communication apparatus 409, or installed from the storage apparatus 406, or installed from the ROM 402. When the computer program is executed by the processing apparatus 401, the above-mentioned functions defined in the face image detection method of embodiments of the present disclosure are executed.
[0090] The electronic device provided by the embodiments of the present disclosure belongs to the same disclosure concept as the face image detection method provided by the above-mentioned embodiments, and the technical details not described in detail in the present embodiment can be referred to the above-mentioned embodiments, and the present embodiment has the same beneficial effects as the above-mentioned embodiments.
[0091] Embodiment Five
[0092] The embodiments of the present disclosure provide a computer storage medium, which stores a computer program, and the program is executed by a processor to implement the face image detection method provided by the above-mentioned embodiments.
[0093] It should be noted that the computer-readable medium described above can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium, for example, can be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination of the foregoing. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program used by or in connection with an instruction execution system, apparatus or device. In the present disclosure, the computer-readable signal medium can include a data signal propagated in baseband or propagated as a carrier wave in a propagated data signal, in which the computer-readable program code is contained. Such a propagated data signal can take any of a variety of forms, including, but not limited to, an electromagnetic signal, an optical signal, or any suitable combination of the foregoing. The computer-readable signal medium can also be any computer-readable medium that is not a storage medium and that can communicate, propagate or transport a program for use by or in connection with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including, but not limited to, wire, cable, RF (radio frequency), or the like, or any suitable combination of the foregoing.
[0094] In some embodiments, the client, server, or both can communicate using any current known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet, and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any current known or future developed networks.
[0095] The computer-readable medium described above can be included in the electronic device described above; or can exist separately from the electronic device described above, and is not assembled into the electronic device described above.
[0096] The computer-readable medium described above carries one or more programs, when the one or more programs are executed by the electronic device, cause the electronic device to:
[0097] obtaining a face image to be detected;
[0098] inputting the face image to be detected into a preset face detection model to obtain a face image detection result;
[0099] The preset face detection model is generated through a synchronous model training path training based on a first image obtained by preprocessing a training sample image according to an influence degree of a pixel pair in the training sample image on an image detection result and a second image generated by occluding the training sample image according to a preset occlusion strategy.
[0100] Computer program code for carrying out operations of the present disclosure can be written in one or more programming languages or combinations of languages including object oriented programming languages such as Java, Smalltalk, C++ as well as conventional procedural programming languages such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0101] The flow and block diagrams in the drawings show architectural, functional, and operational representations of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flow and block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may be executed in the reverse order, depending on the functionality involved. It will also be noted that each block of the block diagrams and / or flowchart illustrations, and combinations thereof, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or combinations of hardware and software.
[0102] The units described in the embodiments of the present disclosure can be implemented in the form of software, or can be implemented in the form of hardware. Among them, the name of the unit, module does not constitute a limitation to the unit, module itself in some cases, for example, the data generation module can also be described as "video data generation module".
[0103] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that can be used include: Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Parts (ASSPs), System on Chips (SOCs), Complex Programmable Logic Devices (CPLDs), etc.
[0104] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the above. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0105] According to one or more embodiments of the present disclosure, Example One provides a face image detection method, which comprises:
[0106] Obtaining a face image to be detected;
[0107] Inputting the face image to be detected into a preset face detection model to obtain a face image detection result;
[0108] The preset face detection model is trained through a synchronous model training path established based on a first image obtained by preprocessing a training sample image according to an influence degree of each pixel in the training sample image on an image detection result and a second image generated by occluding the training sample image according to a preset occlusion strategy.
[0109] According to one or more embodiments of the present disclosure, Example Two provides a face image detection method, further comprising:
[0110] In some optional implementations, the training process of the preset face detection model includes the following steps:
[0111] The training sample image is input into a preset convolutional neural network to perform first-stage training of the preset face detection model, and an initial face detection model is obtained.
[0112] The first image and the second image are input into the initial face detection model respectively to establish two synchronous model training paths, and second-stage training of the preset face detection model is performed, wherein the parameters of the initial face detection model in the two synchronous model training paths are the same and are updated synchronously.
[0113] The training sample image is input into the face detection model obtained through the second-stage training to perform third-stage training of the preset face detection model, and the preset face detection model is obtained.
[0114] According to one or more embodiments of the present disclosure, Example Three provides a face image detection method, further comprising:
[0115] In some optional implementations, the first image obtained by preprocessing the training sample image according to the influence degree of each pixel in the training sample image on the image detection result includes:
[0116] The training sample image is input into an initial face detection model embedded with a pixel score function module to score the influence degree of each pixel in the training sample image on the image detection result.
[0117] The pixel points in the training sample image with a score result greater than a preset score threshold are erased to obtain the first image.
[0118] According to one or more embodiments of the present disclosure, Example Four provides a face image detection method, further comprising:
[0119] In some optional implementations, the parameter update strategy of the initial face detection model embedded with the pixel score function module includes:
[0120] In the second stage training process of the preset face detection model, after each model training round, the parameter values of the initial face detection model updated by the training are synchronously updated to the initial face detection model embedded with the pixel score function module until the second stage training process reaches a preset model training round.
[0121] According to one or more embodiments of the present disclosure, Example Five provides a face image detection method, further comprising:
[0122] In some optional implementations, the training sample image is occluded according to a preset occlusion strategy to obtain a second image, comprising:
[0123] The pixel points in the training sample image are randomly occluded by using a preset dimension all-black pixel matrix.
[0124] According to one or more embodiments of the present disclosure, Example Six provides a face image detection method, further comprising:
[0125] In some optional implementations, in the second stage training process of the preset face detection model, the loss function of the model output result in the two synchronous model training paths is a combined loss function including a cross-entropy loss function, a mean square error loss function, a triplet loss function and / or a center loss function.
[0126] According to one or more embodiments of the present disclosure, Example Seven provides a face image detection method, further comprising:
[0127] In some optional implementations, the training sample image includes a live face image and a non-live face image.
[0128] According to one or more embodiments of the present disclosure, Example Eight provides a face image detection device, further comprising:
[0129] An image acquisition module is configured to acquire a face image to be detected;
[0130] An image detection module is configured to input the face image to be detected into a preset face detection model to obtain a face image detection result.
[0131] The preset face detection model is generated by a synchronous model training path trained based on a first image obtained by preprocessing a training sample image according to an influence degree of a pixel in the training sample image on an image detection result and a second image generated by occluding the training sample image according to a preset occlusion strategy.
[0132] According to one or more embodiments of the present disclosure, Example Nine provides a face image detection device, further comprising:
[0133] In some optional implementations, the face image detection apparatus further comprises a model training module configured to train the preset face detection model.
[0134] The model training module comprises a first-stage training submodule, a second-stage training submodule, and a third-stage training submodule.
[0135] The first-stage training submodule is configured to input the training sample image into a preset convolutional neural network to perform first-stage training of the preset face detection model, and obtain an initial face detection model.
[0136] The second-stage training submodule is configured to input the first image and the second image into the initial face detection model respectively to establish two synchronous model training paths, and perform second-stage training of the preset face detection model, wherein the parameters of the initial face detection model in the two synchronous model training paths are the same and are synchronously updated.
[0137] The third-stage training submodule is configured to input the training sample image into the face detection model obtained through the second-stage training to perform third-stage training of the preset face detection model, and obtain the preset face detection model.
[0138] According to one or more embodiments of the present disclosure, Example Ten provides a face image detection apparatus, which further comprises:
[0139] In some optional implementations, the second-stage training submodule is further configured to:
[0140] input the training sample image into the initial face detection model embedded with the pixel score function module to score the influence degree of each pixel in the training sample image on the image detection result;
[0141] erasing the pixel points in the training sample image with a score result greater than a preset score threshold to obtain the first image.
[0142] According to one or more embodiments of the present disclosure, Example Eleven provides a face image detection apparatus, which further comprises:
[0143] In some optional implementations, the second-stage training submodule is further configured to:
[0144] In the second-stage training process of the preset face detection model, after each model training round, the parameter value of the initial face detection model updated through the training is synchronously updated to the initial face detection model embedded with the pixel score function module until the second-stage training process reaches a preset model training round.
[0145] According to one or more embodiments of the present disclosure, Example Twelve provides a face image detection device, further comprising:
[0146] In some optional implementation manners, the second stage training submodule is further configured to:
[0147] The pixel points in the training sample image are randomly occluded by using a preset dimension all-black pixel matrix.
[0148] According to one or more embodiments of the present disclosure, Example Thirteen provides a face image detection device, further comprising:
[0149] In some optional implementation manners, in the process of performing the second stage training on the preset face detection model, the loss function of the model output result in the two synchronous model training paths is a combined loss function including a cross-entropy loss function, a mean square error loss function, a triplet loss function and / or a center loss function.
[0150] According to one or more embodiments of the present disclosure, Example Fourteen provides a face image detection device, further comprising:
[0151] In some optional implementation manners, the training sample image includes a live face image and a non-live face image.
[0152] The above description is merely preferred embodiments of the present disclosure and a description of the principles of the technology employed. It should be understood by those skilled in the art that the disclosed scope of the present disclosure is not limited to the technical solutions formed by the specific combinations of the above technical features, and should also cover other technical solutions formed by any combinations of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the technical solutions formed by replacing the above features with the technical features disclosed in the present disclosure (but not limited to) having similar functions.
[0153] Further, while operations are depicted in a particular order, this should not be understood as requiring these operations to be performed in the particular order shown or in sequential order, as some other operations can be performed in parallel or concurrently. Additionally, the various elements depicted can also be implemented in a different order than that which is shown. Furthermore, no element or component is intended to be dependent on another, unless the element or component is deemed absolutely required for the other to achieve its purpose. Similarly, the various embodiments described herein are not necessarily mutually exclusive, as some embodiments can be combined with one another despite the fact that the combination is not specifically shown. The various elements and components described above can be implemented in hardware, software, or a combination thereof. Software can comprise computer readable instructions stored on computer readable media such as computer memory, hard disk, removable disk, optical storage media, or any other computer readable media. The computer readable instructions can be executed by a processor, such as a central processing unit (CPU), a graphics processing unit (GPU), or any other processor.
[0154] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.
Claims
1. A method for detecting human faces, characterized in that, include: Acquire the image of the face to be detected; The face image to be detected is input into a preset face detection model to obtain the face image detection result; The preset face detection model is generated by training a synchronous model training path based on a first image obtained by preprocessing the training sample image according to the degree of influence of pixels in the training sample image on the image detection result, and a second image generated after occluding the training sample image according to a preset occlusion strategy.
2. The method according to claim 1, characterized in that, The training process of the preset face detection model includes the following steps: The training sample images are input into a preset convolutional neural network to perform the first stage training of the preset face detection model, thereby obtaining the initial face detection model. The first image and the second image are respectively input into the initial face detection model to establish two synchronous model training paths. The preset face detection model is then trained in the second stage. The parameters of the initial face detection model in the two synchronous model training paths are the same and are updated synchronously. The training sample images are input into the face detection model obtained in the second stage of training, and the third stage of training of the preset face detection model is carried out to obtain the preset face detection model.
3. The method according to claim 2, characterized in that, The training sample images are preprocessed to obtain the first image based on the degree of influence of pixels in the training sample images on the image detection results, including: The training sample images are input into an initial face detection model with an embedded pixel scoring function module to score the degree of influence of each pixel in the training sample images on the image detection results. The first image is obtained by erasing pixels in the training sample image whose scores are greater than a preset score threshold.
4. The method according to claim 3, characterized in that, The parameter update strategy for the initial face detection model with the embedded pixel scoring function module includes: During the second stage of training the preset face detection model, after each training round, the parameter values of the initial face detection model are synchronously updated to the initial face detection model with the embedded pixel scoring function module, until the second stage of training reaches the preset training round.
5. The method according to claim 2, characterized in that, The training sample images are occluded according to a preset occlusion strategy to obtain a second image, including: A matrix of all-black pixels of a preset dimension is used to randomly occlude pixels in the training sample image.
6. The method according to claim 2, characterized in that, During the second stage training of the preset face detection model, the loss function of the model output in the two synchronous model training paths is a combination loss function including cross-entropy loss function, mean squared error loss function, triplet loss function and / or center loss function.
7. The method according to any one of claims 1-6, characterized in that, The training sample images include live human face images and inactive human face images.
8. A face image detection device, characterized in that, include: Image acquisition module, used to acquire images of the face to be detected; The image detection module is used to input the face image to be detected into a preset face detection model to obtain the face image detection result; The preset face detection model is generated by training a synchronous model training path based on a first image obtained by preprocessing the training sample image according to the degree of influence of pixels in the training sample image on the image detection result, and a second image generated after occluding the training sample image according to a preset occlusion strategy.
9. An electronic device, characterized in that, The electronic device includes: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the face image detection method as described in any one of claims 1-7.
10. A storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the face image detection method as described in any one of claims 1-7.
Citation Information
Patent Citations
Face characteristic point tracking method and device
CN108304758A
Method and device for detecting whether target object is blocked, electronic equipment and storage medium
CN108319953A