A living body detection method, device, apparatus and storage medium
By combining the contrastive learning model with the decoupled target detection model, the target domain-independent feature maps are extracted for category detection, which solves the problems of poor model stability and high acquisition cost in existing liveness detection methods, and improves the detection accuracy and scalability of application scenarios.
Patent Information
- Application Number
- CN202210705836.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-21
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2042-06-21
AI Technical Summary
Existing liveness detection methods have problems such as poor model stability, high acquisition cost and low detection accuracy.
By constructing a target detection model that combines a contrastive learning model with a decoupling method, we extract target domain-independent feature maps whose correlation with the scene is lower than a set threshold value, perform category detection, and improve the model's generalization ability and detection accuracy.
It achieves rapid convergence and improved stability of the model, reduces data collection costs and equipment deployment difficulty, and expands the scalability of application scenarios.
Smart Images

Figure CN116994341B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computers, in particular to the field of artificial intelligence, and provides a living body detection method and device, equipment and a storage medium. BACKGROUND
[0002] With the wide application of face recognition, face unlocking and other biometric technologies in daily life, attack methods using biological features are also emerging in an endless stream. Therefore, as a detection technology that can resist common attack methods such as photos, face swapping, masks, and occlusion, living body detection has also received more and more attention in recent years.
[0003] At present, the following detection methods are often used for living body detection, and the specific detection methods and technical defects are as follows:
[0004] Detection method one: living body detection method based on traditional binary classification. This method has poor generalization ability. Once it faces unknown fake pictures and application scenarios different from the training stage, it cannot accurately detect false face images in other application scenarios.
[0005] Detection method two: living body detection method based on meta-learning. Meta-learning refers to training a network model with better prediction results through meta data (such as image size, resolution, style, data set division, etc.). Since this method uses a complex structure of living body detection model, it is difficult to converge, which poses a certain risk to model iteration and update, and it is difficult to ensure the stability of the model.
[0006] Detection method three: living body detection method based on multi-modal supervision. Multi-modal refers to integrating or fusing at least two biometric technologies to take advantage of the unique advantages of multiple biometric technologies, making the detection process more accurate and secure, and effectively improving the detection accuracy. However, this method highly depends on external data acquisition equipment to obtain multi-modal data, which in turn increases the data acquisition cost and equipment deployment difficulty. SUMMARY
[0007] The embodiments of the present application provide a living body detection method, device, equipment and storage medium to solve the problems of poor model stability, high acquisition cost and low detection accuracy.
[0008] In a first aspect, the embodiments of the present application provide a living body detection method, comprising:
[0009] inputting a to-be-detected face image into a target detection model, performing feature extraction on the to-be-detected face image, and obtaining a corresponding face feature map;
[0010] performing decoupling processing on the face feature map to extract a target domain-independent feature map with a scene correlation degree lower than a set threshold.
[0011] performing category detection on the obtained target domain-independent feature map to obtain a corresponding prediction classification result, the prediction classification result representing whether the to-be-detected face image is a real face image.
[0012] The target detection model is trained based on at least one pair of first contrast combinations of each first domain-independent feature map in an initial detection model and at least one pair of second contrast combinations of each first domain-dependent feature map in the initial detection model. Each first contrast combination is constructed based on a category correlation degree between the first domain-independent feature map and each second domain-independent feature map in an auxiliary detection model, and each second contrast combination is constructed based on a scene correlation degree and a category correlation degree between the first domain-dependent feature map and each second domain-dependent feature map.
[0013] In a second aspect, the embodiments of the present application further provide a living body detection device, comprising:
[0014] a feature extraction unit configured to input a to-be-detected face image into a target detection model, and perform feature extraction on the to-be-detected face image to obtain a corresponding face feature map;
[0015] a decoupling unit configured to perform decoupling processing on the face feature map to extract a target domain-independent feature map with a scene correlation degree lower than a set threshold value;
[0016] a detection unit configured to perform category detection on the obtained target domain-independent feature map to obtain a corresponding prediction classification result, the prediction classification result representing whether the to-be-detected face image is a real face image.
[0017] The target detection model is trained based on at least one pair of first contrast combinations of each first domain-independent feature map in an initial detection model and at least one pair of second contrast combinations of each first domain-dependent feature map in the initial detection model. Each first contrast combination is constructed based on a category correlation degree between the first domain-independent feature map and each second domain-independent feature map in an auxiliary detection model, and each second contrast combination is constructed based on a scene correlation degree and a category correlation degree between the first domain-dependent feature map and each second domain-dependent feature map.
[0018] Optionally, the living body detection device further comprises a model training unit configured to train the initial detection model in a multi-round iteration manner until a preset iteration stop condition is met, and output a trained target detection model. In one training round of the initial detection model, the following steps are performed:
[0019] input the first sample image set and the second sample image set into the initial detection model and the auxiliary detection model respectively for feature extraction, to obtain respective first face feature maps and respective second face feature maps;
[0020] respectively decouple the respective first face feature maps and the respective second face feature maps, to obtain respective first domain-independent feature maps, first domain-dependent feature maps and a decoupling loss, and respective second domain-independent feature maps and second domain-dependent feature maps;
[0021] based on the respective predicted classification results of the respective first sample images and the respective actual classification results, determine a total loss of category detection;
[0022] based on the respective first domain-independent feature maps and the respective second domain-independent feature maps, determine a total loss of living body representation of the first sample image set, and based on the respective first domain-dependent feature maps and the respective second domain-dependent feature maps, determine a total loss of domain transformation of the first sample image set;
[0023] based on the decoupling loss, the total loss of category detection, the total loss of living body representation and the total loss of domain transformation, adjust the model parameters of the initial detection model.
[0024] Optionally, the model training unit is configured to:
[0025] based on the degree of category association between the respective first domain-independent feature maps and the respective second domain-independent feature maps, determine the total loss of living body representation of the first sample image set;
[0026] and based on the degree of scene association and the degree of category association between the respective first domain-dependent feature maps and the respective second domain-dependent feature maps, determine the total loss of domain transformation of the first sample image set.
[0027] Optionally, the model training unit is configured to:
[0028] based on the degree of category association between the respective first domain-independent feature maps and the respective second domain-independent feature maps, construct at least one pair of first contrast combinations for each of the respective first domain-independent feature maps;
[0029] based on each first contrast combination, determine the total loss of living body representation of the first sample image set.
[0030] Optionally, the model training unit is configured to:
[0031] for each first domain-independent feature map, the following operations are performed respectively:
[0032] at least one second domain-independent feature map of the same category as the first domain-independent feature map is taken as a corresponding global-same-category feature map, and each global-same-category feature map is combined with the first domain-independent feature map to form a first comparison pair;
[0033] at least one second domain-independent feature map of a different category from the first domain-independent feature map is taken as a corresponding global-different-category feature map, and each global-different-category feature map is combined with the first domain-independent feature map to form a first comparison queue;
[0034] each first comparison pair is combined with the first comparison queue to form at least one first comparison combination.
[0035] Optionally, the model training unit is configured to:
[0036] based on the scene correlation degree and the category correlation degree between the first domain-related feature maps and the second domain-related feature maps, at least one second comparison combination is constructed for each first domain-related feature map;
[0037] based on each second comparison combination, a domain transformation total loss of the first sample image set is determined.
[0038] Optionally, the model training unit is configured to:
[0039] for each first domain-related feature map, the following operations are performed:
[0040] at least one second domain-related feature map of the same category and the same scene as the first domain-related feature map is taken as a corresponding same-domain-same-category feature map, and each same-domain-same-category feature map is combined with the first domain-related feature map to form a second comparison pair;
[0041] at least one second domain-related feature map of the same category but a different scene from the first domain-related feature map is taken as a corresponding different-domain-same-category feature map, and each different-domain-same-category feature map is combined with the first domain-related feature map to form a second comparison queue;
[0042] each second comparison pair is combined with the second comparison queue to form at least one second comparison combination.
[0043] Optionally, the model training unit is configured to:
[0044] for each first face feature map, the following operations are performed:
[0045] each first face feature map is subjected to decompression processing to obtain a first face feature map after dimension reduction;
[0046] The domain attention matrix with the same dimension as the first face feature map after dimension reduction is used to decouple the first face feature map after dimension reduction respectively, to obtain each first domain-independent feature map with a scene correlation degree lower than a set threshold, each first domain-dependent feature map with a scene correlation degree higher than the set threshold, and a corresponding decoupling loss.
[0047] Optionally, when determining the total loss of the living body representation of the first sample image set and the total loss of the domain transformation, the model training unit is further configured to:
[0048] The first domain-independent feature maps are clustered to obtain a plurality of initial clustering clusters.
[0049] Data mining is performed on each initial clustering cluster to obtain a target clustering cluster with a model learning difficulty evaluation value exceeding a set standard value.
[0050] Based on the respective predicted classification results and the corresponding actual classification results of each first domain-independent feature map in each initial clustering cluster, a total sample mining loss is determined, and the total sample mining loss is used to adjust the model parameters of the initial detection model.
[0051] Optionally, the model training unit is configured to:
[0052] Based on the respective predicted classification results of each first domain-independent feature map in each initial clustering cluster, the model learning difficulty of each initial clustering cluster is evaluated respectively, and at least one initial clustering cluster with a model learning difficulty evaluation value exceeding a set standard value is determined as a corresponding target clustering cluster.
[0053] Optionally, after being determined as a corresponding target clustering cluster, the model training unit is further configured to:
[0054] Based on the sample images corresponding to each first domain-independent feature map in each target clustering cluster and other sample images in the training sample set, a first sample image set and a second sample image set for next round of training input are generated.
[0055] In a third aspect, the embodiments of the present application further provide a computer device, including a processor and a memory, wherein the memory stores program code, when the program code is executed by the processor, the processor executes the steps of any one of the living body detection methods.
[0056] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium, including program code, when the program product is run on a computer device, the program code is used to make the computer device execute the steps of any one of the living body detection methods.
[0057] In a fifth aspect, the embodiments of the present application further provide a computer program product comprising computer instructions for implementing the steps of any of the live body detection methods described above.
[0058] The present application has the following advantages:
[0059] The embodiments of the present application provide a live body detection method, device and equipment and a storage medium. The method comprises the following steps: performing feature extraction on a to-be-detected face image input to a target detection model to obtain a corresponding face feature map, performing decoupling processing on the face feature map to extract a target domain irrelevant feature map with a scene correlation degree lower than a set threshold, and finally performing category detection on the target domain irrelevant feature map to obtain a corresponding prediction classification result, which represents whether the to-be-detected face image is a real face image. The target detection model is trained based on at least one pair of first contrast combinations of each first domain related feature map in an initial detection model and based on at least one pair of second contrast combinations of each first domain related feature map in the initial detection model. Each first contrast combination is constructed based on the category correlation degree between each first domain irrelevant feature map and each second domain irrelevant feature map in an auxiliary detection model, and each second contrast combination is constructed based on the scene correlation degree and the category correlation degree between each first domain related feature map and each second domain related feature map.
[0060] The embodiments of the present application combine the contrast learning model with the decoupling mode, improve the information content of the representation space useful information by constructing the contrast pair and the contrast queue, and obtain the defense capability comparable to the complex network model only by relying on the RGB information, so as to improve the generalization ability and detection accuracy of the model.
[0061] Compared with the commonly used live body detection model, the network architecture of the initial detection model used in the embodiments of the present application is simple, and the model can achieve fast convergence in the process of model training and later iteration update, thereby improving the stability of the model.
[0062] Moreover, the target detection model used in the embodiments of the present application determines the prediction classification result of the to-be-detected face image by the extracted target domain irrelevant feature map, and has no limitation on the data collection scene, so that it is not necessary to deploy a device for collecting different data in the application scene, thereby effectively reducing the data collection cost and the difficulty of device deployment, and the application scene is highly scalable.
[0063] Other features and advantages of the present application will be described in the following description, and some will become apparent from the description, or will be learned from practice of the present application. The purpose and other advantages of the present application can be achieved and obtained by the structure specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF DRAWINGS
[0064] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:
[0065] Figure 1 An optional schematic diagram of an application scenario in an embodiment of the application;
[0066] Figure 2A A flowchart of training an initial detection model in an embodiment of the application;
[0067] Figure 2B A logic diagram of training an initial detection model in an embodiment of the application;
[0068] Figure 2C A logic diagram of decoupling processing of each first face feature map using a dense mutual constraint decoupling module in an embodiment of the application;
[0069] Figure 2D A flowchart of determining a total loss of a living body representation of a first sample image set provided in an embodiment of the application;
[0070] Figure 2E A logic diagram of constructing a first contrast pair and a first contrast queue in an embodiment of the application;
[0071] Figure 2F A flowchart of determining a domain transformation total loss of a first sample image set provided in an embodiment of the application;
[0072] Figure 3A A flowchart of another training of an initial detection model in an embodiment of the application;
[0073] Figure 3B A logic diagram of another training of an initial detection model in an embodiment of the application;
[0074] Figure 4A An architecture diagram of a target detection model provided in an embodiment of the application;
[0075] Figure 4B A flowchart of living body detection using a target detection model provided in an embodiment of the application;
[0076] Figure 5 A structure diagram of a living body detection device provided in an embodiment of the application;
[0077] Figure 6 A component structure diagram of a computer device provided in an embodiment of the application;
[0078] Figure 7 A structural schematic diagram of a computing device in an embodiment of the present application. DETAILED DESCRIPTION
[0079] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments described in the present application document, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the technical solutions of the present application.
[0080] Some terms in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.
[0081] 1. Artificial Intelligence (AI):
[0082] Artificial intelligence is the use of digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use the knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which aims to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.
[0083] Artificial intelligence technology is a comprehensive discipline, involving a wide range of fields, both hardware and software technologies. Artificial intelligence basic technologies generally include technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc.; artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc. several major directions.
[0084] With the research and progress of artificial intelligence technology, artificial intelligence has been researched and applied in many fields, such as common smart home, intelligent customer service, virtual assistant, smart speaker, intelligent marketing, unmanned vehicle, autonomous driving, robot, intelligent medical treatment, etc. It is believed that with the development of technology, artificial intelligence will be applied in more and more fields and play an increasingly important value.
[0085] 2. Machine learning:
[0086] Machine learning is a multi-disciplinary subject, involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, etc. It is a specialized study of how computers simulate or implement human learning behavior to acquire new knowledge or skills, reorganize existing knowledge structure, and continuously improve their performance.
[0087] Machine learning is the core of artificial intelligence and the fundamental approach to making computers intelligent. It is applied in various fields of artificial intelligence, including deep learning, reinforcement learning, transfer learning, inductive learning, and inductive learning.
[0088] 3、Computer vision is a comprehensive discipline that combines computer science, signal processing, physics, applied mathematics, statistics, and neurophysiology. It is also a challenging and important research direction in the field of science. This discipline uses various imaging systems as input means instead of visual organs, and uses computers to replace the brain to complete processing and interpretation, enabling computers to have the ability to observe and understand the world through vision like humans.
[0089] Among them, the subfields of computer vision include face detection, face comparison, feature detection, blink detection, live detection, and fatigue detection.
[0090] 4、Live detection: In some identity verification scenarios, a combination of actions such as blinking, opening the mouth, shaking the head, and nodding is used to verify whether the user in the picture is a real live person using face key point positioning and face tracking technologies, preventing people from using fake faces such as photos to pass identity verification.
[0091] Live detection effectively resists common attack methods such as photos, face swapping, masks, obstructions, and screen replays, helping people identify fraudulent behavior and protect their interests.
[0092] The design idea of the embodiments of the present application is briefly introduced as follows:
[0093] With the widespread application of face recognition, face unlocking, and other biometric technologies in daily life, attack methods using biometric features are also emerging. Therefore, live detection, as a detection technology that can resist common attack methods such as photos, face swapping, masks, and obstructions, has received increasing attention in recent years.
[0094] Currently, the following detection methods are commonly used for live detection, and the specific detection methods and technical defects are as follows:
[0095] Detection method one: traditional binary classification-based live detection method. This method has poor generalization ability and cannot accurately detect false face images in other application scenarios once it faces unknown fake images and application scenarios different from the training phase.
[0096] The second detection method is a living body detection method based on meta learning. Meta learning refers to training a network model with better prediction results through meta data (such as image size, resolution, style, data set division, and the like). Since this method uses a living body detection model with a complex structure design, it is difficult to converge iteratively, which causes certain risks to model iterative updating and makes it difficult to ensure the stability of the model.
[0097] The third detection method is a living body detection method based on multi-modal supervision. Multi-modal refers to integrating or fusing at least two biometric technologies to utilize the unique advantages of multiple biometric technologies, make the detection process more accurate and safe, and effectively improve the detection accuracy. However, this method highly depends on external data acquisition equipment to obtain multi-modal data, which in turn increases the data acquisition cost and equipment deployment difficulty.
[0098] Therefore, the embodiments of the present application propose a living body detection method, device, equipment and storage medium. The method comprises: performing feature extraction on a to-be-detected face image input to a target detection model to obtain a corresponding face feature map, performing decoupling processing on the face feature map to extract a target domain-independent feature map with a scene correlation degree lower than a set threshold, and finally performing category detection on the target domain-independent feature map to obtain a corresponding prediction classification result, which represents whether the to-be-detected face image is a real face image. The target detection model is trained based on at least one pair of first contrast combinations of each first domain-related feature map in the initial detection model and at least one pair of second contrast combinations of each first domain-related feature map in the initial detection model. Each first contrast combination is constructed based on the category correlation degree between each first domain-independent feature map and each second domain-independent feature map in an auxiliary detection model, and each second contrast combination is constructed based on the scene correlation degree and the category correlation degree between each first domain-related feature map and each second domain-related feature map.
[0099] The embodiments of the present application combine the contrast learning model with the decoupling method, and obtain the defense capability comparable to the complex network model by relying only on RGB information, thereby achieving the purpose of improving the generalization ability and detection accuracy of the model.
[0100] Compared with the commonly used living body detection model, the initial detection model used in the embodiments of the present application has a simple network architecture design, and can achieve fast convergence effect in the process of model training and later iterative updating, thereby improving the stability of the model.
[0101] Moreover, the target detection model used in the embodiments of the present application is determined by the extracted target domain-independent feature map, and the prediction classification result of the face image to be detected is determined. The data collection scene is not limited, and there is no need to deploy devices for collecting different data in the application scene, which effectively reduces the data collection cost and the difficulty of device deployment, and the application scene is highly scalable.
[0102] The preferred embodiments of the present application are described below in conjunction with the accompanying drawings of the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application, and the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0103] The embodiments of the present application can be applied in various scenarios, including but not limited to cloud technology, artificial intelligence, intelligent transportation, and assisted driving. Figure 1 A schematic diagram of one of the application scenarios is shown, which includes two physical terminal devices 110 and a server 130. Each physical terminal device 110 is connected to the server 130 through a wired network or a wireless network.
[0104] In the embodiments of the present application, the physical terminal device 110 is a computer device used by a user. The computer device includes but is not limited to a mobile phone, a computer, a smart voice interaction device, a smart home appliance, a vehicle-mounted terminal, an aircraft, etc.
[0105] The server 130 in the embodiments of the present application can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content distribution networks (CDN), and big data and artificial intelligence platforms, etc. Basic cloud computing services, which are not limited in the present application.
[0106] The server 130 is deployed with an initial detection model and an auxiliary detection model, and the auxiliary detection model is used to perform multiple rounds of cyclic iteration training on the initial detection model to obtain a trained target detection model. In each training round, based on the second domain-independent feature maps and the second domain-dependent feature maps output by the auxiliary detection model, and the first domain-independent feature maps and the first domain-dependent feature maps output by the initial detection model, at least one pair of first contrast combinations of each first domain-independent feature map and at least one pair of second contrast combinations of each first domain-dependent feature map are formed, and then based on the obtained first contrast combinations and second contrast combinations, the model parameters of the initial detection model are adjusted, and finally based on the adjusted model parameters of the initial detection model, the model parameters of the auxiliary detection model are adjusted.
[0107] After obtaining the trained target detection model, the physical terminal device 110 presents the access interface 120 of the target application to the opposite party in response to a user-triggered login operation. When the user triggers an identity verification operation, the physical terminal device 110 calls the camera to capture the user's face to obtain a to-be-detected face image, and then sends the collected to-be-detected face image to the target detection model deployed on the server 130 through a pre-established communication channel, performs liveness detection on the to-be-detected face image, verifies whether the user in the picture is a real live person, and prevents people from passing the identity verification by using photos and other means of fake faces.
[0108] Next, refer to Figure 2A the flowchart shown in Figure 2B the logical diagram shown, and first understand the training process of the initial detection model.
[0109] S201: input the first sample image set and the second sample image set into the initial detection model and the auxiliary detection model respectively for feature extraction, to obtain respective first face feature maps and respective second face feature maps.
[0110] Before each iteration begins, the first sample image set and the second sample image set for the current training input need to be generated based on the preset training sample set. Multiple face images from different scenes and different categories can be combined into a sample image set, or multiple face images containing the same semantic information (such as accessories, hairstyles, backgrounds, etc.) can be combined into a sample image set.
[0111] For ease of description, the embodiments of the present application use scenes and categories as the construction standard to generate the two sample image sets for the current training input. The two sample image sets contain multiple face images from the same scene and the same category but with different picture contents.
[0112] In the embodiments of the present application, the sample images collected in different scenes are defined as different sample domains, the real live face images are defined as real face images, and the face images obtained by using photos, face swapping, masks, obstructions, and screen flipping and other means of fake faces are defined as false face images, that is, the image categories include two categories of real face images (i.e. positive samples) and false face images (i.e. negative samples).
[0113] In the current iteration, the feature extractor of the initial detection model performs feature extraction on the first sample image set input into the internal to obtain the first face feature map of each first sample image.
[0114] At the same time, the feature extractor of the auxiliary detection model performs feature extraction on the second sample image set inputted into the internal part to obtain a second facial feature map of each second sample image.
[0115] S202: Decoupling is performed on each first facial feature map and each second facial feature map to obtain a corresponding first domain-independent feature map, a first domain-dependent feature map and a decoupling loss, and a corresponding second domain-independent feature map and a second domain-dependent feature map.
[0116] The dense mutual constraint decoupling module of the initial detection model performs decoupling processing on each first face feature map to obtain the corresponding first domain-independent feature map, the first domain-dependent feature map and the decoupling loss.
[0117] Similarly, the dense mutual constraint decoupling module of the auxiliary detection model decouples each second face feature map to obtain the corresponding second domain-independent feature map and second domain-dependent feature map.
[0118] Since the two models are equipped with a dense mutual constraint decoupling module with the same structure, for ease of understanding, the following will take each first facial feature map as an example to illustrate the decoupling process.
[0119] like Figure 2C As shown, firstly, the extracted first facial feature maps are subjected to compression processing (including compression processing and dimensionality reduction processing) to obtain the first facial feature maps after dimensionality reduction;
[0120] Then, the domain attention matrix with the same dimension as the first facial feature map after dimensionality reduction is used to decouple the first facial feature map after dimensionality reduction, and obtain the first domain-independent feature maps whose correlation with the scene is lower than the set threshold value, the first domain-related feature maps whose correlation with the scene is higher than the set threshold value, and the corresponding decoupling losses.
[0121] The domain attention matrix is composed of a plurality of domain attention feature vectors, and the dimension of each domain attention feature vector is the same as the dimension of the first face feature map after dimension reduction. Therefore, when using the domain attention matrix for decoupling processing, the first face feature map after dimension reduction is first respectively operated with each domain attention feature vector to obtain each first domain-independent attention feature map after dimension reduction and each first domain-dependent attention feature map after dimension reduction; then a multilayer perceptron (MLP) is used to perform dimension increasing processing on each first domain-independent attention feature map after dimension reduction and each first domain-dependent attention feature map after dimension reduction to obtain each first domain-independent attention feature map and each first domain-dependent attention feature map; finally, each first domain-independent attention feature map and each first domain-dependent attention feature map are respectively fused with the first face feature map input at the beginning to obtain each first domain-independent feature map and each first domain-dependent feature map.
[0122] The obtained first domain-independent attention feature map and the first domain-dependent attention feature map are substituted into formula 1 to make the attention feature maps orthogonal to each other, so that they can focus on different attributes of the features, and a corresponding decoupling loss is obtained to achieve the purpose of feature decoupling. Wherein, A R C×2k The attention feature map with 2k dimensions and C represents the attention feature map, I is the unit matrix, φ is the spectral normalization operation, L orth (A) is the decoupling loss.
[0123] L orth (A)=φ(A T A-I) formula 1;
[0124] S203: Determine the class detection total loss based on the respective predicted classification results of each first sample image and the corresponding actual classification results.
[0125] Respectively input each first domain-independent attention feature map and each first domain-dependent attention feature map into the corresponding encoder to obtain the respective predicted classification results of each first sample image.
[0126] The actual classification result refers to the image class labeled for a first sample image. In the embodiment of the application, the initial detection model adjusts the model parameters according to a plurality of losses, and the auxiliary detection model adjusts its own model parameters according to the model parameters adjusted by the initial detection model, so in step 203, only the class detection total loss (Loss-Binary Classification Error, L-BCE) is determined according to the respective predicted classification results of each first sample image and the corresponding actual classification results, without considering the predicted classification results of each second sample image output by the auxiliary detection model and the corresponding actual classification results.
[0127] S204: Determine the total living body representation loss of the first sample image set based on each first domain-independent feature map and each second domain-independent feature map, and determine the total domain transformation loss of the first sample image set based on each first domain-dependent feature map and each second domain-dependent feature map.
[0128] The strategy of narrowing the inter-domain distance of homogeneous feature maps and widening the inter-domain distance of heterogeneous feature maps can be used to construct the first contrast pair and the first contrast queue. The strategy of narrowing the inter-domain distance of homogeneous feature maps in the same domain (for example, narrowing the inter-domain distance of positive samples in the same domain and narrowing the inter-domain distance of negative samples in the same domain) can also be used to construct the first contrast pair and the first contrast queue.
[0129] For ease of description, the embodiments of the present application use the strategy of narrowing the inter-domain distance of homogeneous feature maps and widening the inter-domain distance of heterogeneous feature maps to construct the first contrast pair and the first contrast queue.
[0130] (1) Determine the total living body representation loss (Loss-Task, L-T) of the first sample image set based on the category association degree between each first domain-independent feature map and each second domain-independent feature map.
[0131] As shown in Figure 2D , the process of determining the total living body representation loss of the first sample image set is as follows:
[0132] S2041: Based on the category association degree between each first domain-independent feature map and each second domain-independent feature map, construct at least one pair of first contrast combinations for each first domain-independent feature map.
[0133] Specifically, as shown in Figure 2E , for each first domain-independent feature map, the following operations are performed respectively:
[0134] At least one second domain-independent feature map (Kx1, Kx3, …, Kxm) of the same category as a first domain-independent feature map Qx1 (whether two feature maps are of the same category is determined according to the actual classification result of the sample image corresponding to the feature map) is taken as the corresponding global homogeneous feature map, and each global homogeneous feature map is combined with the first domain-independent feature map Qx1 to form a first contrast pair [(Qx1, Kx1), (Qx3, Kx1), …, (Qx1, Kxm)];
[0135] At least one second domain-independent feature map (Kx2, Kx4, Kx5, …, Kxn) that is different from the first domain-independent feature map Qx1 in category (determine whether the two are of the same category according to the actual classification result of the sample image corresponding to the feature map) is taken as a corresponding global dissimilar feature map, and each global dissimilar feature map is combined with the first domain-independent feature map Qx1 to form a first comparison queue [Qx1, Kx2, Kx4, Kx5, …, Kxn];
[0136] Finally, each first comparison pair is combined with a first comparison queue to form at least one first comparison combination {(Qx1, Kx1), [Qx1, Kx2, Kx4, Kx5, …, Kxn]}, {(Qx1, Kx3), [Qx1, Kx2, Kx4, Kx5, …, Kxn]}, …, {(Qx1, Kxm), [Qx1, Kx2, Kx4, Kx5, …, Kxn]}.
[0137] The traditional binary classification model can only construct a locally optimal representation space, which reduces the generalization ability and detection accuracy of the model, resulting in certain limitations of the model. To solve this problem, the embodiment of the present application takes “narrowing the feature distance between each first domain-independent feature map and the second domain-independent feature map of the same category, and widening the feature distance between each first domain-independent feature map and the second domain-independent feature map of different categories” as the construction principle, constructs multiple comparison pairs and a comparison combination, improves the information content of useful information in the representation space, and thus achieves the purpose of improving the generalization ability and detection accuracy of the model.
[0138] In the embodiment of the present application, in addition to constructing at least one pair of comparison combinations of each first domain-independent feature map based on each second domain-independent feature map output by the current round of auxiliary detection model, at least one pair of comparison combinations of each first domain-independent feature map can also be constructed based on each second domain-independent feature map output by at least one previous round of auxiliary detection model and each second domain-independent feature map output by the current round of auxiliary detection model, so as to further improve the information content of useful information in the representation space and further optimize the generalization ability and detection accuracy of the model.
[0139] S2042: Determine the total loss of the live body representation of the first sample image set based on each first comparison combination.
[0140] Actually, the formula of the live body representation sub-loss is designed based on the idea of softmax loss. When the similarity of the similar pair increases, the live body representation sub-loss decreases; when the similarity of the similar pair decreases, the live body representation sub-loss increases. The similarity formula is E and F are a pair of similar pairs, and cos(θ) (i.e., similarity) is the similarity degree between the similar pairs.
[0141] Therefore, using formula 2, the living body representation sub-loss of each first domain-independent feature map is determined respectively, and the sum of each living body representation sub-loss is determined as the living body representation total loss of the first sample image set.
[0142]
[0143] wherein, L liveness is the living body representation sub-loss, τ is the annealing coefficient, θ is the weight of the initial detection model. A = f U D + represents the comparison queue composed of the first domain-independent feature map and the second domain-independent feature map of the global negative sample; B = f U D - represents the comparison queue composed of the first domain-independent feature map and the second domain-independent feature map of the global positive sample. f' k represents the kth second domain-independent feature map in the comparison queue, and exp is the exponential function operation with the natural constant e as the base.
[0144] f is a first domain-independent feature map, f' D+ is a second domain-independent feature map of the same category, f' k is at least one second domain-independent feature map of different categories. x is the first sample image corresponding to the first domain-independent feature map, and lable(x) is the actual classification result of the first sample image. When the actual classification result of the first sample image is a real face image (i.e., a positive sample), lable(x) = 1 is defined; when the actual classification result of the first sample image is a false face image (i.e., a negative sample), lable(x) = 0 is defined.
[0145] The strategy of narrowing the inter-domain distance of the same-domain and same-category feature map and widening the inter-domain distance of the different-domain and same-category feature map can be used to construct the second comparison pair and the second comparison queue, or the strategy of narrowing the inter-domain distance of the same-category and same-domain feature map (for example, narrowing the inter-domain distance of the positive sample in the same domain and narrowing the inter-domain distance of the negative sample in the same domain) can be used to construct the second comparison pair and the second comparison queue.
[0146] For ease of description, the strategy of narrowing the inter-domain distance of the same-domain and same-category feature map and widening the inter-domain distance of the different-domain and same-category feature map is used to construct the second comparison pair and the second comparison queue.
[0147] (2) Based on the scene correlation degree and the category correlation degree between each first domain-related feature map and each second domain-related feature map, the domain transformation total loss (Loss-Domain, L-D) of the first sample image set is determined.
[0148] As shown in Figure 2F , the process of determining the domain transformation total loss of the first sample image set is as follows:
[0149] S2041′: Based on the scene correlation degree and the category correlation degree between each first domain-related feature graph and each second domain-related feature graph, construct at least one pair of second comparison combinations for each first domain-related feature graph.
[0150] It is easy to extract effective domain transformation information from positive samples. However, it is not easy to extract domain transformation information from negative samples because they are mixed with too much information related to the attack method. Therefore, the embodiment of the present application performs the following operations on each first domain-related feature map of the image category of the positive sample:
[0151] At least one second domain-related feature map with the same scene and the same category as the first domain-related feature map (determine whether the two are of the same domain and the same category based on the actual classification results of the sample images corresponding to the feature map) is used as the corresponding same-domain and same category feature map, and each same-domain and same category feature map is respectively combined with the first domain-related feature map to form a second comparison pair;
[0152] Then, at least one second domain-related feature map with a different scene but the same category as the first domain-related feature map (determine whether the two are different domains but the same category based on the actual classification results of the sample images corresponding to the feature map) is used as the corresponding different domain similar feature map, and each different domain similar feature map and the first domain-related feature map are combined into a second comparison queue;
[0153] Finally, each second comparison pair is respectively combined with a second comparison queue to form at least one pair of second comparison combinations. Similarly, in order to solve the problems of poor generalization ability and low detection accuracy of the traditional two-classification model, the embodiment of the present application uses "reducing the feature distance between each first domain-related feature map and the second domain-related feature map of the same type and domain, and expanding the feature distance between each first domain-irrelevant feature map and the second domain-irrelevant feature map of the same type and domain in a different domain" as the construction principle. By constructing multiple comparison pairs and a comparison combination, the information content of the useful information representing the space is improved, thereby achieving the purpose of improving the generalization ability and detection accuracy of the model.
[0154] In an embodiment of the present application, in addition to constructing at least one pair of comparison combinations of each first domain-related feature map based on each second domain-related feature map output by the current round of auxiliary detection model, at least one pair of comparison combinations of each first domain-related feature map can also be constructed based on each second domain-related feature map output by at least one previous round of auxiliary detection model and each second domain-related feature map output by the current round of auxiliary detection model, so as to further improve the information content of the useful information representing the space and further optimize the generalization ability and detection accuracy of the model.
[0155] S2042′: Determine the total domain transformation loss of the first sample image set based on each second comparison combination.
[0156] In fact, the formula of domain transformer loss is designed based on the idea of softmax loss. When the similarity of similar pairs increases, the loss of live representation sub-loss decreases; when the similarity of similar pairs decreases, the loss of live representation sub-loss increases. The similarity formula is E and F are a pair of similar pairs, and cos(θ) (i.e., similarity) is the degree of similarity between the similar pairs.
[0157] Using Formula 3, the domain transformation sub-loss of each first domain-related feature map is determined separately, and then the sum of each domain transformation sub-loss is determined as the total domain transformation loss of the first sample image set.
[0158]
[0159] Among them, L domain (θ; x, τ, C) is the domain transformer loss, τ is the annealing coefficient, and θ is the weight of the initial detection model. represents the comparison queue composed of this first domain related feature map and the set of heterogeneous feature maps; D+(x) is the set of homogeneous feature maps in the same domain of this first domain related feature map, then, It is the set of heterogeneous feature maps of the first domain related feature map.
[0160] S205: Adjusting model parameters of the initial detection model based on the decoupling loss, the total category detection loss, the total liveness characterization loss, and the total domain transformation loss.
[0161] For models built based on deep learning, there are two main ways to update the model parameters: one is gradient update and the other is momentum update. In the embodiment of the present application, the model parameters of the initial detection model are updated by gradient update, and the model parameters of the auxiliary detection model are updated by momentum update. The advantage of this design is that the feature maps extracted by the two detection models are transformed more smoothly during the iteration process, which improves the stability of the model during iteration and helps to quickly converge during model training.
[0162] Specifically, the total model loss is calculated by summing the decoupling loss, the total category detection loss, the total liveness characterization loss, and the total domain transformation loss. Based on this total model loss, the model parameters of the initial detection model are adjusted. The model parameters of the auxiliary detection model are then adjusted based on the adjusted model parameters of the initial detection model.
[0163] S206: Determine whether the initial detection model meets the preset iteration stop condition. If so, output the trained target detection model; otherwise, return to step 201.
[0164] It is judged whether the detection accuracy of the initial detection model no longer changes. If yes, it is determined that the model training is completed, and the corresponding target detection model is output. Otherwise, step 201 is returned, and the next round of iteration training is performed on the initial detection model.
[0165] In order to further improve the recognition ability of the model for unknown sample images, the embodiment of the application further adds a step of resampling training for a target sample cluster that is difficult for the model to learn in the original model training process. The complete training process is as shown in Figures 3A-3B
[0166] S301: The first sample image set and the second sample image set are input into the initial detection model and the auxiliary detection model respectively for feature extraction, and the corresponding each first face feature map and the corresponding each second face feature map are obtained.
[0167] Before each iteration, multiple face images from different scenes and different categories can be combined into a sample image set, or multiple face images containing the same semantic information (such as accessories, hairstyle, background, etc.) can be combined into a sample image set.
[0168] For ease of description, the embodiment of the application takes scene and category as the construction standard to generate the two sample image sets input for this round of training. The two sample image sets include multiple face images from the same scene and the same category but with different picture contents.
[0169] If the current round is the first iteration, multiple face images from the same scene and the same category but with different picture contents are selected from the preset training sample set to generate the two sample image sets input for this round of training.
[0170] If the current round is any round from the second round to the last round, the sample images corresponding to each first domain-independent feature map in the target clustering cluster with high model learning difficulty selected in the last round are combined with other sample images in the training sample set to generate the two sample image sets input for this round of training.
[0171] S302: Each first face feature map and each second face feature map is respectively decoupled to obtain the corresponding first domain-independent feature map, first domain-dependent feature map and decoupling loss, and the corresponding second domain-independent feature map and second domain-dependent feature map.
[0172] S303: The category detection total loss is determined based on the respective predicted classification results of each first sample image and the corresponding actual classification results.
[0173] S304: Determine a total living body representation loss of the first sample image set based on each first domain-independent feature map and each second domain-independent feature map, and determine a total domain transformation loss of the first sample image set based on each first domain-dependent feature map and each second domain-dependent feature map.
[0174] S305: Cluster each first domain-independent feature map to obtain a plurality of initial clustering clusters, and perform data mining on each initial clustering cluster to obtain a target clustering cluster whose model learning difficulty evaluation value exceeds a set standard value.
[0175] In order to utilize the first domain-independent feature map and improve the generalization performance of the initial detection model on the domain, so that the initial detection model has certain robustness in the living body detection task. As shown in formula 4, the present application embodiment is based on the prediction classification result of each first domain-independent feature map in each initial clustering cluster, respectively evaluates the model learning difficulty of each initial clustering cluster, and determines at least one initial clustering cluster whose model learning difficulty evaluation value exceeds the set standard value as the corresponding target clustering cluster.
[0176] After obtaining the corresponding target clustering cluster, based on the sample image corresponding to each first domain-independent feature map in each target clustering cluster and other sample images in the training sample set, generate the first sample image set and the second sample image set of the next round of training input.
[0177]
[0178] Wherein, h(c i ) is the model learning difficulty evaluation value, N c is the total number of image categories contained in an initial clustering cluster, p j represents the proportion value of the jth image category in the initial clustering cluster.
[0179] S306: Determine a corresponding sample mining total loss based on the prediction classification result and the corresponding actual classification result of each first domain-independent feature map in each initial clustering cluster. The sample mining total loss is used to adjust the model parameters of the initial detection model.
[0180] S307: Adjust the model parameters of the initial detection model based on the decoupling loss, the category detection total loss, the total living body representation loss, the total domain transformation loss and the sample mining total loss.
[0181] Specifically, the sum of the decoupling loss, the total loss of the category detection, the total loss of the living body representation, the total loss of the domain transformation, and the total loss of the sample mining (Loss-HardClustering, L-hc) is determined as the total loss of the model, and the model parameters of the initial detection model are adjusted based on the obtained total loss of the model. The model parameters of the auxiliary detection model are adjusted based on the adjusted model parameters of the initial detection model.
[0182] S308: Determine whether the initial detection model meets the preset iteration stop condition, and if so, output the trained target detection model; otherwise, return to step 301.
[0183] Determine whether the detection accuracy of the initial detection model no longer changes, and if so, determine that the model training is complete and output the corresponding target detection model; otherwise, return to step 301 for the next round of iteration training of the initial detection model.
[0184] After multiple rounds of iteration training, the target detection model as shown in Figure 4A is obtained. The target detection model includes a feature extractor, a dense mutual constraint decoupling module, and an encoder. The feature extractor is used to extract features from the face image to be detected to obtain a corresponding face feature map. As the name implies, the dense mutual constraint decoupling module is used to decouple the face feature map to obtain a target domain-independent feature map. The encoder is used to perform category detection on the target domain-independent feature map to obtain a corresponding predicted classification result.
[0185] Next, referring to the flowchart as shown in Figure 4B , the process of using the target detection model for the living body detection task is as follows:
[0186] S401: Input the face image to be detected into the target detection model to extract features from the face image to be detected to obtain a corresponding face feature map.
[0187] S402: Decouple the face feature map to extract a target domain-independent feature map with a scene correlation degree lower than a set threshold.
[0188] The target domain-related feature map has a deviation in image representation due to domain transformation, and does not have good living body detection capability in the living body detection task. The target domain-independent feature map does not have a deviation and has good living body detection capability, so when the face feature map is decoupled, only the target domain-independent feature map with a scene correlation degree lower than a set threshold is extracted.
[0189] S403: performing category detection on the obtained target domain-independent feature map to obtain a corresponding prediction classification result, the prediction classification result representing whether the to-be-detected face image is a real face image; wherein the target detection model is trained based on at least one pair of first contrast combinations of each first domain-independent feature map in the initial detection model, and is trained based on at least one pair of second contrast combinations of each first domain-dependent feature map in the initial detection model; each first contrast combination is constructed based on a category correlation degree between each first domain-independent feature map and each second domain-independent feature map in the auxiliary detection model, and each second contrast combination is constructed based on a scene correlation degree and a category correlation degree between each first domain-dependent feature map and each second domain-dependent feature map.
[0190] For example, the target detection model obtained through multiple rounds of iterative training is applied to real-name and real-person authentication of a public number user. The target detection model performs feature extraction on a collected to-be-detected face image to obtain a corresponding target face feature map, extracts a target domain-independent feature map with low scene correlation degree from the target face feature map, and finally performs category detection on the target domain-independent feature map to obtain a corresponding prediction classification result. Since the prediction classification result indicates that the to-be-detected face image is a false face image, the user fails to pass the real-name and real-person authentication and cannot handle related businesses.
[0191] Based on the same inventive concept as the method embodiments described above, the embodiments of the present application also provide a living body detection device. As shown in Figure 5 The living body detection device 500 can include:
[0192] The feature extraction unit 501 is configured to input a to-be-detected face image into a target detection model, perform feature extraction on the to-be-detected face image, and obtain a corresponding face feature map.
[0193] The decoupling unit 502 is configured to perform decoupling processing on the face feature map to extract a target domain-independent feature map with a scene correlation degree lower than a set threshold.
[0194] The detection unit 503 is configured to perform category detection on the obtained target domain-independent feature map to obtain a corresponding prediction classification result, the prediction classification result representing whether the to-be-detected face image is a real face image.
[0195] The target detection model is trained based on at least one first contrast combination of each first domain-independent feature map in the initial detection model and based on at least one second contrast combination of each first domain-dependent feature map in the initial detection model; each first contrast combination is constructed based on a category association degree between each first domain-independent feature map and each second domain-independent feature map in the auxiliary detection model, and each second contrast combination is constructed based on a scene association degree and a category association degree between each first domain-dependent feature map and each second domain-dependent feature map.
[0196] Optionally, the living body detection apparatus 500 further comprises a model training unit 504, which trains the initial detection model in a plurality of rounds of iterations until a preset iteration stopping condition is met, and outputs the trained target detection model, wherein one round of training of the initial detection model is as follows:
[0197] The first sample image set and the second sample image set are respectively input into the initial detection model and the auxiliary detection model for feature extraction, and each first face feature map and each second face feature map are obtained;
[0198] Each first face feature map and each second face feature map is respectively decoupled to obtain a first domain-independent feature map, a first domain-dependent feature map and a decoupling loss, and a second domain-independent feature map and a second domain-dependent feature map;
[0199] A category detection total loss is determined based on a predicted classification result of each first sample image and a corresponding actual classification result;
[0200] A living body representation total loss of the first sample image set is determined based on each first domain-independent feature map and each second domain-independent feature map, and a domain transformation total loss of the first sample image set is determined based on each first domain-dependent feature map and each second domain-dependent feature map;
[0201] The model parameters of the initial detection model are adjusted based on the decoupling loss, the category detection total loss, the living body representation total loss and the domain transformation total loss.
[0202] Optionally, the model training unit 504 is configured to:
[0203] The living body representation total loss of the first sample image set is determined based on a category association degree between each first domain-independent feature map and each second domain-independent feature map;
[0204] The domain transformation total loss of the first sample image set is determined based on a scene association degree and a category association degree between each first domain-dependent feature map and each second domain-dependent feature map.
[0205] Optionally, the model training unit 504 is configured to:
[0206] based on the category association degree between each first domain-independent feature map and each second domain-independent feature map, constructing at least one pair of first contrast combinations for each first domain-independent feature map;
[0207] based on each first contrast combination, determining the total loss of the live body representation of the first sample image set.
[0208] Optionally, the model training unit 504 is configured to:
[0209] for each first domain-independent feature map, the following operations are performed respectively:
[0210] at least one second domain-independent feature map with the same category as a first domain-independent feature map is taken as a corresponding global same-category feature map, and each global same-category feature map is combined with a first domain-independent feature map to form a first contrast pair;
[0211] at least one second domain-independent feature map with a different category from a first domain-independent feature map is taken as a corresponding global different-category feature map, and each global different-category feature map is combined with a first domain-independent feature map to form a first contrast queue;
[0212] each first contrast pair and a first contrast queue are combined to form at least one pair of first contrast combinations.
[0213] Optionally, the model training unit 504 is configured to:
[0214] based on the scene association degree and the category association degree between each first domain-dependent feature map and each second domain-dependent feature map, constructing at least one pair of second contrast combinations for each first domain-dependent feature map;
[0215] based on each second contrast combination, determining the total loss of the domain transformation of the first sample image set.
[0216] Optionally, the model training unit 504 is configured to:
[0217] for each first domain-dependent feature map, the following operations are performed respectively:
[0218] at least one second domain-dependent feature map with the same scene and the same category as a first domain-dependent feature map is taken as a corresponding same-domain same-category feature map, and each same-domain same-category feature map is combined with a first domain-dependent feature map to form a second contrast pair;
[0219] at least one second domain-dependent feature map with a different scene but the same category as a first domain-dependent feature map is taken as a corresponding different-domain same-category feature map, and each different-domain same-category feature map is combined with a first domain-dependent feature map to form a second contrast queue;
[0220] Each second comparison pair is combined with a second comparison queue to form at least one pair of second comparison combinations.
[0221] Optionally, the model training unit 504 is used to:
[0222] For each first face feature map, perform the following operations:
[0223] Performing down-compression processing on each first face feature map to obtain a first face feature map after dimensionality reduction;
[0224] The domain attention matrix with the same dimension as the first facial feature map after dimensionality reduction is used to decouple the first facial feature map after dimensionality reduction to obtain the first domain-independent feature maps whose correlation with the scene is lower than the set threshold value, the first domain-related feature maps whose correlation with the scene is higher than the set threshold value, and the corresponding decoupling losses.
[0225] Optionally, when determining the total loss of living body characterization and the total loss of domain transformation of the first sample image set, the model training unit 504 is further configured to:
[0226] Clustering each first domain-independent feature map to obtain multiple initial clusters;
[0227] Perform data mining on each initial cluster to obtain a target cluster whose model learning difficulty assessment value exceeds the set standard value;
[0228] Based on the predicted classification results of each first domain-independent feature map in each initial cluster and the corresponding actual classification results, the corresponding total sample mining loss is determined, and the total sample mining loss is used to adjust the model parameters of the initial detection model.
[0229] Optionally, the model training unit 504 is used to:
[0230] Based on the predicted classification results of each first domain-independent feature map in each initial cluster, the model learning difficulty of each initial cluster is evaluated respectively, and at least one initial cluster whose model learning difficulty evaluation value exceeds the set standard value is determined as the corresponding target cluster.
[0231] Optionally, after determining the corresponding target cluster, the model training unit 504 is further configured to:
[0232] Based on the sample images corresponding to the first domain-independent feature maps in each target cluster and other sample images in the training sample set, a first sample image set and a second sample image set for the next round of training input are generated.
[0233] For ease of description, the above parts are divided into modules (or units) according to functions and are respectively described. Of course, functions of the modules (or units) can be implemented in a same or multiple software or hardware in the implementation of the present application.
[0234] After introducing the living body detection method and device of the example embodiment of the present application, next, the computer device according to another example embodiment of the present application is introduced.
[0235] Those skilled in the art can understand that each aspect of the present application can be implemented as a system, a method or a program product. Therefore, each aspect of the present application can be specifically implemented as follows: a complete hardware embodiment, a complete software embodiment (including firmware, microcode, etc.), or an embodiment combining hardware and software, which can be collectively referred to as "circuitry", "module" or "system" here.
[0236] Based on the same inventive concept as the above method embodiments, the present embodiment also provides a computer device, which is shown in Figure 6 The computer device 600 can at least include a processor 601 and a memory 602. The memory 602 stores program code, and when the program code is executed by the processor 601, the processor 601 performs the steps of any one of the living body detection methods described above.
[0237] In some possible embodiments, the computing device according to the present application can at least include at least one processor and at least one memory. The memory stores program code, and when the program code is executed by the processor, the processor performs the steps of the living body detection method according to various example embodiments of the present application described above in the specification. For example, the processor can perform the steps as shown in Figure 4B
[0238] The computing device 700 according to this embodiment of the present application is described below with reference to Figure 7 Figure 7 The computing device 700 is only an example and should not bring any limitation to the functions and use range of the embodiments of the present application.
[0239] As shown in Figure 7 The computing device 700 is in the form of a general computing device. The components of the computing device 700 can include but are not limited to the above at least one processing unit 701, the above at least one storage unit 702, and a bus 703 connecting different system components including the storage unit 702 and the processing unit 701.
[0240] Bus 703 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a local bus using any of a variety of bus architectures.
[0241] Storage 702 can include a readable storage medium, such as volatile memory (RAM) 7021 and / or cache memory 7022 in the form of a volatile memory, and can further include read only memory (ROM) 7023.
[0242] Storage 702 can also include program / utility 7025 having a set of programs / modules 7024, including operating system, one or more application programs, other program modules, and program data, each of which or a combination thereof, can include implementation of a network environment as in each of these examples or some combination thereof.
[0243] Computing device 700 can also communicate with one or more external devices 704 such as a keyboard or a pointing device, through I / O interface 705. Additionally, computing device 700 can communicate with one or more devices selected from a group consisting of devices that enable a user to interact with computing device 700, and / or devices that enable computing device 700 to communicate with one or more other computing devices. Such communication can be via any appropriate communication interface or interfaces 706. For instance, communication interfaces 706 can enable communication between computing device 700 and a private or public network, such as the Internet. As shown, communication interfaces 706 can include a network adaptor 706 that communicates with other modules of computing device 700 via bus 703. It will be appreciated that other hardware and / or software modules can be used in conjunction with computing device 700, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data archival storage systems, etc.
[0244] Based on the same inventive concept as the method embodiments described above, each aspect of the living body detection method provided in the present application can also be implemented in the form of a program product, which includes program codes for causing a computer device to execute the steps of the living body detection method according to various exemplary embodiments of the present application described above in the specification when the program product is run on the computer device, for example, the computer device can execute the steps shown in Figure 4B .
[0245] A program product can employ any combination of one or more computer-readable media. The computer-readable media can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include the following: 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 Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0246] Although preferred embodiments of the application have been described herein, changes and modifications can be suggested to one skilled in the art, and it is intended that the application encompass such changes and modifications as fall within the scope of the appended claims.
[0247] Obviously, numerous modifications and variations of the present application are possible in light of the above teachings. It is therefore to be understood that within the scope of the appended claims and their equivalents, the application can be practiced otherwise than as specifically described.
Claims
1. A method for detecting a living body, characterized in that: include: Inputting the face image to be detected into the target detection model, performing feature extraction on the face image to be detected, and obtaining a corresponding face feature map; Decoupling the facial feature map to extract a target domain-independent feature map whose correlation with the scene is lower than a set threshold value; Performing category detection on the obtained target domain-independent feature map to obtain a corresponding prediction classification result, wherein the prediction classification result indicates whether the face image to be detected is a real face image; In which, the target detection model is trained based on at least one pair of first contrast combinations of each first domain-independent feature map in the initial detection model, and at least one pair of second contrast combinations of each first domain-related feature map in the initial detection model; each first contrast combination is constructed based on the category association degree between the first domain-independent feature map and the second domain-independent feature map output by the auxiliary detection model, and each second contrast combination is constructed based on the scene association degree and category association degree between the first domain-related feature map and the second domain-related feature map.
2. The method according to claim 1, wherein The initial detection model is trained in a multi-round iterative manner until a preset iteration stop condition is met, and the trained target detection model is output. The training process of one round of the initial detection model is as follows: Inputting the first sample image set and the second sample image set into the initial detection model and the auxiliary detection model respectively for feature extraction to obtain corresponding first facial feature maps and corresponding second facial feature maps; Performing decoupling processing on each of the first facial feature maps and each of the second facial feature maps to obtain a corresponding first domain-independent feature map, a first domain-dependent feature map and a decoupling loss, and a corresponding second domain-independent feature map and a second domain-dependent feature map; Determining a total category detection loss based on the predicted classification results of each of the first sample images and the corresponding actual classification results; determining a total loss of liveness characterization of the first sample image set based on the first domain-independent feature maps and the second domain-independent feature maps, and determining a total domain transformation loss of the first sample image set based on the first domain-dependent feature maps and the second domain-dependent feature maps; Model parameters of the initial detection model are adjusted based on the decoupling loss, the total category detection loss, the total liveness characterization loss, and the total domain transformation loss.
3. The method according to claim 2, wherein The determining of the total loss of liveness characterization of the first sample image set based on the first domain-independent feature maps and the second domain-independent feature maps, and determining the total domain transformation loss of the first sample image set based on the first domain-dependent feature maps and the second domain-dependent feature maps, includes: determining a total loss of liveness characterization of the first sample image set based on a degree of category association between each of the first domain-independent feature maps and each of the second domain-independent feature maps; Furthermore, based on the scene correlation degree and the category correlation degree between each first domain-related feature map and each second domain-related feature map, the total domain transformation loss of the first sample image set is determined.
4. The method according to claim 3, wherein The determining, based on the degree of category association between the first domain-independent feature maps and the second domain-independent feature maps, a total loss of living body characterization of the first sample image set includes: constructing at least one pair of first comparison combinations of each of the first domain-independent feature maps based on the degree of category association between each of the first domain-independent feature maps and each of the second domain-independent feature maps; Based on each first comparison combination, a total loss of the living body characterization of the first sample image set is determined.
5. The method according to claim 4, wherein The constructing at least one first comparison combination of each of the first domain-independent feature maps based on the category association degree between each of the first domain-independent feature maps and each of the second domain-independent feature maps includes: For each first domain-independent feature map, perform the following operations: At least one second domain-independent feature map of the same category as the first domain-independent feature map is used as a corresponding global similar feature map, and each global similar feature map is respectively combined with the first domain-independent feature map to form a first comparison pair; Using at least one second domain-independent feature map of a different category from the first domain-independent feature map as a corresponding global heterogeneous feature map, and forming a first comparison queue with each global heterogeneous feature map and the first domain-independent feature map; Each first comparison pair and the one first comparison queue are respectively combined to form at least one first comparison combination.
6. The method according to claim 3, wherein The determining of the total domain transformation loss of the first sample image set based on the scene correlation degree and the category correlation degree between the first domain-related feature maps and the second domain-related feature maps includes: constructing at least one pair of second comparison combinations of each of the first domain-related feature maps based on the scene correlation degree and the category correlation degree between each of the first domain-related feature maps and each of the second domain-related feature maps; Based on each second comparison combination, a total domain transformation loss of the first sample image set is determined.
7. The method according to claim 6, wherein The constructing at least one second comparison combination of each of the first domain-related feature maps based on the scene correlation degree and the category correlation degree between each of the first domain-related feature maps and each of the second domain-related feature maps includes: For each first domain related feature map, perform the following operations: At least one second domain-related feature map having the same scene and the same category as the first domain-related feature map is used as a corresponding same-domain and same-same-category feature map, and each same-domain and same-same-category feature map is respectively combined with the first domain-related feature map to form a second comparison pair; At least one second domain-related feature map having a different scene from the first domain-related feature map but of the same category as the first domain-related feature map is used as a corresponding heterogeneous feature map, and each heterogeneous feature map and the first domain-related feature map are combined into a second comparison queue; Each second comparison pair and the one second comparison queue are respectively combined to form at least one pair of second comparison combinations.
8. The method according to claim 2, wherein The decoupling process is performed on each of the first facial feature maps and each of the second facial feature maps to obtain a corresponding first domain-independent feature map, a first domain-dependent feature map and a decoupling loss, and a corresponding second domain-independent feature map and a second domain-dependent feature map, including: For each of the first facial feature maps, perform the following operations: Performing down-compression processing on each of the first facial feature maps to obtain a first facial feature map after dimensionality reduction; Using a domain attention matrix with the same dimension as the first facial feature map after dimensionality reduction, the first facial feature map after dimensionality reduction is decoupled to obtain each first domain-independent feature map whose degree of correlation with the scene is lower than a set threshold value, each first domain-related feature map whose degree of correlation with the scene exceeds the set threshold value, and corresponding decoupling losses.
9. The method according to claim 2, wherein When determining the total loss of the living body characterization of the first sample image set and the total loss of the domain transformation, the method further includes: Clustering the first domain-independent feature maps to obtain a plurality of initial clusters; Perform data mining on each initial cluster to obtain a target cluster whose model learning difficulty assessment value exceeds the set standard value; Based on the predicted classification results of each first domain-independent feature map in each initial cluster and the corresponding actual classification results, a corresponding total sample mining loss is determined, and the total sample mining loss is used to adjust the model parameters of the initial detection model.
10. The method according to claim 9, wherein The data mining is performed on each initial cluster to obtain a target cluster whose model learning difficulty evaluation value exceeds a set standard value, including: Based on the predicted classification results of each first domain-independent feature map in each initial clustering cluster, the model learning difficulty of each initial clustering cluster is evaluated respectively, and at least one initial clustering cluster whose model learning difficulty evaluation value exceeds the set standard value is determined as the corresponding target clustering cluster.
11. The method according to claim 9, wherein After determining the corresponding target cluster, it also includes: Based on the sample images corresponding to the first domain-independent feature maps in each target cluster and other sample images in the training sample set, a first sample image set and a second sample image set for the next round of training input are generated.
12. A living body detection device, characterized in that: include: A feature extraction unit is used to input the face image to be detected into the target detection model, perform feature extraction on the face image to be detected, and obtain a corresponding face feature map; a decoupling unit, configured to perform decoupling processing on the facial feature map to extract a target domain-irrelevant feature map having a degree of relevance to the scene lower than a set threshold; a detection unit, configured to perform category detection on the obtained target domain-independent feature map to obtain a corresponding prediction classification result, wherein the prediction classification result indicates whether the face image to be detected is a real face image; In which, the target detection model is trained based on at least one pair of first contrast combinations of each first domain-independent feature map in the initial detection model, and at least one pair of second contrast combinations of each first domain-related feature map in the initial detection model; each first contrast combination is constructed based on the category association degree between the first domain-independent feature map and the second domain-independent feature map output by the auxiliary detection model, and each second contrast combination is constructed based on the scene association degree and category association degree between the first domain-related feature map and the second domain-related feature map.
13. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory stores program codes, and when the program codes are executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that The method comprises a program code, and when the program code is run on a computer device, the program code is used to enable the computer device to execute the steps of the method according to any one of claims 1 to 11.
15. A computer program product, characterized in that The method comprises computer instructions, which implement the steps of the method according to any one of claims 1 to 11 when the computer instructions are executed by a processor.
Citation Information
Patent Citations
Face detection model training method and device, face detection method and device and electronic equipment
CN111767906A
Domain self-adaptive face recognition method, system and device based on meta-learning
CN112541458A