CN114463859B - Method and device for generating challenge sample for living body detection, electronic device and storage medium - Google Patents

Method and device for generating challenge sample for living body detection, electronic device and storage medium Download PDF

Info

Publication number
CN114463859B
CN114463859B CN202111295940.4A CN202111295940A CN114463859B CN 114463859 B CN114463859 B CN 114463859B CN 202111295940 A CN202111295940 A CN 202111295940A CN 114463859 B CN114463859 B CN 114463859B
Authority
CN
China
Prior art keywords
image
face
initial reference
probability
reference image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111295940.4A
Other languages
Chinese (zh)
Other versions
CN114463859A (en
Inventor
杨杰之
蒋宁
王洪斌
吴至友
周迅溢
曾定衡
皮家甜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mashang Consumer Finance Co Ltd
Original Assignee
Mashang Consumer Finance Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mashang Consumer Finance Co Ltd filed Critical Mashang Consumer Finance Co Ltd
Priority to CN202111295940.4A priority Critical patent/CN114463859B/en
Publication of CN114463859A publication Critical patent/CN114463859A/en
Application granted granted Critical
Publication of CN114463859B publication Critical patent/CN114463859B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2415Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on parametric or probabilistic models, e.g. based on likelihood ratio or false acceptance rate versus a false rejection rate
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Collating Specific Patterns (AREA)
  • Measurement Of The Respiration, Hearing Ability, Form, And Blood Characteristics Of Living Organisms (AREA)
  • Image Analysis (AREA)

Abstract

The application discloses a method and a device for generating an countermeasure sample for living body detection, electronic equipment and a storage medium, and relates to the technical field of Internet. The method comprises the following steps: firstly, a face image containing a forged face is obtained, and then the face image is subjected to face living body detection to obtain a detection result. When the detection result is a prosthesis, a reference face image is generated based on the face image, the first image difference between the reference face image and the face image is smaller than the specified difference, the probability that the reference face image belongs to a living body is larger than the specified probability, and finally the reference face image is output as a countermeasure sample. Because two conditions of image difference and difference between probability belonging to living body and appointed probability are considered simultaneously in the adjustment process, the application can balance the image difference and the difference between probabilities in the repeated adjustment process, so that a countermeasure sample with higher attack success rate can be obtained only by slightly modifying the face image containing the forged face.

Description

Method and device for generating challenge sample for living body detection, electronic device and storage medium
Technical Field
The present application relates to the field of human face living body detection technology, and in particular, to a method and apparatus for generating a challenge sample for living body detection, an electronic device, and a storage medium.
Background
With the development of face recognition technology, face living detection technology becomes a key step in face recognition technology. The face biopsy technique is not absolutely safe, and can deceive the face biopsy model by specially searching a face antibody sample generated by the weakness of the face biopsy model, so that the face biopsy model outputs an incorrect detection result. However, the success rate of the face against the sample attack is low at present, and the face is not deceptive.
Disclosure of Invention
In view of the above, the present application provides an antagonistic sample generation method, an apparatus, an electronic device, and a storage medium for in vivo detection, which can solve the above-described problems.
In a first aspect, an embodiment of the present application provides a method for generating an challenge sample for in vivo detection, the method comprising: acquiring a face image containing a forged face; performing human face living body detection on the human face image to obtain a detection result; if the detection result is a prosthesis, generating a reference face image based on the face image, wherein the first image difference between the reference face image and the face image is smaller than the appointed difference, and the probability that the reference face image belongs to a living body is larger than the appointed probability; and outputting the reference face image as a countermeasure sample.
In a second aspect, an embodiment of the present application provides an challenge sample generating device for in vivo detection, the device comprising: the device comprises an acquisition module, a detection module, a determination module and an output module. The acquisition module is used for acquiring a face image containing a forged face; the detection module is used for performing face living body detection on the face image to obtain a detection result; the determining module is used for generating a reference face image based on the face image if the detection result is a prosthesis, wherein the first image difference between the reference face image and the face image is smaller than the appointed difference, and the probability that the reference face image belongs to a living body is larger than the appointed probability; and the output module is used for outputting the reference face image as a countermeasure sample.
In a third aspect, an embodiment of the present application provides an electronic device, including: one or more processors; a memory; one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications configured to perform the above-described method.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium having program code stored therein, the program code being callable by a processor to perform the above method.
In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions, characterized in that the computer program product has instructions stored therein, which when run on a computer, cause the computer to implement the above method.
According to the application, the human face living body detection is carried out on the human face image containing the forged human face, when the detection result is the prosthesis, the reference human face image can be generated based on the human face image, wherein the first image difference between the reference human face image and the human face image is smaller than the appointed difference, the probability that the reference human face image belongs to the living body is larger than the appointed probability, and finally the reference human face image is output as the countermeasure sample. The application generates the countermeasures based on the face image containing the forged face, and because two conditions of image difference and difference between probability belonging to living body and appointed probability are considered simultaneously in the adjustment process, the application can balance the image difference and the difference between probabilities in the repeated adjustment process, thus the countermeasures with higher attack success rate can be obtained only by slightly changing the face image containing the forged face.
These and other aspects of the application will be more readily apparent from the following description of the embodiments.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic view showing an application environment of a method for generating an challenge sample for in-vivo detection according to an embodiment of the present application;
FIG. 2 is a flow chart of a method for generating an challenge sample for in vivo detection according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a face image including a counterfeited face according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a new face image according to an embodiment of the present application;
FIG. 5 is a flow chart of a method for generating an challenge sample for in vivo detection according to still another embodiment of the present application;
FIG. 6 is a flow chart of a method for generating an challenge sample for in vivo detection according to another embodiment of the present application;
FIG. 7 is a block flow diagram of a method for generating an challenge sample for in vivo detection according to an embodiment of the present application;
FIG. 8 is a flow chart of a method for generating an challenge sample for in vivo detection according to still another embodiment of the present application;
FIG. 9 is a schematic flow chart of optimizing a face image by using a gradient descent method according to an embodiment of the present application;
FIG. 10 is a block flow diagram showing a method for generating an challenge sample for in-vivo detection according to still another embodiment of the present application;
FIG. 11 is a block diagram showing a living body detection countermeasure sample generating apparatus according to an embodiment of the present application;
FIG. 12 is a block diagram of an electronic device according to an embodiment of the present application;
fig. 13 is a block diagram showing a structure of a computer-readable storage medium according to an embodiment of the present application.
Detailed Description
In order to enable those skilled in the art to better understand the present application, the following description will make clear and complete descriptions of the technical solutions according to the embodiments of the present application with reference to the accompanying drawings.
With the rapid development of the internet industry, in recent years, artificial intelligence technology using machine learning and deep learning as landmark technologies has been widely used in related fields such as video image, speech recognition, natural speech processing, etc., and in particular, the application in face recognition is more widely used. The face recognition has great development potential under the drive of artificial intelligence and big data, the application scene is continuously expanded, and the face recognition falls to the commercial field of payment and verification step by step from the public field of security and protection. However, the face recognition is a double-edged sword, and the problems of data leakage, infringement of personal privacy and the like are brought while the technology is continuously evolved and the application is continuously popularized. Particularly, in the challenge countermeasure technology for the face biopsy, a face challenge sample can be generated by specially searching for the weakness of the face biopsy model, and the face challenge sample can deceive the face biopsy model, so that the face biopsy model outputs an erroneous detection result. In the face living body detection, the recognition accuracy or the anti-attack performance of the face living body detection model can be improved by actively generating an antigen sample to verify or defend and train the face living body detection model. However, the success rate of challenge attack using the currently generated challenge sample is low, and there is no fraud for the face biopsy model, which results in poor effect when further processing such as verifying the face biopsy model based on the challenge sample, or defense training.
In order to solve the above problems, the present inventors have found through careful study that a challenge sample is generated based on a face image including a counterfeit face, and by judging whether or not an image difference between a newly generated face image and an original face image and a probability that the newly generated face image belongs to a living body satisfy conditions, a challenge sample having a high attack success rate can be obtained by only slightly modifying the face image including the counterfeit face.
In order to better understand the method, the device, the electronic device and the storage medium for generating the challenge sample for living body detection provided by the embodiment of the application, an application environment suitable for the embodiment of the application is described below.
Referring to fig. 1, fig. 1 is a schematic view illustrating an application environment of a method for generating an challenge sample for in-vivo detection according to an embodiment of the application. The method, the device, the electronic device and the storage medium for generating the challenge sample for living body detection provided by the embodiment of the application can be applied to the electronic device. Alternatively, the electronic device may be, for example, a server 110 as shown in fig. 1, and the server 110 may be connected to the image capturing device 120 through a network. Wherein the network is used as a medium to provide a communication link between the server 110 and the image capture device 120. The network may include various connection types, such as wired communication links, wireless communication links, and the like, as embodiments of the application are not limited in this regard.
Alternatively, in other embodiments, the electronic device may be a smart phone, tablet, notebook, or the like. At this time, the image capturing function of the image capturing device 120 may be integrated in an electronic device, for example, a camera of a smart phone, a tablet, a notebook computer may be used to capture an image, and so on.
It should be understood that the server 110, network, and image acquisition device 120 in fig. 1 are merely illustrative. There may be any number of servers, networks, and image acquisition devices, as desired for implementation. The server 110 may be a physical server, a server cluster formed by a plurality of servers, or the like, and the image capturing device 120 may be a mobile phone, a tablet, a camera, a notebook, or the like. It will be appreciated that embodiments of the present application may also allow multiple image capture devices 120 to access server 110 simultaneously.
In some embodiments, the image capturing device 120 may send captured images to the server 110 through a network, and after the electronic device receives the images, the images may be processed by the method for generating an challenge sample for in-vivo detection according to the embodiment of the present application. For example, the images may contain face images of counterfeited faces for adjusting counterfeited faces in the face images to generate the challenge sample.
The above application environments are merely examples for facilitating understanding, and it is to be understood that embodiments of the present application are not limited to the above application environments.
The method, apparatus, electronic device, and storage medium for generating an challenge sample for living body detection according to the embodiments of the present application will be described in detail below by way of specific embodiments.
Referring to fig. 2, a flow chart of a method for generating an challenge sample for in-vivo detection according to an embodiment of the application is shown. The method for generating the challenge sample for living body detection specifically may include the following steps, which will be described in detail with respect to the flow chart shown in fig. 2:
step S210: a face image including a counterfeit face is acquired.
In application scenes such as security protection and face payment, a face image of a user is generally collected in real time, then the face image is identified, and the identity of the user is verified according to face characteristics of the user. Under normal conditions, before the identity verification of the face in the face image, whether the current detection is a true person or not is determined through face living body detection, the identity of a user is prevented from being falsified through modes such as a photo, a face mask and the like, and the safety of user information can be ensured.
In the face living body detection, by detecting a face image, it is possible to recognize whether the face image is acquired for a real person (the corresponding detection result is a living body) or a face image generated by a counterfeit face (the corresponding detection result is a prosthesis). In the challenge technique of face living body detection, a face image containing a counterfeited face may be processed to obtain a challenge sample. The challenge sample can simulate the face image of a real person, after the challenge sample is generated, the challenge sample can be used for carrying out face living detection instead of the face image which originally contains the forged face, and at the moment, if the challenge sample is detected as a living body, the challenge is successful, and the aim of detecting the spoofed face living body is fulfilled.
Alternatively, in the face biopsy process, the input face image may be subjected to a biopsy using a face biopsy model, which may be a machine learning model trained in advance using a large amount of training data. In the practical application scene of the human face living body detection, the antibody sample reduces the accuracy of the human face living body detection model. However, in the process of training the face living body detection model, if the antibody sample is actively generated, and then the accuracy verification or the defense training is performed on the face living body detection model by using the antibody sample, the recognition accuracy of the face living body detection model and the performance of resisting the attack can be improved.
In some embodiments, the fake face may be a printed paper face, a face photo, a face mask, or the like, and the fake face may be photographed, for example, by an image capturing device such as a camera, so as to obtain a face image including the fake face. Alternatively, the fake face may be a virtual face, such as an avatar generated from a real face, or the like.
Step S220: and detecting the human face living body of the human face image to obtain a detection result.
In the embodiment of the application, the face image containing the forged face can be input into the face living body detection system for carrying out face living body detection, and then the face living body detection system can output the detection result of the face image. Alternatively, in the face biopsy system, a face biopsy model of which parameters are trained in advance may be used to detect whether an input face image is a living body or a prosthesis. It is understood that the detection result of the face living body detection may be any one of a living body or a prosthesis. The detection result is that the living body can represent that the face image input through face living body detection is confirmed to be the face image of the real user; the detection result is that the prosthesis may represent that the face image inputted through the face living body detection confirmation is not the face image of the real user, and may be a prosthetic face camouflaged as the real user.
In some embodiments, the face living body detection model can extract and analyze image feature information such as surface texture, micro-actions, facial features and the like of a face image through a design operator or a neural network to complete face living body detection. For example, as shown in fig. 3, the face image in fig. 3 is a face mask, the face mask usually shows smooth surface texture, and the real face usually has finer surface texture due to the existence of skin texture, at this time, for example, by extracting the surface texture of the face image in fig. 3, the face image can be obtained as a prosthesis according to the surface texture of the face mask with larger difference from the real face.
Step S230: if the detection result is a prosthesis, a reference face image is generated based on the face image, the first image difference between the reference face image and the face image is smaller than the appointed difference, and the probability that the reference face image belongs to a living body is larger than the appointed probability.
In some embodiments, if the detected result obtained after the face image including the forged face is detected in vivo is a living body, which means that the forged face is not different from the real face, the false-spurious effect can be achieved, and therefore, when the detected result is a living body, the face image including the forged face can be output as an countermeasure sample.
In the embodiment of the application, if the detection result is a prosthesis, the fact that the forged face has a larger difference from the real face at present is indicated, and the face image cannot be detected by the spoofing face living body. At this time, the face image including the fake face may be adjusted to obtain the reference face image, and in the adjustment process, it may be determined whether the first image difference between the newly generated face image and the original face image is smaller than the specified difference, and whether the probability that the newly generated face image belongs to the living body is larger than the specified probability. If the condition is satisfied, the newly generated face image may be used as a reference face image.
In some embodiments, in generating the reference face image based on the face image, perturbation information may be added to the face image to generate the reference face image. For example, an image feature that affects the judgment of the face image as a prosthesis in the face living body detection may be extracted, and then a feature value corresponding to the image feature may be adjusted on the face image. For example, if a face image containing a face mask is detected as a prosthesis due to a surface texture, then the characteristic value of the surface texture may be adjusted, for example, from 0.1 to 0.3 (assuming that the smaller the characteristic value of the surface texture is, the smoother the surface texture is presented), and a newly generated face image may be obtained after the characteristic value adjustment. And then judging the newly generated face image, and determining whether the newly generated face image meets the conditions.
It will be appreciated that there may be multiple image features that affect the detection result of the face live detection at the same time. For example, in addition to surface texture, facial features of a facial mask may also result in detection of a prosthesis (e.g., absence of facial features of eye positions of a facial mask, etc.). Therefore, when the face image is adjusted, a plurality of image features can be adjusted simultaneously. For example, the surface texture of the face mask, facial features of the eye positions, etc. are adjusted simultaneously to obtain a newly generated face image, as shown in fig. 4.
Optionally, in the process of adjusting the face image to obtain the reference face image, condition judgment may be performed on the newly generated face image after each adjustment, or condition judgment may be performed on the newly generated face image after multiple adjustments.
When the newly generated face image is determined to meet the conditions, the difference between the newly generated face image and the original face image is smaller, the disturbance on the original face image is smaller, and meanwhile, the probability that the reference face image belongs to a living body is larger than the designated probability, so that the success rate of resisting attack by using the newly generated reference face image can be determined to be higher, and the newly generated face image can be used as the reference face image in the embodiment of the application, so that the finally obtained reference face image can meet the conditions.
It should be noted that, if the difference between the reference face image generated based on the original face image and the original face image is large, the image quality may be affected, for example, the definition of the reference face image may be damaged, or the recognition result of the face identity after the challenge of the living body detection is successful may be affected. For example, in the context of face payment, a paper photograph of user a may be used as a face image of a fake face to counter attacks against user a's payment account. If the difference between the reference face image generated by processing the paper photo of the user a and the original paper photo is large, the face presented by the reference face image may be different from the real face, but the pattern of the user a cannot be recognized (for example, the difference is too large, so that the reference face image changes the face with respect to the original face image). At this time, even if the reference face image passes the face living body detection, the authentication may fail when the reference face image is used for the authentication.
In addition, by limiting the first image difference between the two face images to be smaller than the specified difference, the amount of calculation in the image adjustment process can also be reduced.
Illustratively, the specified variance and the specified probability may be preset. Alternatively, the value of the specified difference, the specified probability may be set to a fixed size according to the actual situation of face living body detection. Alternatively, the specified probability may be set as the probability that the reference face image belongs to the prosthesis, that is, it is required to determine whether the probability that the reference face image belongs to the living body is greater than the probability that the reference face image belongs to the prosthesis, and when it is determined that the first image difference between the reference face image and the original face image is smaller than the specified difference, and the probability that the reference face image belongs to the living body is greater than the probability that the reference face image belongs to the prosthesis, the reference face image may be output as the countermeasure sample.
Step S240: and outputting the reference face image as a countermeasure sample.
In the embodiment of the application, since the reference face image is generated based on the original face image containing the forged face, and the first image difference between the reference face image and the original face image is smaller than the specified difference, the probability that the reference face image belongs to a living body is larger than the specified probability, that is, only the original face image is slightly changed, the reference face image with higher attack probability for the living body detection of the face can be obtained. Finally, the reference face image can be output as a countermeasure sample, and finally, the countermeasure sample with higher attack success rate can be obtained.
In some embodiments, after the challenge sample is obtained, the challenge sample may be applied to a challenge scene of face identification, for example, to a security test of security protection and face payment, or may be used as training data to verify the accuracy of a face living detection model and perform defense training. At this time, since the attack success rate of the challenge sample generated by the embodiment of the application is higher, when the challenge sample is applied to any scene, a higher challenge is provided for the face recognition model and the face living body detection model, and forward excitation can be formed for technology update of the face recognition model and the face living body detection model.
In summary, in the method for generating the challenge sample for living body detection provided in the present embodiment, a face image including a fake face may be first obtained, and then the face living body detection is performed on the face image to obtain a detection result. When the detection result is a prosthesis, a reference face image is generated based on the face image, wherein a first image difference between the reference face image and the face image is smaller than a specified difference, and the probability that the reference face image belongs to a living body is larger than the specified probability. And finally, outputting the reference face image as a countermeasure sample. The application generates the countermeasures based on the face image containing the forged face, and because two conditions of image difference and difference between probability belonging to living body and appointed probability are considered simultaneously in the adjustment process, the image difference and the difference between probabilities can be balanced in the repeated adjustment process, thus the countermeasures with higher attack success rate can be obtained only by slightly changing the face image containing the forged face.
In some embodiments, optionally, the present embodiment provides an antigen sample generating method for living body detection based on the above embodiment, where the initial reference image obtained by predicting a face image including a fake face may be subjected to face living body detection, a detection probability that the initial reference image belongs to a living body is determined, then, based on a second image difference between the face image and the initial reference image, and based on a difference between the detection probability and a specified probability, the initial reference image is adjusted to obtain a new initial reference image, and face living body detection and subsequent operations are performed on the initial reference image until the initial reference image is adjusted to be a reference face image, and a reference face image with a higher success rate of the antigen attack may be obtained in a case where generated disturbance information is more tiny. Referring to fig. 5, a flowchart of a method for generating an challenge sample for in-vivo detection according to still another embodiment of the application is shown. The generating the reference face image based on the face image may specifically include the following steps:
step S510: and predicting an initial reference image based on the face image.
In the embodiment of the application, if the reference face image is to be generated based on the face image including the fake face, an initial reference image can be obtained by predicting the face image, and then the initial reference image is adjusted.
Alternatively, the face image including the fake face may be used as the initial reference image, the initial reference image may be generated after the face image including the fake face is subjected to a preset process, and a face image related to the face image including the fake face may be preset as the initial face image.
For example, the preset processing of the face image containing the fake face may be to remove unnecessary or redundant interference information in the face image, such as image background, noise affecting image detection, and other possible image noise. Taking a user photo as an example, the preset process may be to identify a face image of a specific user from the user photo (e.g., identify a face of the specific user when there are multiple people on the user photo), and so on.
Step S520: and performing human face living body detection on the initial reference image, and determining the detection probability that the initial reference image belongs to a living body.
In the embodiment of the application, in the process of adjusting the initial reference image, the probability that the initial reference image is detected as a living body can be predicted first, so as to obtain the detection probability that the initial reference image belongs to the living body.
In some embodiments, the face image may be labeled with a classification label, for example, the classification label of the face image detected as a living body may be labeled as a label t (the classification label of the face image detected as a prosthesis may also be labeled as a label i). Further, when predicting the probability P that the initial reference image is detected as a living body, the initial reference image may be input into the classification model to be classified, so as to obtain the probability Pt that the classification label of the initial reference image is the label t (the probability Pi that the classification label corresponding to the initial reference image is the label i may also be obtained), and then the detection probability p=pt that the initial reference image belongs to the living body may be obtained.
Step S530: and adjusting the initial reference image to obtain a new initial reference image based on a second image difference between the face image and the initial reference image and based on a difference between the detection probability and the specified probability, and returning to execute face living detection and subsequent operation on the initial reference image until the initial reference image is adjusted to be a reference face image.
In some embodiments, the difference between the pixel values of the face image and the initial reference image may be directly compared to obtain the second image difference, or the image distance between the face image and the initial reference image may be calculated to obtain the second image difference. For example, the face image and the initial reference image may be respectively generated into image directionsThe distance between the two image vectors is calculated by a metric function D (·). Wherein the metric function D (·) can be L 2 The form definition of the norm.
In some embodiments, the detection probability P that the initial reference image belongs to the living body may be determined through the foregoing steps, and then the detection probability P is compared with the specified probability Px, so as to obtain a difference Δp between the detection probability P and the specified probability Px, where Δp may be equal to P-Px, for example. The specified probability Px may be preset, and the specified probability Px may be equal to a probability that the reference face image belongs to a prosthesis, for example, px=pi. Alternatively, in some exemplary embodiments, the reference face image may only be detected as either a living body or a prosthesis when the face is detected living body, and thus Pi may be equal to 1-Pt.
The initial reference image may then be adjusted to obtain a new initial reference image based on the second image difference and the difference Δp between the detection probability and the specified probability. It can be understood that when the initial reference image is adjusted for the first time, the two conditions that the second image difference is smaller than the specified difference and the difference Δp >0 between the probabilities (i.e., the probability P that the reference face image belongs to the living body is greater than the specified probability Px) may not be simultaneously satisfied, so when the two conditions cannot be simultaneously satisfied, the initial reference image needs to be adjusted repeatedly, that is, the initial reference image needs to be returned to be subjected to the face living body detection and the subsequent operation until the two conditions are simultaneously satisfied, and the obtained initial reference image is the reference face image.
The face image including the fake face will be described below as an example of the initial reference image.
Let the specified probability Px be 0.2 and the specified probability Px be 0.5. The first time the initial reference image is adjusted, the second image difference is 0, which is smaller than the specified probability, but at this time the initial reference image is a face image containing a fake face, which has been detected as a prosthesis in the foregoing embodiment, the detection probability P may be determined to be 0, which is smaller than the specified probability, and thus the face image containing a fake face needs to be adjusted. The image parameter of each adjustment to the initial reference image may be determined as disturbance information δ, which may be exemplarily determined according to the second image difference obtained after each last adjustment, and the difference Δp between the detection probability and the specified probability. Finally, after the initial reference image is repeatedly adjusted, the new initial reference image obtained at the moment can be used as the reference face image until the second image difference between the new initial reference image obtained after the adjustment and the face image containing the forged face is smaller than the appointed probability and the detection probability of the new initial reference image belonging to the living body is larger than the appointed probability can be simultaneously met, and the second image difference at the moment is consistent with the first image difference.
It can be understood that the first image difference and the probability difference between the reference face image and the original face image are balanced by the finally obtained reference face image, so that an countermeasure sample with higher attack success rate can be obtained under the condition that the generated disturbance information is more tiny. In addition, the finally obtained challenge sample can be more targeted by replacing the fake face in the face image, for example, replacing the face mask with a printed paper face to perform challenge.
In some embodiments of the present application, optionally, the method for generating an countermeasure sample for in-vivo detection provided in this embodiment may be used to repeatedly adjust the initial reference image to obtain a new initial reference image based on the above embodiments. Referring to fig. 6, a flowchart of a method for generating an challenge sample for in-vivo detection according to another embodiment of the application is shown. The method specifically comprises the following steps:
step S610: and judging whether the adjustment times are smaller than a designated numerical value, wherein the adjustment times are times of executing adjustment operation, and the adjustment operation is to adjust the initial reference image to obtain a new initial reference image.
In the embodiment of the present application, the adjustment times are times of performing operations of adjusting the initial reference image to obtain a new initial reference header, that is, the adjustment times may be accumulated as the adjustment operations are performed. Alternatively, the adjustment times may be initialized, for example, the adjustment times may be initialized to 0, before the initial reference image is adjusted for the first time. Therefore, when the initial reference image is adjusted for the first time, the adjustment times are smaller than the designated numerical value, and the initial reference image can be adjusted directly for the first time.
In some embodiments, the number of adjustments to the initial reference image may be limited. For example, the number of adjustment times can be limited by specifying a numerical value, so that the initial reference image can obtain a locally optimal solution of the reference face image after being subjected to image adjustment for a limited number of times. Therefore, the initial reference image is adjusted to obtain a new initial reference image, the adjustment times can be accumulated, and the counted adjustment times are compared with the appointed value in each adjustment, so that the size between the adjustment times and the appointed value is judged.
Step S620: and if the adjustment times are smaller than the appointed numerical value, adjusting the initial reference image to obtain a new initial reference image based on the second image difference and the difference between the detection probability and the appointed probability.
When the number of adjustments obtained by the comparison is smaller than the specified value, the number of current adjustments is very small. If the initial reference image is adjusted only a few times, since the initial reference image is predicted from the face image including the fake face, the face included in the new initial reference image obtained by few times of adjustment is still close to the fake face instead of the real face, that is, the probability that the new initial reference image obtained at this time is detected as a prosthesis is high, so when the number of times of adjustment is smaller than the specified value, the adjustment should be continued based on the second image difference between the face image and the new initial reference image obtained after each adjustment, and based on the difference between the detection probability that the initial reference image belongs to a living body and the specified probability.
Alternatively, when the specified value is set to an appropriate value, it may be indicated that the initial reference image obtained after adjustment a sufficient number of times can meet the requirement of high attack success rate, in which case the values of the specified difference and the specified probability may be set according to the magnitude of the specified value. In some embodiments, when the adjustment number reaches the specified value, the new initial reference image obtained after adjustment may be used as the reference face image. For example, the designated value may be set to 100, and after 100 times of adjustment is performed on the initial reference image, the new initial reference image may be used as the locally optimal solution of the reference face image.
Step S630: the number of adjustments is increased.
Optionally, the initial reference image may be adjusted to obtain a new initial reference image, and the adjustment times may be accumulated, so as to achieve the purpose of increasing the adjustment times. For example, 1 may be added to the number of adjustments obtained in the previous step to obtain a new number of adjustments.
Step S640: if the adjustment times are not smaller than the appointed numerical value, judging whether the detection probability is larger than the appointed probability.
In other embodiments, the number of times of adjustment of the initial reference image is limited, and it is also possible to set that condition judgment is performed on the newly generated initial reference image after each adjustment of the specified value, that is, whether the detection probability of the initial reference image belonging to the living body is greater than the specified probability is judged after each adjustment of the specified value, so that the finally obtained new initial reference image is more likely to be successfully attacked, and then the number of times of adjustment is accumulated again, so that the purpose of loop judgment can be achieved.
Step S650: and if the initial reference image is larger than the specified probability, taking the current initial reference image as a reference face image.
Step S660: and if the initial reference image is not greater than the specified probability, adjusting the initial reference image based on the second image difference and the difference between the detection probability and the specified probability to obtain a new initial reference image, and clearing the adjustment times.
In this embodiment, when the adjustment times reach the specified value, if it is determined that the detection probability is greater than the specified probability, it indicates that the currently obtained initial reference image may satisfy the condition of higher attack success rate, and the current initial reference image may be used as the reference face image.
If the detection probability is not greater than the specified probability, the probability that the attack of the initial reference image obtained at present is lower is indicated, and the initial reference image needs to be continuously adjusted, namely, the initial reference image is continuously adjusted based on the second image difference between the face image and the initial reference image and the difference between the detection probability and the specified probability. In addition, in order to achieve the purpose of judging whether the detection probability of the initial reference image belonging to the living body is greater than the specified probability after the adjustment of the specified value, the adjustment times are required to be cleared, so that the adjustment times can be accumulated again in the next round of condition judgment.
In some embodiments, as shown in fig. 7, after the initial reference image is predicted based on the face image, the initial reference image may be adjusted to obtain the reference face image. For example, before each adjustment, first, the detection probability that the initial reference image belongs to the living body may be determined, and then, the number of times of adjustment in which the adjustment operation is performed, which is an operation of adjusting the initial reference image to obtain a new initial reference image, is acquired. Alternatively, the number of adjustments may be initialized before the first adjustment, for example, the number of adjustments may be initialized to 0.
Then, whether the adjustment times are smaller than the specified value is judged, when the adjustment times do not reach the specified value (namely, the adjustment times are smaller than the specified value), the initial reference image is adjusted based on the second image difference and the probability difference to obtain a new initial reference image, then the adjustment times are increased, and the detection probability and the subsequent processing process for determining that the initial reference image belongs to the living body are executed. And judging whether the detection probability of the new initial reference image belonging to the living body is larger than the specified probability or not at the moment when the adjustment times reach the specified value (namely, the adjustment times are not larger than the specified value). If the probability is larger than the specified probability, taking the obtained new initial reference image as a reference face image; if the detection probability is smaller than the specified probability, the new initial reference image does not meet the requirement, the adjustment times are cleared, the initial reference image is continuously adjusted, and the adjustment times are recalculated until the detection probability is larger than the specified probability.
Through the above-mentioned cyclic process, can realize the adjustment of the appointed numerical value each time, judge whether the detection probability that the initial reference image obtained at the moment belongs to living body is greater than the appointed probability, if not greater than the appointed probability, continue to adjust the initial reference image obtained at the moment, then count the adjustment number again, so as to carry on the judgement of the detection probability again when the adjustment number reaches the appointed numerical value again, until the detection probability is greater than the appointed probability, output the reference face image.
Therefore, the reference face image with higher attack success rate can be obtained after the image adjustment of limited times by simultaneously restraining the adjustment times of the initial reference image and the detection probability of the initial reference image belonging to the living body after each adjustment, and meanwhile, the change of the initial reference image can be limited in a smaller range by limiting the adjustment times. Finally, after the reference face image is output as the challenge sample, only minor changes to the face image containing the forged face are needed to obtain the challenge sample with higher attack success rate.
In other embodiments of the present application, in the process of repeatedly adjusting the initial reference image to obtain a new initial reference image, condition judgment may be performed on the newly generated face image after each adjustment. Specifically, please refer to fig. 8, which illustrates a flowchart of an challenge sample generation method for in-vivo detection according to still another embodiment of the present application. The method specifically comprises the following steps:
step S810: it is determined that the initial reference image has been adjusted.
It is understood that the detection probability of the newly obtained initial reference image belonging to the living body may be conditional judged at each adjustment, and therefore, it may be judged whether or not the detection probability is larger than the specified probability after it is determined that the initial reference image has been adjusted.
Step S820: and judging whether the detection probability is larger than the specified probability.
Step S830: and if the initial reference image is larger than the specified probability, taking the current initial reference image as a reference face image.
After determining that the initial reference image has been adjusted, the detection probability that the obtained new initial reference image belongs to the living body may be judged. In some embodiments, once it is determined that the detection probability that the new initial reference image belongs to the living body is greater than the specified probability, it may indicate that the probability that the attack of the new initial reference image obtained at this time is successful has reached the requirement, the adjustment of the initial reference image may be ended, and the new initial reference image obtained at this time is used as the reference face image, so that an countermeasure sample with a higher attack success rate may be obtained.
Step S840: and if the initial reference image is not greater than the specified probability, adjusting the initial reference image based on the difference between the face image and the second image and the difference between the detection probability and the specified probability to obtain a new initial reference image.
In other embodiments, if it is determined that the detection probability that the new initial reference image belongs to the living body is less than the specified probability, at this time, the attack success rate of the new initial reference image does not meet the requirement, and further, the initial reference image needs to be continuously adjusted, the second image difference and the difference between the detection probability and the specified probability are continuously adjusted until the detection probability is greater than the specified probability, and then the current initial reference image is used as the reference face image.
It can be understood that, when each adjustment is performed, the adjustment is performed again on the basis of the initial reference image obtained by the previous adjustment, so that only small changes are required to be made to the initial reference image each time, and finally, after the adjustment is performed for a limited number of times, the obtained reference face image can not only meet the requirement of higher attack success rate, but also ensure that the difference between the reference face image and the original face image is smaller.
Optionally, in the embodiment of the present application, in the process of adjusting the initial reference image to obtain a new initial reference image, an objective function may be established, and an iterative solution may be performed by using a gradient descent algorithm to obtain a locally optimal solution of the reference face image. Specifically, referring to fig. 9, a schematic flow chart of optimizing a face image by using a gradient descent method according to an embodiment of the present application is shown. The method specifically comprises the following steps:
step S910: an objective function is established based on the second image difference and based on the difference between the detection probability and a specified probability.
In some embodiments, the objective function may consist of a second image difference between the face image and the initial reference image, and a difference between the detection probability of the initial reference image belonging to the living body and the specified probability, i.e. the objective function may be Wherein (1)>Can be a metric function for representing a face image x containing a fake face with an initial reference image +.>Second image difference between->Representing that the face image x is to be made to be +.>The second image difference between them is minimal, +.>For representing an initial reference image->Probability of belonging to living body and specified probabilityThe difference between the rates. c is a super parameter greater than 0. In some embodiments, the parameter c may be searched for by means of a grid search, which may range from 1e-1 to 1e10, for example.
Alternatively, the metric function may be L 2 Formal definition of norm, then
Alternatively, the specified probability may be set as the probability that the initial reference image belongs to the prosthesis. Further, the classification label of the face image detected as the living body may be denoted as a label t, and the classification label of the face image detected as the prosthesis may be denoted as a label i. Further, when predicting the probability that the initial reference image is detected as a living body, the initial reference image may be input into a classification model to be classified, so as to obtain the probability that the classification label of the initial reference image is label tAnd probability of classification tag of initial reference image as tag i +. >Then +.>Represented as
k is a hyper-parameter greater than 0.
Thus, the objective function may be
In some embodiments, the activation function Sigmoid may be used in the classification model to make a probabilistic prediction of the initial reference image, which may then be derived
Alternatively, for ease of calculation, the initial reference image involved in the calculation may beAfter normalization, solving the objective function. Illustratively, since the pixel points in the image are typically valued at [0,255 ]]Within the range, then normalized to [0,1 ]]Within the range, to prevent the pixel values of the initial face image after adjustment from exceeding the range, a hyperbolic tangent function tanh () and a variable w may be introduced to solve the problem, and thus the initial face image may be described as::>after normalization, the objective function can be described as
Alternatively, the face image x of the fake face may be normalized, and then the face image of the fake face may be described as:
step S920: and solving the objective function by adopting a gradient descent method to obtain an iterative formula of the initial reference image.
In some embodiments, the objective function may be solved by using a gradient descent method, and the objective function may be derived during the gradient descent process Further, the iterative formula of the initial reference image can be described as +.>Wherein eta is learning rate, w k Can represent the initial parameters obtained after k iterationsExamination image, w k+1 An initial reference image obtained after k+1 iterations may be represented.
Taking the face image including the fake face as the initial reference image as an example. It will be appreciated that at the time of the first iteration (the number of iterations may correspond to the number of adjustments of the initial reference image in the previous embodiment), a new initial reference image is obtained at the time of the first iterationWhereas η may be preset, for example, η may be set to 1e-3,/->The method is obtained by deriving an objective function under an initial condition, wherein the objective function consists of a second image difference between a face image and the initial reference image and a difference between a detection probability of the living body belonging to the initial reference image and a designated probability, so that the purpose of adjusting the initial reference image based on the second image difference and the difference between the detection probability and the designated probability can be achieved.
Step S930: and adjusting the initial reference image based on the iterative formula to obtain a new initial reference image.
It should be noted that after the preset iteration times, the new initial reference image obtained may be set as the optimal solution of the reference face image, for example, w is obtained based on the above iteration formula after 100 iterations 100 Then w 100 Will be referred to as a face image. Alternatively, after the preset iteration times, whether the detection probability of the new initial reference image belonging to the living body is larger than the specified probability or not can be determined, if not, iterative calculation is continued, probability judgment is performed again after the preset iteration times until the detection probability of the new initial reference image belonging to the living body is larger than the specified probability, and finally the reference face image is obtained. Alternatively, it may be determined after each iteration whether the detection probability of the new initial reference image belonging to the living body is greater than a specified probability,if the initial reference image is not larger than the specified probability, continuing to perform iterative computation, and if the initial reference image is larger than the specified probability, obtaining a new initial reference image as a reference face image.
Optionally, the probability judging process may be replaced by directly performing face living detection on a new initial reference image obtained at that time, that is, performing face living detection on the obtained new initial reference image after a preset number of iterations, taking the new initial reference image detected as a living body as a reference face image, and when the new initial reference image is detected as a prosthesis, continuing to perform iterative solution on the new initial reference image based on the iterative process. For example, whether the initial reference image belongs to a living body is detected every 20 iterations or every iteration, and the initial reference image detected as a living body is finally taken as a reference face image. Therefore, the initial face image is directly subjected to face living detection in the iterative process, the attack success rate of the finally obtained reference face image is higher, and the face living detection is also more reliable compared with probability prediction.
The above-described challenge sample generation method for living body detection will be exemplarily described below using a paper face as an example.
Referring to fig. 10, a flowchart of a method for generating an challenge sample for in-vivo detection according to still another embodiment of the present application is shown. Alternatively, a paper face may be obtained by printing a face photograph. After the paper face is printed, the paper face can be used as a fake face, and the face image of the paper face is acquired through an image acquisition device such as a camera, so that the face image can be used as a face image containing the fake face to attack the face living body detection system so as to obtain an attack resisting sample.
Specifically, the face image may be input to a face living body detection system. For example, in the face biopsy system, whether or not the input face image is a living body may be determined using a face biopsy model of which parameters are trained in advance. If the artificial body is judged, the face image can be adjusted, for example, the face image can be transmitted into a disturbance generation algorithm, disturbance information can be obtained through the disturbance generation algorithm, and then the disturbance information is added to the original face image, so that a new face image can be obtained. For example, the process of generating a new face image by the disturbance generating algorithm may refer to the corresponding process of adjusting the initial reference image to obtain a new initial reference image in the foregoing embodiment, where, before adjustment, the initial reference image may be obtained based on face image prediction of the paper face. It should be noted that, the disturbance information may be a pixel difference between the face images before and after each adjustment.
In some embodiments, the new face image generated after each adjustment may be input into the face living body detection system to determine whether the face image is a living body, or whether the new face image is a living body after each adjustment by a specified number of times. If the new face image is judged to be a living body, the new face image can be output as a countermeasure sample; if the new face image is still judged as the prosthesis, the process of adjusting the face image is repeated until the new face image is judged as the living body.
Referring to fig. 11, a block diagram of a challenge sample generating device for in-vivo detection according to an embodiment of the present application is shown. Specifically, the apparatus may include: acquisition module 1110, detection module 1120, determination module 1130, and output module 1140.
Wherein, the acquiring module 1110 is configured to acquire a face image including a forged face; the detection module 1120 is configured to perform face living detection on the face image to obtain a detection result; a determining module 1130, configured to generate a reference face image based on the face image if the detection result is a prosthesis, where a first image difference between the reference face image and the face image is smaller than a specified difference, and a probability that the reference face image belongs to a living body is greater than a specified probability; an output module 1140, configured to output the reference face image as a challenge sample.
In some embodiments, the determining module 1130 may include: the prediction module is used for predicting an initial reference image based on the face image; a determining submodule, configured to perform face living detection on the initial reference image, and determine a detection probability that the initial reference image belongs to a living body; and the adjusting module is used for adjusting the initial reference image to obtain a new initial reference image based on a second image difference between the face image and the initial reference image and based on a difference between the detection probability and the appointed probability, and returning to execute face living detection and subsequent operation on the initial reference image until the initial reference image is adjusted to be the reference face image.
Optionally, the adjusting module may include: the adjustment sub-module is used for adjusting the initial reference image to obtain a new initial reference image based on the second image difference and the difference between the detection probability and the specified probability if the adjustment times are smaller than the specified numerical value, wherein the adjustment times are times for executing adjustment operations, and the adjustment operations are times for adjusting the initial reference image to obtain a new initial reference image; and the frequency calculation module is used for increasing the adjustment frequency.
Optionally, the method may further include: the second judging module is used for judging whether the detection probability is larger than the specified probability or not if the adjustment times are not smaller than the specified numerical value; the first processing module is used for taking the current initial reference image as a reference face image if the initial reference image is larger than the specified probability; and the second processing module is used for adjusting the initial reference image to obtain a new initial reference image based on the second image difference and the difference between the detection probability and the appointed probability if the initial reference image is not larger than the appointed probability, and clearing the adjustment times.
In other embodiments, the adjusting module may include: the third judging module is used for judging whether the detection probability is larger than the specified probability or not if the initial reference image is adjusted; the third processing module is used for taking the current initial reference image as a reference face image if the initial reference image is larger than the specified probability; and a fourth processing module, configured to adjust the initial reference image to obtain a new initial reference image based on the second image difference and based on a difference between the detection probability and the specified probability if the initial reference image is not greater than the specified probability.
Optionally, in some embodiments, the adjusting module may include: a fifth processing module for establishing an objective function based on the second image difference and based on a difference between the detection probability and a specified probability; the solving module is used for solving the objective function by adopting a gradient descent method to obtain an iterative formula of the initial reference image; and the iteration module is used for adjusting the initial reference image based on the iteration formula to obtain a new initial reference image.
In some embodiments, the objective function in the fifth processing module may be Wherein x is the face image, < >>For the initial reference image to be used,representing the probability of the initial reference image being classified as a label i corresponding to the prosthesis,/->And representing the probability that the initial reference image is classified as a label t corresponding to a living body, wherein c and k are super parameters larger than 0. />
Optionally, the challenge sample generating device for in-vivo detection may further include: and the defense training module is used for performing defense training on the human face living body detection model based on the antibody sample.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working processes of the modules/units/sub-units/components in the above-described apparatus may refer to corresponding processes in the foregoing method embodiments, which are not described herein again.
In the several embodiments provided by the present application, the illustrated or discussed coupling or direct coupling or communication connection of the modules to each other may be through some interfaces, indirect coupling or communication connection of devices or modules, electrical, mechanical, or other forms.
In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules.
Referring to fig. 12, a block diagram of an electronic device according to an embodiment of the application is shown. The electronic device in this embodiment may include one or more of the following components: processor 1210, memory 1220, and one or more applications, wherein the one or more applications may be stored in memory 1220 and configured to be executed by the one or more processors 1210, the one or more applications configured to perform the method as described in the foregoing method embodiments.
Wherein the electronic device may be any of a variety of types of computer system devices that are mobile, portable, and perform wireless communications. In particular, the electronic device may be a mobile phone or a smart phone (e.g., an iPhone-based (TM) -based phone), a Portable game device (e.g., a Nintendo DS (TM) -based phone, a PlayStation Portable (TM) -Gameboy Advance TM, an iPhone (TM)), a laptop, a PDA, a Portable internet device, a music player, and a data storage device, other handheld devices, and devices such as a smart watch, a smart bracelet, a headset, a pendant, etc., and the electronic device may also be other wearable devices (e.g., devices such as an electronic glasses, an electronic garment, an electronic bracelet, an electronic necklace, an electronic tattooing, an electronic device, or a head-mounted device (HMD)).
The electronic device may also be any of a number of electronic devices including, but not limited to, cellular telephones, smart phones, smart watches, smart bracelets, other wireless communication devices, personal digital assistants, audio players, other media players, music recorders, video recorders, cameras, other media recorders, radios, medical devices, vehicle transportation equipment, calculators, programmable remote controls, pagers, laptop computers, desktop computers, printers, netbooks, personal Digital Assistants (PDAs), portable Multimedia Players (PMPs), moving picture experts group (MPEG-1 or MPEG-2) audio layer 3 (MP 3) players, portable medical devices, and digital cameras, and combinations thereof.
In some cases, the electronic device may perform a variety of functions (e.g., playing music, displaying video, storing pictures, and receiving and sending phone calls). The electronic device may be, for example, a cellular telephone, a media player, other handheld device, a wristwatch device, a pendant device, an earpiece device, or other compact portable device, if desired.
Optionally, the electronic device may be a server, for example, an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network ), and basic cloud computing services such as big data and an artificial intelligent platform, or a dedicated or platform server that provides face recognition, autopilot, industrial internet services, data communication (such as 4G, 5G, etc.).
Processor 1210 may include one or more processing cores. Processor 1210 utilizes various interfaces and lines to connect various portions of the overall electronic device, perform various functions of the electronic device, and process data by executing or executing instructions, applications, code sets, or instruction sets stored in memory 1220, and invoking data stored in memory 1220. Alternatively, the processor 1210 may be implemented in hardware in at least one of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), programmable logic array (Programmable Logic Array, PLA). The processor 1210 may integrate one or a combination of several of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), and a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for being responsible for rendering and drawing of display content; the modem is used to handle wireless communications. It will be appreciated that the modem may not be integrated into the processor 1210 and may be implemented solely by a single communication chip.
Memory 1220 may include random access Memory (Random Access Memory, RAM) or Read-Only Memory (rom). Memory 1220 may be used to store instructions, applications, code sets, or instruction sets. The memory 1220 may include a stored program area and a stored data area, wherein the stored program area may 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 the various method embodiments described below, etc. The stored data area may also be data created by the electronic device in use (e.g., phonebook, audio-video data, chat-record data), etc.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the processor 1210 and the memory 1220 of the electronic device described above may refer to the corresponding process in the foregoing method embodiment, which is not repeated herein.
Referring to fig. 13, a block diagram of a computer readable storage medium according to an embodiment of the application is shown. The computer readable storage medium 1300 has stored therein program code that can be invoked by a processor to perform the methods described in the method embodiments described above.
The computer readable storage medium 1300 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Optionally, computer readable storage medium 1300 includes non-volatile computer readable storage medium (non-transitory computer-readable storage medium). The computer readable storage medium 1300 has storage space for program code 1310 that performs any of the method steps described above. The program code can be read from or written to one or more computer program products. Program code 1310 may be compressed, for example, in a suitable form. The computer readable storage medium 1300 may be, for example, a Read-Only Memory (ROM), a random access Memory (Random Access Memory RAM), an SSD, an electrically erasable programmable Read-Only Memory (Electrically Erasable Programmable Read Only Memory EEPROM), or a Flash Memory (Flash).
In some embodiments, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-described method embodiments.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
From the above description of the embodiments, it will be clear to those skilled in the art that the method of the above embodiments may be implemented by means of software plus a necessary general purpose hardware platform, or of course by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, SSD, flash) comprising several instructions for causing a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method of the embodiments of the present application.
According to the method, the device, the electronic equipment and the storage medium for generating the countermeasure sample for the living body detection, the face image containing the forged face can be firstly obtained, and then the face living body detection is carried out on the face image to obtain the detection result. When the detection result is a prosthesis, a reference face image is generated based on the face image, wherein a first image difference between the reference face image and the face image is smaller than a specified difference, and the probability that the reference face image belongs to a living body is larger than the specified probability. And finally, outputting the reference face image as a countermeasure sample. Because two conditions of image difference and difference between probability belonging to living body and appointed probability are considered simultaneously in the adjustment process, the application can balance the image difference and the difference between probabilities in the repeated adjustment process, so that a countermeasure sample with higher attack success rate can be obtained only by slightly modifying the face image containing the forged face.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the application has been described in detail with reference to the foregoing embodiments, it will be appreciated by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not drive the essence of the corresponding technical solutions to depart from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A method of generating an challenge sample for in vivo detection, the method comprising:
acquiring a face image containing a forged face;
performing human face living body detection on the human face image to obtain a detection result;
if the detection result is a prosthesis, predicting an initial reference image based on the face image;
performing human face living body detection on the initial reference image, and determining the detection probability of the living body of the initial reference image;
based on a second image difference between the face image and the initial reference image and a difference between the detection probability and the specified probability, adjusting the initial reference image to obtain a reference face image, wherein the first image difference between the reference face image and the face image is smaller than the specified difference, and the probability that the reference face image belongs to a living body is larger than the specified probability;
outputting the reference face image as a challenge sample, wherein the challenge sample is used for performing defensive training on a face living body detection model.
2. The method of claim 1, wherein said adjusting the initial reference image to obtain a new initial reference image based on a second image difference between the face image and the initial reference image and based on a difference between the detection probability and a specified probability comprises:
If the adjustment times are smaller than the appointed numerical value, based on the second image difference and the difference between the detection probability and the appointed probability, adjusting the initial reference image to obtain a new initial reference image, wherein the adjustment times are times of executing adjustment operations, and the adjustment operations are times of adjusting the initial reference image to obtain a new initial reference image;
the number of adjustments is increased.
3. The method as recited in claim 2, further comprising:
if the adjustment times are not smaller than the specified numerical value, judging whether the detection probability is larger than the specified probability or not;
if the initial reference image is larger than the specified probability, taking the current initial reference image as a reference face image;
and if the initial reference image is not greater than the specified probability, adjusting the initial reference image based on the second image difference and the difference between the detection probability and the specified probability to obtain a new initial reference image, and clearing the adjustment times.
4. The method of claim 1, wherein said adjusting the initial reference image to obtain a new initial reference image based on a second image difference between the face image and the initial reference image and based on a difference between the detection probability and a specified probability comprises:
If the initial reference image is adjusted, judging whether the detection probability is larger than the designated probability;
if the initial reference image is larger than the specified probability, taking the current initial reference image as a reference face image;
and if the initial reference image is not greater than the specified probability, adjusting the initial reference image based on the second image difference and the difference between the detection probability and the specified probability to obtain a new initial reference image.
5. The method of claim 1, wherein adjusting the initial reference image to obtain a new initial reference image based on the second image difference and based on a difference between the detection probability and a specified probability comprises:
establishing an objective function based on the second image difference and on a difference between the detection probability and a specified probability;
solving the objective function by adopting a gradient descent method to obtain an iterative formula of the initial reference image;
and adjusting the initial reference image based on the iterative formula to obtain a new initial reference image.
6. The method of claim 5, wherein the objective function is
Wherein x is the face image, For the initial reference picture,/a>Representing the probability of the initial reference image being classified as a label i corresponding to the prosthesis,/->And representing the probability that the initial reference image is classified as a label t corresponding to a living body, wherein c and k are super parameters larger than 0.
7. The method according to claim 1, wherein the method further comprises:
and performing defensive training on the human face living body detection model based on the antigen sample.
8. An challenge sample generating device for in vivo detection, the device comprising:
the acquisition module is used for acquiring a face image containing a forged face;
the detection module is used for performing face living body detection on the face image to obtain a detection result;
the determining module is used for predicting an initial reference image based on the face image if the detection result is a prosthesis;
performing human face living body detection on the initial reference image, and determining the detection probability of the living body of the initial reference image;
based on a second image difference between the face image and the initial reference image and a difference between the detection probability and the appointed probability, adjusting the initial reference image to obtain a new initial reference image, and returning to execute face living detection and subsequent operation on the initial reference image until the initial reference image is adjusted to be a reference face image, wherein the first image difference between the reference face image and the face image is smaller than the appointed difference, and the probability that the reference face image belongs to a living body is larger than the appointed probability;
And the output module is used for outputting the reference face image as a countermeasure sample, and the countermeasure sample is used for performing defensive training on the face living body detection model.
9. An electronic device, comprising:
one or more processors;
a memory;
one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any of claims 1-7.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a program code, which is callable by a processor for executing the method according to any one of claims 1 to 7.
CN202111295940.4A 2021-11-03 2021-11-03 Method and device for generating challenge sample for living body detection, electronic device and storage medium Active CN114463859B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111295940.4A CN114463859B (en) 2021-11-03 2021-11-03 Method and device for generating challenge sample for living body detection, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111295940.4A CN114463859B (en) 2021-11-03 2021-11-03 Method and device for generating challenge sample for living body detection, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN114463859A CN114463859A (en) 2022-05-10
CN114463859B true CN114463859B (en) 2023-08-11

Family

ID=81405090

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111295940.4A Active CN114463859B (en) 2021-11-03 2021-11-03 Method and device for generating challenge sample for living body detection, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN114463859B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109543640A (en) * 2018-11-29 2019-03-29 中国科学院重庆绿色智能技术研究院 A kind of biopsy method based on image conversion
CN109583342A (en) * 2018-11-21 2019-04-05 重庆邮电大学 Human face in-vivo detection method based on transfer learning
CN110866287A (en) * 2019-10-31 2020-03-06 大连理工大学 Point attack method for generating countercheck sample based on weight spectrum
CN111753595A (en) * 2019-03-29 2020-10-09 北京市商汤科技开发有限公司 Living body detection method and apparatus, device, and storage medium
CN111783629A (en) * 2020-06-29 2020-10-16 浙大城市学院 Human face in-vivo detection method and device for resisting sample attack
CN112329837A (en) * 2020-11-02 2021-02-05 北京邮电大学 Countermeasure sample detection method and device, electronic equipment and medium
CN112766189A (en) * 2021-01-25 2021-05-07 北京有竹居网络技术有限公司 Depth forgery detection method, device, storage medium, and electronic apparatus
CN113111776A (en) * 2021-04-12 2021-07-13 京东数字科技控股股份有限公司 Method, device and equipment for generating countermeasure sample and storage medium
CN113554089A (en) * 2021-07-22 2021-10-26 西安电子科技大学 Image classification countermeasure sample defense method and system and data processing terminal
CN113591526A (en) * 2020-04-30 2021-11-02 华为技术有限公司 Face living body detection method, device, equipment and computer readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110741388B (en) * 2019-08-14 2023-04-14 东莞理工学院 Confrontation sample detection method and device, computing equipment and computer storage medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109583342A (en) * 2018-11-21 2019-04-05 重庆邮电大学 Human face in-vivo detection method based on transfer learning
CN109543640A (en) * 2018-11-29 2019-03-29 中国科学院重庆绿色智能技术研究院 A kind of biopsy method based on image conversion
CN111753595A (en) * 2019-03-29 2020-10-09 北京市商汤科技开发有限公司 Living body detection method and apparatus, device, and storage medium
CN110866287A (en) * 2019-10-31 2020-03-06 大连理工大学 Point attack method for generating countercheck sample based on weight spectrum
CN113591526A (en) * 2020-04-30 2021-11-02 华为技术有限公司 Face living body detection method, device, equipment and computer readable storage medium
CN111783629A (en) * 2020-06-29 2020-10-16 浙大城市学院 Human face in-vivo detection method and device for resisting sample attack
CN112329837A (en) * 2020-11-02 2021-02-05 北京邮电大学 Countermeasure sample detection method and device, electronic equipment and medium
CN112766189A (en) * 2021-01-25 2021-05-07 北京有竹居网络技术有限公司 Depth forgery detection method, device, storage medium, and electronic apparatus
CN113111776A (en) * 2021-04-12 2021-07-13 京东数字科技控股股份有限公司 Method, device and equipment for generating countermeasure sample and storage medium
CN113554089A (en) * 2021-07-22 2021-10-26 西安电子科技大学 Image classification countermeasure sample defense method and system and data processing terminal

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
轻量级鲁棒人脸活体检测方法研究;杨杰之;《中国优秀硕士学位论文全文数据库》;信息科技辑 I138-135 *

Also Published As

Publication number Publication date
CN114463859A (en) 2022-05-10

Similar Documents

Publication Publication Date Title
CN111461089B (en) Face detection method, and training method and device of face detection model
CN108111489B (en) URL attack detection method and device and electronic equipment
US20210019541A1 (en) Technologies for transferring visual attributes to images
CN107330904B (en) Image processing method, image processing device, electronic equipment and storage medium
CN109657554B (en) Image identification method and device based on micro expression and related equipment
CN111475797B (en) Method, device and equipment for generating countermeasure image and readable storage medium
EP4099217A1 (en) Image processing model training method and apparatus, device, and storage medium
CN111340013B (en) Face recognition method and device, computer equipment and storage medium
CN111738735B (en) Image data processing method and device and related equipment
CN114333078A (en) Living body detection method, living body detection device, electronic apparatus, and storage medium
CN111160555A (en) Processing method and device based on neural network and electronic equipment
CN108875549B (en) Image recognition method, device, system and computer storage medium
JP2022177229A (en) Liveness detection verification method, liveness detection verification system, recording medium, and method for training liveness detection verification system
CN114841340B (en) Identification method and device for depth counterfeiting algorithm, electronic equipment and storage medium
CN114463859B (en) Method and device for generating challenge sample for living body detection, electronic device and storage medium
CN112200109A (en) Face attribute recognition method, electronic device, and computer-readable storage medium
CN116580208A (en) Image processing method, image model training method, device, medium and equipment
Deb et al. Use of auxiliary classifier generative adversarial network in touchstroke authentication
CN115937938A (en) Training method of face identity recognition model, face identity recognition method and device
CN108446660A (en) The method and apparatus of facial image for identification
CN114596638A (en) Face living body detection method, device and storage medium
CN112070022A (en) Face image recognition method and device, electronic equipment and computer readable medium
CN111931148A (en) Image processing method and device and electronic equipment
CN111898529A (en) Face detection method and device, electronic equipment and computer readable medium
CN117079336B (en) Training method, device, equipment and storage medium for sample classification model

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant