Live detection method, device, apparatus and storage medium
By colorizing and scene-transforming inactive face images, adversarial images are generated and the liveness detection model is adjusted. This solves the problem of the liveness detection model being vulnerable to attacks, improves detection and defense capabilities, and ensures the accuracy of image detection results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PING AN TECH (SHENZHEN) CO LTD
- Filing Date
- 2023-02-27
- Publication Date
- 2026-05-22
AI Technical Summary
Existing liveness detection models are vulnerable to attacks, which can cause non-live face images to be misclassified as live, leading to the paralysis of the face recognition system and posing a security risk.
By colorizing and scene-transforming non-live face images, filter images are generated. These images are then detected using a pre-set liveness detection network. The transformation misclassification rate and face quality score are calculated, and the process is iteratively updated until the preset requirements are met. Finally, adversarial images are generated to adjust the liveness detection model.
It improves the detection and defense capabilities of the liveness detection model, enhances its ability to resist attacks, and improves the accuracy of image detection results.
Smart Images

Figure CN116206374B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, apparatus, device, and storage medium for detecting liveness. Background Technology
[0002] With the emergence of attack methods such as printing, photographing, and masking, facial recognition systems have been subjected to security threats. To distinguish between live and fake faces, liveness detection models have been introduced into facial recognition systems. However, adversarial perturbations have made liveness detection models vulnerable to attack. Specifically, attackers can modify the pixels of a fake face, causing the liveness detection model to misclassify the fake face as live, thus bypassing the liveness detection model and entering the face matching process along with a clean, live face. If the face matching result matches the clean sample, this will paralyze the entire facial recognition system and cause security problems.
[0003] Therefore, it is necessary to study physical attacks on faces in order to improve the detection and defense capabilities of liveness detection models. Summary of the Invention
[0004] In view of the above, it is necessary to provide a liveness detection method, apparatus, device, and storage medium that can solve the technical problem of how to improve the detection and defense capabilities of liveness detection models.
[0005] On one hand, the present invention proposes a liveness detection method, the liveness detection method comprising:
[0006] The acquired inactive human face image is colorized to obtain the filter image;
[0007] The filter image is subjected to scene transformation processing to obtain the initial transformed image;
[0008] Liveness detection is performed on the transformed image based on a preset liveness detection network to obtain liveness detection results;
[0009] The transformation misclassification rate of the transformed image is calculated based on the liveness detection results, and the transformed face quality score of the transformed image is calculated based on the liveness detection results.
[0010] Based on the transformation misclassification rate and the transformation face quality score, the transformation fitness difference of the transformed image is calculated;
[0011] If the transformation misclassification rate and / or the transformation face quality score do not meet the first preset requirement, and / or the transformation fitness difference does not meet the second preset requirement, then the transformation image is iteratively updated to obtain an updated image after each iteration, until the update misclassification rate and update face quality score corresponding to the updated image after each iteration meet the first preset requirement, and / or the update fitness difference corresponding to the updated image after each iteration meets the second preset requirement, then the updated image after each iteration is determined as an adversarial image;
[0012] Based on the adversarial image, the parameters of the preset liveness detection network are adjusted to obtain a liveness detection model;
[0013] Based on the liveness detection model, the image detection result is obtained by responding to the received liveness detection request and the corresponding image to be tested.
[0014] According to a preferred embodiment of the present invention, the step of colorizing the acquired non-living human face image to obtain a filter image includes:
[0015] The inactive human face image is converted to grayscale to obtain a grayscale image;
[0016] Obtain the grayscale value of the grayscale image and obtain the filter channel value of the preset filter;
[0017] An update channel value is generated based on the grayscale value and the filter channel value. The formula for generating the update channel value is as follows:
[0018] Among them, R f G represents the updated channel value on the red channel. f B represents the updated channel value on the green channel. f This represents the updated channel value on the blue channel, r. f g represents the filter channel value on the red channel. f b represents the filter channel value on the green channel. f This represents the filter channel value on the blue channel, gray represents the grayscale value, and clip(r) represents the filter channel value on the blue channel. f ×gray,,)clip9g f ×gray,a,b) and clip(b) f ×gray,a,b) all indicate that the updated channel value is in the interval [a,b], where a and b are preset positive integers;
[0019] The non-live face image is adjusted according to the updated channel value to obtain the filter image.
[0020] According to a preferred embodiment of the present invention, the step of performing scene transformation processing on the filter image to obtain the initial transformed image includes:
[0021] The filter image is illuminated based on a preset light beam to obtain an illuminated image.
[0022] The brightness of the illumination image is adjusted based on a preset brightness coefficient to obtain a brightness image. The formula for generating the brightness value in the brightness image is: x l =clip(λx) g (a, b), where x l λ represents the image brightness value, λ represents the preset brightness coefficient, and x represents the image brightness value. g Clip(λx) represents the illuminance value of the illumination image. g (a, b) indicates that the image brightness value is in the interval [a, b], where a and b are the preset positive integers;
[0023] The brightness image is corrected based on a preset correction coefficient to obtain the transformed image. The formula for generating the transformed brightness value in the transformed image is: Where, x b The variable brightness value is represented by γ, which represents the preset correction coefficient, and x represents the variable brightness value. l This represents the image brightness value. This indicates that the transformed brightness value is in the range [a, b], where a and b are the preset positive integers.
[0024] According to a preferred embodiment of the present invention, the formula for generating the illumination channel value of each pixel in the illumination image is:
[0025] in, This represents the illumination channel value of the (i,j)th pixel in the illumination image on the red channel. This represents the illumination channel value of the (i,j)th pixel in the green channel. R represents the illumination channel value of the (i,j)th pixel in the blue channel. ij G represents the filter channel value of the (i,j)th pixel on the red channel. ij B represents the filter channel value of the (i,j)th pixel in the green channel. ij κ represents the filter channel value of the (i,j)th pixel on the blue channel, d represents the illumination coefficient, and d represents the filter channel value of the (i,j)th pixel. ij This indicates the distance from the (i,j)th pixel to the illumination center (x) of the preset light beam. c ,y c The distance R cThe light radius of the preset light beam is represented by clip(,a,b), which indicates that the light channel value is in the interval [a,b], where a and b are the preset positive integers.
[0026] According to a preferred embodiment of the present invention, the formula for calculating the transformation misclassification rate is: y = E t~T [1(f(x c )=0)], where y represents the transformation misclassification rate, T represents the image set composed of the transformed images, l(·) represents the indicator function, f represents the preset liveness detection network, x c Let f(x) represent the c-th transformed image in the image set. c ) = 0 indicates that the liveness detection result of the c-th transformed image is the first preset result;
[0027] The formula for calculating the transformed face quality score is as follows:
[0028] z = E T~T [(1-Q(x c ))1(f(x c )=1)],where z represents the transformed face quality score, T represents the image set, Q(x c ) represents the image quality score of the c-th transformed image.
[0029] f(x c ) = 1 indicates that the liveness detection result of the c-th transformed image is the second preset result.
[0030] According to a preferred embodiment of the present invention, after iteratively updating the transformed image to obtain an updated image after each iteration, the liveness detection method further includes:
[0031] Compare the updated fitness difference with the preset difference;
[0032] If the absolute value of the update fitness difference is less than the preset difference, then the scene iteration number of the updated image corresponding to the update fitness difference is counted.
[0033] If the number of scene iterations is greater than or equal to the first preset number, then the update fitness difference is determined to meet the second preset requirement.
[0034] According to a preferred embodiment of the present invention, if the updated misclassification rate and / or the updated face quality score do not meet the first preset requirement, and / or the updated fitness difference does not meet the second preset requirement, the liveness detection method further includes:
[0035] Count the number of image iterations for the updated image;
[0036] If the number of image iterations is greater than or equal to the second preset number, then a configuration filter is used to colorize the non-living face image.
[0037] On the other hand, the present invention also proposes a liveness detection device, the liveness detection device comprising:
[0038] The processing unit is used to perform colorization processing on the acquired inactive human face image to obtain a filter image;
[0039] A transformation unit is used to perform scene transformation processing on the filter image to obtain an initial transformed image;
[0040] The detection unit is used to perform liveness detection on the transformed image based on a preset liveness detection network to obtain liveness detection results;
[0041] The calculation unit is used to calculate the transformation misclassification rate of the transformed image based on the liveness detection result, and to calculate the transformed face quality score of the transformed image based on the liveness detection result;
[0042] The calculation unit is also used to calculate the transformation fitness difference of the transformed image based on the transformation misclassification rate and the transformed face quality score;
[0043] An iterative unit is configured to perform scene iterative updates on the transformed image if the transformation misclassification rate and / or the transformation face quality score do not meet a first preset requirement, and / or the transformation fitness difference does not meet a second preset requirement, to obtain an updated image after each iteration, until the updated misclassification rate and updated face quality score corresponding to the updated image after iteration meet the first preset requirement, and / or the updated fitness difference corresponding to the updated image after iteration meets the second preset requirement, and then determine the updated image after iteration as an adversarial image;
[0044] An adjustment unit is used to adjust the parameters of the preset liveness detection network based on the adversarial image to obtain a liveness detection model.
[0045] The response unit is used to respond to the image to be tested corresponding to the received liveness detection request based on the liveness detection model, and obtain the image detection result.
[0046] On the other hand, the present invention also proposes an electronic device, the electronic device comprising:
[0047] Memory, which stores computer-readable instructions; and
[0048] The processor executes computer-readable instructions stored in the memory to implement the liveness detection method.
[0049] On the other hand, the present invention also proposes a computer-readable storage medium storing computer-readable instructions, which are executed by a processor in an electronic device to implement the liveness detection method.
[0050] As can be seen from the above technical solutions, this application can simulate the lighting effects of real life by colorizing the non-living face image. Simultaneously, it can achieve unrestricted perturbation of the non-living face image without changing the image semantics, thereby improving the generation efficiency of the filter image. Furthermore, by performing scene transformation processing on the filter image, the transformed image can adapt to actual shooting scenarios (such as shooting angle, shooting distance, background light intensity, etc.). This application uses the preset liveness detection network as a benchmark to detect the transformed image, which can reasonably quantify the transformation misclassification rate and the transformed face quality score, thereby improving the transformation fitness difference. The quantitative rationality is further demonstrated by the fact that when the transformation misclassification rate and / or the transformation face quality score do not meet the first preset requirement, and / or the transformation fitness difference does not meet the second preset requirement, it indicates that the transformed image is not the optimal image for attacking the preset liveness detection network. Therefore, by iteratively updating the scene of the transformed image, the attack capability of the adversarial image on the preset liveness detection network is improved. Furthermore, by adjusting the preset liveness detection network through the adversarial image, the defense capability of the liveness detection model against the attacking image can be improved, thereby improving the detection capability and accuracy of the liveness detection model, and further improving the accuracy of the generated image detection results. Attached Figure Description
[0051] Figure 1 This is a flowchart of a preferred embodiment of the liveness detection method of the present invention.
[0052] Figure 2 This is a schematic diagram of an embodiment of generating adversarial images in the liveness detection method of the present invention.
[0053] Figure 3 This is a functional block diagram of a preferred embodiment of the liveness detection device of the present invention.
[0054] Figure 4 This is a schematic diagram of the structure of an electronic device that implements the liveness detection method of the present invention. Detailed Implementation
[0055] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0056] like Figure 1The diagram shown is a flowchart of a preferred embodiment of the liveness detection method of the present invention. The order of the steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements.
[0057] The liveness detection method described above can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0058] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0059] The liveness detection method is applied to one or more electronic devices. The electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored computer-readable instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0060] The electronic device can be any electronic product that can interact with the user, such as a personal computer, tablet computer, smartphone, personal digital assistant (PDA), game console, interactive network television (IPTV), smart wearable device, etc.
[0061] The electronic devices may include network devices and / or user devices. The network devices include, but are not limited to, single network electronic devices, groups of multiple network electronic devices, or cloud computing-based systems consisting of a large number of hosts or network electronic devices.
[0062] The network in which the electronic device is located includes, but is not limited to: the Internet, wide area network, metropolitan area network, local area network, virtual private network (VPN), etc.
[0063] 101. The acquired non-live human face image is colorized to obtain the filter image.
[0064] In at least one embodiment of the present invention, the non-living face image refers to a face image labeled as non-living. The non-living face image can be obtained from a face database.
[0065] In this application, since misclassifying a live image as a non-live image is not practically meaningful, this application improves the analytical rationality of liveness detection by acquiring the non-live face image.
[0066] The filter image refers to the image obtained by colorizing the inactive face image based on any filter color. The filter image also refers to the image obtained by illuminating the inactive face image with simulated real-life lighting.
[0067] In at least one embodiment of the present invention, the electronic device performs colorization processing on the acquired inactive human face image to obtain a filter image, including:
[0068] The inactive human face image is converted to grayscale to obtain a grayscale image;
[0069] Obtain the grayscale value of the grayscale image and obtain the filter channel value of the preset filter;
[0070] An update channel value is generated based on the grayscale value and the filter channel value. The formula for generating the update channel value is as follows:
[0071] Among them, R f G represents the updated channel value on the red channel. f B represents the updated channel value on the green channel. f This represents the updated channel value on the blue channel, r. f g represents the filter channel value on the red channel. f b represents the filter channel value on the green channel. f This represents the filter channel value on the blue channel, gray represents the grayscale value, and clip(r) represents the filter channel value on the blue channel. f ×gray,,)clip(g f ×gray,a,b) and clip(b) f ×gray,a,b) all indicate that the updated channel value is in the interval [a,b], where a and b are preset positive integers;
[0072] The non-live face image is adjusted according to the updated channel value to obtain the filter image.
[0073] The preset filter can be a filter corresponding to any color of illumination light.
[0074] a and b can be set according to actual needs. For example, a can be set to 0 and b can be set to 255.
[0075] By performing grayscale processing on the non-live face image, a grayscale image with a single channel pixel value can be obtained. By adding the preset filter to the grayscale image, the effect of lighting in real life can be simulated. Color perturbation can be added without changing the semantics of the image, making the filter image closer to real life. This can help to combat false positives in liveness detection caused by lighting effects during face recognition in real life.
[0076] 102. Perform scene transformation processing on the filter image to obtain the initial transformed image.
[0077] In at least one embodiment of the present invention, the transformed image refers to the image generated after directly transforming the filter image by scene.
[0078] In at least one embodiment of the present invention, the electronic device performs scene transformation processing on the filter image to obtain an initial transformed image, including:
[0079] The filter image is illuminated based on a preset light beam to obtain an illuminated image.
[0080] The brightness of the illumination image is adjusted based on a preset brightness coefficient to obtain a brightness image. The formula for generating the brightness value in the brightness image is: x l =clip(λx) g ,,), where x l λ represents the image brightness value, λ represents the preset brightness coefficient, and x represents the image brightness value. g Clip(λx) represents the illuminance value of the illumination image. g ,,) indicates that the image brightness value is in the range [a,b], where a and b are the preset positive integers;
[0081] The brightness image is corrected based on a preset correction coefficient to obtain the transformed image. The formula for generating the transformed brightness value in the transformed image is: Where, x b The variable brightness value is represented by γ, which represents the preset correction coefficient, and x represents the variable brightness value. l This represents the image brightness value. This indicates that the transformed brightness value is in the range [a, b], where a and b are the preset positive integers.
[0082] The preset beam is a beam generated to simulate the halo that appears when taking pictures in a real-world scene, and the center of the preset beam can be on the filter image.
[0083] The preset brightness coefficient and the preset correction coefficient can be set according to actual needs, and can be adjusted during subsequent iterative scene changes.
[0084] a and b can be set according to actual needs. For example, a can be set to 0 and b can be set to 255.
[0085] By setting the light center on the filter image, the halo effect that occurs when taking photos of real-world scenes can be simulated, avoiding unnatural images caused by adding the preset filter, and making the lighting image more realistic. Adjusting the brightness of the lighting image using the preset brightness coefficient can prevent the lighting image from being affected by the background brightness due to the shooting scene. Correcting the brightness image using the preset correction coefficient can solve the problem of the difference between the physical scene perceived by the human eye and the photograph.
[0086] Specifically, the formula for generating the illumination channel value of each pixel in the illumination image is as follows:
[0087] in, This represents the illumination channel value of the (i,j)th pixel in the illumination image on the red channel. This represents the illumination channel value of the (i,j)th pixel in the green channel. R represents the illumination channel value of the (i,j)th pixel in the blue channel. ij G represents the filter channel value of the (i,j)th pixel on the red channel. ij B represents the filter channel value of the (i,j)th pixel in the green channel. ij κ represents the filter channel value of the (i,j)th pixel on the blue channel, d represents the illumination coefficient, and d represents the filter channel value of the (i,j)th pixel. ij This indicates the distance from the (i,j)th pixel to the illumination center (x) of the preset light beam. c ,y c The distance R c The light radius of the preset light beam is represented by clip(,a,b), which indicates that the light channel value is in the interval [a,b], where a and b are the preset positive integers.
[0088] The illumination coefficient can be set according to actual needs, and can be adjusted during subsequent iterative scene changes.
[0089] a and b can be set according to actual needs. For example, a can be set to 0 and b can be set to 255.
[0090] In other embodiments, the electronic device may adjust the brightness of the filter image based on the preset brightness coefficient.
[0091] In other embodiments, the electronic device may perform brightness correction on the filter image or the illumination image based on the preset correction coefficient.
[0092] In other embodiments, the electronic device may also perform scene transformation processing on the filter image, the illumination image, the brightness image and the transformed image based on transformation methods such as translation, rotation, cropping, and Gaussian blur, so as to simulate the actual shooting scene.
[0093] 103. Perform liveness detection on the transformed image based on a preset liveness detection network to obtain liveness detection results.
[0094] In at least one embodiment of the present invention, the preset liveness detection network can be used to detect whether a face image belongs to a live face image. This application does not limit the specific network structure of the preset liveness detection network.
[0095] The liveness detection results include: the transformed image is a non-liveness image, and the transformed image is a liveness image.
[0096] 104. Calculate the transformation misclassification rate of the transformed image based on the liveness detection results, and calculate the transformed face quality score of the transformed image based on the liveness detection results.
[0097] In at least one embodiment of the present invention, the transformation misclassification rate refers to the ratio of the transformed image to a non-living image.
[0098] The transformed face quality score refers to the average image quality score that identifies the transformed image as a live image.
[0099] In at least one embodiment of the present invention, the formula for calculating the transformation misclassification rate is:
[0100] y = E t~T [1(f(x c )=0)], where y represents the transformation misclassification rate, T represents the image set composed of the transformed images, l(·) represents the indicator function, f represents the preset liveness detection network, xc Let f(x) represent the c-th transformed image in the image set. c ) = 0 indicates that the liveness detection result of the c-th transformed image is the first preset result.
[0101] The first preset result is usually set to a non-living image.
[0102] For example, if the image set includes 200 transformed images, and the preset liveness detection network identifies 150 transformed images as non-live images and 50 transformed images as live images, then the transformation misclassification rate is calculated to be 0.75.
[0103] In this application, since it is necessary to acquire as many transformed images as possible that are classified as live images, the transformation misclassification rate can be calculated by using the transformed images whose liveness detection results are the first preset results, thereby improving the accuracy of the transformation misclassification rate.
[0104] In at least one embodiment of the present invention, the formula for calculating the transformed face quality score is:
[0105] z = E t~T [(1-Q(x c ))1(f(x c )=1)],where z represents the transformed face quality score, T represents the image set, Q(x c ) represents the image quality score of the c-th transformed image.
[0106] f(x c ) = 1 indicates that the liveness detection result of the c-th transformed image is the second preset result.
[0107] The second preset result is usually set to a live image.
[0108] The image quality score can be determined based on information such as the sharpness of the transformed image. Alternatively, the image quality score can be generated by detecting the transformed image using a pre-trained quality detection model; the quality detection model is not specifically limited in this application.
[0109] By calculating the transformed face quality score from the transformed image whose liveness detection result is the second preset result, the image quality of the liveness image can be ensured, thereby enabling face attacks to be completed without reducing image quality.
[0110] 105. Based on the transformation misclassification rate and the transformation face quality score, calculate the transformation fitness difference of the transformed image.
[0111] In at least one embodiment of the present invention, the transform fitness difference refers to the difference between the fitness value of the transformed image and a preset threshold. The preset threshold can be set according to actual needs, and is typically set to 0.
[0112] In at least one embodiment of the present invention, the electronic device calculates the sum of the transformation misclassification rate and the transformation face quality score to obtain the fitness value of the transformation image.
[0113] 106. If the transformation misclassification rate and / or the transformation face quality score do not meet the first preset requirement, and / or the transformation fitness difference does not meet the second preset requirement, then the transformation image is iteratively updated to obtain an updated image after each iteration, until the updated misclassification rate and updated face quality score corresponding to the updated image after iteration meet the first preset requirement, and / or the updated fitness difference corresponding to the updated image after iteration meets the second preset requirement, and the updated image after iteration is determined as an adversarial image.
[0114] In at least one embodiment of the present invention, in order to balance the transformation misclassification rate and the transformation face quality score, the first preset requirement can be set such that the transformation misclassification rate is less than a first configured value and the transformation face quality score is greater than a second configured value. The first configured value and the second configured value can be set according to actual needs. For example, the first configured value can be set to 0.1 and the second configured value can be set to 0.5.
[0115] The second preset requirement can be set to the absolute value of the cumulative first preset number of transformation fitness differences being less than a preset difference. In other words, the second preset requirement indicates that the fitness value of the updated images does not change or changes only slightly for the first preset number of consecutive updates. The preset difference and the first preset number of times can be set according to actual needs; for example, the preset difference can be set to 0, and the first preset number of times can be set to 10.
[0116] By setting the second preset requirement, it is possible to avoid the fitness value of the updated image generated in the current iteration from getting trapped in a local minimum.
[0117] The calculation method for the updated misclassification rate is similar to that for the transformed misclassification rate, and the calculation method for the updated face quality score is similar to that for the transformed face quality score. Therefore, this application will not elaborate further on these methods.
[0118] The update fitness difference refers to the difference between the fitness value of the updated image generated in the current iteration and the fitness value of the updated image or transformed image generated in the previous iteration.
[0119] The adversarial image includes: a transformed image in which the transformed misclassification rate and the transformed face quality score meet the first preset requirement, and / or the transformed fitness difference meets the second preset requirement; an updated image in which the updated misclassification rate and the updated face quality score meet the first preset requirement, and / or the updated fitness difference meets the second preset requirement; the adversarial image also includes the updated image corresponding to the iterated updated image in which the updated misclassification rate and the updated face quality score meet the first preset requirement, and the fitness value of the iterated updated image is the minimum.
[0120] In other embodiments, if the updated misclassification rate and updated face quality score corresponding to the iterated updated image meet the first preset requirements, and the fitness value of the iterated updated image is the smallest, then the electronic device determines the iterated updated image as the adversarial image.
[0121] In other embodiments, if the transformation misclassification rate and the transformation face quality score meet the first preset requirement, and / or the transformation fitness difference meets the second preset requirement, then the electronic device determines the transformed image as the adversarial image.
[0122] In at least one embodiment of the present invention, the electronic device performs scene iterative updates on the transformed image to obtain an updated image after each iteration, including:
[0123] Adjust the illumination coefficient and / or the preset brightness coefficient and / or the preset correction coefficient;
[0124] The scene transformation is performed on the transformed image or the updated image generated in the previous iteration based on the adjusted illumination coefficient and / or the adjusted preset brightness coefficient and / or the adjusted preset correction coefficient to obtain the updated image after iteration.
[0125] In at least one embodiment of the present invention, after iteratively updating the transformed image to obtain an updated image after each iteration, the liveness detection method further includes:
[0126] Compare the updated fitness difference with the preset difference;
[0127] If the absolute value of the update fitness difference is less than the preset difference, then the scene iteration number of the updated image corresponding to the update fitness difference is counted.
[0128] If the number of scene iterations is greater than or equal to the first preset number, then the update fitness difference is determined to meet the second preset requirement.
[0129] Through the above implementation method, it is possible to quickly identify whether the update fitness difference meets the second preset requirement.
[0130] In at least one embodiment of the present invention, if the updated misclassification rate and / or the updated face quality score do not meet the first preset requirement, and / or the updated fitness difference does not meet the second preset requirement, the liveness detection method further includes:
[0131] Count the number of image iterations for the updated image;
[0132] If the number of image iterations is greater than or equal to the second preset number, then a configuration filter is used to colorize the non-living face image.
[0133] The second preset number of times can be set according to actual needs.
[0134] The configured filter can be a filter of a different color than the preset filter.
[0135] When the number of image iterations is greater than or equal to the second preset number, this application reprocesses the non-live human face image using the configured filter, which can improve the generation efficiency of the adversarial image.
[0136] like Figure 2 The diagram shown is a schematic representation of an embodiment of the liveness detection method of the present invention, which generates adversarial images. Figure 2 In the process, the electronic device performs colorization processing on the non-live face image, further performs scene transformation processing on the colorized image, and further checks whether the scene transformation image meets the first preset requirement and the second preset requirement. If it meets the requirement, the scene transformation image is determined as an adversarial image. If it does not meet the iteration termination condition, the filter of the non-live face image is updated.
[0137] 107. Based on the adversarial image, the parameters of the preset liveness detection network are adjusted to obtain a liveness detection model.
[0138] In at least one embodiment of the present invention, the liveness detection model refers to a model generated by adjusting the parameters of the preset liveness detection network using the adversarial image.
[0139] In at least one embodiment of the present invention, the electronic device adjusts the parameters of the preset liveness detection network based on the adversarial image to obtain a liveness detection model, including:
[0140] The network parameters of the preset liveness detection network are adjusted to obtain the adjusted liveness detection network. The adversarial image is then predicted based on the adjusted liveness detection network until the adjusted liveness detection network predicts the adversarial image as a non-live image, thus obtaining the liveness detection model.
[0141] Through the above implementation method, since the parameters of the preset liveness detection network can be adjusted using non-live images (i.e., adversarial images) that are misclassified as live images by the preset liveness detection network, the detection capability and defense capability of the liveness detection model can be improved.
[0142] 108. Based on the liveness detection model, respond to the image to be tested corresponding to the received liveness detection request, and obtain the image detection result.
[0143] It should be emphasized that, to further ensure the privacy and security of the above image detection results, the image detection results can also be stored in a blockchain node.
[0144] In at least one embodiment of the present invention, the image to be tested can be obtained from an image library based on the liveness detection request.
[0145] The image detection results include: the image to be tested is a live image, the image to be tested is a non-live image, etc.
[0146] In at least one embodiment of the present invention, the electronic device generates the image detection result in a manner similar to the electronic device generating the liveness detection result.
[0147] As can be seen from the above technical solutions, this application can simulate the lighting effects of real life by colorizing the non-living face image. Simultaneously, it can achieve unrestricted perturbation of the non-living face image without changing the image semantics, thereby improving the generation efficiency of the filter image. Furthermore, by performing scene transformation processing on the filter image, the transformed image can adapt to actual shooting scenarios (such as shooting angle, shooting distance, background light intensity, etc.). This application uses the preset liveness detection network as a benchmark to detect the transformed image, which can reasonably quantify the transformation misclassification rate and the transformed face quality score, thereby improving the transformation fitness difference. The quantitative rationality is further demonstrated by the fact that when the transformation misclassification rate and / or the transformation face quality score do not meet the first preset requirement, and / or the transformation fitness difference does not meet the second preset requirement, it indicates that the transformed image is not the optimal image for attacking the preset liveness detection network. Therefore, by iteratively updating the scene of the transformed image, the attack capability of the adversarial image on the preset liveness detection network is improved. Furthermore, by adjusting the preset liveness detection network through the adversarial image, the defense capability of the liveness detection model against the attacking image can be improved, thereby improving the detection capability and accuracy of the liveness detection model, and further improving the accuracy of the generated image detection results.
[0148] like Figure 3 The diagram shown is a functional block diagram of a preferred embodiment of the liveness detection device of the present invention. The liveness detection device 11 includes a processing unit 110, a transformation unit 111, a detection unit 112, a calculation unit 113, an iteration unit 114, an adjustment unit 115, a response unit 116, a comparison unit 117, and a determination unit 118. The module / unit referred to in this invention refers to a series of computer-readable instruction segments that can be acquired by the processor 13 and perform a fixed function, and which are stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0149] Processing unit 110 is used to perform colorization processing on the acquired non-live human face image to obtain a filter image;
[0150] Transformation unit 111 is used to perform scene transformation processing on the filter image to obtain an initial transformed image;
[0151] Detection unit 112 is used to perform liveness detection on the transformed image based on a preset liveness detection network to obtain liveness detection results;
[0152] The calculation unit 113 is used to calculate the transformation misclassification rate of the transformed image based on the liveness detection result, and to calculate the transformed face quality score of the transformed image based on the liveness detection result;
[0153] The calculation unit 113 is also used to calculate the transformation fitness difference of the transformed image based on the transformation misclassification rate and the transformed face quality score;
[0154] The iteration unit 114 is configured to perform scene iterative updates on the transformed image if the transformation misclassification rate and / or the transformation face quality score do not meet the first preset requirement, and / or the transformation fitness difference does not meet the second preset requirement, so as to obtain an updated image after each iteration, until the updated misclassification rate and updated face quality score corresponding to the updated image after iteration meet the first preset requirement, and / or the updated fitness difference corresponding to the updated image after iteration meets the second preset requirement, and then determine the updated image after iteration as an adversarial image;
[0155] Adjustment unit 115 is used to adjust the parameters of the preset liveness detection network based on the adversarial image to obtain a liveness detection model;
[0156] The response unit 116 is used to respond to the image to be tested corresponding to the received liveness detection request based on the liveness detection model, and obtain the image detection result.
[0157] In at least one embodiment of the present invention, the processing unit 110 is further configured to perform grayscale processing on the non-living human face image to obtain a grayscale image;
[0158] Obtain the grayscale value of the grayscale image and obtain the filter channel value of the preset filter;
[0159] An update channel value is generated based on the grayscale value and the filter channel value. The formula for generating the update channel value is as follows:
[0160] Among them, R f G represents the updated channel value on the red channel. f B represents the updated channel value on the green channel. f This represents the updated channel value on the blue channel, r. f g represents the filter channel value on the red channel. f b represents the filter channel value on the green channel. f This represents the filter channel value on the blue channel, gray represents the grayscale value, and clip(r) represents the filter channel value on the blue channel. f ×gray,,)clip9g f ×gray,a,b) and clip(b)f ×gray,a,b) all indicate that the updated channel value is in the interval [a,b], where a and b are preset positive integers;
[0161] The non-live face image is adjusted according to the updated channel value to obtain the filter image.
[0162] In at least one embodiment of the present invention, the transformation unit 111 is further configured to perform illumination processing on the filter image based on a preset light beam to obtain an illumination image;
[0163] The brightness of the illumination image is adjusted based on a preset brightness coefficient to obtain a brightness image. The formula for generating the brightness value in the brightness image is: x l =clip(λx) g ,,), where x l λ represents the image brightness value, λ represents the preset brightness coefficient, and x represents the image brightness value. g Clip(λx) represents the illuminance value of the illumination image. g ,,) indicates that the image brightness value is in the range [a,b], where a and b are the preset positive integers;
[0164] The brightness image is corrected based on a preset correction coefficient to obtain the transformed image. The formula for generating the transformed brightness value in the transformed image is: Where, x b The variable brightness value is represented by γ, which represents the preset correction coefficient, and x represents the variable brightness value. l This represents the image brightness value. This indicates that the transformed brightness value is in the range [a, b], where a and b are the preset positive integers.
[0165] In at least one embodiment of the present invention, the formula for generating the illumination channel value of each pixel in the illumination image is as follows:
[0166] in, This represents the illumination channel value of the (i,j)th pixel in the illumination image on the red channel. This represents the illumination channel value of the (i,j)th pixel in the green channel. R represents the illumination channel value of the (i,j)th pixel in the blue channel. ij G represents the filter channel value of the (i,j)th pixel on the red channel. ij B represents the filter channel value of the (i,j)th pixel in the green channel. ij κ represents the filter channel value of the (i,j)th pixel on the blue channel, d represents the illumination coefficient, and d represents the filter channel value of the (i,j)th pixel.ij This indicates the distance from the (i,j)th pixel to the illumination center (x) of the preset light beam. c ,y c The distance R c The light radius of the preset light beam is represented by clip(,a,b), which indicates that the light channel value is in the interval [a,b], where a and b are the preset positive integers.
[0167] In at least one embodiment of the present invention, the formula for calculating the transformation misclassification rate is: y = E t~T [1(f(x c )=0)], where y represents the transformation misclassification rate, T represents the image set composed of the transformed images, l(·) represents the indicator function, f represents the preset liveness detection network, x c Let f(x) represent the c-th transformed image in the image set. c ) = 0 indicates that the liveness detection result of the c-th transformed image is the first preset result;
[0168] The formula for calculating the transformed face quality score is as follows:
[0169] z = E t~T [(1-Q(x c ))1(f(x c )=1)],where z represents the transformed face quality score, T represents the image set, Q(x c f(x) represents the image quality score of the c-th transformed image. c ) = 1 indicates that the liveness detection result of the c-th transformed image is the second preset result.
[0170] In at least one embodiment of the present invention, after scene iterative update of the transformed image to obtain the updated image after each iteration, the comparison unit 117 is used to compare the update fitness difference with a preset difference.
[0171] The calculation unit 113 is further configured to count the number of scene iterations of the updated image corresponding to the update fitness difference if the absolute value of the update fitness difference is less than the preset difference.
[0172] The determining unit 118 is used to determine that the update fitness difference meets the second preset requirement if the number of scene iterations is greater than or equal to the first preset number.
[0173] In at least one embodiment of the present invention, if the updated misclassification rate and / or the updated face quality score do not meet the first preset requirement, and / or the updated fitness difference does not meet the second preset requirement, the calculation unit 113 is further used to count the number of image iterations of the updated image;
[0174] The processing unit 110 is further configured to perform colorization processing on the non-live human face image using a configuration filter if the number of image iterations is greater than or equal to a second preset number.
[0175] As can be seen from the above technical solutions, this application can simulate the lighting effects of real life by colorizing the non-living face image. Simultaneously, it can achieve unrestricted perturbation of the non-living face image without changing the image semantics, thereby improving the generation efficiency of the filter image. Furthermore, by performing scene transformation processing on the filter image, the transformed image can adapt to actual shooting scenarios (such as shooting angle, shooting distance, background light intensity, etc.). This application uses the preset liveness detection network as a benchmark to detect the transformed image, which can reasonably quantify the transformation misclassification rate and the transformed face quality score, thereby improving the transformation fitness difference. The quantitative rationality is further demonstrated by the fact that when the transformation misclassification rate and / or the transformation face quality score do not meet the first preset requirement, and / or the transformation fitness difference does not meet the second preset requirement, it indicates that the transformed image is not the optimal image for attacking the preset liveness detection network. Therefore, by iteratively updating the scene of the transformed image, the attack capability of the adversarial image on the preset liveness detection network is improved. Furthermore, by adjusting the preset liveness detection network through the adversarial image, the defense capability of the liveness detection model against the attacking image can be improved, thereby improving the detection capability and accuracy of the liveness detection model, and further improving the accuracy of the generated image detection results.
[0176] like Figure 4 The diagram shown is a schematic diagram of the structure of an electronic device that implements the liveness detection method of the present invention.
[0177] In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and computer-readable instructions, such as a liveness detection program, stored in the memory 12 and executable on the processor 13.
[0178] Those skilled in the art will understand that the schematic diagram is merely an example of electronic device 1 and does not constitute a limitation on electronic device 1. It may include more or fewer components than shown in the diagram, or combine certain components, or different components. For example, electronic device 1 may also include input / output devices, network access devices, buses, etc.
[0179] The processor 13 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor 13 is the computing core and control center of the electronic device 1, connecting various parts of the electronic device 1 through various interfaces and lines, and executing the operating system of the electronic device 1, as well as various installed application programs and program code.
[0180] For example, the computer-readable instructions can be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules / units can be a series of computer-readable instruction segments capable of performing a specific function, which describe the execution process of the computer-readable instructions in the electronic device 1. For example, the computer-readable instructions can be divided into a processing unit 110, a transformation unit 111, a detection unit 112, a calculation unit 113, an iteration unit 114, an adjustment unit 115, a response unit 116, a comparison unit 117, and a determination unit 118.
[0181] The memory 12 can be used to store the computer-readable instructions and / or modules. The processor 13 implements various functions of the electronic device 1 by running or executing the computer-readable instructions and / or modules stored in the memory 12 and calling the data stored in the memory 12. The memory 12 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. The memory 12 may include non-volatile and volatile memory, such as: hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other storage devices.
[0182] The memory 12 can be the external memory and / or internal memory of the electronic device 1. Furthermore, the memory 12 can be a physical memory, such as a memory module, a TF card (Trans-flash Card), etc.
[0183] If the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by instructing related hardware through computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium, and when executed by a processor, the computer-readable instructions can implement the steps of the various method embodiments described above.
[0184] The computer-readable instructions include computer-readable instruction code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer-readable instruction code, recording medium, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), and random access memory (RAM).
[0185] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed liveness detection, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0186] Combination Figure 2 The memory 12 in the electronic device 1 stores computer-readable instructions to implement a liveness detection method, and the processor 13 can execute the computer-readable instructions to achieve the following:
[0187] The acquired inactive human face image is colorized to obtain the filter image;
[0188] The filter image is subjected to scene transformation processing to obtain the initial transformed image;
[0189] Liveness detection is performed on the transformed image based on a preset liveness detection network to obtain liveness detection results;
[0190] The transformation misclassification rate of the transformed image is calculated based on the liveness detection results, and the transformed face quality score of the transformed image is calculated based on the liveness detection results.
[0191] Based on the transformation misclassification rate and the transformation face quality score, the transformation fitness difference of the transformed image is calculated;
[0192] If the transformation misclassification rate and / or the transformation face quality score do not meet the first preset requirement, and / or the transformation fitness difference does not meet the second preset requirement, then the transformation image is iteratively updated to obtain an updated image after each iteration, until the update misclassification rate and update face quality score corresponding to the updated image after each iteration meet the first preset requirement, and / or the update fitness difference corresponding to the updated image after each iteration meets the second preset requirement, then the updated image after each iteration is determined as an adversarial image;
[0193] Based on the adversarial image, the parameters of the preset liveness detection network are adjusted to obtain a liveness detection model;
[0194] Based on the liveness detection model, the image detection result is obtained by responding to the received liveness detection request and the corresponding image to be tested.
[0195] Specifically, the specific implementation method of the processor 13 for the above-mentioned computer-readable instructions can be found in [reference needed]. Figure 1The descriptions of the relevant steps in the corresponding embodiments are not repeated here.
[0196] In the several embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0197] The computer-readable storage medium stores computer-readable instructions, which, when executed by the processor 13, are used to perform the following steps:
[0198] The acquired inactive human face image is colorized to obtain the filter image;
[0199] The filter image is subjected to scene transformation processing to obtain the initial transformed image;
[0200] Liveness detection is performed on the transformed image based on a preset liveness detection network to obtain liveness detection results;
[0201] The transformation misclassification rate of the transformed image is calculated based on the liveness detection results, and the transformed face quality score of the transformed image is calculated based on the liveness detection results.
[0202] Based on the transformation misclassification rate and the transformation face quality score, the transformation fitness difference of the transformed image is calculated;
[0203] If the transformation misclassification rate and / or the transformation face quality score do not meet the first preset requirement, and / or the transformation fitness difference does not meet the second preset requirement, then the transformation image is iteratively updated to obtain an updated image after each iteration, until the update misclassification rate and update face quality score corresponding to the updated image after each iteration meet the first preset requirement, and / or the update fitness difference corresponding to the updated image after each iteration meets the second preset requirement, then the updated image after each iteration is determined as an adversarial image;
[0204] Based on the adversarial image, the parameters of the preset liveness detection network are adjusted to obtain a liveness detection model;
[0205] Based on the liveness detection model, the image detection result is obtained by responding to the received liveness detection request and the corresponding image to be tested.
[0206] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0207] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0208] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0209] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units or devices described may also be implemented by a single unit or device through software or hardware. Terms such as "first," "second," etc., are used to indicate names and do not indicate any specific order.
[0210] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for detecting liveness, characterized in that, The liveness detection method includes: The acquired inactive human face image is colorized to obtain the filter image; The filter image is subjected to scene transformation processing to obtain an initialized transformed image, including: illumination processing of the filter image based on a preset light beam to obtain an illumination image; and brightness adjustment of the illumination image based on a preset brightness coefficient to obtain a brightness image, wherein the formula for generating the brightness value in the brightness image is: ,in, This represents the image brightness value. This represents the preset brightness coefficient. This represents the illuminance value of the illumination image. This indicates that the image brightness value is in [ ] interval, The value is a preset positive integer; the brightness image is corrected based on a preset correction coefficient to obtain the transformed image, and the formula for generating the transformed brightness value in the transformed image is: ,in, This represents the changed brightness value. This represents the preset correction coefficient. This represents the image brightness value. This indicates that the changed brightness value is in [ ] interval, The preset positive integer; Liveness detection is performed on the transformed image based on a preset liveness detection network to obtain liveness detection results; The transformation misclassification rate of the transformed image is calculated based on the liveness detection results, and the transformed face quality score of the transformed image is calculated based on the liveness detection results. Based on the transformation misclassification rate and the transformation face quality score, the transformation fitness difference of the transformed image is calculated; If the transformation misclassification rate and / or the transformation face quality score do not meet the first preset requirement, and / or the transformation fitness difference does not meet the second preset requirement, then the transformation image is iteratively updated to obtain an updated image after each iteration, until the update misclassification rate and update face quality score corresponding to the updated image after each iteration meet the first preset requirement, and / or the update fitness difference corresponding to the updated image after each iteration meets the second preset requirement, then the updated image after each iteration is determined as an adversarial image; Based on the adversarial image, the parameters of the preset liveness detection network are adjusted to obtain a liveness detection model; Based on the liveness detection model, the image detection result is obtained by responding to the received liveness detection request and the corresponding image to be tested.
2. The live detection method as described in claim 1, characterized in that, The step of colorizing the acquired inactive human face image to obtain the filter image includes: The inactive human face image is converted to grayscale to obtain a grayscale image; Obtain the grayscale value of the grayscale image and obtain the filter channel value of the preset filter; An update channel value is generated based on the grayscale value and the filter channel value. The formula for generating the update channel value is as follows: ,in, This represents the updated channel value on the red channel. This indicates the updated channel value on the green channel. This represents the updated channel value on the blue channel. This represents the filter channel value on the red channel. This represents the filter channel value on the green channel. This represents the filter channel value on the blue channel. This represents the grayscale value. , and All indicate that the updated channel value is in [ ] interval, The preset positive integer; The non-live face image is adjusted according to the updated channel value to obtain the filter image.
3. The live detection method as described in claim 2, characterized in that, The formula for generating the illumination channel value of each pixel in the illumination image is: ,in, Indicates the first in the illumination image The illumination channel value of each pixel in the red channel. Indicates the first The illumination channel value of each pixel in the green channel. Indicates the first The illumination channel value of each pixel in the blue channel. Indicates the first The filter channel value of each pixel on the red channel. Indicates the first The filter channel value of each pixel in the green channel. Indicates the first The filter channel value of each pixel in the blue channel. Indicates the illuminance coefficient. Indicates the first Each pixel is located at the illumination center of the preset light beam. distance, This indicates the illumination radius of the preset light beam. This indicates that the illumination channel value is in [ ] interval, The preset positive integer is denoted as .
4. The live detection method as described in claim 1, characterized in that, The formula for calculating the transformation misclassification rate is as follows: ,in, This represents the misclassification rate of the transformation. This represents the set of images composed of the transformed images. Indicates an indicator function, This refers to the preset liveness detection network. In the image set, the first... Zhang Transformed Image, Indicates the first The liveness detection result of the transformed image is the first preset result; The formula for calculating the transformed face quality score is as follows: ,in, This represents the transformed face quality score. Represents the set of images, Indicates the first Image quality score of the transformed image. Indicates the first The liveness detection result of the transformed image is the second preset result.
5. The live detection method as described in claim 1, characterized in that, After iteratively updating the transformed image to obtain the updated image after each iteration, the liveness detection method further includes: Compare the updated fitness difference with the preset difference; If the absolute value of the update fitness difference is less than the preset difference, then the scene iteration number of the updated image corresponding to the update fitness difference is counted. If the number of scene iterations is greater than or equal to the first preset number, then the update fitness difference is determined to meet the second preset requirement.
6. The liveness detection method as described in claim 5, characterized in that, If the updated misclassification rate and / or the updated face quality score do not meet the first preset requirement, and / or the updated fitness difference does not meet the second preset requirement, the liveness detection method further includes: Count the number of image iterations for the updated image; If the number of image iterations is greater than or equal to the second preset number, then a configuration filter is used to colorize the non-living face image.
7. A liveness detection device, characterized in that, The liveness detection device includes: The processing unit is used to perform colorization processing on the acquired inactive human face image to obtain a filter image; The transformation unit is used to perform scene transformation processing on the filter image to obtain an initialized transformed image, including: performing illumination processing on the filter image based on a preset light beam to obtain an illumination image; and adjusting the brightness of the illumination image based on a preset brightness coefficient to obtain a brightness image, wherein the formula for generating the brightness value in the brightness image is: ,in, This represents the image brightness value. This represents the preset brightness coefficient. This represents the illuminance value of the illumination image. This indicates that the image brightness value is in [ ] interval, The value is a preset positive integer; the brightness image is corrected based on a preset correction coefficient to obtain the transformed image, and the formula for generating the transformed brightness value in the transformed image is: ,in, This represents the changed brightness value. This represents the preset correction coefficient. This represents the image brightness value. This indicates that the changed brightness value is in [ ] interval, The preset positive integer; The detection unit is used to perform liveness detection on the transformed image based on a preset liveness detection network to obtain liveness detection results; The calculation unit is used to calculate the transformation misclassification rate of the transformed image based on the liveness detection result, and to calculate the transformed face quality score of the transformed image based on the liveness detection result; The calculation unit is also used to calculate the transformation fitness difference of the transformed image based on the transformation misclassification rate and the transformed face quality score; An iterative unit is configured to perform scene iterative updates on the transformed image if the transformation misclassification rate and / or the transformed face quality score do not meet a first preset requirement, and / or the transformation fitness difference does not meet a second preset requirement, to obtain an updated image after each iteration, until the updated misclassification rate and updated face quality score corresponding to the updated image after iteration meet the first preset requirement, and / or the updated fitness difference corresponding to the updated image after iteration meets the second preset requirement, and then determine the updated image after iteration as an adversarial image; An adjustment unit is used to adjust the parameters of the preset liveness detection network based on the adversarial image to obtain a liveness detection model. The response unit is used to respond to the image to be tested corresponding to the received liveness detection request based on the liveness detection model, and obtain the image detection result.
8. An electronic device, characterized in that, The electronic device includes: Memory, which stores computer-readable instructions; and The processor executes computer-readable instructions stored in the memory to implement the liveness detection method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions that are executed by a processor in an electronic device to implement the liveness detection method as described in any one of claims 1 to 6.