Method for training a live body detection model, live body detection method and system
By using training images from the target domain and pseudo-labels for iterative training in the liveness detection model, and combining information maximization and pseudo-label center constraints, the problem of poor cross-domain adaptability of the liveness detection model is solved, and the detection accuracy of the model in new scenarios is improved.
Patent Information
- Application Number
- CN202310096975.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-19
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2043-01-19
AI Technical Summary
Existing liveness detection models have poor cross-domain adaptability and cannot effectively adapt to the needs of new scenarios, resulting in a decline in the performance of face recognition systems.
By obtaining multiple first training images and their corresponding pseudo-labels in the target domain, the liveness detection model is iteratively trained using the first comprehensive loss information, and information maximization constraints and pseudo-label center constraints are applied to improve the cross-domain adaptive performance of the model.
It improves the cross-domain adaptive performance and generalization ability of the liveness detection model, and enhances the detection accuracy of the model in new scenarios.
Smart Images

Figure CN115953849B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present specification relates to the technical field of artificial intelligence, and in particular to a living body detection model training method, a living body detection method and system. BACKGROUND
[0002] In recent years, face recognition technology has been widely applied. However, face recognition is also vulnerable to living body attacks, and some attackers use photos, printed paper, masks and other means to fake face images, thereby attempting to cause damage to user property and information security through face recognition. Therefore, it is necessary to perform living body detection before face recognition.
[0003] Currently, a living body detection model can be trained in a deep learning manner and applied to an actual scene for living body detection. Although the living body detection model can well solve the problem of living body attacks, when the living body detection model trained in one scene is deployed to another new scene, the performance of the face recognition system will decrease. To solve the above problem, the prior art fine-tunes the trained living body detection model based on the labels of the new scene data manually annotated, or annotates the labels of the new scene data based on the trained living body detection model and trains to obtain a living body detection model applied to the new scene. However, the living body detection performance of the new scene living body detection model trained in the prior art is poor, and often cannot meet the needs of the new scene, i.e., the cross-domain self-adaptation performance is poor.
[0004] Therefore, it is necessary to provide a living body detection model with good cross-domain self-adaptation performance. SUMMARY
[0005] The present specification provides a living body detection model training method, a living body detection method and system, which can improve the cross-domain self-adaptation performance of the living body detection model.
[0006] In a first aspect, the present specification provides a living body detection model training method, comprising: obtaining a plurality of first training images of a target domain and a plurality of pseudo labels corresponding thereto, each of the first training images comprising a biological feature of a user, and the pseudo label being non-manual annotation information representing that the first training image is of a living body category or an attack category; performing iterative training of a living body classification of a pre-training living body detection model based on the plurality of first training images and the plurality of pseudo labels corresponding thereto, and a first comprehensive loss information, wherein the first comprehensive loss information performs information maximization constraint and / or pseudo label center constraint on the training result of the iterative training in the training; and outputting a target living body detection model obtained after the training is completed.
[0007] In some embodiments, the plurality of first training images correspond to a labeled distribution rule of the living body category and the attack category; and each time the iterative training comprises: inputting the plurality of first training images into the pre-training living body detection model to determine a plurality of first living body classification training results corresponding to the plurality of first training images; determining, as a plurality of pseudo labels corresponding to the plurality of first training images in the current iteration training, the plurality of first living body classification training results of the plurality of first training images in the last iteration training; determining a training distribution result of the living body classification corresponding to the plurality of first training images based on the plurality of first living body classification training results; and determining the first comprehensive loss information based on the plurality of first living body classification training results and the plurality of pseudo labels, and the training distribution result and the labeled distribution rule, to maximize the information constraint of the training result of the iterative training.
[0008] In some embodiments, the pre-training living body detection model comprises a pre-training first feature encoder and a pre-training first living body classifier; and the inputting the plurality of first training images into the pre-training living body detection model to determine a plurality of first living body classification training results of the plurality of first training images comprises: inputting the plurality of first training images into the pre-training first feature encoder to obtain a plurality of first training features corresponding to the plurality of first training images; and inputting the plurality of first training features into the pre-training first living body classifier to obtain the plurality of first living body classification training results corresponding to the plurality of first training images.
[0009] In some embodiments, the determining a training distribution result of the living body classification corresponding to the plurality of first training images based on the plurality of first living body classification training results comprises: determining the training distribution result based on a distribution of the living body category and the attack category in the plurality of first living body classification training results.
[0010] In some embodiments, the determining the first comprehensive loss information based on the plurality of first living body classification training results and the plurality of pseudo labels, and the training distribution result and the labeled distribution rule comprises: determining a first living body classification loss information based on a difference between the plurality of first living body classification training results and the corresponding plurality of pseudo labels; determining a distribution loss information of the living body classification based on a difference between the training distribution result and the labeled distribution rule, and determining the distribution loss information of the living body classification as an information maximization constraint loss information; and obtaining the first comprehensive loss information based on an accumulation of the first living body classification loss information and the information maximization constraint loss information.
[0011] In some embodiments, the distribution loss information of the living body classification constrains the training distribution result to approach the labeled distribution rule.
[0012] In some embodiments, the first living body classification training result comprises a predicted probability of the living body classification; and the first comprehensive loss information is determined based on the plurality of first living body classification training results and the plurality of pseudo labels, and the training distribution result and the labeled distribution rule, comprising: determining first living body classification loss information based on the difference between the plurality of first living body classification training results and the plurality of corresponding pseudo labels; determining a plurality of prediction confidence degrees corresponding to the plurality of first living body classification training results based on a plurality of living body classification prediction probabilities corresponding to the plurality of first training images; determining information maximization constraint loss information based on the training distribution result and the labeled distribution rule, and the plurality of prediction confidence degrees; and obtaining the first comprehensive loss information based on the accumulation sum of the first living body classification loss information and the information maximization constraint loss information.
[0013] In some embodiments, the information maximization constraint loss information is determined based on the training distribution result and the labeled distribution rule, and the plurality of prediction confidence degrees, comprising: determining distribution loss information of the living body classification based on the difference between the training distribution result and the labeled distribution rule; determining prediction loss information corresponding to the plurality of pseudo labels based on the plurality of prediction confidence degrees; and obtaining the information maximization constraint loss information based on the accumulation sum of the distribution loss information of the living body classification and the prediction loss information.
[0014] In some embodiments, the distribution loss information of the living body classification constrains the training distribution result to approach the labeled distribution rule; and the prediction loss information constrains the confidence degree of the plurality of first living body classification training results to approach a preset confidence degree.
[0015] In some embodiments, the first comprehensive loss information further comprises pseudo label center constraint loss information; and the pseudo label center constraint loss information constrains M first training features corresponding to M living body classes in the plurality of first training features to be close to a living body center feature, and N first training features corresponding to N attack classes to be close to an attack center feature, the M and the N are integers greater than 0 and less than or equal to the number of pseudo labels.
[0016] In some embodiments, the living body center feature is determined based on a feature average value of at least one first training feature corresponding to at least one pseudo label representing a living body class in the plurality of pseudo labels obtained based on the last iteration training.
[0017] In some embodiments, the attack center feature is determined based on a feature mean value of at least one first training feature corresponding to at least one pseudo label representing an attack class in the plurality of pseudo labels obtained by the last iteration training.
[0018] In some embodiments, the pseudo label center constraint loss information is determined based on distances between M first training features corresponding to M live body classes and the live body center feature, and distances between N first training features corresponding to N attack classes and attack center features corresponding to the N first training features.
[0019] In some embodiments, the plurality of pseudo labels is obtained by inputting the plurality of first training images into a pre-trained source domain model in the initial iteration training.
[0020] In some embodiments, the pre-trained source domain model is trained based on a plurality of second training images of a source domain and corresponding real labels, each of the second training images including a biological feature of a user, the real labels being artificial annotation information representing that the second training images are live body classes or attack classes, and iterative training of a pre-training source domain model for live body classification based on the plurality of second training images and the corresponding real labels and a second comprehensive loss information, the second comprehensive loss information being domain-independent constraint on a training result of the iterative training.
[0021] In some embodiments, the pre-training source domain model includes a pre-training second feature encoder, a pre-training second live body classifier, and a pre-training domain classifier, and each of the iterative training includes: inputting the plurality of second training images into the pre-training second feature encoder to obtain a plurality of second training features corresponding to the plurality of second training images; inputting the plurality of second training features into the pre-training second live body classifier to obtain a plurality of second live body classification training results corresponding to the plurality of second training features; inputting the plurality of second training features into the pre-training domain classifier to obtain a plurality of domain classification results corresponding to the plurality of second training features; and determining a second comprehensive loss information based on differences between the plurality of second live body classification training results and corresponding real labels, and differences between the plurality of domain classification results and corresponding annotation domain classes, to domain-independently constrain the training result of the iterative training.
[0022] In some embodiments, the determining the second comprehensive loss information based on the difference between the plurality of second training living body classification results and corresponding living body class labels, the difference between the domain classification results and corresponding labeled domain classes comprises: determining living body classification loss information based on the difference between the plurality of second living body classification training results and corresponding true labels; determining domain-related classification loss information based on the difference between the plurality of domain classification results and corresponding labeled domain classes, and performing gradient inversion on the domain-related classification loss information to obtain domain-independent classification loss information; and obtaining the second comprehensive loss information based on the accumulation of the living body classification loss information and the domain-independent classification loss information.
[0023] In some embodiments, the obtaining the plurality of first training images comprises: obtaining a plurality of compressed features corresponding to a plurality of original images of the target domain; inputting the plurality of compressed features into a trained image reconstruction module to obtain a plurality of reconstructed images corresponding to the plurality of compressed features; and obtaining the plurality of first training images based on the plurality of reconstructed images.
[0024] In some embodiments, the obtaining a plurality of compressed features corresponding to a plurality of original images of the target domain comprises: receiving, from a client, a plurality of target compressed features corresponding to a plurality of original images of the target domain, the plurality of target compressed features being obtained by the client by compressing the plurality of original images through a trained image compression module.
[0025] In some embodiments, the obtaining a plurality of compressed features corresponding to a plurality of original images of the target domain comprises: receiving, from a client, a plurality of target compressed features corresponding to a plurality of original images of the target domain, the plurality of target compressed features being obtained by the client by compressing the plurality of original images through a trained image compression module.
[0026] In some embodiments, the trained image reconstruction module and the trained image compression module are trained by the following method steps: obtaining original image samples; inputting the original image samples into a pre-trained image compression module to obtain training compressed features corresponding to the original image samples; inputting the training compressed features into a pre-trained image reconstruction module to obtain reconstructed image samples corresponding to the training compressed features; and determining third comprehensive loss information based on the original image samples, the reconstructed image samples, and the training compressed features, and iteratively training the pre-trained image compression module and the pre-trained image reconstruction module based on the third comprehensive loss information to obtain the trained image compression module and the trained image reconstruction module.
[0027] In some embodiments, the determining the third comprehensive loss information based on the original image sample, the reconstructed image sample and the training compressed feature includes: determining image reconstruction loss information based on a difference between the original image sample and the reconstructed image sample; determining feature sparsity loss information based on a difference between a number of target elements in the training compressed feature and a preset number; determining sample relationship constraint information based on a difference between the original image sample and the training compressed feature; and obtaining the third comprehensive loss information based on an accumulation of the image reconstruction loss information, the feature sparsity loss information and the sample relationship constraint information.
[0028] In a second aspect, the present specification also provides a training system of a living body detection model, comprising: at least one storage medium storing at least one instruction set for training the living body detection model; and at least one processor in communication connection with the at least one storage medium, wherein when the living body detection system is running, the at least one processor reads the at least one instruction set and executes the method of the first aspect according to the instruction of the at least one instruction set.
[0029] In a third aspect, the present specification also provides a living body detection method, comprising: obtaining an original image of a biological feature of a user; inputting the original image into a target living body detection model to obtain a living body detection result, wherein the living body detection model is a model trained by the method of the first aspect.
[0030] In a fourth aspect, the present specification also provides a living body detection system, comprising: at least one storage medium storing at least one instruction set for performing living body detection; and at least one processor in communication connection with the at least one storage medium, wherein when the living body detection system is running, the at least one processor reads the at least one instruction set and executes the living body detection method of the third aspect according to the instruction of the at least one instruction set.
[0031] According to the technical solution, the method, the system and the device for training a living body detection model provided in the specification are used to obtain a plurality of first training images and a plurality of pseudo labels corresponding to the first training images in a target domain, perform iterative training on a living body classification of a pre-training living body detection model based on the plurality of first training images, the plurality of pseudo labels corresponding to the first training images and first comprehensive loss information, and use the first comprehensive loss information to perform information maximization constraint and / or pseudo label center constraint on a training result of the iterative training in a training process, so as to obtain a target living body detection model after training and output the target living body detection model. In the scheme, the first comprehensive loss information can perform information maximization constraint and / or pseudo label center constraint on the training result of the pre-training living body detection model in the iterative training process, so as to improve the prediction accuracy of the pseudo label, and then guide the training process of the pre-training living body detection model as a supervision signal, improve the living body detection performance of the target detection model obtained by training, and improve the performance and generalization ability of the living body cross-domain self-adaptation.
[0032] Other functions of the method, the system and the device for training a living body detection model provided in the specification will be partially listed in the following description. According to the description, the following numbers and examples will be obvious to those skilled in the art. The creative aspects of the method, the system and the device for training a living body detection model provided in the specification can be fully explained by practicing or using the methods, the devices and the combinations described in the following detailed examples. BRIEF DESCRIPTION OF DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the embodiments of the specification, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the specification, and those skilled in the art can also obtain other drawings according to the drawings without creating any creative labor.
[0034] Figure 1 An application scenario schematic diagram of a living body detection system provided according to an embodiment of the specification is shown;
[0035] Figure 2 A hardware structure diagram of a computing device provided according to an embodiment of the specification is shown;
[0036] Figure 3 A flowchart of a method for training a living body detection model provided according to an embodiment of the specification is shown;
[0037] Figure 4 A method flowchart of each iteration training of a pre-training living body detection model provided according to an embodiment of the specification is shown;
[0038] Figure 5A schematic diagram of a network structure of a pre-training source domain model is shown according to an embodiment of the present specification.
[0039] Figure 6 A whole flow block diagram of the living body detection method is shown. DETAILED DESCRIPTION
[0040] The following description provides specific applications and requirements of the present specification, which is intended to enable a person skilled in the art to manufacture and use the content of the present specification. Various partial modifications of the disclosed embodiments are obvious to those skilled in the art, and the general principles defined herein can be applied to other embodiments and applications without departing from the spirit and scope of the present specification. Therefore, the present specification is not limited to the shown embodiments, but to the widest scope consistent with the claims.
[0041] The terms used herein are only for the purpose of describing specific example embodiments, and are not limiting. For example, unless the context clearly indicates otherwise, as used herein, the singular forms "a", "an", and "the" can also include the plural forms. When used in the present specification, the terms "comprise", "include" and / or "contain" mean that the associated whole, step, operation, element and / or component exists, but do not exclude the presence of one or more other features, whole, step, operation, element, component and / or group or additional features, whole, step, operation, element, component and / or group can be added in the system / method.
[0042] In view of the following description, these features of the present specification and other features, and the operation and function of related elements of the structure, and the combination and economy of manufacture of components can be obviously improved. Referring to the drawings, all of which form part of the present specification. However, it should be clearly understood that the drawings are for illustrative and descriptive purposes only and are not intended to limit the scope of the present specification. It should also be understood that the drawings are not drawn to scale.
[0043] The flowchart used in the present specification shows the operation of system implementation according to some embodiments of the present specification. It should be clearly understood that the operations of the flowchart can not be implemented in sequence. On the contrary, the operations can be implemented in reverse order or simultaneously. In addition, one or more other operations can be added to the flowchart. One or more operations can be removed from the flowchart.
[0044] For the convenience of description, the terms appearing in the present specification are first explained as follows:
[0045] Information maximization: refers to the prediction result of various categories of samples as much as possible in unsupervised learning. In unsupervised learning, the training samples have no real labels manually annotated. Therefore, it is not known what the real labels of the training samples are. But when training, it is hoped that each training sample will be classified into a category. Therefore, in unsupervised learning, it is hoped that the probability output by all training samples is balanced on the entire training sample set, that is, the number of samples classified into each category is as consistent as possible. For example, assuming that the input data includes 100 training samples, and the 100 training samples correspond to 10 categories, and every 10 samples correspond to one category. Then the training goal is to be able to distribute the 100 training samples as evenly as possible to each category.
[0046] Live detection: refers to an algorithm for determining whether an image is a live image or an attack image in a face recognition system.
[0047] Cross-domain adaptation: in this scheme, it refers to the adjustment and adaptation work needed when applying a live detection algorithm from one scene to another scene (for example, from a face payment scene to a face attendance scene).
[0048] Before the specific embodiments of the present specification are described, the application scenarios of the present specification are introduced as follows:
[0049] The live detection method provided by the present specification can be applied in any scene that needs to perform identity verification, such as a face payment service scene of an offline retail store, an artificial intelligence (AI) vending machine, an access control machine, or other scenes that need to perform face payment. When it is determined that the live detection result of the detection object is a live body, the next step of identity verification is performed. For example, in a payment scene, the user can be subjected to live detection by the live detection method provided by the present specification, and when it is determined that the user is a live body, the user is subjected to face recognition, and when it is determined that the user is a legal user, the operation of face payment is allowed to be performed. Or in an access control scene, the user can be subjected to live detection by the live detection method provided by the present specification, and when it is determined that the user is a live body, the user is subjected to face recognition, and when it is determined that the user is a legal user, the user is allowed to pass. Or in an information query type scene, the user can be subjected to live detection by the live detection method provided by the present specification, and when it is determined that the user is a live body, the user is subjected to face recognition, and when it is determined that the user is a legal user, the user is allowed to be subjected to information query.
[0050] Those skilled in the art should understand that the live detection method of the present specification can also be applied to other use scenarios within the protection scope of the present specification.
[0051] Figure 1An application scenario diagram of a living body detection system 001 provided by an embodiment of the present specification is shown. As shown in Figure 1 The living body detection system 001 (hereinafter referred to as system 001) can include a user 100, a client 200, a server 300 and a network 400. The client 200 and the server 300 are connected to the network 400.
[0052] The user 100 can be a user who needs to perform living body detection, or a user who is performing living body detection. The user 100 can trigger the living body detection function on the client 200 to perform living body detection on the user. The user 100 can be an object detected by the system 001. The user 100 can initiate a living body detection identification program, thereby triggering the living body detection of the user 100. For example, the user 100 can enter the face payment link through a series of operations in the payment service. Or in the access control scene, by placing the face in the face detection range. Or in the information query scene, by entering the face verification link through a series of operations, thereby triggering the living body detection function.
[0053] The client 200 can be a device that performs living body detection on the original image including the biological characteristics of the user in response to the living body detection operation of the user 100. In some embodiments, the training method of the living body detection model and the living body detection method can be executed on the client 200. At this time, the client 200 can store data or instructions for executing the training method of the living body detection model and the living body detection method described in the present specification, and can execute or be used to execute the data or instructions. In some embodiments, the client 200 can include a hardware device with data information processing function and necessary programs required to drive the hardware device to work. As Figure 1As shown, the client 200 can be communicatively connected with the server 300. In some embodiments, the server 300 can be communicatively connected with a plurality of clients 200. In some embodiments, the client 200 can interact with the server 300 through the network 400 to receive or send messages, etc. In some embodiments, the client 200 can include a mobile device, a tablet, a notebook, a built-in device of a motor vehicle, or the like, or any combination thereof. In some embodiments, the mobile device can include a smart home device, a smart mobile device, a virtual reality device, an augmented reality device, or the like, or any combination thereof. In some embodiments, the smart home device can include a smart television, a desktop computer, or the like, or any combination thereof. In some embodiments, the smart mobile device can include a smartphone, a personal digital assistant, a gaming device, a navigation device, or the like, or any combination thereof. In some embodiments, the virtual reality device or the augmented reality device can include a virtual reality headset, a virtual reality glasses, a virtual reality patch, an augmented reality headset, an augmented reality glasses, an augmented reality patch, or the like, or any combination thereof. For example, the virtual reality device or the augmented reality device can include Google glasses, a head-mounted display, a VR, or the like. In some embodiments, the built-in device in the motor vehicle can include an on-board computer, an on-board television, or the like. In some embodiments, the client 200 can include an image acquisition device for acquiring a raw image of a biometric feature of a user. In some embodiments, the image acquisition device can be a two-dimensional image acquisition device (such as an RGB camera, an IR camera, or the like), or a combination of a two-dimensional image acquisition device (such as an RGB camera, an IR camera, or the like) and a depth image acquisition device (such as a 3D structured light camera, a laser detector, or the like). In some embodiments, the client 200 can be a device with positioning technology for positioning a location of the client 200.
[0054] In some embodiments, the client 200 can be installed with one or more applications (APPs). The APPs can provide the target user 100 with the ability and interface to interact with the outside world through the network 400. The APPs include, but are not limited to, web browser type APPs, search type APPs, chat type APPs, shopping type APPs, video type APPs, financial type APPs, instant messaging tools, email clients, social platform software, and the like. In some embodiments, the target APP can be installed on the client 200. The target APP can be used to collect raw images including the user's biological features, and the like, on the client 200. In some embodiments, the target user 100 can also trigger a live body detection request through the target APP. The target APP can execute the live body detection method described in the present specification in response to the live body detection request. In some embodiments, the user 100 can also trigger a training request of the live body detection model through the target APP. The target APP can execute the training method of the live body detection model described in the present specification in response to the training request of the live body detection model. The training method of the live body detection model and the live body detection method will be described in detail in the following content.
[0055] The server 300 can be a server that provides various services, such as a background server that supports live body detection on raw images including the user's biological features collected on the client 200 and on the raw images. In some embodiments, the training method of the live body detection model and the live body detection method can be executed on the server 300. At this time, the server 300 can store data or instructions for executing the training method of the live body detection model and the live body detection method described in the present specification, and can execute or be used to execute the data or instructions. In some embodiments, the server 300 can include a hardware device with data information processing function and necessary programs for driving the hardware device to work. The server 300 can be in communication connection with multiple clients 200 and receive data sent by the clients 200.
[0056] It should be noted that the training method of the live body detection model and the live body detection method can be executed on the same server, or can be executed on different servers.
[0057] The network 400 is used to provide communication connection between the client 200 and the server 300. The network 400 can facilitate exchange of information or data. As Figure 1As shown, the client 200 and the server 300 can be connected with the network 400, and transmit information or data to each other through the network 400. In some embodiments, the network 400 can be any type of wired or wireless network, or a combination thereof. For example, the network 400 can include a cable network, a wired network, a fiber optic network, a telecommunication network, an intranet, the Internet, a local area network (LAN), a wide area network (WAN), a wireless local area network (WLAN), a metropolitan area network (MAN), a wide area network (WAN), a public switched telephone network (PSTN), a Bluetooth network TM , a ZigBee TM network, a near field communication (NFC) network, or a similar network. In some embodiments, the network 400 can include one or more network access points. For example, the network 400 can include wired or wireless network access points, such as base stations or Internet exchange points, through which one or more components of the client 200 and the server 300 can connect to the network 400 to exchange data or information.
[0058] It should be understood that Figure 1 the number of the client 200, the server 300, and the network 400 is merely illustrative. Any number of the client 200, the server 300, and the network 400 can be provided according to implementation needs.
[0059] It should be noted that the live body detection method can be completely executed on the client 200, or completely executed on the server 300, or partially executed on the client 200 and partially executed on the server 300.
[0060] Figure 2 A hardware structure diagram of a computing device 500 is shown, which is provided according to an embodiment of the present specification. The computing device 500 can execute the live body detection model training method and the live body detection method described in the present specification. The live body detection model training method and the live body detection method are introduced in other parts of the present specification. When the live body detection method is executed on the client 200, the computing device 500 can be the client 200. When the live body detection method is executed on the server 300, the computing device 500 can be the server 300. When the live body detection method can be partially executed on the client 200 and partially executed on the server 300, the computing device 500 can be the client 200 and the server 300. When the live body detection model training method is executed on the client 200, the computing device 500 can be the client 200. When the live body detection model training method is executed on the server 300, the computing device 500 can be the server 300. When the live body detection model training method can be partially executed on the client 200 and partially executed on the server 300, the computing device 500 can be the client 200 and the server 300.
[0061] As shown in Figure 2 The computing device 500 can include at least one storage medium 530 and at least one processor 520. In some embodiments, the computing device 500 can also include a communication port 550 and an internal communication bus 510. Meanwhile, the computing device 500 can also include an I / O component 560.
[0062] The internal communication bus 510 can connect different system components, including the storage medium 530, the processor 520 and the communication port 550.
[0063] The I / O component 560 supports input / output between the computing device 500 and other components.
[0064] The communication port 550 is used for data communication between the computing device 500 and the outside world. For example, the communication port 550 can be used for data communication between the computing device 500 and the network 400. The communication port 550 can be a wired communication port or a wireless communication port.
[0065] The storage medium 530 can include a data storage device. The data storage device can be a non-transitory storage medium or a transitory storage medium. For example, the data storage device can include one or more of a magnetic disk 532, a read-only memory (ROM) 534 or a random access memory (RAM) 536. The storage medium 530 also includes at least one instruction set stored in the data storage device. The instructions are computer program codes, which can include programs, routines, objects, components, data structures, processes, modules, etc. that perform the living body detection method provided in the present specification.
[0066] The at least one processor 520 can be communicatively connected with the at least one storage medium 530 and the communication port 550 through the internal communication bus 510. The at least one processor 520 is configured to execute the at least one instruction set. When the computing device 500 is running, the at least one processor 520 reads the at least one instruction set and executes the training method of the liveness detection model and the liveness detection method provided in the present specification according to the instructions of the at least one instruction set. The processor 520 can execute all steps included in the training method of the liveness detection model and the liveness detection method. The processor 520 can be in the form of one or more processors, and in some embodiments, the processor 520 can include one or more hardware processors, such as a microcontroller, a microprocessor, a reduced instruction set computer (RISC), an application-specific integrated circuit (ASIC), an application-specific instruction set processor (ASIP), a central processing unit (CPU), a graphics processing unit (GPU), a physics processing unit (PPU), a microcontroller unit, a digital signal processor (DSP), a field programmable gate array (FPGA), an advanced RISC machine (ARM), a programmable logic device (PLD), any circuit or processor capable of executing one or more functions, or the like, or any combination thereof. For the sake of illustration only, only one processor 520 is described in the computing device 500 of the present specification. However, it should be noted that the computing device 500 of the present specification can also include multiple processors, and therefore, the operations and / or method steps disclosed in the present specification can be executed by one processor or jointly executed by multiple processors. For example, if the processor 520 of the computing device 500 of the present specification executes step A and step B, it should be understood that step A and step B can also be executed by two different processors 520 jointly or separately (e.g., a first processor executes step A and a second processor executes step B, or the first and second processors jointly execute steps A and B).
[0067] Figure 3 A flowchart of a training method P100 of a liveness detection model according to an embodiment of the present specification is shown. As before, the computing device 500 can execute the training method P100 of the liveness detection model of the present specification. Specifically, the processor 520 can read the instruction set stored in its local storage medium, and then execute the training method P100 of the liveness detection model of the present specification according to the provisions of the instruction set. As shown, the method P100 can include: Figure 3
[0068] S110: Obtain a plurality of first training images of a target domain and their corresponding pseudo labels.
[0069] The target domain refers to the knowledge to be learned. Corresponding to the target domain is the source domain. The source domain refers to the existing knowledge. The source domain and the target domain can be distinguished by the number of training images, and / or whether the training images correspond to the labels of the living body categories or attack categories annotated by humans. For example, we initially trained a living body detection model using a large amount of training data in a payment scenario and real labels annotated by humans, which can be well applied to living body detection in the payment scenario. However, now it is necessary to perform living body detection in scenarios such as attendance or access control. There are only a small amount of training images in the attendance or access control scenario, and due to the time-consuming way of manually annotating labels for training images, it is not possible to manually annotate real labels for training images, and other factors, so that the training images in the attendance or access control scenario are unlabeled by humans. Because from the payment scenario to the attendance or access control scenario, the imaging conditions and imaging scenarios of the same user in the payment scenario and the access control scenario are different, different imaging effects will be produced, and the collection conditions and the environment of the device setup change, which will all cause the domain of the training images to change. Therefore, when deploying the living body detection model in the payment scenario to the attendance or access control scenario for living body detection, the living body detection model faces the cross-domain phenomenon, and the performance of living body detection will decrease. Here, the payment scenario can be understood as the source domain, and the attendance or access control scenario target domain can be understood as the target domain.
[0070] The first training image includes a biological feature of a user. The user here is a user to be subjected to living body detection. The biological feature is a physiological characteristic inherent to the human body, which can include at least one of a face, an iris, a sclera, a fingerprint, a palm print, a voiceprint, and a bone projection, and can also include other physiological characteristics inherent to the human body that can be used for face recognition. For the convenience of description, the biological feature will be described as a face in this specification. It should be understood by those skilled in the art that the biological feature is other features within the protection scope of this specification. When a training request for the living body detection model is triggered, the processor 520 can receive the original image of the user uploaded through the client 200, or can also obtain the original image from the storage address based on the received training request for the living body detection model carrying the storage address of the original image of the user. These original images will be used as the first training image and used to train the living body detection model. Specifically, the obtaining manner of the plurality of first training images can be as follows: for example, a plurality of compressed features corresponding to a plurality of original images of the target domain are obtained, the plurality of compressed features or a plurality of decompressed features corresponding to the plurality of compressed features are input into the trained image reconstruction model, a plurality of reconstructed images corresponding to the plurality of compressed features are obtained, and a plurality of first training images are obtained based on the plurality of reconstructed images.
[0071] The manner of obtaining the plurality of compressed features corresponding to the plurality of original images of the target domain can be various, and can be as follows: For example, in some possible implementation manners, the plurality of compressed features corresponding to the plurality of original images of the target domain can be received from the client, or the plurality of compressed features corresponding to the plurality of original images of the target domain pre-stored by the server can be obtained. The plurality of compressed features can be obtained by compressing and desensitizing the plurality of original images by the image compression module after training.
[0072] In another possible implementation manner, obtaining the plurality of compressed features corresponding to the plurality of original images of the target domain includes: receiving target compressed features corresponding to the plurality of original images of the target domain from the client, and decompressing the target compressed features by using a decompression algorithm to obtain the plurality of compressed features. The target compressed features are obtained by compressing the plurality of original images by the image compression module after training to obtain intermediate compressed features, and then compressing the intermediate compressed features by using a compression algorithm.
[0073] The compression algorithm can further compress the original image, further reduce the data transmission amount, and can realize lossless compression. That is, the plurality of intermediate compressed features are obtained by compressing the plurality of original images by the image compression module after training, and the plurality of intermediate compressed features are determined as the plurality of compressed features. Alternatively, the plurality of intermediate compressed features are obtained by compressing the plurality of original images by the image compression module after training, and the plurality of intermediate compressed features are compressed by using a compression algorithm to obtain a plurality of target compressed features. The compression algorithm can be a zip compression algorithm, a rar compression algorithm, a 7-zip compression algorithm, and a lzw compression algorithm, and the plurality of intermediate compressed features are compressed into zip format, rar format, 7-zip format, and lzw format.
[0074] The plurality of decompressed features are obtained by decompressing the plurality of target compressed features by using a decompression algorithm corresponding to the compression algorithm. The decompression algorithm can be a zip decompression algorithm, a rar decompression algorithm, a 7-zip decompression algorithm, and a lzw decompression algorithm.
[0075] As described above, a plurality of original images can be received from the client. In the related art, the client collects the plaintext images without encryption and transmits them to the server as training images to train the liveness detection model. However, this method has the risk of privacy leakage, and when the data volume is large, it also relies heavily on network bandwidth, causing data transmission failure. In order to protect user privacy and reduce data transmission volume, an image compression module can be deployed on the client. When the client collects a plurality of original images, the plurality of original images are input into the trained image compression module deployed on the client. The trained image compression module compresses the plurality of original images respectively to obtain a plurality of compressed features corresponding to the plurality of original images, and each original image corresponds to a compressed feature. Then, the client transmits the compressed plurality of compressed features to the server. The server receives the plurality of compressed features and inputs the plurality of compressed features into the trained image reconstruction module. The trained image reconstruction module reconstructs the images based on the plurality of compressed features to obtain a plurality of reconstructed images. The plurality of reconstructed images are used as the plurality of first training images of the target domain.
[0076] Alternatively, the trained image compression module compresses the plurality of original images respectively to obtain intermediate compressed features. Then, the client uses a compression algorithm to compress the intermediate compressed features to obtain target compressed features. Then, the client transmits the compressed plurality of target compressed features to the server. The server receives the plurality of target compressed features and decompresses the plurality of target compressed features to obtain decompressed compressed features. The decompressed compressed features are input into the trained image reconstruction module. The trained image reconstruction module reconstructs the images based on the plurality of compressed features to obtain a plurality of reconstructed images. The plurality of reconstructed images are used as the plurality of first training images of the target domain. The compressed features have a lower dimension than the original images. That is, the amount of information contained in the compressed features is the same as or close to the amount of information contained in the original image samples, but the compressed features require less storage space. And using deep learning to compress, compared with image compression algorithm, the difficulty of cracking is greater, so that the compressed features have the effect of desensitization and higher security. It can desensitize the user's original image, achieve privacy protection, and on the other hand, it can also reduce the data volume of transmission.
[0077] In addition, in some scenarios, there is also a risk of privacy leakage in the process of storing multiple original images on the server. In this case, a post-training image compression module can be deployed on the server. The post-training image compression module deployed on the server compresses the multiple original images transmitted by the client respectively, thereby obtaining multiple compressed features corresponding to the multiple original images and storing them on the server. When the training of the live detection model is needed, the server can obtain multiple compressed features and input them into the post-training image reconstruction module. The post-training image reconstruction module reconstructs images based on the multiple compressed features respectively, thereby obtaining multiple reconstructed images. The multiple reconstructed images are used as the multiple first training images of the target domain.
[0078] It should be understood that the multiple reconstructed images are the same or close to the multiple original images. That is, after each original image is compressed and reconstructed, a reconstructed image corresponding to the original image can be obtained. Since image reconstruction may not be able to restore the original image 100%, the reconstructed image is the same or close to the corresponding original image.
[0079] The above introduces the application process of the post-training image compression module and the post-training image reconstruction module. Before applying the post-training image compression module to compress the multiple original images and applying the post-training image reconstruction module to reconstruct the multiple decompressed features, the post-training image compression module and the post-training image reconstruction module need to be trained first. The training process of the post-training image compression module and the post-training image reconstruction module will be introduced below.
[0080] The post-training image compression module and the post-training image reconstruction module can be trained by the following method steps: for example, obtaining original image samples, inputting the original image samples into the pre-training image compression module to obtain training compressed features corresponding to the original image samples, inputting the training compressed features into the pre-training image reconstruction module to obtain reconstructed image samples corresponding to the training compressed features, determining third comprehensive loss information based on the original image samples, the reconstructed image samples and the training compressed features, and iteratively training the pre-training image compression module and the pre-training image reconstruction module based on the third comprehensive loss information to obtain the post-training image compression module and the post-training image reconstruction module.
[0081] Among them, the biological features of the training user are included in the original image samples. The training user is the target object to which the biological features in the original image samples belong. The introduction of the biological features can be referred to the foregoing introduction, which will not be repeated here. The original image samples can be obtained from a public data set, or from image samples collected in a real scene and including biological features of the training user, or from other obtaining methods, which are not limited in the present specification.
[0082] The network structure of the pre-training image compression module can be Resnet, such as Resnet18, which is configured to compress the original image sample, with the input being the original image sample and the output being the compressed feature corresponding to the original image sample. After the original image sample is input into the pre-training image compression module, the pre-training image compression module compresses the original image sample to obtain the training compressed feature corresponding to the original image sample.
[0083] The network structure of the pre-training image reconstruction module can be Unet, which is configured to reconstruct the image based on the compressed feature, with the input being the compressed feature and the output being the reconstructed original image. After the training compressed feature is input into the pre-training image reconstruction module, the pre-training image reconstruction module reconstructs the training compressed feature to obtain the reconstructed image sample. The reconstructed image sample here is the reconstructed original image sample.
[0084] After obtaining the training compressed feature and the reconstructed image sample, the third comprehensive loss information can be determined based on the original image sample, the reconstructed image sample and the training compressed feature. The third comprehensive loss information can be determined in the following manner: for example, based on the difference between the original image sample and the reconstructed image sample, the image reconstruction loss information is determined, based on the difference between the number of target elements in the training compressed feature and the preset number, the feature sparsity loss information is determined, based on the difference between the original image sample and the training compressed feature, the sample relationship constraint function is determined; and based on the accumulation of the image reconstruction loss information, the feature sparsity loss information and the sample relationship constraint function, the third comprehensive loss information is obtained. The third comprehensive loss information can be represented by the following formula (1):
[0085] Loss data =Loss recon +Loss sparse +Loss relation ;(1)
[0086] In formula (1), Loss data is the third comprehensive loss information, Loss recon is the image reconstruction loss information, Loss sparse is the feature sparsity loss information, and Loss relation is the sample relationship constraint function.
[0087] Loss recon characterizes the difference between the original image sample and the reconstructed image sample, which can be obtained based on the Euclidean distance between the original image sample and the reconstructed image sample. Loss recon aims to minimize the difference between the original image sample and the reconstructed image sample, so that the image reconstruction module after training can restore the image without distortion.
[0088] Loss sparse Loss sparse Loss sparse Loss sparse Loss sparse Loss sparse Loss sparse
[0089] Loss relation Loss relation Loss relation Loss
[0090]
[0091] Each of the plurality of first training images also corresponds to a pseudo label. The pseudo label is non-manual annotation information representing that the first training image is of the living body category or the attack category, and can be obtained by annotating the living body category or the attack category of the training image in a non-manual annotation manner. The non-manual annotation manner can be a model annotation manner or other manners. The pseudo label can save the time-consuming and high cost problems of manually annotating the labels of the plurality of first training samples, and help the pre-training living body detection model to perform simple and effective semi-supervised learning training from the plurality of first training images without manual annotation, to obtain a living body detection model suitable for a new scene. The pseudo label can be obtained by predicting the living body category of the plurality of first training images by using a pre-trained source domain model. The pre-trained source domain model can be trained by using a plurality of second training images with manually annotated living body category labels. The training process and use process of the pre-trained source domain model will be described in detail below.
[0092] S120: iteratively training the pre-training living body detection model based on the plurality of first training images and the plurality of pseudo labels corresponding to the plurality of first training images, and the first comprehensive loss information.
[0093] The first comprehensive loss information performs information maximization constraint and / or pseudo label center constraint on the training result of the iterative training in the training. The information maximization constraint includes: based on the annotation distribution law of the plurality of first training images, the training distribution result corresponding to the plurality of first training images in the training process is constrained, so that the training distribution result tends to approach the annotation distribution law; and / or based on the maximum constraint on the plurality of living body category prediction probabilities corresponding to the plurality of first training images, the plurality of living body category prediction probabilities tend to approach the preset confidence. The pseudo label center constraint is to constrain the feature of the pseudo label to be close to the feature center of the pseudo label by using the distance between the feature center of the pseudo label and the feature of the pseudo label. The information maximization constraint and the pseudo label center constraint will be described in detail as follows:
[0094] The plurality of first training images correspond to an annotation distribution law of the living body category and the attack category. The annotation distribution law can be the ratio of the number of first training images corresponding to the living body category to the number of first training images corresponding to the attack category in the plurality of first training images, that is, the distribution ratio of the first training images corresponding to the living body category and the attack category in the plurality of first training images. The distribution ratio can be 100:1, 50:1 or other distribution ratios, which are not limited in the specification.
[0095] Figure 4 A method flowchart of each iteration training of the pre-training living body detection model provided by an embodiment of the specification is shown. Figure 4 Corresponding to step S120. As shown in Figure 4 Each iteration training of the pre-training living body detection model in step S120 can include:
[0096] S121: input the plurality of first training images to the pre-training living body detection model to determine a plurality of first living body classification training results corresponding to the plurality of first training images.
[0097] The pre-training living body detection model can include a pre-training first feature encoder and a pre-training first living body classifier. The pre-training first feature encoder is configured to perform feature extraction on the first training image, and the input thereof is the first training image, and the output thereof is the first training feature corresponding to the first training image. The pre-training first living body classifier is configured to perform living body classification based on the first training feature extracted by the pre-training first feature encoder, and the input thereof is the first training feature, and the output thereof is the first living body classification training result corresponding to the first training image. The first living body classification training result represents that the first training image is a living body category or an attack category. Inputting the plurality of first training images to the pre-training first feature encoder can obtain a plurality of first training features corresponding to the plurality of first training images, and each first training image corresponds to a first training feature. Inputting the plurality of first training features to the pre-training first living body classifier can further obtain a plurality of first living body classification training results corresponding to the plurality of first training images, and each first training image corresponds to a first living body classification training result.
[0098] S122: determine the plurality of first living body classification training results of the plurality of first training images in the last iteration training as the plurality of pseudo labels corresponding to the plurality of first training images in the current iteration training.
[0099] In the initial iteration training, the plurality of pseudo labels corresponding to the plurality of first training images are obtained based on the pre-training source domain model. For example, inputting the plurality of first training images to the pre-training source domain model obtains the plurality of pseudo labels in the initial iteration training. Then, in the i-th iteration training, the plurality of first living body classification training results in the (i-1)-th iteration training are used as the plurality of pseudo labels in the i-th iteration training, and the first living body classification loss information in the i-th iteration training is determined based on the difference between the plurality of first living body classification training results in the i-th iteration training and the plurality of pseudo labels corresponding to the i-th iteration training. i is an integer greater than 2.
[0100] The pre-training source domain model is obtained by iterative training based on a plurality of second training images of a source domain and real labels artificially labeled to represent that the second training image is a living body category or an attack category, and is used to predict the plurality of pseudo labels corresponding to the plurality of first training images in the initial iteration training of the pre-training living body detection model. The pseudo label is a label close to the real label of the first training image, which can save the time and cost of artificially labeling the real label of the first training image.
[0101] It should be noted that steps S121 and S122 are not limited in the order of execution here, and can be executed in the order of step S121 first and then step S122, or in the order of step S122 first and then step S121, or simultaneously.
[0102] S123: Determine a training distribution result of the living body classification corresponding to the plurality of first training images based on the plurality of first living body classification training results.
[0103] Each first living body classification training result represents that the living body classification of the first training image in the current iteration training is a living body class or an attack class. The plurality of first living body classification training results correspond to the distribution of the living body class and the attack class. Based on the distribution of the living body class and the attack class in the plurality of first living body classification training results, the training distribution result can be determined. For example, the number of living body classes and the number of attack classes in the plurality of first living body classification training results are determined, and the training distribution result is determined based on the ratio of the number of living body classes to the number of attack classes. The number of living body classes and the number of attack classes in the plurality of first living body classification training results can be determined in the following manner: for example, when the first living body classification training result represents that the living body classification corresponding to the first training image is a living body class, the first living body classification training result is marked as "1"; when the first living body classification training result represents that the living body classification corresponding to the first training image is an attack class, the first living body classification training result is marked as "0". By counting the number of "1" and "0" respectively, the number of living body classes and the number of attack classes in the plurality of first living body classification training results can be obtained. It should be understood that the living body class is marked as "1" and the attack class is marked as "0" here for exemplary illustration, and other marking methods can be used according to actual needs by those skilled in the art.
[0104] S124: Determine a first comprehensive loss information based on the plurality of first living body classification training results and the plurality of pseudo labels, the training distribution result and the annotation distribution rule, to maximize the information constraint on the training result of the iteration training.
[0105] There are many implementation methods for step S124, which can be as follows:
[0106] In a possible implementation, step S124 can be implemented in the following manner: determining first living body classification loss information based on the difference between the plurality of first living body classification training results and the plurality of pseudo labels corresponding thereto, determining distribution loss information of living body classification based on the difference between the training distribution result and the annotation distribution law, determining the distribution loss information of living body classification as information maximization constraint loss information, and obtaining first comprehensive loss information based on the accumulation of the first living body classification loss information and the information maximization constraint loss information. The first comprehensive loss information can be expressed as formula (2) as follows:
[0107] Loss_data’ = Loss_cls + Loss_im1 (2)
[0108] In formula (2), Loss_data’ is the first comprehensive loss information; Loss_cls is the first living body classification loss information; and Loss_im1 is the distribution loss information of living body classification.
[0109] Since the prediction accuracy of the pre-training source domain model cannot reach 100% correct, that is, the accuracy of the pseudo label predicted by the pre-training source domain model for the first training image cannot reach 100%. Therefore, Loss_im1 is used in the first comprehensive loss information to constrain the training distribution result to approach the annotation distribution law. By constraining the training distribution result to approach the annotation distribution law, the prediction accuracy of the pseudo label during iterative training can be improved, so that the pseudo label is the same as or as close as possible to the true label of the first training image.
[0110] Loss_cls is used to minimize the difference between the first living body classification training result and the corresponding pseudo label, aiming to enable the trained target living body detection model to have good living body detection performance, that is, to improve the living body detection accuracy of the trained target living body detection model.
[0111] The combination of Loss_im1 and Loss_cls in the first comprehensive loss information can improve the prediction accuracy of the pseudo label. Moreover, when the pseudo label is used as a supervision signal to guide the iterative training of living body classification, the iterative training of living body classification can be better guided, and thus the accuracy of living body detection can be improved.
[0112] In another possible implementation, the first living body classification training result includes a predicted probability of living body classification. The living body classification includes a living body category and / or an attack category. Step S124 can also be implemented in the following manner: determining first living body classification loss information based on differences between the plurality of first living body classification training results and the plurality of pseudo labels; determining a plurality of prediction confidences corresponding to the plurality of first living body classification training results based on a plurality of predicted probabilities of living body classification corresponding to the plurality of first training images; determining information maximization constraint loss information based on the training distribution result and the annotation distribution rule, and the plurality of prediction confidences; and obtaining first comprehensive loss information based on an accumulation of the first living body classification loss information and the information maximization constraint loss information.
[0113] In the first iteration training, the first living body classification loss information is determined based on differences between the plurality of first living body classification training results and the plurality of pseudo labels determined based on the pre-trained source domain model. In the i-th iteration training, the first living body classification loss information is determined based on differences between the plurality of first living body classification training results and the plurality of first living body classification training results in the (i-1)-th iteration training.
[0114] The plurality of first training images are input into the pre-training living body detection model, and a plurality of predicted probabilities of living body classification corresponding to the plurality of first training images can be obtained. The plurality of predicted probabilities of living body classification corresponding to the plurality of first training images represent probabilities that the living body classification corresponding to the plurality of first training images is a living body category and / or an attack category. The plurality of predicted probabilities of living body classification corresponding to the plurality of first training images can be determined as a plurality of prediction confidences.
[0115] The information maximization constraint loss information is determined based on the training distribution result and the annotation distribution rule, and the plurality of prediction confidences, including: determining distribution loss information of living body classification based on differences between the training distribution result and the annotation distribution rule, determining prediction loss information corresponding to the plurality of pseudo labels based on the plurality of prediction confidences, and obtaining the information maximization constraint loss information based on an accumulation of the distribution loss information of living body classification and the prediction loss information.
[0116] After obtaining the information maximization constraint loss information based on the accumulation of the distribution loss information of living body classification and the prediction loss information, the first comprehensive loss information can be obtained based on an accumulation of the first living body classification loss information and the information maximization constraint loss information. The first comprehensive loss information can also be represented as the following formula (3):
[0117] Loss_data’=Loss_cls+Loss_im1+Loss_im2;(3)
[0118] In formula (3), Loss_data' is the first comprehensive loss information; Loss_cls is the first living body classification loss information; Loss_im1 is the distribution loss information of the living body classification; Loss_im2 is the prediction loss information; Loss_im1+Loss_im2 can be understood as information maximization constraint loss information.
[0119] For Loss_cls and Loss_im1, refer to the corresponding content introduction of formula (2), which will not be repeated here. Loss_im1 is used to constrain the training distribution result to approach the labeled distribution rule. Loss_im2 aims to constrain the confidence of multiple first living body classification training results to approach the pre-set confidence. For example, the pre-set confidence can be 1, and when the confidence of the first living body classification training result maintains a stable state close to 1, it is considered that the confidence of multiple first living body classification training results approaches the pre-set confidence. Here, when the pre-training living body detection model has a high confidence in the output living body category, and the confidence of other categories (such as attack category) is small, it indicates that the pre-training living body detection model is confident in the prediction result of the living body classification. Therefore, through the constraint of the prediction loss information, the prediction accuracy of the pre-training living body detection model for multiple first living body classification results and the first living body classification result as a pseudo label can be improved.
[0120] The role of the prediction loss information corresponding to the pseudo label is also that: due to the error of the constraint of the distribution loss information of the living body classification. For example, when the classification of two first training images is misjudged, that is, the true label of the first training image A is the living body category, the true label of the first training image B is the attack category, and the predicted pseudo label of the first training image A is the attack category, and the pseudo label of the first training image B is the living body category, the effect of constraining the training distribution result to approach the labeled distribution rule can also be achieved, but actually the prediction accuracy of the trained living body detection model is not high. Therefore, by constraining the confidence of multiple first living body classification training results to approach the pre-set confidence through the prediction loss information, the misjudgment phenomenon can be reduced, and the living body detection accuracy of the pre-training living body detection model can be further improved.
[0121] As introduced in step S120, the first comprehensive loss information can also perform pseudo label center constraint on the training result of iterative training in the training of the pre-training living body detection model. The pseudo label center constraint will be introduced in detail as follows:
[0122] The first comprehensive loss information can further include pseudo-label center constraint loss information. The pseudo-label center constraint loss information constrains M first training features corresponding to M live body categories to be close to a live body center feature and N first training features corresponding to N attack categories to be close to an attack center feature in each iteration of training. M and N are both integers greater than 0 and less than or equal to the total number of pseudo-labels.
[0123] The live body center feature is determined based on a feature average of at least one first training feature corresponding to at least one pseudo-label representing a live body category in the plurality of pseudo-labels obtained in the last iteration of training. Specifically, in the initial iteration of training of the live body detection model before training, the live body center feature is determined based on a feature average of at least one first training feature corresponding to at least one pseudo-label representing a live body category in the plurality of pseudo-labels obtained by inputting the plurality of first training images into the pre-trained source domain model. In the ith iteration of training of the live body detection model before training, the live body center feature is determined based on a feature average of at least one first training feature corresponding to at least one pseudo-label representing a live body category in the plurality of first live body classification training results obtained in the (i-1)th iteration of training.
[0124] The attack center feature is determined based on a feature average of at least one first training feature corresponding to at least one pseudo-label representing an attack category in the plurality of pseudo-labels obtained in the last iteration of training. Specifically, in the initial iteration of training of the live body detection model before training, the attack center feature is determined based on a feature average of N first training features corresponding to N attack categories in the plurality of pseudo-labels obtained by inputting the plurality of first training images into the pre-trained source domain model. In the ith iteration of training of the live body detection model before training, the attack center feature is determined based on a feature average of N first training features corresponding to N live body categories in the plurality of first live body classification training results obtained in the (i-1)th iteration of training.
[0125] After the live body center feature and the attack center feature are determined, the pseudo-label center constraint information can be determined based on the live body center feature and the attack center feature. The pseudo-label center constraint loss information can be determined by the following method steps: based on distances between M first training features corresponding to M live body categories and the live body center feature corresponding to the M first training features, and distances between N first training features corresponding to N attack categories and the attack center feature corresponding to the N first training features, the pseudo-label center constraint loss information is obtained.
[0126] After obtaining the pseudo-label center constraint loss information, the first comprehensive loss function can be determined based on the first living body classification loss information, the information maximization constraint loss information and the pseudo-label center constraint loss information. When the first comprehensive loss information performs information maximization constraint or pseudo-label center constraint on the training result of the iterative training in the training, the first comprehensive loss information can include the first living body classification loss information and the information maximization constraint loss information, or include the first living body classification loss information and the pseudo-label center constraint loss information. When the first comprehensive loss information performs information maximization constraint and / or pseudo-label center constraint on the training result of the iterative training in the training, the first comprehensive loss information can also be expressed as the following formula (4):
[0127] Loss_data’ = Loss_cls + Loss_im1 + Loss_im2 + Loss_center; (4)
[0128] In formula (4), Loss_data’ is the first comprehensive loss information; Loss_cls is the first living body classification loss information; Loss_im1 is the distribution loss information of the living body classification; Loss_im2 is the pseudo-label prediction loss information; and Loss_center is the pseudo-label center constraint loss information.
[0129] For Loss_cls, Loss_im1 and Loss_im2, please refer to the foregoing description in the formula (3) part, which will not be repeated here.
[0130] Loss_center can filter out the influence of noise samples on classification. Taking the living body category as an example, a plurality of first training images corresponding to the living body category can be regarded as a cluster. The cluster has a cluster center, and when some first training images are far away from the cluster center, it indicates that the accuracy of the first training features extracted for the first training images is low. Therefore, by constraining the features of the first training images corresponding to the living body category to be close to the cluster center through Loss_center, the prediction accuracy of the pre-training source domain model for the pseudo-label can be further improved.
[0131] When the first comprehensive loss function reaches the minimum or the number of iterations reaches the preset number, the training is completed, and the target living body detection model can be obtained.
[0132] As described above, the pre-training source domain model can generate a plurality of pseudo-labels of the first training images in the initial iteration training of the living body detection model before training. Before applying the pre-training source domain model to generate the pseudo-labels of the initial iteration training of the living body detection model before training, the pre-training source domain model needs to be trained. The training process of the pre-training source domain model will be introduced as follows:
[0133] The pre-training source domain model is trained by the following method steps: obtaining a plurality of second training images of the source domain and corresponding real labels, performing iterative training of the pre-training source domain model based on the plurality of second training images and the corresponding real labels and second comprehensive loss information, obtaining the pre-training source domain model, and the second comprehensive loss information performs domain-independent constraint on the training result of the iterative training in the training.
[0134] Each of the plurality of second training images of the source domain includes a biological feature of the training user, and the biological feature will be described in detail in the foregoing description, which will not be repeated here. The real label is artificial annotation information representing that the second training image is of a live body category or an attack category.
[0135] Each of the plurality of second training images of the source domain includes a biological feature of the training user, and the biological feature will be described in detail in the foregoing description, which will not be repeated here. The real label is artificial annotation information representing that the second training image is of a live body category or an attack category.
[0136] The plurality of second training images can be obtained by the following method: for example, collecting original images of the training user in a plurality of scenes authorized by the user, and / or collecting a plurality of public academic data sets corresponding to a plurality of scenes, each public academic data set corresponding to a scene and including original images of the user in a plurality of scenes. Each public academic data set can be annotated based on different scenes. It is worth noting that the collected original images and the plurality of public academic data sets all include biological features of the training user. For the obtained plurality of original images, they can be annotated as a source domain, annotated as different domains based on different scenes, and annotated with live body classification labels based on live body / attack categories. Each of the plurality of second training images corresponds to a source domain label, a domain category label and a live body classification label.
[0137] After obtaining the second training image, the pre-training source domain model can be trained based on the second training image and the corresponding live body classification label.
[0138] Figure 5 A schematic diagram of a network structure of a pre-training source domain model is shown according to an embodiment of the present specification. As shown in FIG. 1, the network structure of the pre-training source domain model includes a feature extraction network and a live body classification network. Figure 5As shown, the pre-training source domain model includes a pre-training second feature encoder, a pre-training second living body classifier, and a pre-training domain classifier. The pre-training second feature encoder can be a Resnet network configured to perform feature extraction on the second training image. The pre-training second living body classifier can be a fully connected layer configured to perform living body classification based on the second training features of the second training image extracted by the pre-training second feature encoder, thereby outputting a second living body classification training result. The pre-training domain classifier can be a fully connected layer configured to perform domain classification based on the second training features of the second training image extracted by the pre-training second feature encoder, thereby outputting a domain classification result representing which domain (or what domain category) the second training image comes from.
[0139] After inputting the plurality of second training images into the pre-training second feature encoder, a plurality of second training features corresponding to the plurality of second training images can be obtained. Then, the plurality of second training features are inputted into the pre-training second living body classifier to obtain a plurality of second living body classification training results corresponding to the plurality of second training features, and the plurality of second training features are inputted into the pre-training domain classifier to obtain a plurality of domain classification results corresponding to the plurality of second training features. Based on the difference between the plurality of second living body classification training results and the corresponding real labels, and the difference between the plurality of domain classification results and the corresponding labeled domain categories, a second comprehensive loss information is determined to constrain the training result of the iterative training in a domain-independent manner.
[0140] The second comprehensive loss information is determined based on the difference between the plurality of second living body classification results and the corresponding living body category labels, and the difference between the domain classification results and the corresponding labeled domain categories, including: determining a second living body classification loss information based on the difference between the plurality of second living body classification training results and the corresponding real labels; determining a domain classification loss information based on the difference between the plurality of domain classification results and the corresponding labeled domain categories, and performing gradient inversion on the gradient of the domain classification loss information to obtain a domain-independent classification loss information; and obtaining the second comprehensive loss information based on the accumulation of the second living body classification loss information and the domain-independent classification loss information. The second comprehensive loss information can be represented by the following formula (5):
[0141] Loss_src = Loss cls' + Loss domain; (5)
[0142] In formula (4), Loss_src is the second comprehensive loss information; Loss cls' is the second living body classification loss information; and Loss domain is the domain-independent classification loss information.
[0143] After obtaining the second comprehensive loss information, the network parameters of the pre-training second feature encoder can be updated based on the second comprehensive loss function in the back propagation process. The back propagation process will be described in detail below in combination with the drawings:
[0144] Continuing to refer to Figure 5 It can be seen that the pre-training second feature encoder is connected with the pre-training domain classifier through a gradient reversal layer (GRL). The GRL can be a diagonal matrix. In the forward propagation process, the GRL functions to achieve an identity transformation, i.e., the GRL does not process the input second training features and directly outputs the second training features. In the back propagation process, the loss (the difference between the predicted value and the true value, i.e., the error) is usually transmitted back layer by layer, and then each layer of the network calculates the gradient based on the transmitted loss to update the parameters of the layer. After the GRL is added, the GRL will multiply the error transmitted to the layer by a negative number, such as -λ, to reverse the domain-related gradient of the domain classification loss into a domain-independent gradient, so that the training target of the pre-training second feature encoder and the pre-training domain classifier is opposite. Before the GRL is not accessed, the optimization target of the pre-training domain classifier is to distinguish as much as possible the second training features extracted by the pre-training feature encoder from which domain. The optimization target of the pre-training second feature encoder is to generate as much as possible features that can distinguish the second training features from which domain, and the optimization targets of the pre-training second feature encoder and the pre-training domain classifier are consistent. After the GRL is accessed, the optimization target of the pre-training second feature encoder will be opposite to that of the domain classifier, and the optimization target of the pre-training second feature encoder needs to meet the following two conditions: (1) generating second training features that can be correctly classified; and (2) gradually weakening the attention of the pre-training feature encoder to the domain information to generate second training features that make the domain classifier as difficult as possible to distinguish from which domain.
[0145] The training process described above ends when the second comprehensive loss information is minimized or the number of training reaches a preset number, i.e., a pre-training source domain model is obtained. The pre-training source domain model is a domain-independent constrained model, i.e., it is not sensitive to domain category information and is not sensitive to which domain the input training image comes from, and only focuses on the accuracy of live body classification. In this way, when the pre-training source domain model is applied to the target domain, the interference of the domain information on the prediction of the pre-training source domain model can be reduced, the accuracy of the predicted pseudo-label of the second training image of the target domain can be improved, and the cross-domain adaptability of the pre-training source domain model can be improved.
[0146] S130: output the target live body detection model obtained after the training is completed.
[0147] After the training of the target live body detection model is completed, the target live body detection model can be output to the client, and the steps of the live body detection method are executed on the client. The steps of the live body detection method include: after obtaining the original image of the biological feature of the user, inputting the original image into the target live body detection model to obtain a live body detection result.
[0148] The inputting of the original image into the target live body detection model to obtain the live body detection result can include: inputting the original image into the target live body detection model to obtain a live body attack probability P, and determining the live body detection result based on the live body attack probability P. For example, if the live body attack probability P is greater than a set threshold T, the original image is identified as an attack category; if the live body attack probability P is less than the set threshold T, the original image is identified as a live body category.
[0149] It should be noted that for the case that the live body attack probability P is equal to the set threshold T, the original image can be identified as a live body category or an attack category, which is not limited in the present specification.
[0150] In order to improve the cross-domain adaptability of the source domain model in the target domain, a no-label live body cross-domain adaptation method based on information maximization is proposed. The overall flowchart of the cross-domain adaptation method can be as shown in Figure 6 The overall flowchart of the cross-domain adaptation method can be as shown in
[0151] (1) Source domain data acquisition and model training: first, the source domain data acquisition, labeling and source domain model training are performed.
[0152] (2) Target domain data acquisition: the target domain data acquisition is performed on the client (taking into account the privacy protection problem).
[0153] (3) Cross-domain adaptation based on information maximization and pseudo-label generation: through the information maximization constraint and the pseudo-label generation technology, the cross-domain adaptation model training is performed.
[0154] (4) Live body detection: the trained model is deployed to the client for live body detection.
[0155] To sum up, the training method of a living body detection model, the living body detection method and the system provided in the specification, after obtaining a plurality of first training images and a plurality of pseudo labels corresponding to the first training images in a target domain, the first comprehensive loss information is used to iteratively train the living body detection model before training to classify the living body, and the training result of the iterative training is constrained by information maximization and / or pseudo label center in the training process, so as to obtain the target living body detection model after training and output. In the scheme, since the first comprehensive loss information can constrain the training result of the living body detection model before training in the iterative training process by information maximization and / or pseudo label center, the prediction accuracy of the pseudo label can be improved, and then the training process of the living body detection model before training is guided as a supervision signal, the living body detection performance of the target detection model obtained by training is improved, and the performance and generalization ability of the living body cross-domain self-adaptation are improved.
[0156] In another aspect of the present specification, a non-transitory storage medium storing at least one set of executable instructions for performing page processing is provided. When the executable instructions are executed by a processor, the executable instructions direct the processor to implement the steps of the training method of the living body detection model and the living body detection method described in the present specification. In some possible implementation manners, various aspects of the present specification can also be implemented in the form of a program product including program codes. When the program product is run on the computing device 500, the program codes are used to cause the computing device 500 to perform the steps of the training method of the living body detection model and the living body detection method described in the present specification. The program product for implementing the above method can include program codes in a portable compact disc read-only memory (CD-ROM) and can be run on the computing device 500. However, the program product of the present specification is not limited to this, and in the present specification, the readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system. The program product can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium may, for example, be but is not limited to an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any appropriate combination of the above. More specific examples of the readable storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or a flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination of the above. The computer readable storage medium can include a data signal carried in a baseband or as part of a carrier wave, in which readable program codes are borne. Such a propagated data signal can take on multiple forms, including but not limited to an electromagnetic signal, an optical signal, or any appropriate combination of the above. The readable storage medium can also be any readable medium that is not a storage medium, which can send, propagate, or transmit programs for use by or in connection with an instruction execution system, apparatus, or device. The program codes contained in the readable storage medium can be transmitted by any appropriate medium, including but not limited to wireless, wired, optical fiber, RF, and the like, or any appropriate combination of the above. The program codes for performing the operations of the present specification can be written in any combination of one or more programming languages, including an object-oriented programming language, such as Java, C++, and the like, and a conventional procedural programming language, such as the "C" language or similar programming languages. The program codes can be executed entirely on the computing device 500, partially on the computing device 500, as an independent software package, partially on the computing device 500 and partially on a remote computing device, or entirely on a remote computing device.
[0157] The foregoing description of specific embodiments of the disclosure has been presented for the purposes of illustration and description. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order and still accomplish the desired results. Additionally, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous.
[0158] In light of the above, it should be appreciated that the foregoing detailed description and specific examples of the disclosure are presented for purposes of illustration and description only. The detailed description and specific examples are not intended to limit the disclosure or the scope of the claims. Although specific examples have been described in detail, various modifications can be possible without departing from the spirit and scope of the disclosure, which are to be given the full scope of the claims. The disclosure is intended to include all such modifications.
[0159] In addition, certain terminology has been used to describe the embodiments of the disclosure. For example, the terms "one embodiment" or "an embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the disclosure. The appearances of the phrase "in one embodiment" or "an embodiment", or "in some embodiments" in various places in the specification are not necessarily referring to the same embodiment. Furthermore, the particular features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.
[0160] It should be understood that in the foregoing description of embodiments of the disclosure, various features are sometimes grouped together in a single embodiment, figure, or description of a figure for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various aspects, embodiments, and / or features. However, this should not be interpreted as a requirement that these features must be provided together in order to form an embodiment of the disclosure. In fact, some embodiments of the disclosure can provide only a subset of these features. In addition, streams of features from different embodiments can be combined to provide a further embodiment of the disclosure. In addition, some embodiments can not include certain features that are present in other embodiments. In some cases, this can be due to a lack of a need to include such features in such embodiments. In other cases, such features can be removed from an embodiment of the disclosure without departing from the scope of the disclosure. In addition, the disclosure can include embodiments that include only a single feature of the disclosure.
[0161] Each patent, patent application, publication of a patent application, and other material, for example articles, books, specifications, publications, documents, things, or the like which can be cited in the present document are hereby incorporated by reference in their entirety for all purposes to the same extent as if each were specifically and individually indicated to be incorporated by reference herein in its entirety for all purposes. In the event of any inconsistency between the terminology, description, definition, and / or use of a term associated with any of the incorporated material and the terminology, description, definition, and / or use of the term in the present document, the terminology, description, definition, and / or use of the term in the present document shall control.
[0162] Finally, it should be understood that the embodiments of the application disclosed herein are illustrative of the principles of the present specification. Other modifications that fall within the scope of the present specification can also be made. Accordingly, the present specification discloses embodiments only as examples. Substantially any arrangement, which is neither specifically described nor explicitly illustrated, can be substituted for the specific embodiments disclosed, without departing from the scope of the present specification. Accordingly, the present specification discloses embodiments only as examples.
Claims
1. A method for training a live detection model, comprising: obtaining a plurality of first training images of a target domain and a plurality of pseudo labels corresponding to the plurality of first training images, each of the plurality of first training images comprising a biological feature of a user, the plurality of pseudo labels being non-artificial annotation information representing that the plurality of first training images are of a live category or an attack category; performing iterative training of a pre-training live detection model based on the plurality of first training images and the plurality of pseudo labels corresponding to the plurality of first training images, and a first comprehensive loss information, the first comprehensive loss information comprising information maximization constraint loss information, the information maximization constraint loss information being determined based on an annotation distribution rule of the plurality of first training images and a training distribution result corresponding to the plurality of first training images, the information maximization constraint loss information being used to constrain the training distribution result to approach the annotation distribution rule, wherein the annotation distribution rule comprises a ratio of a number of images of the live category to a number of images of the attack category in the plurality of first training images, and the training distribution result comprises a ratio of a number of the live category to a number of the attack category in a plurality of first live category training results corresponding to the plurality of first training images; and outputting a target live detection model obtained after the training is completed. Each of the iterative training comprises:
2. The method of claim 1, wherein, inputting the plurality of first training images into the pre-training live detection model to determine a plurality of first live category training results corresponding to the plurality of first training images; determining, as a plurality of pseudo labels corresponding to the plurality of first training images in a current iteration, the plurality of first live category training results of the plurality of first training images in a previous iteration; determining, based on the plurality of first live category training results, a training distribution result of the live category corresponding to the plurality of first training images, and determining, based on the plurality of first live category training results and the plurality of pseudo labels, and the training distribution result and the annotation distribution rule, the first comprehensive loss information to perform information maximization constraint on the training result of the iteration. the pre-training live detection model comprises a pre-training first feature encoder and a pre-training first live category classifier; and 3. The method of claim 2, wherein, the inputting the plurality of first training images into the pre-training live detection model to determine the plurality of first live category training results of the plurality of first training images comprises: inputting the plurality of first training images into the pre-training first feature encoder to obtain a plurality of first training features corresponding to the plurality of first training images; and inputting the plurality of first training features into the pre-training first live category classifier to obtain the plurality of first live category training results corresponding to the plurality of first training images. the determining, based on the plurality of first live category training results, the training distribution result of the live category corresponding to the plurality of first training images comprises: determining the training distribution result based on a distribution of the live category and the attack category in the plurality of first live category training results. 4. The method of claim 2, wherein, 5. The method of claim 2, wherein, The first comprehensive loss information is determined based on the plurality of first living body classification training results, the plurality of pseudo labels, the training distribution result, and the annotation distribution rule. The first living body classification loss information is determined based on the difference between the plurality of first living body classification training results and the plurality of pseudo labels corresponding thereto. The distribution loss information of the living body classification is determined based on the difference between the training distribution result and the annotation distribution rule, and the distribution loss information of the living body classification is determined as the information maximization constraint loss information. The first comprehensive loss information is obtained based on the accumulation sum of the first living body classification loss information and the information maximization constraint loss information.
6. The method of claim 5, wherein, The distribution loss information of the living body classification constrains the training distribution result to approach the annotation distribution rule.
7. The method of claim 2, wherein, The first living body classification training result includes a predicted probability of the living body classification. The first comprehensive loss information is determined based on the plurality of first living body classification training results, the plurality of pseudo labels, the training distribution result, and the annotation distribution rule. The first living body classification loss information is determined based on the difference between the plurality of first living body classification training results and the plurality of pseudo labels corresponding thereto. The plurality of prediction confidence levels corresponding to the plurality of first living body classification training results are determined based on the plurality of living body classification prediction probabilities corresponding to the plurality of first training images. The information maximization constraint loss information is determined based on the training distribution result, the annotation distribution rule, and the plurality of prediction confidence levels. The first comprehensive loss information is obtained based on the accumulation sum of the first living body classification loss information and the information maximization constraint loss information.
8. The method of claim 7, wherein, The information maximization constraint loss information is determined based on the training distribution result, the annotation distribution rule, and the plurality of prediction confidence levels. The distribution loss information of the living body classification is determined based on the difference between the training distribution result and the annotation distribution rule. The prediction loss information corresponding to the plurality of pseudo labels is determined based on the plurality of prediction confidence levels; and The information maximization constraint loss information is obtained based on the accumulation sum of the distribution loss information of the living body classification and the prediction loss information.
9. The method of claim 8, wherein, The distribution loss information of the living body classification constrains the training distribution result to approach the annotation distribution rule. The prediction loss information constrains the confidence level of the plurality of first living body classification training results to approach a preset confidence level.
10. The method of claim 3, wherein, The first comprehensive loss information further includes pseudo label center constraint loss information, and the pseudo label center constraint loss information is used to constrain the training result of the iterative training in the training; and In each iteration training, the pseudo label center constraint loss information constrains M first training features corresponding to M living body categories in the plurality of first training features to be close to a living body center feature, and N first training features corresponding to N attack categories to be close to an attack center feature. The M and the N are integers greater than 0 and less than or equal to the number of pseudo labels.
11. The method of claim 10, wherein, The living center feature is determined based on a feature mean value of at least one first training feature corresponding to at least one pseudo label representing a living body category in the plurality of pseudo labels obtained in the last iteration training.
12. The method of claim 10, wherein, The attack center feature is determined based on a feature mean value of at least one first training feature corresponding to at least one pseudo label representing an attack category in the plurality of pseudo labels obtained in the last iteration training.
13. The method of claim 10, wherein, The pseudo label center constraint loss information is determined by the following method steps: The pseudo label center constraint loss information is obtained based on distances between M first training features corresponding to M living body categories in the plurality of first training features and the living center feature, and distances between N first training features corresponding to N attack categories and attack center features corresponding to the N first training features.
14. The method of claim 2, wherein, In the initial iteration training, the plurality of pseudo labels are obtained by the following method steps: The plurality of first training images are input into a pre-training source domain model to obtain the plurality of pseudo labels in the initial iteration training.
15. The method of claim 14, wherein, The pre-training source domain model is trained by the following method steps: A plurality of second training images of a source domain and corresponding real labels thereof are obtained, each of the second training images including a biological feature of a user, and the real labels being artificial annotation information representing that the second training images are living body categories or attack categories. And The pre-training source domain model is obtained by performing living body classification iteration training on a pre-training source domain model based on the plurality of second training images and the corresponding real labels, and a second comprehensive loss information, the second comprehensive loss information being used to constrain a training result of the iteration training in the training in a domain-independent manner.
16. The method of claim 15, wherein, The pre-training source domain model includes a pre-training second feature encoder, a pre-training second living body classifier, and a pre-training domain classifier. And Each of the iteration trainings includes: The plurality of second training images are input into the pre-training second feature encoder to obtain a plurality of second training features corresponding to the plurality of second training images; The plurality of second training features are input into the pre-training second living body classifier to obtain a plurality of second living body classification training results corresponding to the plurality of second training features; The plurality of second training features are input into the pre-training domain classifier to obtain a plurality of domain classification results corresponding to the plurality of second training features; and A second comprehensive loss information is determined based on differences between the plurality of second living body classification training results and corresponding real labels, and differences between the plurality of domain classification results and corresponding annotated domain categories, to constrain the training result of the iteration training in a domain-independent manner.
17. The method of claim 16, wherein, The second comprehensive loss information is determined based on differences between the plurality of second living body classification training results and corresponding real labels, and differences between the plurality of domain classification results and corresponding annotated domain categories, including: A second living body classification loss information is determined based on differences between the plurality of second living body classification training results and corresponding real labels. Based on differences between the plurality of domain classification results and corresponding labeled domain categories, domain-related classification loss information is determined, and gradient reversal is performed on the domain-related classification loss information to obtain domain-independent classification loss information; and Based on an accumulation sum of the second living body classification loss information and the domain-independent classification loss information, the second comprehensive loss information is obtained.
18. The method of claim 1, wherein, The plurality of first training images are obtained, including: A plurality of compressed features corresponding to a plurality of original images of the target domain are obtained; The plurality of compressed features are input into a trained image reconstruction module to obtain a plurality of reconstructed images corresponding to the plurality of compressed features; and Based on the plurality of reconstructed images, the plurality of first training images are obtained.
19. The method of claim 18, wherein, The plurality of compressed features corresponding to the plurality of original images of the target domain are obtained, including: A plurality of compressed features corresponding to a plurality of original images of the target domain are received from a client, the plurality of compressed features being obtained by the client by compressing the plurality of original images through a trained image compression module.
20. The method of claim 18, wherein, The plurality of compressed features corresponding to the plurality of original images of the target domain are obtained, including: Target compressed features corresponding to a plurality of original images of a target domain are received from a client, the target compressed features being obtained by the client by compressing the plurality of original images through a trained image compression module, obtaining intermediate compressed features, and compressing the intermediate compressed features using a compression algorithm; The target compressed features are decompressed using a decompression algorithm to obtain the plurality of compressed features.
21. The method of claim 19 or 20, wherein, The trained image reconstruction module and the trained image compression module are trained using the following method steps: An original image sample is obtained; The original image sample is input into a pre-trained image compression module to obtain training compressed features corresponding to the original image sample; The training compressed features are input into a pre-trained image reconstruction module to obtain reconstructed image samples corresponding to the training compressed features; and Based on the original image sample, the reconstructed image sample, and the training compressed features, third comprehensive loss information is determined, and the pre-trained image compression module and the pre-trained image reconstruction module are iteratively trained based on the third comprehensive loss information to obtain the trained image compression module and the trained image reconstruction module.
22. The method of claim 21, wherein, The third comprehensive loss information is determined based on the original image sample, the reconstructed image sample, and the training compressed features, including: Image reconstruction loss information is determined based on differences between the original image sample and the reconstructed image sample; Feature sparsity loss information is determined based on differences between a number of target elements in the training compressed features and a preset number; Sample relationship constraint information is determined based on differences between the original image sample and the training compressed features; and The third comprehensive loss information is obtained based on an accumulation sum of the image reconstruction loss information, the feature sparsity loss information, and the sample relationship constraint information.
23. A living body detection model training system, comprising: at least one storage medium storing at least one instruction set for training the living body detection model; and at least one processor in communication with the at least one storage medium, wherein, when the training system of the living body detection model is running, the at least one processor reads the at least one instruction set and executes the training method of the living body detection model according to the indication of the at least one instruction set.
24. A living body detection method, comprising: obtaining a raw image of a biological feature of a user; inputting the raw image into a target living body detection model to obtain a living body detection result, the target living body detection model being a model trained by the training method of the living body detection model according to any one of claims 1-22.
25. A living body detection system, comprising: at least one storage medium storing at least one instruction set for living body detection; and at least one processor in communication with the at least one storage medium, wherein, when the living body detection system is running, the at least one processor reads the at least one instruction set and executes the living body detection method according to the indication of the at least one instruction set.
Citation Information
Patent Citations
Living body detection model training method, living body detection method and device and equipment
CN113705425A
Multi-source cross-domain expression recognition method and device and storage medium
CN114612961A