Living body examination model training method and device, living body examination method and device, and storage medium
By adjusting the sample extraction weights and constructing a loss function to train the liveness detection model, the problems of low sample utilization and poor detection capability in the face recognition system are solved, achieving more efficient liveness detection accuracy and adaptability.
Patent Information
- Application Number
- CN202211734361.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-12-30
AI Technical Summary
In existing technologies, the accuracy of liveness detection in face recognition systems is challenged by high traffic, complex usage scenarios, and highly realistic attack methods, resulting in low sample utilization, poor model detection capabilities, and an inability to effectively intercept non-liveness attack samples.
By adjusting the sample extraction weights based on the sample extraction weights of each live sample image in the sample image library, determining the sample reward value based on the output data of the liveness detection model, constructing a loss function to train the liveness detection model until the model converges, the high-value sample images can be reused in a targeted manner, thereby improving sample utilization and model training efficiency.
It enhances the model's adaptability to samples, improves the accuracy of liveness detection in complex environments, and enhances the detection capability of the liveness detection model.
Smart Images

Figure CN116071833B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present specification relate to the technical field of computer artificial intelligence, and in particular to a live body verification model training method and a live body verification method and device, and a storage medium. BACKGROUND
[0002] With the development of face recognition service functions, live body attack detection has become an indispensable part of a face recognition system, and live body attack detection aims to effectively intercept non-live body type attack samples, including image attacks, video attacks, etc. However, the high access volume of face recognition functions, the complexity of use scenarios, the difficulty of unified hardware device conditions, and the gradually emerging high-simulation live body attack methods all pose greater challenges to the accuracy of live body attack detection. SUMMARY
[0003] Embodiments of the present specification provide a live body verification model training method and a live body verification method and device, and a storage medium, which can solve the technical problems of low sample utilization and poor model detection capability in related technologies.
[0004] In a first aspect, embodiments of the present specification provide a live body verification model training method, which comprises:
[0005] Based on the sample extraction weights of each live body sample image in the sample image library, at least one target live body sample image is extracted, and first output data obtained after each target live body sample image is input into a live body verification model is determined;
[0006] According to the standard output data of each target live body sample image and the first output data of each target live body sample image, a sample reward value corresponding to each target live body sample image is determined, and the sample extraction weight corresponding to each target live body sample image is adjusted according to the sample reward value corresponding to each target live body sample image;
[0007] The loss function constructed based on the standard output data of each target live body sample image and the first output data of each target live body sample image is used to train the live body verification model;
[0008] Based on the adjusted sample extraction weights, the target live body sample images are re-extracted, and the live body verification model is trained based on the re-extracted target live body sample images until the live body verification model converges.
[0009] In a second aspect, embodiments of the present specification provide a live body verification method, which comprises:
[0010] A live body image to be detected is obtained, and the live body image to be detected is input into a live body verification model;
[0011] determine a living body inspection result corresponding to the to-be-detected living body image according to output data of the living body inspection model;
[0012] The living body inspection model is a living body inspection model trained by the living body inspection model training method in any of the preceding embodiments.
[0013] In a third aspect, an embodiment of the present specification provides a living body inspection model training device, which comprises:
[0014] a living body classification module configured to extract at least one target living body sample image based on sample extraction weights of each living body sample image in a sample image library, and determine first output data obtained by inputting each target living body sample image into a living body inspection model;
[0015] a sample reward module configured to determine a sample reward value corresponding to each target living body sample image according to standard output data of each target living body sample image and the first output data of each target living body sample image, and adjust the sample extraction weight corresponding to each target living body sample image according to the sample reward value corresponding to each target living body sample image;
[0016] a loss calculation module configured to train the living body inspection model based on a loss function constructed based on the standard output data of each target living body sample image and the first output data of each target living body sample image;
[0017] a model training module configured to re-extract target living body sample images based on the adjusted sample extraction weights, and train the living body inspection model based on the re-extracted target living body sample images until the living body inspection model converges.
[0018] In a fourth aspect, an embodiment of the present specification provides a living body inspection device, which comprises:
[0019] a data acquisition module configured to acquire a to-be-detected living body image, and input the to-be-detected living body image into a living body inspection model;
[0020] a living body inspection module configured to determine a living body inspection result corresponding to the to-be-detected living body image according to output data of the living body inspection model;
[0021] The living body inspection model is a living body inspection model trained by the living body inspection model training method in any of the preceding embodiments.
[0022] In a fifth aspect, an embodiment of the present specification provides a computer program product containing instructions, which, when executed on a computer or a processor, cause the computer or the processor to perform the steps of the method described above.
[0023] In a sixth aspect, the embodiments of the present specification provide a computer storage medium, which stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the steps of the method described above.
[0024] In a seventh aspect, the embodiments of the present specification provide a terminal, which comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, and the computer program is suitable for being loaded by the processor and executing the steps of the method described above.
[0025] The technical solutions provided by some embodiments of the present specification have at least the following beneficial effects:
[0026] The embodiments of the present specification provide a live body inspection model training method, based on the sample extraction weights of each live body sample image in the sample image library, at least one target live body sample image is extracted, and the first output data obtained after each target live body sample image is input into the live body inspection model is determined; the standard output data of each target live body sample image and the first output data of each target live body sample image are used to determine the sample reward value corresponding to each target live body sample image, and the sample extraction weight corresponding to each target live body sample image is adjusted according to the sample reward value corresponding to each target live body sample image; the loss function constructed based on the standard output data of each target live body sample image and the first output data of each target live body sample image is used to train the live body inspection model; the target live body sample image is re-extracted based on the adjusted sample extraction weight, and the live body inspection model is trained based on the re-extracted target live body sample image until the live body inspection model converges. Since the output data obtained after the live body inspection model classifies and detects the sample image can reflect the classification adaptability of the live body inspection model to the sample. Then, the sample extraction weight of each sample image is adjusted according to the classification result of the model to the sample image, and the sample distribution in subsequent training is adjusted, which enables specific samples to be repeatedly used for specific purposes, improves the sample utilization rate and the model training efficiency, enhances the adaptability of the model to the samples, and improves the live body inspection accuracy of the model in complex environments. BRIEF DESCRIPTION OF DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present specification or the prior art, the drawings needed in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present specification, and other drawings can be obtained by those skilled in the art without creating any creative labor.
[0028] Figure 1 An exemplary system architecture diagram of a live body inspection model training method provided by the embodiments of the present specification is provided.
[0029] Figure 2A flowchart of a method for training a live detection model is provided for the embodiments of the present specification.
[0030] Figure 3 A logic flow diagram of adjusting sample extraction weights is provided for the embodiments of the present specification.
[0031] Figure 4 A flowchart of a method for training a live detection model is provided for the embodiments of the present specification.
[0032] Figure 5 A flowchart of a method for training a live detection model is provided for the embodiments of the present specification.
[0033] Figure 6 A logic flow diagram of a method for training a live detection model is provided for the embodiments of the present specification.
[0034] Figure 7 A flowchart of a method for live detection is provided for the embodiments of the present specification.
[0035] Figure 8 A structural block diagram of a device for training a live detection model is provided for the embodiments of the present specification.
[0036] Figure 9 A structural block diagram of a device for live detection is provided for the embodiments of the present specification.
[0037] Figure 10 A structural diagram of a terminal is provided for the embodiments of the present specification. DETAILED DESCRIPTION
[0038] In order to make the features and advantages of the embodiments of the present specification more obvious and easy to understand, the technical solutions in the embodiments of the present specification will be described clearly and completely in conjunction with the drawings in the embodiments of the present specification. Obviously, the described embodiments are only some of the embodiments of the present specification, but not all the embodiments. Based on the embodiments in the present specification, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the embodiments of the present specification.
[0039] The following description refers to the accompanying drawings. Unless otherwise indicated, same or similar elements in different drawings are denoted by same or similar reference numerals. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the embodiments of the present specification. Instead, they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of the present specification as detailed in the appended claims.
[0040] With the increasing amount of face recognition tasks, the number of users using face recognition function and the face recognition scenarios they are in is increasing. The user's live body data is highly related to their personal information, and during the information collection process, live body attacks against the live body verification model may be collected, such as face images, photos, videos, and other information. If the detection is incorrect when non-real live body data is collected, it may lead to information leakage and loss of users, and thus live body verification to intercept non-live body attacks becomes an indispensable part of the face recognition system. Live body verification needs to effectively intercept non-live body attack samples, including mobile phone attacks, paper attacks, head models, and the like.
[0041] Based on the rapid development of artificial intelligence deep neural networks, a trained live body verification model is usually deployed in a face recognition device to complete the live body verification task. However, in actual scenarios, the high access volume of face recognition function, the complexity of use scenarios, the difficulty of unified hardware device conditions, and the gradual emergence of high-simulation live body attack methods all pose greater challenges to the accuracy of live body attack detection.
[0042] During the training phase of the live body verification model, a large number of diverse live body sample images are often used as training data. However, there are generally two kinds of sample data screening. One is one-time, and each live body sample image in the sample image library is used only once. The other is that the model randomly selects live body sample images from the sample image library for each round of training. However, when the sample image library contains live body sample images with higher training value, these live body sample images cannot be used specifically, resulting in low utilization of high-value live body sample images. Moreover, the model cannot learn more accurate live body verification capabilities through more efficient training, which leads to the inability to improve the accuracy of the live body verification model.
[0043] Therefore, the embodiment of the present specification provides a live body verification model training method. According to the predicted classification result of the target live body sample image by the live body verification model and the standard classification result of the target live body sample image, the training value of the target live body sample image to the live body verification model is determined, and then the reward value obtained by each target live body sample image is adjusted based on each reward value. The sample extraction weight of each target live body sample image is adjusted, and finally the target live body sample image used in the next round of training is re-extracted according to the adjusted sample extraction weight, so as to solve the above technical problems of low sample utilization and poor model detection capability.
[0044] Please refer to Figure 1 , Figure 1 An exemplary system architecture diagram of a live body verification model training method provided by the embodiment of the present specification is provided.
[0045] As Figure 1As shown, the system architecture can include a terminal 101, a network 102 and a server 103. The network 102 is used to provide a communication link medium between the terminal 101 and the server 103. The network 102 can include various types of wired communication links or wireless communication links, for example, the wired communication links include optical fiber, twisted pair or coaxial cable, and the wireless communication links include Bluetooth communication link, Wireless-Fidelity (Wi-Fi) communication link or microwave communication link, etc.
[0046] The terminal 101 can interact with the server 103 through the network 102 to receive messages from the server 103 or send messages to the server 103, or the terminal 101 can interact with the server 103 through the network 102 to receive messages or data sent by other users to the server 103. The terminal 101 can be hardware or software. When the terminal 101 is hardware, it can be various electronic devices, including but not limited to smart watches, smart phones, tablet computers, laptop computers and desktop computers, etc. When the terminal 101 is software, it can be installed in the above-mentioned electronic devices, which can be implemented as multiple software or software modules (for example, to provide distributed services) or as a single software or software module, which is not specifically limited here.
[0047] In the embodiments of the present application, first, the terminal 101 can extract at least one target living body sample image based on the sample extraction weights of each living body sample image in the sample image library, and determine the first output data obtained by inputting each target living body sample image into the living body verification model; second, the terminal 101 can determine the sample reward value corresponding to each target living body sample image according to the standard output data of each target living body sample image and the first output data of each target living body sample image, and adjust the sample extraction weight corresponding to each target living body sample image according to the sample reward value corresponding to each target living body sample image; further, the terminal 101 trains the living body verification model based on the loss function constructed by the standard output data of each target living body sample image and the first output data of each target living body sample image; finally, the terminal 101 re-extracts the target living body sample image based on the adjusted sample extraction weight, and trains the living body verification model based on the re-extracted target living body sample image until the living body verification model converges.
[0048] The server 103 can be an integrated server that provides various services. It should be noted that the server 103 can be hardware or software. When the server 103 is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server. When the server 103 is software, it can be implemented as multiple software or software modules (for example, to provide distributed services), or as a single software or software module, which is not specifically limited here.
[0049] Alternatively, the system architecture can also not include the server 103, in other words, the server 103 can be an optional device in the embodiments of the present specification, that is, the method provided in the embodiments of the present specification can be applied to a system architecture including only the terminal 101, and the embodiments of the present specification do not limit this.
[0050] It should be understood that Figure 1 The number of terminals, networks and servers in the above system architecture is only illustrative, and can be any number of terminals, networks and servers according to the needs of implementation.
[0051] Please refer to Figure 2 , Figure 2 A flowchart of a living body verification model training method provided in the embodiments of the present specification is shown. The execution subject of the embodiments of the present specification can be a terminal executing the living body verification model training, can also be a processor in the terminal executing the living body verification model training method, or can also be a living body verification model training service in the terminal executing the living body verification model training method. For the convenience of description, the specific execution process of the living body verification model training method is introduced below by taking the execution subject as the processor in the terminal.
[0052] As Figure 2 shown, the living body verification model training method can at least include:
[0053] S202, based on the sample extraction weight of each living body sample image in the sample image library, extracting at least one target living body sample image, and determining the first output data obtained after each target living body sample image is input into the living body verification model.
[0054] Optionally, due to the wide use of face recognition, the use scenarios of the living body verification model are gradually complicated, the access volume is gradually increased, and more high-simulation-level living body attack methods appear, such as high-definition face attacks, simulation head models, etc. In order to further train the model to obtain more accurate living body verification capability, multiple-scene and multiple-target living body sample images can be added to the sample image library for model training, so that there are enough living body sample images in the sample image library to train the living body verification model from all aspects.
[0055] Optionally, when training the living body verification model, in order to improve the training efficiency, a batch of target living body sample images can be extracted from the sample image library in one round of training, and after the model classifies the batch of target living body sample images, the loss function of this round of training is calculated to complete one training cycle; in a new training cycle, the same number of batches of target living body sample images are extracted again for prediction training until the model converges.
[0056] Optionally, when the model performs prediction classification on the target living body sample image, for some target living body sample images, the model can accurately complete the prediction classification task, which indicates that the model has better adaptability to such high separability samples and has better mastered the detection ability of classifying such samples; for other target living body sample images, the prediction label output by the model is greatly different from the real standard label, which indicates that the model has not yet mastered the classification knowledge of such samples, and these samples have high training value for the model.
[0057] Optionally, if each living body sample image is used only once or is randomly extracted from the sample image library each time the target living body sample image is extracted, the utilization rate of the living body sample image will be low, and the living body sample image with high training value cannot be used for targeted training. Therefore, in order to extract the living body sample image with high training value as the target living body sample image, it is necessary to first determine the living body sample image that is helpful to the model capability. The output data obtained by the living body verification model after classifying and detecting the sample image can reflect the classification adaptability of the living body verification model to the sample, and therefore the training value of the target living body sample image for the model can be determined based on the first output data of the living body verification model to the target living body sample image.
[0058] That is, in the embodiments of the present specification, first, based on the sample extraction weights of each living body sample image in the sample image library, at least one target living body sample image is extracted, and the first output data obtained after each target living body sample image is input into the living body verification model, so as to facilitate subsequent determination of the sample distribution during subsequent training according to the prediction performance of the living body verification model to each target living body sample image. The first output data is the classification result output by the living body verification model to each target living body sample image, and the batch of target living body sample images can be flexibly set according to the training requirement. Generally, the batch of samples in one training cycle includes 64 sample images or 128 sample images, which is not limited in the embodiments of the present specification.
[0059] S204, determining the sample reward value corresponding to each target living body sample image according to the standard output data of each target living body sample image and the first output data of each target living body sample image, and adjusting the sample extraction weight corresponding to each target living body sample image according to the sample reward value corresponding to each target living body sample image.
[0060] Optionally, after obtaining the first output data of each target living body sample image, the difference between the predicted label and the standard label of each target living body sample image represents the classification accuracy of the current living body inspection model for each target living body sample image, and different classification deviation results can reflect the required degree of the living body inspection model for the target living body sample image. For example, when the classification result of the living body inspection model for the target living body sample image with dark color is inaccurate, it indicates that the living body inspection model cannot accurately complete the living body inspection task in the dark color scene at this time, and therefore the classification number of the living body inspection model for such living body sample images should be increased to strengthen the ability of the model to solve such tasks.
[0061] Further, different degrees of classification result deviation indicate different required degrees of the living body inspection model for different target living body sample images. Therefore, in order to adjust the sample extraction weight corresponding to the target living body sample image according to the first output data of the target living body sample image, the output result of the living body inspection model for the target living body sample image can be scored, and the sample extraction weight corresponding to each target living body sample image can be adjusted to a corresponding degree according to the different scores of each target living body sample image.
[0062] Specifically, the model can be trained through reinforcement learning, the accuracy of the current prediction result can be known through the comparison feedback between the predicted classification result and the standard result, and based on a specific reward mechanism, the sample reward value corresponding to each target living body sample image can be determined according to the first output data and the standard output data of the target living body sample image, so that the model can adjust the sample extraction weight corresponding to each target living body sample image to a corresponding degree based on the reward value. After such adjustment, the importance of different target living body sample images to the model can be used to change the sample distribution in the next training period, so that important target living body sample images can appear multiple times during the training process, or even be extracted multiple times in one training period, directly improving the sample utilization rate and the model training efficiency, and enhancing the adaptability of the model to the samples.
[0063] Further, since multiple target living body sample images are input into the living body inspection model at a time, the model processes each target living body sample image in sequence, and therefore the sample reward value of each target living body sample image has certain time sequence characteristics. Based on this, a recurrent neural network (RNN) can be used to extract the time sequence characteristics of a batch of target living body sample images. The RNN network can extract information from the time dimension by means of a recurrent kernel, and the recurrent kernel parameters are shared in the time sequence space. Therefore, the RNN can be used for shared weight calculation on time series data. In the embodiments of the present specification, the sample reward value of a batch of target living body sample images in the time sequence space can be calculated in a time sequence accumulation manner.
[0064] S206, training the living body verification model based on the loss function constructed based on the standard output data of each target living body sample image and the first output data of each target living body sample image.
[0065] Optionally, for parameter adjustment in the living body verification model, a loss function can be used to calculate the deviation between the output result and the target result, and the loss function value calculated can be used to judge the fitting result of the current model and guide the parameter adjustment direction of the current model, and then verify the current performance of the living body verification model. Therefore, in the embodiments of the present specification, based on the standard output data of each target living body sample image and the first output data of each target living body sample image, a loss function can be constructed, and based on the loss function, the living body verification model can be trained.
[0066] S208, re-extracting the target living body sample image based on the adjusted sample extraction weight, and training the living body verification model based on the re-extracted target living body sample image until the living body verification model converges.
[0067] Optionally, after completing a training period, the target living body sample image of a new training period is re-extracted in the sample image library based on the adjusted sample extraction weight, and the living body verification model is trained based on the re-extracted target living body sample image until the living body verification model converges. In each training period, the sample extraction weight used for sample extraction is iteratively updated, and some complex and more valuable living body sample images can be used multiple times, improving sample utilization and model training efficiency. When the living body verification model converges, it can accurately classify such complex living body sample images, enhance the adaptability of the living body verification model to samples, and improve the living body verification accuracy of the living body verification model in more complex environments.
[0068] Please refer to Figure 3 , Figure 3 A logical flowchart for adjusting the sample extraction weight is provided for the embodiments of the present specification. As shown in Figure 3 , after a batch of target living body sample images are input into the living body verification model, the features are extracted through the preset network structure and the first output data is obtained, and then the RNN network structure is used to score the reward value of each target living body sample image according to the first output data and the standard output data of each target living body sample image, so that each target living body sample image obtains a corresponding sample reward value. The sample extraction weight of each target living body sample image is adjusted based on the feedback of the sample reward value; in a new training period, the target living body sample image is re-extracted based on the new sample extraction weight and the adjusted sample extraction weight. Figure 3 The preset network structure of the living body verification model in the embodiments of the present specification is illustrative and does not limit the scheme.
[0069] In the embodiment of the present specification, a living body examination model training method is provided. Based on the sample extraction weights of each living body sample image in a sample image library, at least one target living body sample image is extracted, and first output data obtained after each target living body sample image is input into a living body examination model is determined. The sample reward value corresponding to each target living body sample image is determined according to the standard output data of each target living body sample image and the first output data of each target living body sample image, and the sample extraction weight corresponding to each target living body sample image is adjusted according to the sample reward value corresponding to each target living body sample image. The living body examination model is trained based on the loss function constructed based on the standard output data of each target living body sample image and the first output data of each target living body sample image. The target living body sample image is re-extracted based on the adjusted sample extraction weight, and the living body examination model is trained based on the re-extracted target living body sample image until the living body examination model converges. Since the output data obtained after the living body examination model classifies and detects the sample image can reflect the classification adaptability of the living body examination model to the sample. Then, the sample extraction weight of each sample image is adjusted according to the classification result of the model to the sample image, so as to adjust the sample distribution in subsequent training, which enables the specific sample to be repeatedly used for specific purposes, improves the sample utilization rate and model training efficiency, enhances the adaptability of the model to the sample, and improves the living body examination accuracy of the model in complex environment.
[0070] Please refer to Figure 4 , Figure 4 A flowchart of a living body examination model training method provided by the embodiment of the present specification is shown.
[0071] As Figure 4 shown, the living body examination model training method can at least include:
[0072] S402, based on the sample extraction weight of each living body sample image in the sample image library, at least one target living body sample image is extracted, and the first output data obtained after each target living body sample image is input into a living body examination model is determined.
[0073] For step S402, please refer to the detailed description in step S202, which will not be repeated here.
[0074] S404, the output similarity of the standard output data of each target living body sample image and the first output data of each target living body sample image is calculated.
[0075] Optionally, it can be known from the introduction of the above embodiments that the prediction effect of the model on each target living body sample image can be determined through the difference between the standard output data of each target living body sample image and the first output data of each target living body sample image, and then the importance of each target living body sample image to the model can be determined. Furthermore, in order to determine the specific difference between the standard output data and the first output data, the output similarity of the standard output data of each target living body sample image and the corresponding first output data can be calculated to specifically quantify the difference. The output similarity can be a cosine similarity or other available similarity calculation manner, which is not limited in the embodiments of the present specification.
[0076] S406, determining the sample reward value corresponding to each target living body sample image according to each output similarity.
[0077] Optionally, after the output similarity of each target living body sample image is calculated, the sample reward value corresponding to each target living body sample image can be further determined according to each output similarity. Specifically, first, a preset similarity threshold can be set as the dividing line between the high separability target living body sample image and the weak separability target living body sample image, the target living body sample image with the output similarity greater than the preset similarity threshold is determined to obtain a negative sample reward value, wherein the negative sample reward value of each target living body sample image is negatively correlated with the output similarity of each target living body sample image, that is, the greater the output similarity of each target living body sample image, the smaller the negative sample reward value obtained; and the target living body sample image with the output similarity less than or equal to the preset similarity threshold is determined to obtain a positive sample reward value, wherein the positive sample reward value of each target living body sample image is negatively correlated with the output similarity of each target living body sample image, that is, the smaller the output similarity of each target living body sample image, the greater the positive sample reward value obtained.
[0078] S408, expanding the sample extraction weight corresponding to the target living body sample image obtaining the positive sample reward value, and reducing the sample extraction weight corresponding to the target living body sample image obtaining the negative sample reward value.
[0079] Optionally, according to the sample reward value obtained by each target living body sample image, it is easy to understand that the target living body sample image obtaining the positive sample reward value is the target living body sample image that the model cannot currently complete the classification task more accurately, so the sample extraction weight corresponding to this part of target living body sample image can be expanded to expand the proportion of this part of target living body sample image in the subsequent sample distribution; and the target living body sample image obtaining the negative sample reward value is the target living body sample image that the model can complete the classification task more accurately, so the sample extraction weight corresponding to this part of target living body sample image can be reduced to reduce the proportion of this part of target living body sample image in the subsequent sample distribution.
[0080] The greater the positive sample reward value of the target living body sample image is, the greater the sample extraction weight corresponding to the target living body sample image should be, and the smaller the negative sample reward value of the target living body sample image is, the smaller the sample extraction weight corresponding to the target living body sample image should be. In this way, the sample extraction weights corresponding to the target living body sample images are adjusted, the sample weight redistribution is completed, the sample distribution of the next round of training period is optimized, and the sample utilization rate is improved.
[0081] S4010, training the living body verification model based on the loss function constructed based on the standard output data of each target living body sample image and the first output data of each target living body sample image.
[0082] S4012, re-extracting the target living body sample images based on the adjusted sample extraction weights of each sample, and training the living body verification model based on the re-extracted target living body sample images until the living body verification model converges.
[0083] For steps S4010-S4012, please refer to the detailed description in steps S206-S208, which will not be repeated here.
[0084] In the embodiments of the present specification, a living body verification model training method is provided. The output similarity of the standard output data of each target living body sample image and the first output data of each target living body sample image is calculated to determine the sample reward value corresponding to each target living body sample image. For the target living body sample image with an output similarity greater than a preset similarity threshold, a negative sample reward value is obtained, and the sample extraction weight corresponding to the target living body sample image obtaining the negative sample reward value is reduced. For the target living body sample image with an output similarity less than or equal to a preset similarity threshold, a positive sample reward value is obtained, and the sample extraction weight corresponding to the target living body sample image obtaining the positive sample reward value is expanded. In this way, the sample extraction weights corresponding to the target living body sample images are adjusted, the sample weight redistribution is completed, the sample distribution of the next round of training period is optimized, and the sample utilization rate is improved.
[0085] Please refer to Figure 5 , Figure 5 A flowchart of a living body verification model training method provided by the embodiments of the present specification is shown.
[0086] As Figure 5 shown, the living body verification model training method can at least include:
[0087] S502, extracting at least one target living body sample image based on the sample extraction weights of each living body sample image in the sample image library.
[0088] Optionally, at the beginning of a round of training period, at least one target living body sample image is first extracted from the sample image library based on the sample extraction weights of each living body sample image, which is used for the current round of living body verification model training.
[0089] S504, determine the global feature obtained after each target living body sample image is input into the living body inspection model, and determine the first output data corresponding to each target living body sample image based on the global feature.
[0090] Optionally, when the living body inspection model predicts each target living body sample image, first, the global feature of each target living body sample image is extracted according to the feature extraction layer in the network, and then the first output data corresponding to each target living body sample image is determined based on the global feature.
[0091] Specifically, the network structure of the living body inspection model can adopt a residual network (Residual Network, ResNet). The residual network has the characteristics of easy optimization, and can improve the accuracy by increasing the depth. The residual block in the network uses a jump connection, which alleviates the gradient vanishing problem and the gradient explosion problem caused by increasing the depth in other common deep neural networks. For the input target living body sample image, the feature is extracted through the network basic framework of the residual network. The network basic framework includes three groups of resblock network structures. For the input target living body sample image of a fixed size (for example, a 3x128x128 image), a high-dimensional global feature of 512x64x64 can be extracted.
[0092] S506, disassemble the global feature to obtain at least one local feature corresponding to each target living body sample image.
[0093] Optionally, the main task of the living body inspection model is to obtain the first output result based on the global feature of the target living body sample image. Then, in order to cope with the complex situation in the actual scene, the living body inspection model can be further incrementally learned, and an incremental task highly related to the main task is incrementally learned. The incremental task and the main task form a joint and mutual constraint, and the incremental optimization purpose of the incremental task to the main task is achieved.
[0094] Specifically, the feature of the face block can be disassembled, and different face block features can be randomly disassembled for constructing an incremental task related to the main task, that is, it is hoped that only the features of the face part area can accurately classify the living body and the attack. That is, the global feature of each target living body sample image needs to be disassembled first to obtain at least one local feature corresponding to each target living body sample image. When disassembling the global feature, at least one local face area can be randomly selected; or a local area can be randomly selected in a planned local area, for example, the area is specified to be divided into upper left, lower left, upper right, lower right and middle area, and the local feature is randomly selected in the five local areas.
[0095] S508, determine the second output data corresponding to each target living body sample image based on the local feature corresponding to each target living body sample image.
[0096] Optionally, after determining the local features of the target living body sample image, the target living body sample image is classified according to the local features to obtain an output result of the incremental task. The specific calculation manner is to directly splice the selected local features, and determine the second output data corresponding to each target living body sample image based on the spliced features, so as to obtain the predicted classification result of the target living body sample image through the local face region.
[0097] S5010, determining a sample reward value corresponding to each target living body sample image according to the standard output data of each target living body sample image and the first output data of each target living body sample image, and adjusting the sample extraction weight corresponding to each target living body sample image according to the sample reward value corresponding to each target living body sample image.
[0098] Optionally, for step S5010, please refer to the detailed description in step S204, which will not be repeated here.
[0099] S5012, training the living body verification model based on the loss function constructed based on the standard output data of each target living body sample image, the first output data of each target living body sample image and the second output data of each target living body sample image.
[0100] Optionally, after obtaining the first output data corresponding to the main task based on the global features of each target living body sample image, and the second output data corresponding to the incremental task based on the local features of each target living body sample image, a loss function can be constructed based on the standard output data of each target living body sample image, the first output data of each target living body sample image and the second output data of each target living body sample image, and the living body verification model is trained using the calculated loss value. Specifically, the main task classifier and the incremental task classifier are combined through the multi-loss function in the training process, so as to realize end-to-end joint training, so as to realize auxiliary learning of the living body attack detection main task, further improve the classification accuracy and robustness of the living body verification model, and finally only the deduction process based on the global features is needed for prediction in the actual inference stage.
[0101] Please refer to Figure 6 , Figure 6 A logic flowchart of a living body verification model training method provided by an embodiment of the present specification. As shown in Figure 6As shown, after a batch of target living body sample images are input into the living body inspection model, global features are extracted through a preset network structure, in the classifier of the main task, the target living body sample images are directly classified based on the global features to obtain first output data corresponding to the main task; in the classifier of the incremental task, the global features are first disassembled, and then the target living body sample images are classified based on the obtained at least one local feature to obtain second output data corresponding to the incremental task; when the loss function is calculated, the first output data, the second output data and the standard output data are combined through a multi-loss function mode to realize multi-task joint training.
[0102] S5014, re-extract the target living body sample images based on the adjusted sample extraction weights, and train the living body inspection model based on the re-extracted target living body sample images until the living body inspection model converges.
[0103] For step S5014, please refer to the detailed description in step S208, which will not be repeated here.
[0104] In the embodiments of the present specification, a living body inspection model training method is provided. In addition to the basic global feature reasoning module, an incremental task based on a face block is added to disassemble the global features to obtain at least one local feature corresponding to each target living body sample image. The second output data corresponding to each target living body sample image is determined based on the local feature corresponding to each target living body sample image. The living body inspection model is finally trained based on the loss function constructed by the standard output data, the first output data and the second output data of each target living body sample image. While ensuring that the incremental secondary task is highly related to the main task, the constraint relationship between the incremental task and the main task is established through the learning of the incremental task, thereby realizing the auxiliary learning of the living body attack detection main task, and further improving the classification accuracy and robustness of the living body inspection model.
[0105] Please refer to Figure 7 , Figure 7 A flowchart of a living body inspection method provided by the embodiments of the present specification is shown.
[0106] As Figure 7 shown, the living body inspection method can at least include:
[0107] S702, obtaining a to-be-detected living body image, and inputting the to-be-detected living body image into the living body inspection model.
[0108] Optionally, in an actual application scenario, in order to automatically collect and detect live body data, a live body verification model needs to be deployed, at this time, the live body verification model can obtain the to-be-detected live body image in the current scene based on the deployment task of the live body verification model, and input the to-be-detected live body image into the live body verification model, so as to facilitate the live body verification model to detect and analyze the to-be-detected live body image, so that the subsequent response to the user demand is based on the accurate detection result output by the live body verification model, wherein the live body verification model used is the live body verification model in any embodiment of the present specification.
[0109] Optionally, when obtaining the to-be-detected live body image in the current scene, the built-in camera in the device or the external camera connected to the device can be used for shooting to collect the live body data in the current scene in real time. After collecting the to-be-detected live body image, the to-be-detected live body image is input into the live body verification model. The live body verification model can detect the live body data, and finally determine whether the live body verification result of the to-be-detected live body image meets the preset response condition, and process the current task according to the live body verification result.
[0110] S704, determining the live body verification result corresponding to the to-be-detected live body image according to the output data of the live body verification model.
[0111] Optionally, after the to-be-detected live body image is input into the live body verification model, the live body verification model analyzes the to-be-detected live body image based on the knowledge learned in the detection of live body data in the training, and obtains output data, wherein the output data can be the probability that the to-be-detected live body image is a live body and the probability that it is an attack. Based on the output data, the live body verification result corresponding to the to-be-detected live body image can be determined. For example, when the probability that the to-be-detected live body image output by the live body verification model is a live body is larger, it is judged that the to-be-detected live body image is a real live body image, and the user demand is continued to be responded. When the probability that the to-be-detected live body image output by the live body verification model is an attack is larger, it is judged that the to-be-detected live body image corresponds to a live body attack image, the detection result and the prompt information of verification failure are displayed, and the collection process can be reset to continue to collect the next to-be-detected live body image.
[0112] In the embodiments of the present specification, a live body verification method is provided. In an actual application scenario, the live body verification model in any of the preceding embodiments is deployed, a to-be-detected live body image is obtained, and the to-be-detected live body image is input into the live body verification model. The live body verification result corresponding to the to-be-detected live body image is determined according to the output data of the live body verification model. Since the live body verification model has better sample adaptability after training and learning of high-value samples, and has more accurate live body classification ability after training of incremental tasks, the live body verification model has more accurate live body verification ability at this time, and finally can output more accurate live body verification result, realize accurate response to user demand, and enhance user experience.
[0113] Please refer to Figure 8 , Figure 8 A structural block diagram of a living body inspection model training apparatus is provided for an embodiment of the present specification. As shown in Figure 8 , the living body inspection model training apparatus 800 comprises:
[0114] A living body classification module 810 is configured to extract at least one target living body sample image based on sample extraction weights of each living body sample image in a sample image library, and determine first output data obtained after each target living body sample image is input into a living body inspection model.
[0115] A sample reward module 820 is configured to determine sample reward values corresponding to each target living body sample image according to standard output data of each target living body sample image and the first output data of each target living body sample image, and adjust sample extraction weights corresponding to each target living body sample image according to the sample reward values corresponding to each target living body sample image.
[0116] A loss calculation module 830 is configured to train the living body inspection model based on a loss function constructed based on the standard output data of each target living body sample image and the first output data of each target living body sample image.
[0117] A model training module 840 is configured to re-extract target living body sample images based on the adjusted sample extraction weights, and train the living body inspection model based on the re-extracted target living body sample images until the living body inspection model converges.
[0118] Optionally, the sample reward module 820 is further configured to calculate output similarities of the standard output data of each target living body sample image and the first output data of each target living body sample image, and determine the sample reward values corresponding to each target living body sample image according to the output similarities.
[0119] Optionally, the sample reward module 820 is further configured to determine that a target living body sample image with an output similarity greater than a preset similarity threshold value obtains a negative sample reward value, wherein the negative sample reward value of each target living body sample image is negatively correlated with the output similarity of each target living body sample image; determine that a target living body sample image with an output similarity less than or equal to the preset similarity threshold value obtains a positive sample reward value, wherein the positive sample reward value of each target living body sample image is negatively correlated with the output similarity of each target living body sample image; increase the sample extraction weight corresponding to the target living body sample image obtaining the positive sample reward value, and decrease the sample extraction weight corresponding to the target living body sample image obtaining the negative sample reward value.
[0120] Optionally, the living body classification module 810 is further configured to determine global features obtained after each target living body sample image is input into the living body inspection model, and determine the first output data corresponding to each target living body sample image based on the global features.
[0121] Optionally, the living body inspection model training apparatus 800 further comprises a local feature classification module configured to disassemble the global feature to obtain at least one local feature corresponding to each target living body sample image; and determine the second output data corresponding to each target living body sample image based on the local feature corresponding to each target living body sample image.
[0122] Optionally, the loss calculation module 830 is further configured to train the living body inspection model based on a loss function constructed based on the standard output data of each target living body sample image, the first output data of each target living body sample image, and the second output data of each target living body sample image.
[0123] In the embodiments of the present specification, a living body inspection model training apparatus is provided, wherein the living body classification module is configured to extract at least one target living body sample image based on the sample extraction weight of each living body sample image in the sample image library, and determine the first output data obtained after each target living body sample image is input into the living body inspection model; the sample reward module is configured to determine the sample reward value corresponding to each target living body sample image according to the standard output data of each target living body sample image and the first output data of each target living body sample image, and adjust the sample extraction weight corresponding to each target living body sample image according to the sample reward value corresponding to each target living body sample image; the loss calculation module is configured to train the living body inspection model based on a loss function constructed based on the standard output data of each target living body sample image and the first output data of each target living body sample image; and the model training module is configured to re-extract the target living body sample image based on the adjusted sample extraction weight, and train the living body inspection model based on the re-extracted target living body sample image until the living body inspection model converges. Since the output data obtained after the living body inspection model classifies and detects the sample image can reflect the classification adaptation ability of the living body inspection model to the sample. Then, the sample extraction weight of each sample image is adjusted according to the classification result of the model to the sample image, so as to adjust the sample distribution in subsequent training, which enables the targeted repeated use of specific samples, improves the sample utilization rate and the model training efficiency, enhances the adaptation ability of the model to the sample, and improves the living body inspection accuracy of the model in a complex environment.
[0124] Please refer to Figure 9 , Figure 9 The structure block diagram of a living body inspection apparatus provided in the embodiments of the present specification is shown in FIG. 9. As shown in FIG. 9, the living body inspection apparatus 900 comprises: Figure 9
[0125] The data acquisition module 910 is configured to acquire the living body image to be detected, and input the living body image to be detected into the living body inspection model.
[0126] The living body inspection module 920 is configured to determine a living body inspection result corresponding to the to-be-detected living body image according to output data of the living body inspection model.
[0127] The living body inspection model is any of the living body inspection models in the above embodiments.
[0128] In the embodiments of the present disclosure, a living body inspection device is provided, which includes a data acquisition module configured to acquire a to-be-detected living body image and input the to-be-detected living body image into a living body inspection model; and a living body inspection module configured to determine a living body inspection result corresponding to the to-be-detected living body image according to output data of the living body inspection model. Since the living body inspection model has better sample adaptability after being trained and learned by high-value samples, and has more accurate living body classification ability after being trained by incremental tasks, the living body inspection model has more accurate living body inspection ability, and can finally output more accurate living body inspection results, so as to accurately respond to user needs and enhance user experience.
[0129] The embodiments of the present disclosure provide a computer program product containing instructions, which, when executed on a computer or processor, cause the computer or processor to perform the steps of the method of any of the above embodiments.
[0130] The embodiments of the present disclosure also provide a computer storage medium, which can store a plurality of instructions, and the instructions are suitable for being loaded and executed by a processor to perform the steps of the method of any of the above embodiments.
[0131] Please refer to Figure 10 , Figure 10 A structural schematic diagram of a terminal is provided for the embodiments of the present disclosure. As shown in Figure 10 , the terminal 1000 can include at least one terminal processor 1001, at least one network interface 1004, a user interface 1003, a memory 1005, and at least one communication bus 1002.
[0132] The communication bus 1002 is configured to realize the connection and communication between the components.
[0133] The user interface 1003 can include a display screen (Display) and a camera (Camera), and the optional user interface 1003 can further include a standard wired interface and a wireless interface.
[0134] The network interface 1004 can optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0135] The terminal processor 1001 can include one or more processing cores. The terminal processor 1001 connects various parts within the terminal 1000 through various interfaces and lines, and performs various functions of the terminal 1000 and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 1005, and calling data stored in the memory 1005. Alternatively, the terminal processor 1001 can be implemented in at least one of a hardware form of a digital signal processing (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The terminal processor 1001 can be integrated with a combination of one or more of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU is mainly used to process the operating system, user interface, and application programs; the GPU is used to render and draw the content to be displayed on the display screen; and the modem is used to process wireless communication. It can be understood that the above-mentioned modem can also not be integrated into the terminal processor 1001, but can be realized by a separate chip.
[0136] The memory 1005 can include a random access memory (RAM) and a read-only memory (ROM). Optionally, the memory 1005 includes a non-transitory computer-readable storage medium. The memory 1005 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 1005 can include a program storage area and a data storage area, wherein the program storage area can store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area can store data involved in the above-mentioned various method embodiments, etc. The memory 1005 can also be at least one storage device located away from the aforementioned terminal processor 1001. As shown in the figure, the memory 1005 as a computer storage medium can include an operating system, a network communication module, a user interface module, and a live body detection model training and live body detection program. Figure 10 As shown in the figure, the memory 1005 as a computer storage medium can include an operating system, a network communication module, a user interface module, and a live body detection model training and live body detection program.
[0137] In Figure 10In the terminal 1000 shown, the user interface 1003 is mainly used to provide an interface for the user to input, and obtain data input by the user; and the terminal processor 1001 can be used to call a live body inspection model training program stored in the memory 1005, and specifically perform the following operations:
[0138] Based on the sample extraction weights of the live body sample images in the sample image library, at least one target live body sample image is extracted, and first output data obtained after each target live body sample image is input into the live body inspection model is determined.
[0139] According to the standard output data of each target live body sample image and the first output data of each target live body sample image, a sample reward value corresponding to each target live body sample image is determined, and the sample extraction weight corresponding to each target live body sample image is adjusted according to the sample reward value corresponding to each target live body sample image.
[0140] The loss function constructed based on the standard output data of each target live body sample image and the first output data of each target live body sample image is used to train the live body inspection model.
[0141] Based on the adjusted sample extraction weights, the target live body sample images are re-extracted, and the live body inspection model is trained based on the re-extracted target live body sample images until the live body inspection model converges.
[0142] In some embodiments, when the terminal processor 1001 performs the operation of determining the sample reward value corresponding to each target live body sample image according to the standard output data of each target live body sample image and the first output data of each target live body sample image, the following steps are specifically performed: calculating the output similarity of the standard output data of each target live body sample image and the first output data of each target live body sample image; and determining the sample reward value corresponding to each target live body sample image according to each output similarity.
[0143] In some embodiments, the terminal processor 1001, when determining the sample reward value corresponding to each target living body sample image according to the output similarity, specifically performs the following steps: determining that the target living body sample image with an output similarity greater than a preset similarity threshold obtains a negative sample reward value, wherein the negative sample reward value of each target living body sample image is negatively correlated with the output similarity of each target living body sample image; determining that the target living body sample image with an output similarity less than or equal to the preset similarity threshold obtains a positive sample reward value, wherein the positive sample reward value of each target living body sample image is negatively correlated with the output similarity of each target living body sample image; and the terminal processor 1001, when adjusting the sample extraction weight corresponding to each target living body sample image according to the sample reward value corresponding to each target living body sample image, specifically performs the following steps: expanding the sample extraction weight corresponding to the target living body sample image obtaining the positive sample reward value, and reducing the sample extraction weight corresponding to the target living body sample image obtaining the negative sample reward value.
[0144] In some embodiments, the terminal processor 1001, when determining the first output data obtained after each target living body sample image is input into the living body detection model, specifically performs the following steps: determining the global feature obtained after each target living body sample image is input into the living body detection model, and determining the first output data corresponding to each target living body sample image based on the global feature.
[0145] In some embodiments, after the terminal processor 1001 determines the first output data obtained after each target living body sample image is input into the living body detection model, it further specifically performs the following steps: disassembling the global feature to obtain at least one local feature corresponding to each target living body sample image; and determining the second output data corresponding to each target living body sample image based on the local feature corresponding to each target living body sample image.
[0146] In some embodiments, the terminal processor 1001, when training the living body detection model based on the loss function constructed based on the standard output data of each target living body sample image and the first output data of each target living body sample image, specifically performs the following steps: training the living body detection model based on the loss function constructed based on the standard output data of each target living body sample image, the first output data of each target living body sample image, and the second output data of each target living body sample image.
[0147] In Figure 10 In the terminal 1000 shown in the figure, the user interface 1003 is mainly used to provide an interface for the user to input, and obtain data input by the user; and the terminal processor 1001 can also be used to call the living body detection program stored in the storage 1005, and specifically perform the following operations:
[0148] Obtaining a to-be-detected living body image, and inputting the to-be-detected living body image into the living body detection model;
[0149] According to the output data of the living body inspection model, a living body inspection result corresponding to the living body image to be detected is determined.
[0150] The living body inspection model is the living body inspection model included in any of the above embodiments.
[0151] In several embodiments provided in the present specification, it should be understood that the disclosed apparatus and method can be implemented in other manners. For example, the described apparatus embodiments are merely schematic. For example, the division of the modules is merely a logical function division. There can be another division manner for the actual implementation. For example, a plurality of modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed coupling or direct coupling or communication connection between the modules can be indirect coupling or communication connection through some interfaces, or electrical, mechanical or other forms.
[0152] The modules illustrated as separate components can or can not be physically separate, and the components illustrated as modules can or can not be physical modules, i.e., can be located in one place, or can be distributed to a plurality of network modules. Part or all of the modules can be selected according to actual needs to achieve the purpose of the present embodiment.
[0153] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The above computer program product includes one or more computer instructions. When the above computer program instructions are loaded and executed on a computer, all or part of the processes or functions described above according to the embodiments of the present specification are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted by the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that includes one or more available media sets. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a digital versatile disc (DVD)), or a semiconductor medium (for example, a solid state disk (SSD)), etc.
[0154] It should be noted that, for the foregoing method embodiments, in order to facilitate description, they are all described as a combination of a series of actions, but those skilled in the art should know that the embodiments of the present specification are not limited by the order of the described actions, because according to the embodiments of the present specification, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of the present specification.
[0155] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0156] The above is the description of the living body inspection model training and living body inspection method and device and storage medium provided by the embodiments of the present specification. For those skilled in the art, according to the idea of the embodiments of the present specification, there will be changes in specific implementation and application range. In conclusion, the content of the present specification should not be understood as a limitation of the embodiments of the present specification.
Claims
1. A method for training a live detection model, the method comprising: extracting at least one target live sample image based on sample extraction weights of each live sample image in a sample image library, and determining first output data obtained after inputting each target live sample image into a live detection model; determining sample reward values corresponding to each target live sample image according to standard output data of each target live sample image and the first output data of each target live sample image, and adjusting sample extraction weights corresponding to each target live sample image according to the sample reward values corresponding to each target live sample image; training the live detection model based on a loss function constructed based on the standard output data of each target live sample image and the first output data of each target live sample image; re-extracting target live sample images based on the adjusted sample extraction weights, and training the live detection model based on the re-extracted target live sample images until the live detection model converges; the determining sample reward values corresponding to each target live sample image according to standard output data of each target live sample image and the first output data of each target live sample image, and adjusting sample extraction weights corresponding to each target live sample image according to the sample reward values corresponding to each target live sample image, comprising: calculating output similarity of the standard output data of each target live sample image and the first output data of each target live sample image, wherein the output similarity is a cosine similarity; determining that a target live sample image with an output similarity greater than a preset similarity threshold obtains a negative sample reward value, wherein the negative sample reward value of each target live sample image is negatively correlated with the output similarity of each target live sample image; determining that a target live sample image with an output similarity less than or equal to the preset similarity threshold obtains a positive sample reward value, wherein the positive sample reward value of each target live sample image is negatively correlated with the output similarity of each target live sample image; increasing the sample extraction weight corresponding to the target live sample image obtaining the positive sample reward value, and decreasing the sample extraction weight corresponding to the target live sample image obtaining the negative sample reward value.
2. The method of claim 1, wherein the determining first output data obtained after inputting each target live sample image into a live detection model comprises: determining global features obtained after inputting each target live sample image into a live detection model, and determining first output data corresponding to each target live sample image based on the global features.
3. The method of claim 2, further comprising, after the determining first output data obtained after inputting each target live sample image into a live detection model: disassembling the global features to obtain at least one local feature corresponding to each target live sample image; and determining second output data corresponding to each target live sample image based on the local features corresponding to each target live sample image.
4. The method of claim 3, wherein the training the live detection model based on a loss function constructed based on the standard output data of each target live sample image and the first output data of each target live sample image comprises: The loss function constructed based on the standard output data of each target living body sample image, the first output data of each target living body sample image, and the second output data of each target living body sample image is used to train the living body verification model.
5. A living body verification method, comprising: obtaining a living body image to be detected and inputting the living body image to be detected into a living body verification model; determining a living body verification result corresponding to the living body image to be detected according to output data of the living body verification model; The living body verification model is the living body verification model in any one of claims 1 to 4.
6. A living body verification model training device, comprising: a living body classification module configured to extract at least one target living body sample image based on sample extraction weights of each living body sample image in a sample image library, and determine first output data obtained after each target living body sample image is input into a living body verification model; a sample reward module configured to determine sample reward values corresponding to each target living body sample image according to standard output data of each target living body sample image and the first output data of each target living body sample image, and adjust the sample extraction weights corresponding to each target living body sample image according to the sample reward values corresponding to each target living body sample image; a loss calculation module configured to train the living body verification model based on a loss function constructed based on the standard output data of each target living body sample image and the first output data of each target living body sample image; a model training module configured to re-extract target living body sample images based on the adjusted sample extraction weights, and train the living body verification model based on the re-extracted target living body sample images until the living body verification model converges; The sample reward module is further configured to calculate an output similarity of the standard output data of each target living body sample image and the first output data of each target living body sample image, wherein the output similarity is a cosine similarity; determine that a target living body sample image with an output similarity greater than a preset similarity threshold value obtains a negative sample reward value, wherein the negative sample reward value of each target living body sample image is negatively correlated with the output similarity of each target living body sample image; determine that a target living body sample image with an output similarity less than or equal to the preset similarity threshold value obtains a positive sample reward value, wherein the positive sample reward value of each target living body sample image is negatively correlated with the output similarity of each target living body sample image; The sample extraction weights corresponding to the target living body sample image obtaining the positive sample reward value are increased, and the sample extraction weights corresponding to the target living body sample image obtaining the negative sample reward value are decreased.
7. A living body verification device, comprising: a data acquisition module configured to obtain a living body image to be detected and input the living body image to be detected into a living body verification model; a living body verification module configured to determine a living body verification result corresponding to the living body image to be detected according to output data of the living body verification model; The living body verification model is the living body verification model in any one of claims 1 to 4.
8. A computer program product comprising instructions which, when the computer program product is executed on a computer or processor, cause the computer or the processor to carry out the steps of the method according to any one of claims 1 to 4 or 5.
9. A computer storage medium having stored thereon a plurality of instructions adapted to be loaded and executed by a processor to carry out the steps of the method according to any one of claims 1 to 4 or 5.
10. A terminal comprising a memory, a processor, and a computer program stored on the memory and adapted to be executed on the processor, the processor implementing the steps of the method according to any one of claims 1 to 4 or 5 when executing the program.
Citation Information
Patent Citations
Double-loss value network deep reinforcement learning KVFD model mechanical parameter global optimization method and system
CN113077853A
Living body detection model training method and device, electronic equipment and storage medium
CN114120454A
DRL-based edge video target detection task unloading method and system
CN115022319A