A living body detection method, device, storage medium and electronic device
By generating and combining the polarization state image of the target object in silent liveness detection, the problem of insufficient security performance of silent liveness detection is solved, and high-security liveness detection is achieved in various scenarios.
Patent Information
- Application Number
- CN202310277108.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-16
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2043-03-16
AI Technical Summary
Existing silent liveness detection methods have poor security performance in images captured in a user's natural state, making them difficult to apply to scenarios with high security requirements, such as financial scenarios.
By acquiring images of the target object, generating polarization state images of the target object based on a machine learning model, and combining the target object images and polarization state images for liveness detection, security performance is improved without the need for additional polarization imaging hardware.
In liveness detection scenarios, it improves the detection effect of liveness protection against attacks, ensures security performance, and has good versatility, making it suitable for various scenarios.
Smart Images

Figure CN116778585B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present specification relates to the technical field of computer technology, and particularly relates to a living body detection method and device, a storage medium and an electronic device. BACKGROUND
[0002] With the rapid development of computer technology, biometric technology is widely applied to people's production and life. For example, face payment, face department ban, face attendance and face station entry technologies all need to rely on biometric technology. However, with the more and more extensive application of biometric technology, the demand for living body detection in the biometric scene is also more and more prominent. For example, biometric scenes such as face attendance, face entry and face payment are widely used. While biometric technology provides convenience for people, it also brings new risks and challenges. The most common means to threaten the security of the biometric system is living body attack, that is, trying to bypass the image biometric verification through device screen, printed photo and other means. Therefore, living body detection is particularly important in the biometric scene. SUMMARY
[0003] The present specification provides a living body detection method, device, storage medium and electronic device, and the technical solution is as follows:
[0004] In a first aspect, the present specification provides a living body detection method, and the method comprises:
[0005] Collecting a target object image of a target object in a target environment;
[0006] Determining a target object polarization state image of the target object based on the target object image;
[0007] Performing living body attack detection processing based on the target object image and the target object polarization state image to obtain a target detection type of the target object.
[0008] In a second aspect, the present specification provides a living body detection device, and the device comprises:
[0009] An object image collection module, configured to collect a target object image of a target object in a target environment;
[0010] A polarization image determination module, configured to determine a target object polarization state image of the target object based on the target object image;
[0011] A living body attack detection module, configured to perform living body attack detection processing based on the target object image and the target object polarization state image to obtain a target detection type of the target object.
[0012] In a third aspect, the present specification provides a computer storage medium, which stores at least one instruction, and the instruction is suitable for being loaded by a processor and performing the method steps of one or more embodiments of the present specification.
[0013] In a fourth aspect, the present specification provides a computer program product, which stores at least one instruction, and the instruction is suitable for being loaded by a processor and performing the method steps of one or more embodiments of the present specification.
[0014] In a fifth aspect, the present specification provides an electronic device, which can include a processor and a memory, wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and performing the method steps of one or more embodiments of the present specification.
[0015] The technical solutions provided by some embodiments of the present specification have at least the following beneficial effects:
[0016] In one or more embodiments of the present specification, the electronic device collects a target object image of a target object in a target environment, and then determines a target object polarization state image of the target object. The target object image and the target object polarization state image are combined for live attack detection processing. In the live detection scene, the polarization state image can be combined to improve the security of the live attack detection of the target object, improve the detection effect of the live attack detection, ensure the security performance, and can not need to add related polarization imaging hardware. Therefore, the live detection method disclosed in the present specification can be applied in various scenes, and has good universality. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the present specification or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments of the present specification, and those skilled in the art can obtain other drawings according to these drawings without creative labor.
[0018] Figure 1 is a scene schematic diagram of a live detection system provided by the present specification;
[0019] Figure 2 is a flowchart of a live detection method provided by the present specification;
[0020] Figure 3 is a flowchart of a polarization state image determination provided by the present specification;
[0021] Figure 4 is a model training schematic diagram of a polarization diffusion model provided by the present specification;
[0022] Figure 5 is a schematic diagram of a model processing process provided by the present specification;
[0023] Figure 6 is a flowchart of a polarization angle prediction provided by the present specification;
[0024] Figure 7 is a model training schematic diagram of a polarization angle prediction model provided by the present specification;
[0025] Figure 8 is a structural schematic diagram of a living body detection device provided by the present specification;
[0026] Figure 9 is a structural schematic diagram of an electronic device provided by the present specification;
[0027] Figure 10 is a structural schematic diagram of an operating system and user space provided by the present specification;
[0028] Figure 11 is an architecture diagram of an Android operating system in the present specification; Figure 10
[0029] Figure 12 is an architecture diagram of an IOS operating system in the present specification. Figure 10 DETAILED DESCRIPTION
[0030] The technical solutions in the present specification will be described clearly and completely in combination with the drawings in the present specification. Obviously, the described embodiments are only some of the embodiments of the present specification, but not all the embodiments. Based on the embodiments in the present specification, all the other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present specification.
[0031] In the description of the specification, it is understood that the terms "first", "second" and the like are used only for the purpose of description and are not to be construed as indicating or implying relative importance. In the description of the specification, it is necessary to explain that, unless otherwise explicitly specified and limited, "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units not listed, or optionally also includes other steps or units inherent to the process, method, product or device. The specific meaning of the above terms in the specification can be understood by the person skilled in the art according to the specific circumstances. In addition, in the description of the specification, "a plurality of" means two or more, unless otherwise specified. The association relationship of the associated objects is described, which means that there can be three relationships, for example, A and / or B can represent the following three cases: A exists alone, A and B exist together, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after it.
[0032] In the related art, a common living body detection method is a silent living body detection method without additional interaction. This kind of silent living body detection method performs biological recognition and living body detection based on the collected user image in the natural state of the user, without the need for the user to perform additional action interaction. This kind of method is easy to deploy and scale, and the user experience is good, but in actual application scenarios, due to the poor security performance of the user image collected in the silent state in living body detection, it is difficult to apply in scenarios with high security requirements, such as financial scenarios.
[0033] The specification will be described in detail below in conjunction with specific embodiments.
[0034] Please refer to Figure 1 , a scene schematic diagram of a living body detection system provided in the specification. As Figure 1 indicated, the living body detection system can at least include a client cluster and a service platform 100.
[0035] The client cluster can include at least one client, such as Figure 1 indicated, specifically including a client 1 corresponding to a user 1, a client 2 corresponding to a user 2,..., and a client n corresponding to a user n, n is an integer greater than 0.
[0036] The clients in the client cluster can be electronic devices with communication functions, including but not limited to wearable devices, handheld devices, personal computers, tablet computers, vehicle-mounted devices, smart phones, computing devices, or other processing devices connected to wireless modems, etc. Electronic devices can be called different names in different networks, such as user equipment, access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user device, cellular phone, cordless phone, personal digital assistant (PDA), electronic device in 5G network or future evolution network, etc.
[0037] The service platform 100 can be a separate server device, such as a rack-mounted, blade, tower, or cabinet server device, or a hardware device with strong computing power such as a workstation, a mainframe computer, etc. It can also be a server cluster composed of multiple servers. Each server in the service cluster can be composed in a symmetrical manner, where each server is functionally and positionally equivalent in the transaction link, and each server can independently provide services externally. The independent service can be understood as not requiring the assistance of another server.
[0038] In one or more embodiments of the present specification, the service platform 100 can establish a communication connection with at least one client in the client cluster, and based on the communication connection, the data interaction in the live body detection process is completed, such as online transaction data interaction. For example, the client can collect the target object image of the target object in the environment, and send it to the service platform 100, and the service platform 100 performs the live body attack detection processing according to the live body attack detection method corresponding to one or more embodiments of the present specification; for example, the service platform 100 can instruct the client to perform the live body attack detection processing according to the live body attack detection method corresponding to one or more embodiments of the present specification;
[0039] It should be noted that the service platform 100 and at least one client in the client cluster establish a communication connection through a network for interactive communication, where the network can be a wireless network or a wired network. The wireless network includes but is not limited to a cellular network, a wireless local area network, an infrared network or a Bluetooth network. The wired network includes but is not limited to an Ethernet, a universal serial bus (USB) or a controller area network. In one or more embodiments of the specification, technologies and / or formats such as Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML) and the like are used to represent data (such as the target compressed package) exchanged through the network. In addition, all or some links can be encrypted using conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) and the like. In other embodiments, custom and / or dedicated data communication technologies can be used instead of or in addition to the above data communication technologies.
[0040] The living body detection system embodiments provided by the specification belong to the same concept as the living body detection method in one or more embodiments. The corresponding execution subject of the living body detection method involved in one or more embodiments of the specification can be an electronic device, which can be the service platform 100 described above. The corresponding execution subject of the living body detection method involved in one or more embodiments of the specification can also be an electronic device corresponding to a client, which is determined based on the actual application environment. The implementation process of the living body detection system embodiment can be seen from the method embodiments described below, which will not be described here.
[0041] Based on Figure 1 The scene diagram shown below provides a detailed description of the living body detection method provided by one or more embodiments of the specification.
[0042] Please refer to Figure 2 The flowchart of the living body detection method provided by one or more embodiments of the specification is provided, which can be implemented by relying on a computer program and can be run on a living body detection device based on the von Neumann system. The computer program can be integrated in an application or run as an independent tool application. The living body detection device can be a service platform.
[0043] Specifically, the living body detection method comprises:
[0044] S102: acquire a target object image of a target object in a target environment;
[0045] It can be understood that live detection is a detection method for determining the real physiological characteristics of an object in some target environment such as an identity verification scene. In image live detection applications, image live detection needs to verify whether the image is a real live object operation based on the acquired target live detection image. Image live detection needs to effectively resist common live attack means such as photos, face replacement, masks, shielding, and screen flipping, thereby helping users to identify fraudulent behavior and protecting the rights and interests of users.
[0046] The target object image can be understood as an object image data corresponding to a certain modal type collected for a target object (such as a user, an animal, or the like) in an image live detection scene.
[0047] The target environment can be understood as a physical environment in which the target object of the electronic device is located.
[0048] It can be understood that a plurality of target object images collected for a target object can have different image modal types in actual application. The image modal type can be one or more of a video modal type, a color picture modal (rgb) type, a short video modal type, an animation modal type, a depth image (depth) modal type, an infrared image (ir) modal type, a near-infrared modal (NIR) type, and the like.
[0049] Illustratively, the target object image can be an rgb image of a color picture modal (rgb) type.
[0050] Illustratively, in actual application scenarios, the target object image of the target object in the current target environment to be recognized or detected can be acquired based on the corresponding live detection task through, for example, an RGB camera, a monocular camera, an infrared camera, and the like.
[0051] S104: determining a target object polarization state image of the target object based on the target object image;
[0052] Illustratively, visible light is generally with all-angle polarization. In this specification, the target object image is an image obtained by imaging the target object based on visible light. The target object image can be referred to as a normal state image that has not been polarized with respect to polarized light.
[0053] Further, while polarized light is light polarized in only one direction, it can be understood that an image obtained based on imaging a target object using polarized light can be referred to as a target object polarization state image or a target object polarized light image.
[0054] In the related art, for any object, object polarization state images can be acquired only with the support of polarized light imaging hardware, which undoubtedly increases hardware costs. In this specification, this approach can be optimized, and object polarization state images can be generated based on a target object in a normal state using visible light instead of polarized light imaging hardware.
[0055] In this specification, a polarization diffusion model can be trained based on a machine learning model, and target object polarization state images can be generated based on a target object image or a target object image and a polarization angle as input to the polarization diffusion model.
[0056] In terms of the imaging principle of visible light and polarized light, polarized light is a polarization state image obtained by polarized imaging of visible light at a certain angle, and thus, relative to a normal state image based on visible light, it corresponds to polarization state images of several reference angles.
[0057] Optionally, inputting a desired polarization angle and a target object image can indicate a diffusion polarization image to assist in generating a target object polarization state image of a specified polarization angle.
[0058] Optionally, inputting a target object image can be processed by a polarization diffusion model to generate a target object polarization state image of a specified polarization angle or all polarization angles.
[0059] S106: Perform a living body attack detection process based on the target object image and the target object polarization state image to obtain a target detection type for the target object.
[0060] The target detection type is one of a living body category and an attack category.
[0061] It can be understood that, based on a target object image collected by an image collection device, the target object image is a normal state image, and a target object polarization state image is generated based on the normal state target object image. The combination of the visible light normal state target object image and the visible light polarization state target object polarization state image forms a multi-modal image combination. This multi-modal image combination can fully utilize the imaging characteristics of the corresponding self modal under visible light normal state and visible light polarization state, and can take advantage of the living body attack separability characteristics brought by the two different light modal images. The polarization state image will help the living body attack classification and recognition of the image living body detection, and no additional polarization imaging components are needed to generate the polarization image, which improves the security performance.
[0062] It should be noted that the machine learning model involved in one or more embodiments of the present specification includes but is not limited to one or more of the following: fitting of a convolutional neural network (CNN) model, a deep neural network (DNN) model, a recurrent neural network (RNN) model, an embedding model, a gradient boosting decision tree (GBDT) model, a logistic regression (LR) model, a diffusion model (DM), and the like.
[0063] In one or more embodiments of the present specification, the electronic device acquires a target object image of a target object in a target environment, determines a target object polarization state image of the target object, and performs a live attack detection process in combination with the target object image and the target object polarization state image. This can improve the security of the live detection scene in combination with the polarization state image, improve the detection effect of the live attack detection, and ensure the security performance. At the same time, it can be applied in various scenes without the need to add related polarization imaging hardware, and has good universality.
[0064] Optionally, please refer to Figure 3 , Figure 3 is a schematic image of a polarization state image determination according to the present specification, and the target object polarization state image of the target object is determined based on the target object image, comprising:
[0065] S2002: determining a recommended polarization angle for the target object;
[0066] The recommended polarization angle is the angle of the polarization light that is easy to detect in the live detection environment. The effect of live detection using the polarization state image indicated by the recommended polarization angle is better than that of other polarization angles.
[0067] Optionally, one or more specified polarization angles can be set as recommended polarization angles based on the live detection environment in advance. In actual application, one or more recommended polarization angles can be directly obtained ;
[0068] Optionally, the target object image can be used to analyze and predict the optimal polarization angle to determine the recommended polarization angle for the target object in the target environment.
[0069] In one or more embodiments of the present specification, in order to save the living body detection time and improve the effect, the number of polarization angles of visible light is large, and the recommendation of polarization angles can reduce the number of generated polarization images.
[0070] S2004: Polarization imaging processing is performed based on the recommended polarization angle and the target object image using a polarization diffusion model to obtain a target object polarization state image corresponding to the recommended polarization angle.
[0071] It can be understood that the polarization diffusion model is trained by a pre-trained machine learning model, and after the model training is completed, the model is deployed. In actual application scenarios, the recommended polarization angle and the target object image are used as the input of the diffusion polarization image, and the polarization diffusion model is used for polarization imaging processing to output the target object polarization state image corresponding to the recommended polarization angle.
[0072] Illustratively, please refer to Figure 4 , Figure 4 is a model training schematic diagram of a polarization diffusion model proposed in one or more embodiments of the present specification. Specifically:
[0073] S202: Create an initial polarization diffusion model;
[0074] Specifically, a machine learning model is used to create an initial polarization diffusion model based on a polarization image generation task. Illustratively, a diffusion model can be used to create an initial polarization diffusion model.
[0075] Illustratively, the diffusion model is used for model creation and training, which is more effective and easy to implement than using other machine learning models such as generative adversarial networks (GAN). The machine learning model using the generative adversarial network (GAN) often faces a high probability of mode collapse (i.e., outputting one image for all inputs) and unstable quality details. Therefore, the present embodiment creatively uses a diffusion model to construct an initial polarization diffusion model for polarization image generation, which can reconstruct high-quality polarization images.
[0076] S204: Collect sample normal state images of sample objects and sample polarization state label images corresponding to multiple reference polarization angles;
[0077] The number of sample objects can be multiple, that is, sample normal state images of multiple sample objects and sample polarization state label images corresponding to different reference polarization angles are collected;
[0078] Further, the image collection stage before model training:
[0079] Collect normal state images of a plurality of sample objects as sample normal state images, the sample normal state images are images directly generated based on a visible light image generation principle, and a plurality of polarization state images of a plurality of polarization angles corresponding to the sample objects are collected at the same time as the sample normal state images are collected, and the angle range is usually 1 degree-360 degrees, and the collection is performed at every i degrees (such as 5 degrees);
[0080] Illustratively, the sample normal state image and the corresponding polarization angle are The sample polarization state image of the sample normal state image and the corresponding polarization angle is denoted as ;
[0081] S206: Training an initial polarization diffusion model based on the sample normal state image, the reference polarization angle, and the sample polarization state label image corresponding to the reference polarization angle, until the initial polarization diffusion model is trained to obtain a trained polarization diffusion model.
[0082] Specifically, for the polarization image generation task, it is necessary to consider how to achieve the purpose of generating a polarization state image based on a normal state image without using the training idea of a generative adversarial network (GAN), and to achieve this purpose, the initial polarization diffusion model is creatively used to build a model processing architecture;
[0083] Illustratively, the training of the initial polarization diffusion model based on the sample normal state image, the reference polarization angle, and the sample polarization state label image corresponding to the reference polarization angle includes:
[0084] A2: Based on the sample normal state image and the sample polarization state label image, at least one pre-sequence noise processing is performed using the initial polarization diffusion model to obtain a forward sample image sequence, the head image of the forward sample image sequence is the sample normal state image, and the tail image of the forward sample image sequence is the sample polarization state label image;
[0085] Further, the model processing architecture idea of this step can at least be: regarding "generating a polarization state image of a certain polarization angle based on a normal state image" as a light noise processing process, the polarization image generation task is to obtain a polarization image based on a polarization light in a certain angle direction, and the sample normal state image based on visible light retains light imaging information in all polarization angles, that is, for a certain sample object, the light imaging information in other polarization angles except the desired polarization angle can be regarded as light noise information, and for this, the model training structure idea of the initial polarization diffusion model can be transformed into how to filter out the light noise information in the non-desired polarization angle from the sample normal state image retaining the light information in all polarization angles, and obtain the light polarization effective information in the desired polarization angle of the sample normal state image.
[0086] Further, in the image acquisition stage, the sample normal state image x and the sample polarization state image corresponding to the polarization angle are obtained. Based on the sample normal state image x and the sample polarization state image , a forward sample image sequence of the initial polarization diffusion model is constructed; after
[0087] Here, the forward sample image sequence is defined as a sequence composed of a number of images from the sample polarization state image to the sample normal state image x; the sample polarization state image at a certain polarization angle θ is added with noise T times (i.e. the adding noise process simulating the addition of light noise information) to finally obtain the sample normal state image x; the image obtained after each time of adding noise is taken as an intermediate noise-added image of the forward sample image sequence, and the number of intermediate noise-added images is T-2, T being a positive integer, thus obtaining the forward sample image sequence of “the head image being the sample normal state image x+T-2 intermediate noise-added images+the tail image being the sample polarization state label image ”.
[0088] For illustration, please refer to Figure 5 , Figure 5 is a schematic diagram of a model processing process involved in the present specification, as shown in Figure 5 , the initial polarization diffusion model is adopted to determine the head image x0 to be the sample normal state image x and the tail image x T to be the sample polarization state label image , and then, at least one previous noise-adding processing process is performed with the sample normal state image x as the starting signal and the sample polarization state label image as the ending signal, each previous noise-adding processing process obtaining an intermediate noise-added image {x1...x t-1 , x t、 x t+1}; the intuitive interpretation of the model processing of the initial polarization diffusion model is: continuously adding noise on the sample polarization state image at a certain polarization angle θ to accumulate light noise information until the sample polarization state label image is consistent with the sample polarization state label image
[0089] It can be understood that the amount of noise added each time in the forward noise-adding processing process is determined based on the known sample polarization state label image as the starting signal and the sample normal state image x as the ending signal. Here, the amount of noise added each round can be random, as long as the image after accumulating the light noise information at the end of the noise addition is equivalent to the sample normal state image x, i.e. the noise-added image can be constructed based on the sample polarization state label image , the sample normal state image x is taken as the input of the noise adder, and the output is a plurality of intermediate noise-added images, that is, the forward sample image sequence can be obtained.
[0090] A4: control the initial polarization diffusion model to perform reverse denoising processing on the forward sample image sequence based on the reference polarization angle, to obtain a sample polarization state prediction image corresponding to the reference polarization angle of each sequence image in the forward sample image sequence.
[0091] Illustratively, the internal structure of the initial polarization diffusion model constructed based on the diffusion model can be at least regarded as a denoising encoder, and the structure of the denoising encoder can be, for example, UNET type.
[0092] Further, the model training process of the initial polarization diffusion model is a reverse denoising process of the denoising encoder on the forward sample image sequence, and each sequence image in the forward sample image sequence and the reference polarization angle (θ i ) corresponding to the sample polarization state label image are input processing objects in each round of model training process, and control of the denoising encoder of the initial polarization diffusion model on each sequence image in the forward sample image sequence is T times of reverse denoising encoding processing, which will obtain a sample polarization state prediction image corresponding to the reference polarization angle (θ i ) of each sequence image. Assuming that there are m sequence images (m is less than or equal to T), here m sample polarization state prediction images are obtained, and a first model loss is obtained based on the first model loss in each round of model training process as a supervision signal for model training, until a trained polarization diffusion model is obtained.
[0093] Optionally, in the model training process, the sample polarization state label image at the head of each round of forward sample image sequence can be removed, and the forward of the T-1 sequence images after removing the sample polarization state label image .
[0094] A6: calculating a first model loss for the forward sample image sequence based on the sample polarization state prediction image and the sample polarization state label image, and adjusting parameters of the initial polarization diffusion model using the first model loss
[0095] Specifically, the calculation of the first model loss for the forward sample image sequence based on the sample polarization state prediction image and the sample polarization state label image can be:
[0096] calculating a first Euclidean distance loss of the sample polarization state prediction image corresponding to each sequence image in the forward sample image sequence and the sample polarization state label image, and determining the first model loss based on the first Euclidean distance loss.
[0097] The first Euclidean distance loss satisfies the following formula:
[0098] Loss s = L2(x, x_recovery)
[0099] Wherein, the Loss s represents the first Euclidean distance loss, the L2 represents the Euclidean distance operation processing, the x is the sample polarization state label image, and the x_recovery is the sample polarization state prediction image corresponding to the sequence image.
[0100] Optionally, the sum of all first Euclidean distance losses can be taken as the first model loss.
[0101] It can be understood that the initial polarization diffusion model is trained to adjust the model parameters based on the above model structure and the first model loss, and after the model end training condition is met, the trained polarization diffusion model can be obtained.
[0102] Optionally, the model end training condition can include, for example, that the value of the loss function is less than or equal to a preset loss function threshold, the number of iterations reaches a preset number threshold, etc. The specific model end training condition can be determined based on the actual situation, which is not limited here.
[0103] In one or more embodiments of the present specification, the aforementioned method is used to optimize the mode collapse (one image for all input and output) and unstable quality offline caused by the traditional generative adversarial network (GAN), and by creatively using the diffusion model to construct an initial polarization diffusion model for polarization image generation, a high-quality polarization image can be reconstructed.
[0104] Optionally, the electronic device performing the determination of the recommended polarization angle for the target object can be:
[0105] Based on the target object image, a polarization angle prediction model is used for polarization angle prediction processing to obtain the recommended polarization angle for the target object.
[0106] Specifically, the present environment uses a polarization angle prediction model to analyze and predict the optimal polarization angle based on the target object image to determine the recommended polarization angle for the target object in the environment.
[0107] It can be understood that the polarization angle prediction model is trained based on the machine learning model in advance, and after the training is completed, the model is deployed. In actual application scenarios, the target object image is taken as the input of the polarization angle prediction model, and the polarization angle prediction model is used for polarization angle prediction processing to output the recommended polarization angle for the target object.
[0108] Illustratively, please refer toFigure 6 , Figure 6 is a flowchart of a polarization angle prediction, in particular:
[0109] S302: create an initial polarization angle prediction model;
[0110] In particular, a machine learning model is used to create an initial polarization diffusion model based on the polarization angle prediction task;
[0111] It can be understood that in the foregoing polarization image generation, polarization state images of various polarization angles can be generated based on normal state images. Here, the polarization angle prediction model is trained to determine the optimal polarization angle according to the environment, reducing the number of generation times in the polarization image generation and improving efficiency.
[0112] S304: Collect sample normal state images of a sample object, and label the recommended polarization angle label of the sample normal state images under the sample environment;
[0113] Illustratively, the sample normal state image can be training data of the polarization diffusion model in the model training stage, and the recommended polarization angle label of the sample normal state image under the sample environment is labeled at the same time, that is, the expert end service can be used to analyze the recommended polarization angle of the sample normal state image under the sample environment as the recommended polarization angle label.
[0114] S306: Train the initial polarization angle prediction model based on the sample normal state image and the recommended polarization angle label until the initial polarization angle prediction model is trained to obtain the trained polarization angle prediction model.
[0115] Illustratively, the internal model structure of the initial polarization angle prediction model can be constructed based on a machine learning model / network, for example, the initial polarization angle prediction model can be a ResNet50 model structure;
[0116] Illustratively, training the initial polarization angle prediction model based on the sample normal state image and the recommended polarization angle label can be:
[0117] B2: input the sample normal state image into the initial polarization angle prediction model, and perform recommended polarization angle prediction processing by the initial polarization angle prediction model. The initial polarization angle prediction model can predict the optimal polarization angle of the object under the environment based on the environment image information in the sample normal state image to obtain the predicted recommended polarization angle under the sample environment;
[0118] B4: calculate a second model loss based on the predicted recommended polarization angle and the recommended polarization angle label, and adjust the parameters of the initial polarization angle prediction model using the second model loss.
[0119] The second model loss is a model loss of the initial polarization angle prediction model in a model training stage;
[0120] Further, the calculation of the second model loss based on the predicted recommended polarization angle and the recommended polarization angle label can be:
[0121] The second Euclidean distance loss of the predicted recommended polarization angle and the recommended polarization angle label is calculated, and the second Euclidean distance loss is taken as the second model loss.
[0122] The second Euclidean distance loss satisfies the following formula:
[0123] Loss m= L2(p,theta)
[0124] Wherein, the Loss m represents the second Euclidean distance loss, the L2 represents the Euclidean distance operation processing, the p is the predicted recommended polarization angle, and the theta is the recommended polarization angle label.
[0125] Illustratively, the second Euclidean distance loss is taken as a kind of supervision signal to supervise model training in each round of model training process, the model parameters of the initial polarization angle prediction model are adjusted by combining the second model loss to back propagation, until the model training condition is satisfied, and the trained polarization angle prediction model can be obtained.
[0126] In one or more embodiments of the present specification, in the polarization image generation, polarization state images of various polarization angles can be generated based on normal state images, and here, the polarization angle prediction model is trained to determine the optimal polarization angle for the object according to the environmental information indicated by the normal state image, and the generation times in the polarization image generation are reduced based on the recommended polarization angle, and the efficiency is improved.
[0127] Optionally, the electronic device performs the living body attack detection processing based on the target object image and the target object polarization state image to obtain a target detection type for the target object, which can be:
[0128] The living body attack detection processing is performed based on the target object image and the target object polarization state image by using a living body attack prevention model to obtain a target detection type for the target object.
[0129] Illustratively, please refer to Figure 7 , Figure 7 is a model training schematic diagram of a polarization angle prediction model, and specifically:
[0130] S402: create an initial living body attack prevention model;
[0131] Illustratively, an initial anti-liveness attack model for liveness detection based on normal state images and polarization state images is created in advance based on a machine learning model, and an internal model structure of the initial anti-liveness attack model is constructed;
[0132] S404: Obtain a sample normal state image and a sample polarization state image of a sample object, and label a sample liveness classification result label of the sample object;
[0133] The sample normal state image and the sample polarization state image can be sample training data in the model training stage of the one or more models, and at the same time, a sample liveness classification result label for the sample object is labeled;
[0134] Illustratively, the sample liveness classification result label is usually a sample liveness classification probability P;
[0135] S406: Train the initial anti-liveness attack model based on the sample normal state image, the sample polarization state image, and the sample liveness classification result label until the initial anti-liveness attack model is trained to obtain a trained anti-liveness attack model.
[0136] Illustratively, the training of the initial anti-liveness attack model based on the sample normal state image, the sample polarization state image, and the sample liveness classification result label can be:
[0137] C2: input the sample normal state image and the sample polarization state image into the initial anti-liveness attack model to determine a sample normal state image feature and a normal state liveness classification result based on the sample normal state image, a sample polarization state image feature and a polarization state liveness classification result based on the sample polarization state image, a sample image residual feature and a residual state classification result based on the sample normal state image and the sample polarization state image, and a sample fusion image feature and a fusion state classification result based on the sample normal state image feature, the sample polarization state image feature, and the sample image residual feature;
[0138] Illustratively, the internal model structure of the initial anti-liveness attack model of the corresponding reference modal type can be constructed based on a machine learning model / network, for example, the initial anti-liveness attack model can include at least four parts, as follows:
[0139] The first part is a normal state feature encoding module, which processes a sample normal state image feature, and the normal state feature encoding module performs feature extraction and encoding on the sample normal state image feature and performs liveness attack detection to obtain a sample normal state image feature and a normal state liveness classification result, that is, the processing result of the normal state feature encoding module is the sample normal state image feature and the normal state liveness classification result (which can be a liveness attack probability);
[0140] The second part is a polarization state feature encoding module, which processes sample polarization state image features. The polarization state feature encoding module extracts and encodes sample polarization state image features and performs living body attack detection to obtain sample polarization state image features and polarization state living body classification results, i.e., the processing result of the polarization state feature encoding module is sample polarization state image features and polarization state living body classification results (which can be a living body attack probability).
[0141] The third part is a residual feature encoding module, which processes sample normal state image features and sample polarization state image features. The residual feature encoding module obtains sample image residual features by performing difference matching on sample normal state image features and sample polarization state image features, and then performs living body detection based on the sample image residual features to obtain residual state classification results (which can be a living body attack probability).
[0142] The fourth part is a feature fusion module, which processes sample normal state image features, sample polarization state image features, and sample image residual features. The feature fusion module obtains sample fusion image features by performing feature fusion on sample normal state image features, sample polarization state image features, and sample image residual features, and performs living body detection on the sample fusion image features to obtain fusion state classification results (which can be a living body attack probability).
[0143] Illustratively, the model training process of the initial living body attack prevention model in each round is based on the aforementioned multiple sample classification results (which can be a living body attack probability), and in the actual application and deployment stage, the trained living body attack prevention model will output a comprehensive classification result (which can be an average calculation of multiple sample classification results) based on the aforementioned multiple sample classification results.
[0144] C4: Calculate a third model loss based on the normal state living body classification result, the polarization state living body classification result, the residual state classification result, the fusion state classification result, and the sample living body classification result label, and adjust the parameters of the initial living body attack prevention model using the third model loss.
[0145] Illustratively, the calculation of the third model loss based on the normal state living body classification result, the polarization state living body classification result, the residual state classification result, the fusion state classification result, and the sample living body classification result label can be:
[0146] Specifically, a normal state living body classification loss is calculated based on the normal state living body classification result and the sample living body classification result label; a polarization state living body classification loss is calculated based on the polarization state living body classification result and the sample living body classification result label; a residual state classification loss is calculated based on the residual state classification result and the sample living body classification result label; and a fusion state living body classification loss is calculated based on the fusion state classification result and the sample living body classification result label.
[0147] Optionally, the normal state living body classification loss, the polarization state living body classification loss, the residual state living body classification loss, and the fusion state living body classification loss can use a related classification loss function such as a Cross Entropy Loss cross entropy loss function, a Hinge Loss hinge loss function, and the like.
[0148] For example, taking the classification loss function as the Cross Entropy Loss cross entropy loss function, the normal state living body classification loss, the polarization state living body classification loss, the residual state living body classification loss, and the fusion state living body classification loss can be represented as follows:
[0149] The normal state living body classification loss is obtained based on the following calculation formula, as follows:
[0150] Loss normal = CrossEntropy(p1, y)
[0151] Further, the living body classification loss is obtained based on the following calculation formula, as follows:
[0152] Loss polar = CrossEntropy(p2, y)
[0153] Further, the living body classification loss is obtained based on the following calculation formula, as follows:
[0154] Loss residual = CrossEntropy(p3, y)
[0155] Further, the living body classification loss is obtained based on the following calculation formula, as follows:
[0156] Loss fusion = CrossEntropy(p4, y)
[0157] Wherein, p1 is the normal state living body classification result, p2 is the polarization state living body classification result, p3 is the residual state classification result, p4 is the fusion state classification result, and y is the sample living body classification result label.
[0158] Specifically, the third model loss is obtained based on the normal-state living body classification loss, the polarization-state living body classification loss, the residual living body classification loss and the fusion living body classification loss.
[0159] Further, the third model loss can be obtained based on the following calculation formula:
[0160] Loss total= Loss normal +Loss polar +Loss residual +Loss fusion
[0161] wherein, the Loss total is the third model loss, the Loss normal is the normal-state living body classification loss, the Loss polar is the polarization-state living body classification loss, the Loss residual is the residual living body classification loss, and the Loss fusion is the fusion living body classification loss.
[0162] It can be understood that the initial living body anti-attack model is trained based on the above model structure and the third model loss to adjust the model parameters until the model end training condition is met, and then a trained living body anti-attack model can be obtained.
[0163] In one or more embodiments of the present specification, the normal-state image and the polarization-state image have high living body attack separability, and make full use of the optical image imaging characteristics between visible light and polarized light, so that the image living body detection can have good feature representation effect when facing the target object, and the precise living body detection classification can be realized, and better living body attack detection effect can be achieved, and the generalization ability of the image living body detection is improved.
[0164] The following will be combined with Figure 8 The living body detection device provided in the present specification will be described in detail. It should be noted that, Figure 8 The living body detection device shown in the present specification is used to execute the method of the present specification Figures 1-7 The method of the embodiment shown in the present specification is only shown with the part related to the present specification for the convenience of description, and the specific technical details not disclosed, please refer to the embodiment shown in the present specification Figures 1-7 The embodiment shown in the present specification.
[0165] Please refer to Figure 8Fig. 1 is a structural schematic diagram of a living body detection device according to the present disclosure. The living body detection device 1 can be implemented by software, hardware or a combination of both to be all or part of a user terminal. According to some embodiments, the living body detection device 1 comprises an object image acquisition module 11, a polarization image determination module 12 and a living body attack detection module 13, and is specifically used for:
[0166] The object image acquisition module 11 is configured to acquire a target object image of a target object in a target environment.
[0167] The polarization image determination module 12 is configured to determine a target object polarization state image of the target object based on the target object image.
[0168] The living body attack detection module 13 is configured to perform living body attack detection processing based on the target object image and the target object polarization state image to obtain a target detection type of the target object.
[0169] Optionally, the polarization image determination module 12 is configured to:
[0170] determine a recommended polarization angle for the target object;
[0171] perform polarization imaging processing based on the recommended polarization angle and the target object image using a polarization diffusion model to obtain a target object polarization state image corresponding to the recommended polarization angle.
[0172] Optionally, the polarization image determination module 12 is configured to create an initial polarization diffusion model.
[0173] acquire a sample normal state image and a plurality of sample polarization state label images corresponding to a plurality of reference polarization angles of a sample object;
[0174] train the initial polarization diffusion model based on the sample normal state image, the reference polarization angles and the sample polarization state label images corresponding to the reference polarization angles until the initial polarization diffusion model is trained to obtain a trained polarization diffusion model.
[0175] Optionally, the polarization image determination module 12 is configured to:
[0176] perform at least one pre-sequence noise adding processing based on the sample normal state image and the sample polarization state label images using the initial polarization diffusion model to obtain a forward sample image sequence, wherein a head image of the forward sample image sequence is the sample normal state image and a tail image of the forward sample image sequence is the sample polarization state label image.
[0177] The initial polarization diffusion model is controlled to perform reverse denoising processing on the forward sample image sequence based on the reference polarization angle, to obtain a sample polarization state prediction image corresponding to the reference polarization angle of each sequence image in the forward sample image sequence;
[0178] A first model loss for the forward sample image sequence is calculated based on the sample polarization state prediction image and the sample polarization state label image, and the first model loss is used to adjust parameters of the initial polarization diffusion model.
[0179] Optionally, the polarization image determination module 12 is configured to:
[0180] A first Euclidean distance loss of the sample polarization state prediction image and the sample polarization state label image corresponding to each sequence image in the forward sample image sequence is calculated, and a first model loss is determined based on the first Euclidean distance loss.
[0181] Optionally, the polarization image determination module 12 is configured to:
[0182] A polarization angle prediction model is used to perform polarization angle prediction processing based on the target object image, to obtain a recommended polarization angle for the target object.
[0183] Optionally, the polarization image determination module 12 is configured to:
[0184] An initial polarization angle prediction model is created;
[0185] A sample normal state image of a sample object is collected, and a recommended polarization angle label of the sample normal state image in a sample environment is labeled;
[0186] The initial polarization angle prediction model is trained based on the sample normal state image and the recommended polarization angle label, until the initial polarization angle prediction model is trained, to obtain a trained polarization angle prediction model.
[0187] Optionally, the polarization image determination module 12 is configured to:
[0188] The sample normal state image is input into the initial polarization angle prediction model to obtain a predicted recommended polarization angle in a sample environment;
[0189] A second model loss is calculated based on the predicted recommended polarization angle and the recommended polarization angle label, and the second model loss is used to adjust parameters of the initial polarization angle prediction model.
[0190] Optionally, the polarization image determination module 12 is configured to:
[0191] A second Euclidean distance loss of the predicted recommended polarization angle and the recommended polarization angle label is calculated, and the second Euclidean distance loss is taken as a second model loss.
[0192] Optionally, the living body attack detection module 13 is configured to:
[0193] Based on the target object image and the target object polarization state image, a living body attack detection model is used to perform living body attack detection processing, to obtain a target detection type for the target object.
[0194] Optionally, the living body attack detection module 13 is configured to:
[0195] An initial living body attack prevention model is created.
[0196] A sample normal state image and a sample polarization state image of a sample object are obtained, and a sample living body classification result label of the sample object is labeled.
[0197] Based on the sample normal state image, the sample polarization state image, and the sample living body classification result label, the initial living body attack prevention model is trained until the initial living body attack prevention model is trained, to obtain a trained living body attack prevention model.
[0198] Optionally, the living body attack detection module 13 is configured to:
[0199] The sample normal state image and the sample polarization state image are input into an initial living body attack prevention model, to determine a sample normal state image feature and a normal state living body classification result based on the sample normal state image, and to determine a sample polarization state image feature and a polarization state living body classification result based on the sample polarization state image, and to determine a sample image residual feature and a residual state classification result based on the sample polarization state image and the sample polarization state image, and to determine a sample fusion image feature and a fusion state classification result based on the sample normal state image feature, the sample polarization state image feature, and the sample image residual feature.
[0200] A third model loss is calculated based on the normal state living body classification result, the polarization state living body classification result, the residual state classification result, the fusion state classification result, and the sample living body classification result label, and the third model loss is used to adjust parameters of the initial living body attack prevention model.
[0201] Optionally, the living body attack detection module 13 is configured to:
[0202] calculate a normal state living body classification loss based on the normal state living body classification result and the sample living body classification result label; calculate a polarization state living body classification loss based on the polarization state living body classification result and the sample living body classification result label; calculate a residual state living body classification loss based on the residual state classification result and the sample living body classification result label; and calculate a fusion living body classification loss based on the fusion state classification result and the sample living body classification result label.
[0203] obtain a third model loss based on the normal state living body classification loss, the polarization state living body classification loss, the residual state living body classification loss, and the fusion living body classification loss.
[0204] It should be noted that the living body detection device provided in the above embodiments is used to execute the living body detection method, and only the division of the above functional modules is used as an example. In actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the living body detection device and the living body detection method provided in the above embodiments belong to the same concept, and the implementation process is described in detail in the method embodiments, which will not be described here.
[0205] The serial numbers in the specification are only for description, and do not represent the pros and cons of the embodiments.
[0206] In one or more embodiments of the specification, the electronic device collects a target object image of a target object in a target environment, and then determines a target object polarization state image of the target object. The living body attack detection processing is performed in combination with the target object image and the target object polarization state image. In the living body detection scene, the security capability of the living body attack detection for the target object can be improved by combining the polarization state image. The detection effect of the living body attack detection is improved, the security performance is ensured, and the related polarization imaging hardware does not need to be added. Therefore, the living body detection method related to the specification can be applied in various scenes, and has good universality.
[0207] The specification also provides a computer storage medium, which can store a plurality of instructions. The instructions are suitable for being loaded and executed by a processor to execute the living body detection method of the above Figures 1-7 embodiments. The specific execution process can be referred to the specific description of the above Figures 1-7 embodiments, which will not be described here.
[0208] The specification also provides a computer program product, which stores at least one instruction. The at least one instruction is loaded and executed by the processor to execute the living body detection method of the above Figures 1-7 embodiments. The specific execution process can be referred to the specific description of the above Figures 1-7The detailed description of the illustrated embodiments will not be described here.
[0209] Please refer to Figure 9 Fig. 1 shows a structural block diagram of an electronic device according to an example embodiment of the present disclosure. The electronic device in the present disclosure can include one or more of the following components: a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, the memory 120, the input device 130, and the output device 140 can be connected through the bus 150.
[0210] The processor 110 can include one or more processing cores. The processor 110 connects various parts within the entire electronic device by using various interfaces and lines, performs various functions of the electronic device 100 and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and calling data stored in the memory 120. Alternatively, the processor 110 can be implemented in at least one of a hardware form of a digital signal processing (DSP), a field-programmable gate array (FPGA), a programmable logic array (PLA). The processor 110 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes an operating system, a user interface, and an application program; the GPU is responsible for rendering and drawing display content; and the modem is used for processing wireless communication. It can be understood that the above-mentioned modem can also not be integrated into the processor 110, but can be implemented by a separate communication chip.
[0211] The memory 120 can include a random access memory (RAM) and can also include a read-only memory (ROM). Optionally, the memory 120 includes a non-transitory computer-readable storage medium. The memory 120 can be used to store instructions, programs, codes, code sets, or instruction sets. The memory 120 can include a program storage area and a data storage area, where the program storage area can store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing each of the methods described below, etc., and the operating system can be an Android system, an IOS system developed by Apple Inc., a system developed based on the Android system or the IOS system, or other systems. The data storage area can also store data created by the electronic device during use, such as a phone book, audio and video data, chat record data, etc.
[0212] Referring to Figure 10 As shown, the memory 120 can be divided into an operating system space and a user space, and the operating system runs in the operating system space, and native and third-party applications run in the user space. In order to ensure that different third-party applications can achieve good running effects, the operating system allocates corresponding system resources to different third-party applications. However, there are also differences in the demand for system resources in different application scenarios in the same third-party application, for example, in the local resource loading scenario, the third-party application has a higher requirement for the disk reading speed, and in the animation rendering scenario, the third-party application has a higher requirement for the GPU performance. However, the operating system and the third-party application are independent of each other, and the operating system often cannot timely perceive the current application scenario of the third-party application, resulting in that the operating system cannot perform targeted system resource adaptation according to the specific application scenario of the third-party application.
[0213] In order to enable the operating system to distinguish the specific application scenario of the third-party application, it is necessary to open up the data communication between the third-party application and the operating system, so that the operating system can obtain the current scenario information of the third-party application at any time, and then perform targeted system resource adaptation based on the current scenario.
[0214] Taking the operating system as an Android system for example, the programs and data stored in the memory 120 are as follows: Figure 11As shown, the memory 120 can store a Linux kernel layer 320, a system runtime library layer 340, an application framework layer 360, and an application layer 380, wherein the Linux kernel layer 320, the system runtime library layer 340, and the application framework layer 360 belong to an operating system space, and the application layer 380 belongs to a user space. The Linux kernel layer 320 provides underlying drivers for various hardware of the electronic device, such as display drivers, audio drivers, camera drivers, Bluetooth drivers, Wi-Fi drivers, power management, and the like. The system runtime library layer 340 provides main feature support for the Android system through some C / C++ libraries. For example, an SQLite library provides database support, an OpenGL / ES library provides 3D drawing support, a Webkit library provides browser kernel support, and the like. An Android runtime is also provided in the system runtime library layer 340, which mainly provides some core libraries to allow developers to use the Java language to write Android applications. The application framework layer 360 provides various APIs that can be used when building an application, and developers can also build their own applications by using these APIs, such as activity management, window management, view management, notification management, content provider, package management, call management, resource management, and location management. At least one application program is running in the application layer 380, which can be native applications provided by the operating system, such as a contact program, a message program, a clock program, a camera application, and the like, or third-party applications developed by third-party developers, such as game applications, instant messaging programs, photo beautification programs, and the like.
[0215] For example, taking an IOS system as the operating system, the programs and data stored in the memory 120 can include an IOS kernel 310, an IOS runtime library 330, an application framework 350, and an application 370. Figure 12As shown, the IOS system includes: a core operating system layer 420, a core service layer 440, a media layer 460, and a Cocoa Touch layer 480. The core operating system layer 420 includes an operating system kernel, drivers, and underlying frameworks that provide more hardware-specific functionality to frameworks in the core service layer 440. The core service layer 440 provides system services and / or frameworks for applications, such as a Foundation framework, an Accounts framework, an Ad framework, a Data Store framework, a Network Connectivity framework, a GeoLocation framework, a Motion framework, and the like. The media layer 460 provides interfaces for applications related to audiovisual aspects, such as interfaces related to graphics images, interfaces related to audio technology, interfaces related to video technology, an AirPlay interface for wireless audio and video transmission technology, and the like. The Cocoa Touch layer 480 provides various commonly used interface-related frameworks for application development, and is responsible for touch interaction operations of users on the electronic device. For example, a local notification service, a remote push service, an Ad framework, a game tool framework, a message user interface (UI) framework, a user interface UIKit framework, a map framework, and the like.
[0216] In Figure 9 In the framework shown, the frameworks related to most applications include, but are not limited to, a Foundation framework in the core service layer 440 and a UIKit framework in the Cocoa Touch layer 480. The Foundation framework provides many basic object classes and data types, and provides the most basic system services for all applications, and is UI-independent. The UIKit framework provides basic UI class libraries, and is used to create touch-based user interfaces. An iOS application can provide a UI based on the UIKit framework, so it provides the basic framework of the application, and is used to build user interfaces, draw, handle and respond to user interaction events, respond to gestures, and the like.
[0217] In the IOS system, the manner and principle of implementing data communication between a third-party application and an operating system can refer to the Android system, and the present specification will not be repeated here.
[0218] The input device 130 is configured to receive input instructions or data, and the input device 130 includes but is not limited to a keyboard, a mouse, a camera, a microphone, or a touch device. The output device 140 is configured to output instructions or data, and the output device 140 includes but is not limited to a display device and a speaker. In an example, the input device 130 and the output device 140 can be combined, and the input device 130 and the output device 140 are a touch display screen configured to receive a touch operation of a user using a finger, a stylus, or any suitable object on or near the touch display screen, and display a user interface of each application. The touch display screen is usually arranged on a front panel of the electronic device. The touch display screen can be designed as a full screen, a curved screen, or a special-shaped screen. The touch display screen can also be designed as a combination of a full screen and a curved screen, a combination of a special-shaped screen and a curved screen, and the present specification does not limit the touch display screen.
[0219] In addition, those skilled in the art can understand that the structure of the electronic device shown in the above-described drawings does not constitute a limitation on the electronic device, and the electronic device can include more or fewer components than those shown in the drawings, or combine certain components, or different component arrangements. For example, the electronic device further includes a radio frequency circuit, an input unit, a sensor, an audio circuit, a wireless fidelity (WiFi) module, a power supply, a Bluetooth module, and the like, which are not described herein.
[0220] In the present specification, the execution subject of each step can be the electronic device described above. Alternatively, the execution subject of each step is an operating system of the electronic device. The operating system can be an Android system, an IOS system, or other operating systems, and the present specification does not limit the operating system.
[0221] The electronic device of the present specification can further have a display device installed thereon. The display device can be various devices capable of realizing a display function, for example, a cathode ray tube display (CR), a light-emitting diode display (LED), an electronic ink screen, a liquid crystal display (LCD), a plasma display panel (PDP), etc. A user can view displayed text, images, videos, etc. information by using the display device on the electronic device 101. The electronic device can be a smartphone, a tablet computer, a game device, an AR (Augmented Reality) device, a car, a data storage device, an audio playback device, a video playback device, a notebook, a desktop computing device, a server device, a wearable device (such as an electronic watch, electronic glasses, an electronic helmet, an electronic bracelet, an electronic necklace, an electronic clothing), etc.
[0222] In Figure 9 In the electronic device shown in FIG. 1, the processor 110 can be configured to invoke an application stored in the memory 120, and specifically perform the following operations:
[0223] acquire a target object image of a target object in a target environment;
[0224] determine a target object polarization state image of the target object based on the target object image;
[0225] perform a live attack detection process based on the target object image and the target object polarization state image to obtain a target detection type of the target object.
[0226] In one embodiment, the processor 110, in performing the determining a target object polarization state image of the target object based on the target object image, further performs the following steps:
[0227] determine a recommended polarization angle for the target object;
[0228] perform polarization imaging processing based on the recommended polarization angle and the target object image using a polarization diffusion model to obtain a target object polarization state image corresponding to the recommended polarization angle.
[0229] In one embodiment, the processor 110, in performing the live detection method, further performs the following steps:
[0230] create an initial polarization diffusion model;
[0231] collect a sample normal state image of a sample object and a plurality of sample polarization state label images corresponding to a plurality of reference polarization angles;
[0232] train an initial polarization diffusion model based on the sample normal state image, the reference polarization angle and the sample polarization state label image corresponding to the reference polarization angle until the training of the initial polarization diffusion model is completed to obtain a trained polarization diffusion model.
[0233] In one embodiment, the processor 110 performs the following steps when performing the training of the initial polarization diffusion model based on the sample normal state image, the reference polarization angle and the sample polarization state label image corresponding to the reference polarization angle:
[0234] perform at least one pre-noise adding processing on the initial polarization diffusion model based on the sample normal state image and the sample polarization state label image to obtain a forward sample image sequence, wherein a head image of the forward sample image sequence is the sample normal state image, and a tail image of the forward sample image sequence is the sample polarization state label image;
[0235] control the initial polarization diffusion model to perform reverse de-noise processing on the forward sample image sequence based on the reference polarization angle to obtain a sample polarization state prediction image corresponding to the reference polarization angle of each sequence image in the forward sample image sequence;
[0236] calculate a first model loss for the forward sample image sequence based on the sample polarization state prediction image and the sample polarization state label image, and perform parameter adjustment on the initial polarization diffusion model based on the first model loss.
[0237] In one embodiment, the processor 110 performs the following steps when performing the calculation of the first model loss for the forward sample image sequence based on the sample polarization state prediction image and the sample polarization state label image:
[0238] calculate a first Euclidean distance loss of the sample polarization state prediction image corresponding to each sequence image in the forward sample image sequence and the sample polarization state label image, and determine a first model loss based on the first Euclidean distance loss.
[0239] In one embodiment, the processor 110 performs the following steps when performing the determination of the recommended polarization angle for the target object:
[0240] perform polarization angle prediction processing on the target object image based on a polarization angle prediction model to obtain a recommended polarization angle for the target object.
[0241] In an embodiment, the processor 110, in executing the living body detection method, further executes the following steps:
[0242] creating an initial polarization angle prediction model;
[0243] collecting a sample normal state image of a sample object, and labeling a recommended polarization angle label of the sample normal state image under a sample environment;
[0244] training the initial polarization angle prediction model based on the sample normal state image and the recommended polarization angle label until the initial polarization angle prediction model is trained to obtain a trained polarization angle prediction model.
[0245] In an embodiment, the processor 110, in executing the training of the initial polarization angle prediction model based on the sample normal state image and the recommended polarization angle label, executes the following steps:
[0246] inputting the sample normal state image into the initial polarization angle prediction model to obtain a predicted recommended polarization angle under a sample environment;
[0247] calculating a second model loss based on the predicted recommended polarization angle and the recommended polarization angle label, and adjusting parameters of the initial polarization angle prediction model using the second model loss.
[0248] In an embodiment, the processor 110, in executing the calculation of the second model loss based on the predicted recommended polarization angle and the recommended polarization angle label, executes the following steps:
[0249] calculating a second Euclidean distance loss of the predicted recommended polarization angle and the recommended polarization angle label, and taking the second Euclidean distance loss as the second model loss.
[0250] In an embodiment, the processor 110, in executing the living body attack detection processing based on the target object image and the target object polarization state image, obtains a target detection type for the target object, including:
[0251] performing living body attack detection processing based on the target object image and the target object polarization state image using a living body attack prevention model to obtain a target detection type for the target object.
[0252] In an embodiment, the processor 110, in executing the living body detection method, further executes the following steps:
[0253] creating an initial living body attack prevention model;
[0254] obtain a sample normal state image and a sample polarization state image of a sample object, and label a sample living body classification result label of the sample object;
[0255] train the initial living body anti-attack model based on the sample normal state image, the sample polarization state image and the sample living body classification result label until the initial living body anti-attack model is trained to obtain a trained living body anti-attack model.
[0256] In one embodiment, the processor 110 performs the following steps when performing the training of the initial living body anti-attack model based on the sample normal state image, the sample polarization state image and the sample living body classification result label:
[0257] input the sample normal state image and the sample polarization state image into an initial living body anti-attack model to determine a sample normal state image feature and a normal state living body classification result based on the sample normal state image, a sample polarization state image feature and a polarization state living body classification result based on the sample polarization state image, a sample image residual feature and a residual state classification result based on the sample polarization state image and the sample polarization state image, and a sample fusion image feature and a fusion state classification result based on the sample normal state image feature, the sample polarization state image feature and the sample image residual feature;
[0258] calculate a third model loss based on the normal state living body classification result, the polarization state living body classification result, the residual state classification result, the fusion state classification result and the sample living body classification result label, and adjust parameters of the initial living body anti-attack model based on the third model loss.
[0259] In one embodiment, the processor 110 performs the following steps when performing the calculation of the third model loss based on the normal state living body classification result, the polarization state living body classification result, the residual state classification result, the fusion state classification result and the sample living body classification result label:
[0260] calculate a normal state living body classification loss based on the normal state living body classification result and the sample living body classification result label, a polarization state living body classification loss based on the polarization state living body classification result and the sample living body classification result label, a residual living body classification loss based on the residual state classification result and the sample living body classification result label, and a fusion living body classification loss based on the fusion state classification result and the sample living body classification result label;
[0261] obtain the third model loss based on the normal state living body classification loss, the polarization state living body classification loss, the residual living body classification loss and the fusion living body classification loss.
[0262] In one or more embodiments of the present specification, the electronic device collects a target object image of a target object in a target environment, determines a target object polarization state image of the target object, and performs a live attack detection process in combination with the target object image and the target object polarization state image. The live detection scene can improve the security of the live attack detection of the target object by combining the polarization state image, improve the detection effect of the live attack detection, ensure the security performance, and can be applied in various scenes without adding related polarization imaging hardware. The live detection method disclosed in the present specification has good universality.
[0263] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The program can be stored in a computer readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments. The storage medium can be a magnetic disc, an optical disc, a read-only memory, or a random access memory.
[0264] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data for analysis, stored data, displayed data, etc.) and signals involved in the embodiments of the present specification are all authorized by the user or fully authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions. For example, the object features, interaction behavior features and user information involved in the present specification are obtained under sufficient authorization.
[0265] The above only discloses the preferred embodiments of the present specification, and of course cannot limit the scope of the rights of the present specification. Therefore, equivalent changes made in accordance with the claims of the present specification still fall within the scope of the present specification.
Claims
1. A method for detecting liveness, the method comprising: Collect an image of the target object in the target environment, wherein the target object image is a normal state image; A recommended polarization angle for the target object is determined, and polarization imaging processing is performed using a polarization diffusion model based on the recommended polarization angle and the target object image to obtain a polarization state image of the target object corresponding to the recommended polarization angle. Based on the target object image and the target object polarization state image, a trained liveness detection model is used to perform liveness attack detection processing. The liveness detection model determines normal state image features and normal state liveness classification results based on the normal state image, polarization state image features and polarization state liveness classification results based on the polarization state image, image residual features and residual state classification results based on the normal state image and the polarization state image, and a fused state classification result based on the fused image features of the normal state image features, the polarization state image features, and the image residual features. A comprehensive classification result is determined based on the normal state liveness classification result, the polarization state liveness classification result, the residual state classification result, and the fused state classification result. Based on the comprehensive classification result, a target detection type for the target object is obtained, where the target detection type is either a liveness category or an attack category. The method further includes: Create an initial polarization diffusion model; Acquire normal state images of sample objects and polarization state label images of samples corresponding to multiple reference polarization angles; The initial polarization diffusion model is trained based on the normal state image of the sample, the reference polarization angle, and the sample polarization state label image corresponding to the reference polarization angle until the initial polarization diffusion model is trained, resulting in the trained polarization diffusion model.
2. The method according to claim 1, wherein training the initial polarization diffusion model based on the sample normal state image, the reference polarization angle, and the sample polarization state label image corresponding to the reference polarization angle includes: Based on the normal state image of the sample and the polarization state label image of the sample, at least one pre-order noise addition process is performed using the initial polarization diffusion model to obtain a forward sample image sequence. The first image of the forward sample image sequence is the normal state image of the sample, and the last image of the forward sample image sequence is the polarization state label image of the sample. The initial polarization diffusion model is controlled to perform reverse denoising processing on the forward sample image sequence based on the reference polarization angle to obtain the sample polarization state prediction image of each sequence image in the forward sample image sequence corresponding to the reference polarization angle; Based on the sample polarization state prediction image and the sample polarization state label image, a first model loss is calculated for the forward sample image sequence, and the parameters of the initial polarization diffusion model are adjusted using the first model loss.
3. The method according to claim 2, wherein calculating the first model loss for the forward sample image sequence based on the sample polarization state prediction image and the sample polarization state label image comprises: Calculate the first Euclidean distance loss between the sample polarization state prediction image and the sample polarization state label image corresponding to each sequence image in the forward sample image sequence, and determine the first model loss based on the first Euclidean distance loss.
4. The method according to claim 1, wherein determining the recommended polarization angle for the target object includes: One or more specified polarization angles are pre-set based on the liveness detection environment as recommended polarization angles for the target object; or, Based on the target object image, a polarization angle prediction model is used to predict the polarization angle to obtain a recommended polarization angle for the target object.
5. The method according to claim 4, further comprising: Create an initial polarization angle prediction model; Collect normal state images of the sample objects and label the normal state images with recommended polarization angles in the sample environment; The initial polarization angle prediction model is trained based on the sample normal state image and the recommended polarization angle label until the initial polarization angle prediction model is trained, resulting in the trained polarization angle prediction model.
6. The method according to claim 5, wherein training the initial polarization angle prediction model based on the sample normal state image and the recommended polarization angle label comprises: The normal state image of the sample is input into the initial polarization angle prediction model to obtain the predicted recommended polarization angle under the sample environment; The second model loss is calculated based on the predicted recommended polarization angle and the recommended polarization angle label, and the parameters of the initial polarization angle prediction model are adjusted using the second model loss.
7. The method according to claim 6, wherein calculating the second model loss based on the predicted recommended polarization angle and the recommended polarization angle label comprises: Calculate the second Euclidean distance loss between the predicted recommended polarization angle and the recommended polarization angle label, and use the second Euclidean distance loss as the second model loss.
8. The method according to claim 1, further comprising: Create an initial liveness detection model; Obtain the normal state image and polarization state image of the sample object, and label the sample object with the liveness classification result label; The initial liveness prevention model is trained based on the normal state image of the sample, the polarization state image of the sample, and the liveness classification result label of the sample until the initial liveness prevention model is trained, resulting in the trained liveness prevention model.
9. The method according to claim 8, wherein training the initial liveness anti-attack model based on the sample normal state image, the sample polarization state image, and the sample liveness classification result label comprises: The normal state image and the polarization state image of the sample are input into the initial liveness prevention model to determine the normal state image features and normal state liveness classification results based on the normal state image, the polarization state image features and polarization state liveness classification results based on the polarization state image, the residual features and residual state classification results of the sample image based on the normal state image and the polarization state image, and the fused image features and fused state classification results of the sample image based on the normal state image features, the polarization state image features and the residual features of the sample image. The third model loss is calculated based on the normal state liveness classification result, the polarization state liveness classification result, the residual state classification result, the fusion state classification result, and the sample liveness classification result label. The parameters of the initial liveness anti-attack model are then adjusted using the third model loss.
10. The method according to claim 9, wherein calculating the third model loss based on the normal state liveness classification result, the polarization state liveness classification result, the residual state classification result, the fused state classification result, and the sample liveness classification result label comprises: Calculate the normal liveness classification loss based on the normal liveness classification results and the labels of the sample liveness classification results; The polarization-state liveness classification loss is calculated based on the polarization-state liveness classification results and the labels of the sample liveness classification results. Calculate the residual liveness classification loss based on the residual state classification result and the sample liveness classification result label; calculate the fusion liveness classification loss based on the fusion state classification result and the sample liveness classification result label; The third model loss is obtained based on the normal state liveness classification loss, the polarization state liveness classification loss, the residual liveness classification loss, and the fused liveness classification loss.
11. A liveness detection device, the device comprising: The object image acquisition module is used to acquire the target object image of the target object in the target environment, wherein the target object image is a normal state image; The polarization image determination module is used to determine a recommended polarization angle for the target object, and to perform polarization imaging processing using a polarization diffusion model based on the recommended polarization angle and the target object image to obtain a polarization state image of the target object corresponding to the recommended polarization angle. The liveness attack detection module is used to perform liveness attack detection processing based on the target object image and the target object polarization state image using a trained liveness anti-attack model. The liveness anti-attack model determines normal state image features and normal state liveness classification results based on the normal state image, polarization state image features and polarization state liveness classification results based on the polarization state image, image residual features and residual state classification results based on the normal state image and the polarization state image, and a fused state classification result based on the fused image features of the normal state image features, the polarization state image features, and the image residual features. A comprehensive classification result is determined based on the normal state liveness classification result, the polarization state liveness classification result, the residual state classification result, and the fused state classification result. Based on the comprehensive classification result, a target detection type for the target object is obtained, where the target detection type is either a liveness category or an attack category. The device is also used for: Create an initial polarization diffusion model; Acquire normal state images of sample objects and polarization state label images of samples corresponding to multiple reference polarization angles; The initial polarization diffusion model is trained based on the normal state image of the sample, the reference polarization angle, and the sample polarization state label image corresponding to the reference polarization angle until the initial polarization diffusion model is trained, resulting in the trained polarization diffusion model.
12. A computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the method as claimed in any one of claims 1 to 10.
13. A computer program product storing at least one instruction, said at least one instruction being loaded by a processor and executing the method as claimed in any one of claims 1 to 10.
14. An electronic device, comprising: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Living body detection method and system for target object
CN111401348A
Polarization image generation method and device, electronic equipment and readable storage medium
CN115424327A