Facial image detection method and device, storage medium and electronic equipment
By building a hierarchical and linking intelligent inference architecture in facial image detection, combining the rapid screening ability of small models and the precise judgment ability of large models, the problem of low facial image detection efficiency in the existing technology is solved, and the effect of improving detection efficiency is achieved.
Patent Information
- Application Number
- CN202411999208.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-02
AI Technical Summary
The existing high-precision models have the problem of too long detection time in facial image detection, which is difficult to meet application scenarios with high real-time requirements, resulting in low detection efficiency.
By building a hierarchical and linking intelligent reasoning architecture, the rapid screening ability of small models and the precise judgment ability of large models are combined to optimize resource allocation and accuracy. The specific method includes obtaining the sample to be tested for the facial image, inputting it into the target classification model for analysis, obtaining the classification results, and inputting it into the target detection model for analysis based on this result to determine whether the sample to be tested is a living sample of the facial image.
It significantly improves the efficiency of facial image detection, can significantly reduce resource consumption while ensuring detection accuracy, and is suitable for scenarios that emphasize both high accuracy and high efficiency.
Smart Images

Figure CN119919979A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a facial image detection method, device, storage medium and electronic device. Background Art
[0002] With the rapid development of information technology and artificial intelligence, face recognition technology has become an important part of the field of biometrics and has been widely used in many fields. Among them, the detection of live faces is an important part of the face recognition system, which aims to distinguish real faces from photos.
[0003] At present, high-precision models are used to detect human facial images. However, high-precision models contain a large number of parameters and a complex network structure, resulting in a long detection time and difficulty in meeting application scenarios with high real-time requirements, leading to technical problems such as low efficiency in facial image detection.
[0004] Currently, no effective solution has been proposed to the above-mentioned technical problem of low efficiency in facial image detection. Summary of the invention
[0005] The embodiments of the present application provide a facial image detection method, device, storage medium and electronic device to at least solve the technical problem of low facial image detection efficiency.
[0006] According to one aspect of an embodiment of the present application, a facial image detection method is provided. The method may include: obtaining a sample to be tested of a facial image; inputting the sample to be tested into a target classification model corresponding to the facial image for analysis, and obtaining a classification result of the sample to be tested, wherein the target classification model is constructed by a neural network model, and the classification result is used to characterize the category to which the sample to be tested belongs; based on the classification result, inputting the sample to be tested into a target detection model corresponding to the facial image for analysis, and obtaining a detection result of the sample to be tested, wherein the target detection model is constructed by a neural network model, and the parameter amount of the target detection model is greater than the parameter amount of the target classification model, and the detection result is used to characterize whether the sample to be tested is a live sample of the facial image.
[0007] Optionally, the sample to be tested is input into a target classification model corresponding to the facial image for analysis to obtain a classification result of the sample to be tested, including: obtaining a verification set of the target classification model, and multiple liveness confidences corresponding to the samples in the verification set, wherein the liveness confidence is used to characterize whether the facial image is a real live object; based on the sample size and multiple liveness confidences of the verification set, determining the sample percentage of the target sample category in the verification set, wherein the sample percentage is used to characterize the sample size of the target sample category, and the difficulty index of the samples under the target sample category is higher than the difficulty index threshold; based on the sample percentage, the sample to be tested is input into the target classification model for analysis to obtain a classification result of the sample to be tested.
[0008] Optionally, based on the sample percentage, the sample to be tested is input into the target classification model for analysis to obtain a classification result of the sample to be tested, including: based on the sample percentage, determining a first liveness threshold and a second liveness threshold of the sample to be tested, wherein the first liveness threshold is less than the second liveness threshold; based on the first liveness threshold and the second liveness threshold, the sample to be tested is input into the target classification model for analysis to obtain a classification result of the sample to be tested.
[0009] Optionally, based on the first liveness threshold and the second liveness threshold, the sample to be tested is input into the target classification model for analysis to obtain a classification result of the sample to be tested, including: inputting the sample to be tested into the target classification model for analysis to obtain a target liveness confidence of the sample to be tested; and determining the classification result based on the target liveness confidence, the first liveness threshold and the second liveness threshold.
[0010] Optionally, based on the target liveness confidence, the first liveness threshold and the second liveness threshold, the classification result is determined, including: in response to the target liveness confidence being less than the first liveness threshold, determining the classification result as the sample to be tested being a first category, wherein the first category is a prosthetic sample category; in response to the target liveness confidence being greater than the second liveness threshold, determining the classification result as the sample to be tested being a second category, wherein the second category is a live sample category; in response to the target liveness confidence being greater than or equal to the first liveness threshold and less than or equal to the second liveness threshold, determining the classification result as the sample to be tested being a third category, wherein the third category is a difficult sample category.
[0011] Optionally, based on the classification result, the sample to be tested is input into the target detection model corresponding to the facial image for analysis to obtain the detection result of the sample to be tested, including: in response to the classification result being the third category, the sample to be tested is input into the target detection model for analysis to obtain the detection result of the sample to be tested.
[0012] Optionally, the method also includes: obtaining an initial detection model of the facial image; training the initial detection model using a hierarchical fine-tuning strategy of the initial detection model to obtain a target detection model, wherein the hierarchical fine-tuning strategy is used to characterize rules for hierarchical adjustment of parameters of the initial detection model.
[0013] According to another aspect of an embodiment of the present application, a facial image detection device is also provided, including: a first acquisition unit, used to acquire a sample to be tested of a facial image; a first analysis unit, used to input the sample to be tested into a target classification model corresponding to the facial image for analysis, to obtain a classification result of the sample to be tested, wherein the target classification model is constructed by a neural network model, and the classification result is used to characterize the category to which the sample to be tested belongs; a second analysis unit, used to input the sample to be tested into a target detection model corresponding to the facial image for analysis based on the classification result, to obtain a detection result of the sample to be tested, wherein the target detection model is constructed by a neural network model, and the parameter amount of the target detection model is greater than the parameter amount of the target classification model, and the detection result is used to characterize whether the sample to be tested is a living sample of the facial image.
[0014] According to another aspect of an embodiment of the present application, a non-volatile storage medium is also provided, including: the storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute any facial image detection method.
[0015] According to another aspect of an embodiment of the present application, an electronic device is also provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement any facial image detection method.
[0016] In an embodiment of the present application, a test sample of a facial image is obtained; the test sample is input into a target classification model corresponding to the facial image for analysis to obtain a classification result of the test sample, wherein the target classification model is constructed by a neural network model, and the classification result is used to characterize the category to which the test sample belongs; based on the classification result, the test sample is input into a target detection model corresponding to the facial image for analysis to obtain a detection result of the test sample, wherein the target detection model is constructed by a neural network model, and the parameter amount of the target detection model is greater than the parameter amount of the target classification model, and the detection result is used to characterize whether the test sample is a live sample of the facial image. That is to say, a test sample of a facial image can be obtained, and the above-mentioned test sample can be input into a target classification model for analysis, so as to obtain a classification result for characterizing the category to which the test sample belongs. Then, according to the classification result, the test sample can be input into a target detection model corresponding to the facial image for analysis, so as to obtain the detection result of the test sample. Considering that after obtaining the classification result of the test sample, the test sample can be input into the target detection model of the facial image for analysis according to the classification result, so as to achieve the purpose of obtaining the detection result of the test sample, thereby solving the technical problem of low detection efficiency of facial images and achieving the technical effect of improving the detection efficiency of facial images. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0018] Figure 1 is a flow chart of a facial image detection method according to an embodiment of the present application;
[0019] Figure 2 is a flow chart of a method for face liveness detection according to an embodiment of the present application;
[0020] Figure 3 is a schematic diagram of a facial image detection device according to an embodiment of the present application;
[0021] Figure 4 It is a schematic diagram of an exemplary electronic device for implementing an embodiment of the present application according to an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:
[0025] Liveness detection: Liveness detection refers to analyzing the biological features of the face in an image or video to determine whether it is a real face rather than an attack method (such as a photo, video or mask). In facial recognition applications, liveness detection is an important technology to ensure system security;
[0026] Convolutional Neural Network: Convolutional Neural Network (CNN) is a deep learning model widely used in image recognition and processing. CNN extracts local features of an image through convolutional layers, thereby gradually building a high-level understanding of the input image, which is suitable for face liveness detection tasks;
[0027] Visual encoder: The visual encoder is a model generated through pre-training, which is used to extract high-dimensional feature representations from images. The encoder can be trained with large-scale visual data and has strong migration and generalization capabilities;
[0028] Pre-trained model: A pre-trained model is a model that has been pre-trained on a large-scale dataset and can be fine-tuned to adapt to specific needs in new tasks;
[0029] Freeze shallow parameters: Freezing shallow parameters means that when fine-tuning the model, the parameters of the first few layers of the pre-trained model are fixed and only the deep parameters are adjusted. This method can reduce the computational overhead while maintaining the model's strong generalization ability for basic features;
[0030] Cascade model: The cascade model is a model architecture that processes models step by step, optimizing resource allocation by executing different models in sequence;
[0031] Small model: It is a lightweight convolutional neural network that quickly detects liveness of input samples through local features. It is used to process simple samples and filter out difficult samples with low confidence.
[0032] Large model: The large model is a visual encoder pre-trained with large-scale data, and is used to process complex samples in liveness detection after specific fine-tuning. Compared with the small model, the large model has more parameters, focuses on learning global features, and has higher accuracy and generalization ability;
[0033] Model training: Model training is the process of adjusting the parameters of a machine learning model using given data so that it can make accurate predictions on new data. The goal of training a model is to allow it to learn patterns from the data so that it can make inferences about future unseen data.
[0034] A neural network model that maps images and text into a shared embedding space, allowing the model to learn cross-modal representations through contrastive features;
[0035] Inference: refers to the process of predicting new samples after the model is trained;
[0036] Generalization ability: Generalization ability refers to the ability of the model to make accurate predictions when faced with unseen data;
[0037] Fine-tuning: Fine-tuning refers to adaptively adjusting the model based on the existing pre-trained model using less data and computing resources.
[0038] According to an embodiment of the present application, an embodiment of a facial image detection method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0039] Figure 1 is a flow chart of a facial image detection method according to an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:
[0040] Step S102, obtaining a sample of a facial image to be tested.
[0041] In the technical solution provided in the above step S102 of the present application, a sample of a facial image to be tested is obtained, wherein the sample to be tested can be represented by an image X. The facial image can be called a living face image, or a facial image captured from a face video, and the face video can be from a surveillance video, etc. It should be noted that only an example of the acquisition source of the facial image is given here, and the acquisition source of the facial image is not specifically limited.
[0042] Step S104, inputting the sample to be tested into the target classification model corresponding to the facial image for analysis to obtain the classification result of the sample to be tested.
[0043] In the technical solution provided in the above step S104 of the present application, after obtaining the sample to be tested, the sample to be tested can be input into the target classification model corresponding to the facial image for analysis so as to obtain the classification result of the sample to be tested, wherein the target classification model is constructed through a neural network model, and the classification result is used to characterize the category to which the sample to be tested belongs.
[0044] Optionally, the neural network model is used to characterize complex nonlinear relationships, such as features of data such as images, text, audio, etc. The target classification model can be called a small model, which can be constructed by a convolutional neural network, also known as a lightweight CNN.
[0045] Optionally, the classification result may be a preset category, such as a prosthetic sample category, a living sample category, and a difficult sample category, etc. It should be noted that only examples are given here to illustrate the category to which the sample to be tested belongs, and no specific limitation is made to the category to which the sample to be tested belongs.
[0046] For example, after obtaining that the sample to be tested is image X, image X is classified through a lightweight CNN, so that the classification result of image X is obtained as a difficult sample category, so that image X can be processed in the next step.
[0047] It can be understood that this is only a preferred implementation method for obtaining the classification results of the samples to be tested, and the process and method for obtaining the classification results of the samples to be tested are not specifically limited. As long as the samples to be tested are input into the target classification model corresponding to the facial image for analysis, the process and method for obtaining the classification results of the samples to be tested are within the scope of this application and will not be listed here.
[0048] Step S106: Based on the classification result, the sample to be tested is input into the target detection model corresponding to the facial image for analysis to obtain the detection result of the sample to be tested.
[0049] In the technical solution provided in the above step S106 of the present application, according to the classification results obtained in the above steps, the sample to be tested is input into the target detection model corresponding to the facial image for analysis, so as to achieve the purpose of obtaining the detection results of the sample to be tested.
[0050] Optionally, the target detection model is constructed through a neural network model, which can be called a large model with adaptive hierarchical fine-tuning, that is, a large model pre-trained with large-scale data, referred to as a large model, and the number of parameters of the target detection model is greater than the number of parameters of the target classification model.
[0051] Optionally, the detection result is used to characterize whether the sample to be tested is a live sample of a facial image, that is, whether the category to which the sample to be tested belongs is a live sample category.
[0052] For example, if the classification result of image X is a difficult sample category, the image X at this time can be input into the large model for further analysis and judgment, and it can be determined that the detection result of image X at this time is a live sample of a facial image.
[0053] It should be noted that this is only a preferred implementation method for obtaining the detection results of the samples to be tested, and the process and method for obtaining the detection results of the samples to be tested are not specifically limited. As long as the samples to be tested are input into the target detection model corresponding to the facial image for analysis based on the classification results, the process and method for obtaining the detection results of the samples to be tested are within the scope of protection of this application and will not be listed here.
[0054] In steps S102 to S106 of the embodiment of the present application, a sample to be tested of a facial image is obtained; the sample to be tested is input into a target classification model corresponding to the facial image for analysis to obtain a classification result of the sample to be tested, wherein the target classification model is constructed by a neural network model, and the classification result is used to characterize the category to which the sample to be tested belongs; based on the classification result, the sample to be tested is input into a target detection model corresponding to the facial image for analysis to obtain a detection result of the sample to be tested, wherein the target detection model is constructed by a neural network model, and the parameter amount of the target detection model is greater than the parameter amount of the target classification model, and the detection result is used to characterize whether the sample to be tested is a living sample of the facial image. That is to say, the embodiment of the present application can obtain a test sample of a facial image, and input the above-mentioned test sample into a target classification model for analysis, so as to obtain a classification result used to characterize the category to which the test sample belongs. Then, according to the classification result, the test sample can be input into a target detection model corresponding to the facial image for analysis, so as to obtain the detection result of the test sample. Considering that after obtaining the classification result of the test sample, the test sample can be input into the target detection model of the facial image for analysis according to the classification result, so as to achieve the purpose of obtaining the detection result of the test sample, thereby solving the technical problem of low detection efficiency of facial images and achieving the technical effect of improving the detection efficiency of facial images.
[0055] In some embodiments of the present application, the sample to be tested is input into a target classification model corresponding to the facial image for analysis to obtain a classification result of the sample to be tested, including: obtaining a verification set of the target classification model, and multiple liveness confidences corresponding to the samples in the verification set, wherein the liveness confidence is used to characterize whether the facial image is a real live object; based on the sample size and multiple liveness confidences of the verification set, determining the sample percentage of the target sample category in the verification set, wherein the sample percentage is used to characterize the sample size of the target sample category, and the difficulty index of the samples under the target sample category is higher than the difficulty index threshold; based on the sample percentage, inputting the sample to be tested into the target classification model for analysis to obtain a classification result of the sample to be tested.
[0056] In this embodiment, the validation set of the target classification model and multiple liveness confidences corresponding to the samples in the validation set can be obtained first, and then the sample percentage of the target sample category in the validation set can be determined according to the sample size and multiple liveness confidences of the validation set. Finally, according to the above sample percentage, the sample to be tested can be input into the target classification model for analysis to achieve the purpose of obtaining the classification result of the sample to be tested. Among them, the target sample category can be a difficult sample category.
[0057] Optionally, the liveness confidence can be represented by a liveness score, and the liveness score is between a continuous interval [0,1]. The validation set may include samples of a preset sample size, wherein the preset sample size may be represented by N val The liveness scores of multiple samples can form a set, that is, the set can be represented by S val,i The liveness score of all samples in the validation set is S val,i (i=1,2,…,N val ), and the label of the sample can be obtained through Y val,i When the label is 1, it means that the sample is alive; if the label is 0, it means that the sample is a fake. The sample percentage can be represented by P.
[0058] For example, according to the distribution setting of the liveness scores of the samples in the validation set, the score distribution of the real samples and the attack samples is analyzed through the validation set. Assuming that the validation set contains N val samples, whose liveness score is S val,i (i=1,2,…,N val ), labelled as Y val,i (where 1 represents a living body and 0 represents a fake body), and considering that the number of living samples in actual applications is much larger than the number of attack samples, the percentage of samples entering the large model analysis stage can be approximated by the rejection rate of the small model in living samples, that is, the percentage of samples entering the large model is set to P according to the expected computational efficiency, thereby achieving the effect of obtaining the classification result of image X.
[0059] In some optional embodiments of the present application, based on the sample percentage, the sample to be tested is input into the target classification model for analysis to obtain a classification result of the sample to be tested, including: based on the sample percentage, determining a first liveness threshold and a second liveness threshold of the sample to be tested, wherein the first liveness threshold is less than the second liveness threshold; based on the first liveness threshold and the second liveness threshold, the sample to be tested is input into the target classification model for analysis to obtain a classification result of the sample to be tested.
[0060] In this embodiment, after obtaining the sample percentage, the first liveness threshold and the second liveness threshold of the sample to be tested can be determined, and then according to the first liveness threshold and the second liveness threshold obtained above, the sample to be tested is input into the target classification model for analysis to obtain the classification result of the sample to be tested.
[0061] Optionally, according to the obtained sample percentage P, the sample percentage can be determined as the second liveness threshold, and the first liveness threshold at this time is 1-P. The first liveness threshold can be calculated by T fake The second living threshold can be expressed by T realThe first liveness threshold and the second liveness threshold can be used to form a threshold interval, which is [T fake ,T real ].
[0062] For example, after obtaining the percentage of expected entry into the large model based on computational efficiency as P, the upper threshold T real It should be set to the P quantile of the live sample score of the validation set, and the lower threshold T fake is the 1-P percentile of the score of the prosthesis sample in the validation set. Further, according to the sample percentage P, the first living threshold T can be determined fake and the second living body threshold T real , and then according to the above obtained T fake and T real , you can get the classification result of image X.
[0063] In some optional embodiments of the present application, based on the first liveness threshold and the second liveness threshold, the sample to be tested is input into the target classification model for analysis to obtain a classification result of the sample to be tested, including: inputting the sample to be tested into the target classification model for analysis to obtain the target liveness confidence of the sample to be tested; based on the target liveness confidence, the first liveness threshold and the second liveness threshold, determining the classification result.
[0064] In this embodiment, the sample to be tested can be input into the target classification model for analysis to obtain the target liveness confidence of the sample to be tested, and then the classification result is determined according to the target liveness confidence, the first liveness threshold and the second liveness threshold obtained above. The target liveness confidence can be represented by S.
[0065] For example, image X is processed by a lightweight CNN to obtain a liveness score S, which can be calculated by the following formula:
[0066] S=f(X,W)
[0067] Among them, f can be used to represent the forward propagation function of the CNN model, and W is used to represent the parameters of the model. After a series of convolutional layers and activation functions, the liveness score S output by the model will fall between a continuous interval [0,1], and the liveness score is used to indicate the confidence that the image is alive.
[0068] In some embodiments of the present application, a classification result is determined based on a target liveness confidence, a first liveness threshold, and a second liveness threshold, including: in response to the target liveness confidence being less than the first liveness threshold, determining the classification result as the sample to be tested being a first category, wherein the first category is a prosthetic sample category; in response to the target liveness confidence being greater than the second liveness threshold, determining the classification result as the sample to be tested being a second category, wherein the second category is a live sample category; in response to the target liveness confidence being greater than or equal to the first liveness threshold, and less than or equal to the second liveness threshold, determining the classification result as the sample to be tested being a third category, wherein the third category is a target sample category.
[0069] In this embodiment, after obtaining the target liveness confidence, the target liveness confidence is compared with the first liveness threshold and the second liveness threshold respectively. If the target liveness confidence is less than the first liveness threshold, the classification result is determined to be that the sample to be tested is a prosthetic sample category; if the target liveness confidence is greater than the second liveness threshold, the classification result is determined to be that the sample to be tested is a live sample category; if the target liveness confidence is greater than or equal to the first liveness threshold and less than or equal to the second liveness threshold, the classification result is determined to be that the sample to be tested is a target sample category. Among them, the prosthetic sample category can be referred to as prosthesis. The live sample category can be referred to as live. The difficult sample category can be referred to as difficult sample.
[0070] For example, if S <T fake , then the sample to be tested is judged to be a prosthesis; if S>T real , then the sample to be tested is judged to be alive; if T fake ≤S≤T real , then the sample to be tested is judged as a difficult sample, that is, a large model is needed for further verification.
[0071] In some optional embodiments of the present application, based on the classification result, the sample to be tested is input into the target detection model corresponding to the facial image for analysis to obtain the detection result of the sample to be tested, including: in response to the classification result being the third category, the sample to be tested is input into the target detection model for analysis to obtain the detection result of the sample to be tested.
[0072] In this embodiment, when the classification result is the third category, the sample to be tested needs to be input into the target detection model for analysis to obtain the detection result of the sample to be tested. It should be noted that when the sample to be tested is a difficult sample at this time, further analysis and detection is required.
[0073] In this embodiment, two models need to be trained using in vivo image data, one is a lightweight CNN model, which can be trained according to the general deep learning method, and the other is a large model pre-trained with large-scale data, which is trained according to the adaptive hierarchical fine-tuning strategy of the large model. The samples to be tested are input into the small model for screening of difficult samples, and the samples to be tested can be judged as prostheses, living bodies and difficult samples, and the samples that are not judged as difficult samples directly return the test results, saving computing resources. Samples judged as difficult samples can be input into the trained large model for further analysis and detection to obtain the test results.
[0074] In some optional embodiments of the present application, the method also includes: obtaining an initial detection model of the facial image; training the initial detection model using a hierarchical fine-tuning strategy of the initial detection model to obtain a target detection model, wherein the hierarchical fine-tuning strategy is used to characterize the rules for hierarchical adjustment of the parameters of the initial detection model.
[0075] In this embodiment, an initial detection model of a facial image can be obtained, and then the initial detection model can be trained using a hierarchical fine-tuning strategy of the initial detection model to obtain a target detection model. The initial detection model can be constructed by a neural network model. The hierarchical fine-tuning strategy can be called an adaptive hierarchical fine-tuning strategy, including: a feature importance evaluation method and a progressive fine-tuning method.
[0076] Optionally, the implementation process of the feature importance evaluation method is: before fine-tuning, the importance of the output features of each layer in the initial detection model is evaluated for a specific task. For example, for a given input image X, the importance of each layer feature can be calculated using gradient information and expressed by the following formula:
[0077]
[0078] Among them, L is used to represent the loss function, F i It is used to represent the feature output of the i-th layer, I i It is used to represent the feature importance of the i-th layer. By calculating the feature importance of all layers, the layers that need to be fine-tuned can be dynamically selected.
[0079] To go further, the implementation process of the progressive fine-tuning method is as follows: according to the results of the feature importance evaluation, select the layers with lower importance for freezing, and fine-tune the layers with higher importance. A layer-by-layer fine-tuning strategy is adopted, that is, after each training cycle (epoch), the importance of the layer is re-evaluated, and the frozen and fine-tuned layers are adjusted according to the results. In this way, different layers in the model can be gradually unlocked, making it more flexible to adapt to specific tasks. Among them, the fine-tuning strategy can be expressed by the following formula:
[0080]
[0081] Among them, θ is used to represent the threshold of feature importance, and α is used to represent the parameter update learning rate. From the above formula, we can see that when the feature importance of the i-th layer is less than the threshold θ, the parameters of this layer need to be frozen; when the feature importance of the i-th layer is greater than or equal to the threshold θ, the parameters of this layer need to be fine-tuned.
[0082] It should be noted that this is only a preferred implementation method for obtaining the target detection model, and does not specifically limit the process and method for obtaining the target detection model.
[0083] In an embodiment of the present application, a sample to be tested of a facial image can be obtained, and the sample to be tested can be input into a target classification model for analysis so as to obtain a classification result for characterizing the category to which the sample to be tested belongs. Then, based on the classification result, the sample to be tested can be input into a target detection model corresponding to the facial image for analysis so as to obtain a detection result of the sample to be tested. Considering that after obtaining the classification result of the sample to be tested, the sample to be tested can be input into a target detection model of the facial image for analysis based on the classification result so as to achieve the purpose of obtaining the detection result of the sample to be tested, thereby solving the technical problem of low detection efficiency of facial images and achieving the technical effect of improving the detection efficiency of facial images.
[0084] With the rapid development of information technology and artificial intelligence, face recognition technology, as an important part of the field of biometrics, has been applied in many fields, such as security monitoring, smart payment, access control systems, etc. Among them, face liveness detection, as an important part of the face recognition system, aims to distinguish real faces from photos, and identify forgeries such as video playback and three-dimensional masks. The above methods are the key to ensuring the security of face recognition technology.
[0085] At present, high-precision models are used to detect human facial images. However, high-precision models contain a large number of parameters and a complex network structure, resulting in a long detection time and difficulty in meeting application scenarios with high real-time requirements, leading to technical problems such as low efficiency in facial image detection.
[0086] In order to solve the above problems, an embodiment of the present application can propose a face liveness detection method based on a large model. The method combines the fast screening capability of a small model and the precise judgment capability of a large model by constructing a hierarchical and linked intelligent reasoning architecture, thereby optimizing the system's resource allocation and accuracy in face liveness detection, providing strong support for the security and convenience of biometrics, solving the technical problem of low detection efficiency of facial images, and achieving the technical effect of improving the detection efficiency of facial images.
[0087] In the embodiments of the present application, the above method is suitable for scenarios where high precision and efficiency are equally important, such as access control identification, financial payment authentication, and smart device unlocking. It can significantly reduce resource consumption while ensuring detection accuracy, thereby improving the practicality of the system.
[0088] In order to facilitate those skilled in the art to better understand the technical solution of the present application, a specific embodiment is now described.
[0089] In the embodiments of the present application, Figure 2 is a flow chart of a method for face liveness detection according to an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0090] Step S201, obtaining a sample to be tested.
[0091] Step S202: input the sample to be tested into the small model for analysis.
[0092] In this embodiment, after obtaining the sample to be tested, the sample to be tested can be input into the small model for analysis to achieve screening of difficult samples.
[0093] For example, image X is processed by a lightweight CNN to obtain a liveness score S, which can be calculated by the following formula:
[0094] S=f(X,W)
[0095] Among them, f is used to represent the forward propagation function of the CNN model, and W is used to represent the parameters of the model. After a series of convolutional layers and activation functions, the liveness score S output by the model will fall between a continuous interval [0,1], and the liveness score is used to indicate the confidence that the image is alive. The threshold will be set according to the output score of the model, and the category will be divided, that is, if S <T fake , then the sample to be tested is judged to be a prosthesis; if S>T real , then the sample to be tested is judged to be alive; if T fake ≤S≤T real , then the sample to be tested is judged as a difficult sample, that is, a large model is needed for further verification.
[0096] Optionally, the above threshold selection is set according to the distribution of liveness scores of samples in the validation set. The score distribution of real samples and attack samples is analyzed through the validation set. Assuming that the validation set contains N val samples, whose liveness score is S val,i (i=1,2,…,N val ), labelled as Y val,i, and considering that the number of live samples in actual applications is much larger than the number of attack samples, the percentage of samples entering the large model analysis phase can be approximated by the rejection rate of the small model in live samples, which can be set as the percentage of samples entering the large model according to the computational efficiency as P, then the upper threshold T real It should be set to the P quantile of the live sample score of the validation set, and the lower threshold T fake is the 1-P quantile of the score of the prosthesis sample in the validation set.
[0097] In this embodiment, the purpose of the small model to screen difficult samples is to submit more difficult samples to the large model for verification, thereby improving the liveness detection accuracy of the entire system. It is necessary to select an appropriate threshold range to determine the effectiveness of the small model for liveness detection, thereby ensuring that the pass rate of real face samples is as high as possible and the pass rate of attack samples is as low as possible in practical applications.
[0098] Step S203, determining whether the sample to be tested is a difficult sample category.
[0099] In this embodiment, after the sample to be tested is input into the small model for analysis, it is necessary to determine whether the sample to be tested at this time is a difficult sample category. If yes, execute step S204; if not, execute step S205.
[0100] Step S204: input the sample to be tested into the large model of adaptive hierarchical fine-tuning for analysis.
[0101] In this embodiment, when the sample category of the sample to be tested is a difficult sample category, the sample to be tested can be input into the large model of adaptive hierarchical fine-tuning for analysis to obtain a detection result.
[0102] Optionally, two models need to be trained using in vivo image data, one is a lightweight CNN model, which can be trained according to the general deep learning method, and the other is a large model pre-trained with large-scale data, trained according to the adaptive hierarchical fine-tuning strategy of the large model. The samples to be tested are input into the small model for screening of difficult samples, and the samples to be tested can be judged as prostheses, living bodies, and difficult samples, and the samples that are not judged as difficult samples directly return the test results, saving computing resources. Samples judged as difficult samples can be input into the trained large model for further analysis and detection to obtain the test results.
[0103] In this embodiment, in order to efficiently utilize large-scale pre-trained visual encoders in liveness detection tasks, an adaptive hierarchical fine-tuning strategy is proposed, which achieves more efficient transfer learning by dynamically adjusting the frozen layer and the fine-tuning layer, so that the above large model can be trained to better meet the needs of specific tasks. The adaptive hierarchical fine-tuning strategy can include: feature importance evaluation method and progressive fine-tuning method.
[0104] Optionally, the implementation process of the feature importance evaluation method is: before fine-tuning, the importance of the output features of each layer in the initial detection model is evaluated for a specific task. For example, for a given input image X, the importance of each layer feature can be calculated using gradient information and expressed by the following formula:
[0105]
[0106] Among them, L is used to represent the loss function, F i It is used to represent the feature output of the i-th layer, I i It is used to represent the feature importance of the i-th layer. By calculating the feature importance of all layers, the layers that need to be fine-tuned can be dynamically selected.
[0107] Optionally, the implementation process of the progressive fine-tuning method is: according to the results of the feature importance evaluation, select the layers with lower importance to freeze, and fine-tune the layers with higher importance. Adopt a layer-by-layer fine-tuning strategy, that is, after each training cycle (epoch), re-evaluate the importance of the layer, and adjust the frozen and fine-tuned layers based on the results. In this way, different layers in the model can be gradually unlocked, making it more flexible to adapt to specific tasks. Among them, the fine-tuning strategy can be expressed by the following formula:
[0108]
[0109] Among them, θ is used to represent the threshold of feature importance, and α is used to represent the parameter update learning rate. From the above formula, we can see that when the feature importance of the i-th layer is less than the threshold θ, the parameters of this layer need to be frozen; when the feature importance of the i-th layer is greater than or equal to the threshold θ, the parameters of this layer need to be fine-tuned.
[0110] Step S205, obtaining the detection result.
[0111] In an embodiment of the present application, a sample to be tested of a facial image can be obtained, and the sample to be tested can be input into a target classification model for analysis so as to obtain a classification result for characterizing the category to which the sample to be tested belongs. Then, based on the classification result, the sample to be tested can be input into a target detection model corresponding to the facial image for analysis so as to obtain a detection result of the sample to be tested. Considering that after obtaining the classification result of the sample to be tested, the sample to be tested can be input into a target detection model of the facial image for analysis based on the classification result so as to achieve the purpose of obtaining the detection result of the sample to be tested, thereby solving the technical problem of low detection efficiency of facial images and achieving the technical effect of improving the detection efficiency of facial images.
[0112] Figure 3is a schematic diagram of a facial image detection device according to an embodiment of the present application, such as Figure 3 As shown, the facial image detection device 300 includes: a first acquisition unit 301, a first analysis unit 302 and a second analysis unit 303.
[0113] The first acquisition unit 301 is used to acquire a sample of a facial image to be tested.
[0114] The first analysis unit 302 is used to input the sample to be tested into the target classification model corresponding to the facial image for analysis to obtain the classification result of the sample to be tested, wherein the target classification model is constructed by a neural network model, and the classification result is used to characterize the category to which the sample to be tested belongs.
[0115] The second analysis unit 303 is used to input the sample to be tested into the target detection model corresponding to the facial image for analysis based on the classification result, so as to obtain the detection result of the sample to be tested, wherein the target detection model is constructed by a neural network model, and the parameter amount of the target detection model is greater than the parameter amount of the target classification model, and the detection result is used to characterize whether the sample to be tested is a living sample of the facial image.
[0116] Optionally, the first analysis unit 302 may include: a first acquisition module, used to acquire a verification set of a target classification model, and multiple liveness confidences corresponding to samples in the verification set, wherein the liveness confidence is used to characterize whether the facial image is a real live object; a determination module, used to determine the sample percentage of the target sample category in the verification set based on the sample size of the verification set and the multiple liveness confidences, wherein the sample percentage is used to characterize the sample size of the target sample category, and the difficulty index of the samples under the target sample category is higher than the difficulty index threshold; a second acquisition module, used to input the sample to be tested into the target classification model for analysis based on the sample percentage, and obtain the classification result of the sample to be tested.
[0117] Optionally, the second acquisition module may include: a determination submodule, used to determine a first liveness threshold and a second liveness threshold of the sample to be tested based on the sample percentage, wherein the first liveness threshold is less than the second liveness threshold; an acquisition submodule, used to input the sample to be tested into a target classification model for analysis based on the first liveness threshold and the second liveness threshold to obtain a classification result of the sample to be tested.
[0118] Optionally, the acquisition submodule is used to input the sample to be tested into the target classification model for analysis to obtain the target liveness confidence of the sample to be tested; and determine the classification result based on the target liveness confidence, the first liveness threshold and the second liveness threshold.
[0119] Optionally, the acquisition submodule is also used to, in response to the target liveness confidence being less than a first liveness threshold, determine the classification result as the sample to be tested being a first category, wherein the first category is a prosthetic sample category; in response to the target liveness confidence being greater than a second liveness threshold, determine the classification result as the sample to be tested being a second category, wherein the second category is a live sample category; in response to the target liveness confidence being greater than or equal to the first liveness threshold and less than or equal to the second liveness threshold, determine the classification result as the sample to be tested being a third category, wherein the third category is the target sample category.
[0120] Optionally, the acquisition submodule is further configured to, in response to the classification result being the third category, input the sample to be tested into the target detection model for analysis to obtain a detection result of the sample to be tested.
[0121] Optionally, the device also includes: a second acquisition unit, used to acquire an initial detection model of the facial image; a training unit, used to train the initial detection model using a hierarchical fine-tuning strategy of the initial detection model to obtain a target detection model, wherein the hierarchical fine-tuning strategy is used to characterize the rules for hierarchical adjustment of the parameters of the initial detection model.
[0122] In the device, a sample to be tested of a facial image is acquired by a first acquisition unit; the sample to be tested is input into a target classification model corresponding to the facial image for analysis by a first analysis unit to obtain a classification result of the sample to be tested, wherein the target classification model is constructed by a neural network model, and the classification result is used to characterize the category to which the sample to be tested belongs; based on the classification result, the sample to be tested is input into a target detection model corresponding to the facial image for analysis by a second analysis unit to obtain a detection result of the sample to be tested, wherein the target detection model is constructed by a neural network model, and the parameter amount of the target detection model is greater than the parameter amount of the target classification model, and the detection result is used to characterize whether the sample to be tested is a living sample of the facial image, so as to solve the technical problem of low detection efficiency of facial images and achieve the technical effect of improving detection efficiency of facial images.
[0123] According to another aspect of an embodiment of the present application, a non-volatile storage medium is further provided, the non-volatile storage medium including a stored program, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute any facial image detection method.
[0124] Specifically, the above storage medium is used to store program instructions for the following functions to implement the following functions:
[0125] Acquire a test sample of a facial image; input the test sample into a target classification model corresponding to the facial image for analysis to obtain a classification result of the test sample, wherein the target classification model is constructed by a neural network model, and the classification result is used to characterize the category to which the test sample belongs; based on the classification result, input the test sample into a target detection model corresponding to the facial image for analysis to obtain a detection result of the test sample, wherein the target detection model is constructed by a neural network model, and the parameter amount of the target detection model is greater than the parameter amount of the target classification model, and the detection result is used to characterize whether the test sample is a living sample of the facial image.
[0126] Optionally, in this embodiment, the above-mentioned storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the above-mentioned contents. More specific examples of the above-mentioned storage medium may include electrical connections based on one or more lines, 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-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above-mentioned contents.
[0127] In an exemplary embodiment of the present application, a computer program product is further provided, including a computer program, and when the computer program is executed by a processor, the computer program implements any of the above-mentioned facial image detection methods.
[0128] Optionally, the computer program may implement the following steps when executed by a processor:
[0129] Acquire a test sample of a facial image; input the test sample into a target classification model corresponding to the facial image for analysis to obtain a classification result of the test sample, wherein the target classification model is constructed by a neural network model, and the classification result is used to characterize the category to which the test sample belongs; based on the classification result, input the test sample into a target detection model corresponding to the facial image for analysis to obtain a detection result of the test sample, wherein the target detection model is constructed by a neural network model, and the parameter amount of the target detection model is greater than the parameter amount of the target classification model, and the detection result is used to characterize whether the test sample is a living sample of the facial image.
[0130] According to an embodiment of the present application, an electronic device is provided, which includes: 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 any one of the above-mentioned facial image detection methods.
[0131] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0132] Figure 4 It is a schematic diagram of an example electronic device for implementing an embodiment of the present application according to an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, 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 application described and / or required herein.
[0133] like Figure 4 As shown, the device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0134] A number of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0135] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 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 401 performs the various methods and processes described above, such as a method for processing call chain data. For example, in some embodiments, the method for processing call chain data may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the computing unit 401, one or more steps of the method for processing call chain data described above may be executed. Alternatively, in other embodiments, the computing unit 401 may be configured to execute the method for processing call chain data in any other appropriate manner (eg, by means of firmware).
[0136] Various embodiments of the systems and techniques described above herein may 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 a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor that may be a dedicated or general-purpose programmable processor that may 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.
[0137] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can 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, implements the functions / operations specified in the flow chart and / or block diagram. The program code can 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.
[0138] In the context of the present application, 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 equipment, 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.
[0139] 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).
[0140] 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.
[0141] 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 of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0142] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0143] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0144] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0145] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0146] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0147] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), mobile hard disk, disk or CD-ROM and other media that can store program codes.
[0148] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A facial image detection method, characterized in that: include: Obtain a sample of a facial image to be tested; Inputting the sample to be tested into a target classification model corresponding to the facial image for analysis to obtain a classification result of the sample to be tested, wherein the target classification model is constructed by a neural network model, and the classification result is used to characterize the category to which the sample to be tested belongs; Based on the classification result, the sample to be tested is input into the target detection model corresponding to the facial image for analysis to obtain the detection result of the sample to be tested, wherein the target detection model is constructed by the neural network model, and the parameter amount of the target detection model is greater than the parameter amount of the target classification model, and the detection result is used to characterize whether the sample to be tested is a living sample of the facial image.
2. The method according to claim 1, characterized in that Inputting the sample to be tested into the target classification model corresponding to the facial image for analysis to obtain the classification result of the sample to be tested, including: Acquire a validation set of the target classification model and a plurality of liveness confidences corresponding to samples in the validation set, wherein the liveness confidences are used to characterize whether the facial image is a real live object; Based on the sample size of the validation set and the plurality of living body confidences, determining a sample percentage of a target sample category in the validation set, wherein the sample percentage is used to characterize the sample size of the target sample category, and a difficulty index of samples under the target sample category is higher than a difficulty index threshold; Based on the sample percentage, the sample to be tested is input into the target classification model for analysis to obtain a classification result of the sample to be tested.
3. The method according to claim 2, characterized in that Based on the sample percentage, the sample to be tested is input into the target classification model for analysis to obtain the classification result of the sample to be tested, including: Determining a first liveness threshold and a second liveness threshold of the sample to be tested based on the sample percentage, wherein the first liveness threshold is less than the second liveness threshold; Based on the first living body threshold and the second living body threshold, the sample to be tested is input into the target classification model for analysis to obtain a classification result of the sample to be tested.
4. The method according to claim 3, characterized in that Based on the first living body threshold and the second living body threshold, the sample to be tested is input into the target classification model for analysis to obtain a classification result of the sample to be tested, including: Inputting the sample to be tested into the target classification model for analysis to obtain the target living body confidence of the sample to be tested; The classification result is determined based on the target living body confidence, the first living body threshold and the second living body threshold.
5. The method according to claim 4, characterized in that Determining the classification result based on the target living body confidence, the first living body threshold and the second living body threshold includes: In response to the target living body confidence being less than the first living body threshold, determining the classification result as the sample to be tested being of a first category, wherein the first category is a prosthetic sample category; In response to the target living body confidence being greater than the second living body threshold, determining the classification result as the sample to be tested being of a second category, wherein the second category is a living body sample category; In response to the target living body confidence being greater than or equal to the first living body threshold and less than or equal to the second living body threshold, the classification result is determined as the sample to be tested is a third category, wherein the third category is the target sample category.
6. The method according to claim 5, characterized in that Based on the classification result, the sample to be tested is input into the target detection model corresponding to the facial image for analysis to obtain the detection result of the sample to be tested, including: In response to the classification result being the third category, the sample to be tested is input into the target detection model for analysis to obtain a detection result of the sample to be tested.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Acquire an initial detection model of the facial image; The initial detection model is trained using the hierarchical fine-tuning strategy of the initial detection model to obtain the target detection model, wherein the hierarchical fine-tuning strategy is used to characterize rules for hierarchical adjustment of parameters of the initial detection model.
8. A facial image detection device, characterized in that: include: A first acquisition unit, used for acquiring a sample to be tested of a facial image; A first analysis unit is used to input the sample to be tested into a target classification model corresponding to the facial image for analysis to obtain a classification result of the sample to be tested, wherein the target classification model is constructed by a neural network model, and the classification result is used to characterize the category to which the sample to be tested belongs; A second analysis unit is used to input the sample to be tested into the target detection model corresponding to the facial image for analysis based on the classification result, so as to obtain the detection result of the sample to be tested, wherein the target detection model is constructed by the neural network model, and the parameter amount of the target detection model is greater than the parameter amount of the target classification model, and the detection result is used to characterize whether the sample to be tested is a living sample of the facial image.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored executable program, wherein when the executable program is run, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method according to any one of claims 1 to 7.
Citation Information
Cited By
Strawberry identification and positioning method oriented to natural picking scene
CN120496059A