Sample generation method, payment method, sample generation system and related equipment
By masking and superimposing two user images, high-quality attack samples are generated, which solves the problem of difficulty in generating high-quality attack samples in the prior art, and improves the ability of face-scanning payment devices to identify and combat attacks.
Patent Information
- Application Number
- CN202111184870.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-12
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2041-10-12
AI Technical Summary
The prior art is difficult to generate high-quality attack samples, making it difficult for face-scanning payment devices to identify and defend against attacks.
By obtaining two user images, masking and overlaying, generating overlay images, and inputting them into the preset face recognition model for training, generating high-quality attack samples.
The generated attack samples can effectively improve the ability of face-scanning payment devices to identify and combat attacks and enhance the security of the devices.
Smart Images

Figure CN113947409B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of artificial intelligence, and in particular, to a sample generation method, a payment method, a sample generation system, and related equipment. Background Art
[0002] With the continuous development of artificial intelligence technology, face recognition technology is increasingly used in people's daily lives, for example, face payment. However, in actual applications, there are criminals who carry out counterattacks, for example, wearing masks and pretending to be other legitimate users to steal money.
[0003] In order to identify the above-mentioned fraudulent card behaviors, face-scanning payment devices are usually trained to defend against the above-mentioned adversarial attacks. In the above-mentioned training process, a large number of attack samples are required for training. However, it is difficult for current technology to generate high-quality attack samples, and training with low-quality attack samples is difficult to improve the ability of face-scanning payment devices to identify adversarial attacks. Therefore, a method is urgently needed to generate high-quality attack samples. Summary of the invention
[0004] The embodiments of the present application provide a sample generation method, a payment method, a sample generation system and related equipment to provide a way to generate samples through model training, which can generate high-quality attack samples.
[0005] In a first aspect, an embodiment of the present application provides a sample generation method, including:
[0006] Acquire a first user image and a second user image;
[0007] Performing mask covering on the first user image to obtain a first user covered image;
[0008] Superimposing the first user masked image and the second user image to obtain a superimposed image;
[0009] The superimposed image is input into one or more preset face recognition models for training to obtain attack samples.
[0010] In the embodiment of the present application, high-quality attack samples can be generated by training a composite image of the first user image and the second user image.
[0011] In one possible implementation, inputting the superimposed image into one or more preset face recognition models for training to obtain the attack sample includes:
[0012] Performing data enhancement on the superimposed image to obtain an enhanced image;
[0013] The enhanced image is input into one or more preset face recognition models for training to obtain attack samples.
[0014] In one possible implementation, inputting the superimposed image into one or more preset face recognition models for training includes:
[0015] Inputting the superimposed image into one or more preset face recognition models to obtain a recognition result;
[0016] Calculating a loss based on the recognition result and the first user image;
[0017] The first user masked image is gradient updated based on the loss to obtain a first user masked updated image, and the first user masked updated image is input into one or more preset face recognition models for training.
[0018] In one possible implementation, the first user masked image includes a visible part and an invisible part, and superimposing the first user masked image and the second user image to obtain a superimposed image includes:
[0019] The visible portion of the first user masked image is overlaid on the second user image to obtain a superimposed image.
[0020] In one possible implementation, the multiple preset face recognition models include multiple preset face recognition models of different network types.
[0021] The present application embodiment also provides a payment method, including:
[0022] In response to the user's operation, acquiring a user's facial image;
[0023] Performing face detection on the face image;
[0024] Performing liveness recognition on the detected human face using a preset liveness recognition model to obtain a first recognition result; wherein the first recognition result is used to characterize the classification of the human face, and the preset liveness recognition model is obtained by training the samples obtained by the above-mentioned sample generation method;
[0025] Based on the first recognition result, a preset face recognition model is used to perform face recognition on the detected face to obtain a second recognition result; wherein the second recognition result is used to characterize the recognized target object, and the preset liveness recognition model is trained by the samples obtained by the above-mentioned sample generation method;
[0026] The payment is completed based on the second identification result.
[0027] In a second aspect, an embodiment of the present application provides a sample generation system, including:
[0028] An acquisition module, used to acquire a first user image and a second user image;
[0029] a masking module, configured to perform masking on the first user image to obtain a first user masked image;
[0030] A superposition module, used for superimposing the first user masked image and the second user image to obtain a superimposed image;
[0031] The generation module is used to input the superimposed image into one or more preset face recognition models for training to obtain attack samples.
[0032] In one possible implementation, the generating module is further used to
[0033] Performing data enhancement on the superimposed image to obtain an enhanced image;
[0034] The enhanced image is input into one or more preset face recognition models for training to obtain attack samples.
[0035] In one possible implementation, the generating module is further used to
[0036] Inputting the superimposed image into one or more preset face recognition models to obtain a recognition result;
[0037] Calculating a loss based on the recognition result and the first user image;
[0038] The first user masked image is gradient updated based on the loss to obtain a first user masked updated image, and the first user masked updated image is input into one or more preset face recognition models for training.
[0039] In one possible implementation, the first user masked image includes a visible portion and an invisible portion, and the superposition module is further configured to
[0040] The visible portion of the first user masked image is overlaid on the second user image to obtain a superimposed image.
[0041] In one possible implementation, the multiple preset face recognition models include multiple preset face recognition models of different network types.
[0042] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0043] A memory, wherein the memory is used to store computer program codes, wherein the computer program codes include instructions, and when the electronic device reads the instructions from the memory, the electronic device performs the following steps:
[0044] In response to the user's operation, acquiring a user's facial image;
[0045] Performing face detection on the face image;
[0046] Performing liveness recognition on the detected face using a preset liveness recognition model to obtain a first recognition result; wherein the first recognition result is used to characterize the classification of the face, and the preset liveness recognition model is obtained by training the samples obtained by the method described in the first aspect;
[0047] Based on the first recognition result, a preset face recognition model is used to perform face recognition on the detected face to obtain a second recognition result; wherein the second recognition result is used to characterize the recognized target object, and the preset liveness recognition model is trained by the samples obtained by the method described in the first aspect;
[0048] The payment is completed based on the second identification result.
[0049] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the method described in the first aspect.
[0050] In a fifth aspect, an embodiment of the present application provides a computer program, which, when executed by a computer, is used to execute the method described in the first aspect.
[0051] In one possible design, the program in the fifth aspect may be stored in whole or in part on a storage medium packaged together with the processor, or may be stored in whole or in part on a memory not packaged together with the processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 A schematic diagram of a flow chart of a sample generation method provided in an embodiment of the present application;
[0053] Figure 2 A schematic diagram of a payment method according to an embodiment of the present application;
[0054] Figure 3 A schematic diagram of the structure of a sample generation system provided in an embodiment of the present application;
[0055] Figure 4 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The technical solution in the embodiment of the present application will be described below in conjunction with the drawings in the embodiment of the present application. In the description of the embodiment of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0057] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0058] With the continuous development of artificial intelligence technology, face recognition technology is increasingly used in people's daily lives, for example, face payment. However, in actual applications, there are criminals who carry out counterattacks, for example, wearing masks and pretending to be other legitimate users to steal money.
[0059] In order to identify the above-mentioned fraudulent card behaviors, face-scanning payment devices are usually trained to defend against the above-mentioned adversarial attacks. In the above-mentioned training process, a large number of attack samples are required for training. However, it is difficult for current technology to generate high-quality attack samples, and training with low-quality attack samples is difficult to improve the ability of face-scanning payment devices to identify adversarial attacks. Therefore, a method is urgently needed to generate high-quality attack samples.
[0060] Based on the above problems, an embodiment of the present application proposes a sample generation method.
[0061] Now combined Figure 1 The sample generation method provided in the embodiment of the present application is described.
[0062] like Figure 1 The figure is a flow chart of an embodiment of a sample generation method provided in an embodiment of the present application, including:
[0063] Step 101, obtaining a training data set.
[0064] Specifically, the training data set may include a first training data set and a second training data set. The first training data set may include multiple training data, and the training data may be an image of any user (for the convenience of explanation, the user here will be referred to as the "first user" below) (for the convenience of explanation, the image will be referred to as the "first user image" below), that is, one training data may be an image (for example, a first user image), and the first user image may be an attack image, that is, a counterfeit image. The first user image may be obtained through an Internet gallery, may be obtained from a local gallery, or may be obtained by shooting. The embodiment of the present application does not specifically limit the source of the first user image. It can be understood that, for the effectiveness of training, multiple training data are usually required, and therefore, multiple first user images are required for training. In addition, the first user may be the same user, that is, the multiple first user images may be multiple images of the same user.
[0065] Preferably, in order to improve the quality of training and avoid overfitting of training, the first user may be a plurality of different users, that is, the plurality of first user images may be images of different users.
[0066] The second training data set may also include multiple training data, and the training data may be an image of any user (for the convenience of explanation, the user here will be referred to as the "second user" hereinafter) (for the convenience of explanation, the image will be referred to as the "second user image" hereinafter), that is, one training data may be an image (for example, a second user image), and the second user image may be a recognized image, that is, an image that is counterfeited. Similarly, the second user image may be obtained through an Internet gallery, may be obtained from a local gallery, or may be obtained by shooting. The embodiment of the present application does not specifically limit the source of the second user image. It can be understood that, in order to ensure the effectiveness of training, multiple training data are usually required, and therefore, multiple second user images are required for training. In addition, the second user may be the same user, that is, the multiple second user images may be multiple images of the same user.
[0067] Preferably, in order to improve the quality of training and avoid overfitting of training, the second user may be a plurality of different users, that is, the plurality of second user images may be images of different users.
[0068] It should be noted that the second user is different from the first user.
[0069] Step 102: Initialize the first user image.
[0070] Specifically, after obtaining a training data set (for example, multiple first user images), any first user image in the training data set may be initialized. The initialization process may be to cover the first user image. For example, Figure 1 As shown, after the first user image 1000 is initially masked, a first user masked image 1010 can be obtained, and the first user masked image 1010 includes a visible part 10101 and an invisible part 10102. The visible part 10101 includes eyebrows, eyes, nose, mouth and other parts. The visible part 10101 has no obstructions, so all organs in the visible part 10101 are visible. The invisible part 10102 includes parts other than the eyebrows, eyes, nose and mouth. Since the invisible part 10102 is blocked by the mask, all organs in the invisible part 10102 are invisible.
[0071] Step 103: superimpose the first user masked image and the second user image to obtain a superimposed image.
[0072] Specifically, after obtaining the first user masked image, a second user image can be randomly selected from the second training data. Then, the first user masked image and the second user image can be superimposed to obtain a superimposed image, which can be considered as an attack image with a mask, that is, a counterfeit image. The superimposition can be to overlay the visible part of the first user masked image on the second user image. For example, Figure 1 For example, the visible part 10101 in the first user masked image 1010 can be overlaid on the second user image 2000, thereby obtaining the superimposed image 2010. It can be understood that the above superposition is only completed by covering the visible part 10101 on the second user image 2000, and the invisible part 10102 is not overlaid on the second user image 2000. Therefore, the eyebrows, eyes, nose, mouth and other parts on the superimposed image 2010 present the eyebrows, eyes, nose, and mouth in the first user image 1000, and the parts other than the eyebrows, eyes, nose, and mouth on the superimposed image 2010 present the content on the second user image 2000.
[0073] Step 104: perform data enhancement on the superimposed image to obtain an enhanced image.
[0074] Optionally, after the superimposed image is acquired, data enhancement may be performed on the superimposed image. The data enhancement may include operations such as transforming the width of the image and rotating the image. Through the data enhancement, the texture of the superimposed image may be improved, which is beneficial for recognition.
[0075] It should be noted that step 104 is an optional step, that is, step 104 may not be performed, and the superimposed image may be directly input into the face recognition model for recognition (for example, step 105 is performed).
[0076] Step 105: input the enhanced image into a preset face recognition model for recognition.
[0077] Specifically, after the enhanced image is acquired, the enhanced image may be input into a preset face recognition model for recognition to obtain a recognition result, which may be used to characterize the similarity between the enhanced image and the second user image.
[0078] It should be noted that if an enhanced image is obtained in step 105 (for example, data enhancement is performed in step 104), the enhanced image can be directly input into the preset face recognition model. If only an overlay image is obtained in step 105, the overlay image can be directly input into the preset face recognition model. For the convenience of explanation, the following description is made by taking the recognition of the enhanced image as an example.
[0079] The preset face recognition model may be a neural network model, or may be another type of deep learning network model. The embodiment of the present application does not specifically limit the network type of the face recognition model.
[0080] Step 106: Calculate the loss based on the recognition result, perform gradient update on the first user masked image based on the loss, and obtain the attack sample based on the update result.
[0081] Specifically, when the face recognition model recognizes the enhanced image and obtains the recognition result, the loss can be calculated based on the recognition result and the first user image. For example, the first user image can be used as a label value and the recognition result can be used as a prediction value. Then, the loss can be calculated based on the label value and the prediction value, and the gradient value can be calculated from the loss. After the gradient value is calculated, the gradient of the first user masked image can be updated based on the gradient value, thereby obtaining the first user masked updated image.
[0082] Next, the first user masked updated image can be processed in the manner of steps 103 to 105. For example, the first user masked updated image can be superimposed on the second user image, the superimposed image can be enhanced, and the enhanced image can be input into a preset face recognition model for recognition, thereby obtaining the loss. When the loss reaches a preset target (for example, the preset target can be a similarity threshold between the enhanced image and the second user image), the training of the first user image can be terminated, wherein the superimposed image obtained last time can be used as the final attack sample. Optionally, the enhanced image obtained last time can also be used as the final attack sample.
[0083] For example, Figure 1 Taking the first user image 1000 and the second user image 2000 shown in FIG. 1 as an example, when the first user image 1000 is initialized for the first time and superimposed with the second user image 2000, a superimposed image 2010 is obtained. Next, after the superimposed image 2010 is identified, it is determined whether the preset condition is met according to the calculated loss. If the preset condition is met, the superimposed image 2010 can be used as the attack sample of this time. If the preset condition is not met, the first user masked image 1010 can be gradient updated based on the loss, thereby obtaining the first user masked first updated image 1011. The first user masked first updated image 1011 is superimposed with the second user image 2000 to obtain the superimposed first updated image 2011. Next, after the superimposed image 2011 is identified, it is determined whether the preset condition is met according to the calculated loss. If the preset condition is met, the superimposed image 2011 can be used as the attack sample of this time. If the preset condition is not met, the first user masked first update image 1011 can be further gradient updated based on the above loss, thereby obtaining the first user masked second update image 1012, and can be further superimposed and identified in the above manner until the loss meets the preset condition. It should be noted that the above only uses the superimposed image as an attack sample as an example, but is not limited to this. In some embodiments, the above enhanced image can also be used as an attack sample. The specific method of using the above enhanced sample as an attack sample can refer to the above method of using the superimposed image as an attack sample, which will not be repeated here.
[0084] It is understandable that after a first user image and a second user image are trained to obtain corresponding attack samples, the next first user image and the next second user image may be trained to obtain corresponding attack samples. Optionally, only one of the first user image and the second user image may be replaced, for example, only the first user image or only the second user image.
[0085] After the above-mentioned face recognition model recognizes any superimposed image or enhanced image, a recognition result can be obtained. Then, the loss (LOSS) can be calculated based on the above-mentioned recognition result and the first user image corresponding to the recognition result. Since the purpose of the embodiment of the present application is to construct an attack sample, the above-mentioned recognition result is to make the superimposed image or enhanced image similar to the first user image, so as to construct a high-quality attack sample. In other words, the above-mentioned loss is based on the similarity between the superimposed image or enhanced image and the first user image. The higher the similarity between the superimposed image or enhanced image and the first user image, the smaller the loss, and the lower the similarity between the superimposed image or enhanced image and the first user image, the greater the loss. Through the above-mentioned training, the above-mentioned cover image (for example, the first user cover image 1010) is continuously updated according to the gradient, so that the loss is reduced, thereby achieving the preset condition that the superimposed image or enhanced image is similar to the first user image. Among them, the preset condition can be a similarity threshold. For example, when the similarity between the superimposed image or enhanced image and the first user image reaches 80%, it can be considered that the preset condition is met. It should be noted that the above value of 80% is only an example and does not constitute a limitation on the embodiments of the present application. In some embodiments, other values may also be used.
[0086] Preferably, in the above-mentioned training process, the above-mentioned first user image and the second user image can also be trained by multiple face recognition models (for example, model 1, model 2...model n). Exemplarily, the above-mentioned superimposed image or enhanced image can be input into a face recognition model for training. When the above-mentioned superimposed image or enhanced image is trained by the current face recognition model and meets the preset conditions, the above-mentioned superimposed image or enhanced image can be trained by the next face recognition model. Among them, the above-mentioned multiple face recognition models can be different types of network models, so that the training results can adapt to different types of network models, thereby improving the quality of attack samples. After the above-mentioned superimposed image or enhanced image is trained by n face recognition models and all meet the preset conditions, the superimposed image or enhanced image trained in the last face recognition model can be used as an attack sample. Among them, the value of n can be preset, that is, n face recognition models can be selected in advance.
[0087] Optionally, when using the above-mentioned n face recognition models for training, training can also be performed in batch training. Exemplarily, supervised training can be first performed using n-1 face recognition models. Among them, the above-mentioned n-1 face recognition models can be randomly selected. After training with the above-mentioned n-1 face recognition models, attack samples after gradient update can be obtained. Then, supervised training can be performed using the remaining 1 face recognition model, thereby obtaining the final attack sample. Compared with the solution of using n at the same time, the batch training method can further improve the attack success rate and stability of the attack sample.
[0088] The embodiment of the present application also proposes a payment method for defending against attacks on face-swiping payment.
[0089] Now combined Figure 2 The payment method provided in the embodiment of the present application is described.
[0090] like Figure 2 The figure is a flow chart of an embodiment of a payment method provided by an embodiment of the present application, including:
[0091] Step 201: Acquire a user's facial image in response to a user's operation.
[0092] Specifically, the user can operate on the electronic device. For example, the user can click on the face recognition function control on the display screen of the electronic device. The electronic device can be a face recognition payment device, such as a vending machine. In response to the user's operation, the electronic device can turn on the camera to obtain the user's face image.
[0093] Step 202: Detect the face image and determine the position of the face.
[0094] Specifically, after the electronic device obtains the user's face image, it can perform face detection on the user's face image to locate the user's face, thereby obtaining the position of the face in the preview interface of the electronic device. The above-mentioned positioning of the face position can use an existing face detection algorithm, which will not be repeated here.
[0095] Step 203: Perform liveness recognition on the face.
[0096] Specifically, after the electronic device locates the face in the user's face image, liveness recognition can be performed on the face. The liveness recognition is used to identify whether it is live or prosthetic, that is, to classify the type of the face, and the categories may include live and prosthetic. The liveness recognition can be performed using a preset liveness recognition model. The preset liveness recognition model can be obtained through training. In the training process, the attack sample generated by the sample generation method can be used for training to improve the classification accuracy of the liveness recognition model.
[0097] Step 204: perform face recognition on the face.
[0098] Specifically, after performing liveness recognition on the face in step 203, if it is determined that the face is a live type, that is, the face is a real face, face recognition can be further performed on the face to identify which user the face belongs to. If it is determined that the face is a fake type, that is, it may be an illegal user wearing a mask to impersonate a legitimate user, then the payment task can be terminated.
[0099] The face recognition can be performed using a preset face recognition model. The preset face recognition model can be obtained through training. During the training process, the attack sample generated by the sample generation method can be used for training to improve the recognition accuracy of the face recognition model.
[0100] Step 205, completing payment based on the face recognition result.
[0101] Specifically, after the user's face is recognized, a recognition result can be obtained. If it is determined that the recognition result matches the face of a legitimate user, the authentication is considered successful. At this time, the payment can be completed. For example, the account of the user whose face corresponds to the recognition result can be called and the corresponding deduction can be made to complete the face payment task. If no legitimate user is matched, the authentication is considered to have failed and the payment task is terminated.
[0102] Figure 3 This is a schematic diagram of the structure of an embodiment of the sample generation system of the present application. Figure 3 As shown, the sample generation system 30 may include: an acquisition module 31, a covering module 32, an overlay module 33 and a generation module 34; wherein,
[0103] An acquisition module 31 is used to acquire a first user image and a second user image;
[0104] A masking module 32, configured to perform masking on the first user image to obtain a first user masked image;
[0105] A superposition module 33, configured to superimpose the first user masked image and the second user image to obtain a superimposed image;
[0106] The generating module 34 is used to input the superimposed image into one or more preset face recognition models for training to obtain attack samples.
[0107] In one possible implementation, the generating module 34 is further used to
[0108] Performing data enhancement on the superimposed image to obtain an enhanced image;
[0109] The enhanced image is input into one or more preset face recognition models for training to obtain attack samples.
[0110] In one possible implementation, the generating module 34 is further used to
[0111] Inputting the superimposed image into one or more preset face recognition models to obtain a recognition result;
[0112] Calculating a loss based on the recognition result and the first user image;
[0113] The first user masked image is gradient updated based on the loss to obtain a first user masked updated image, and the first user masked updated image is input into one or more preset face recognition models for training.
[0114] In one possible implementation, the first user masked image includes a visible portion and an invisible portion, and the superposition module 33 is further configured to
[0115] The visible portion of the first user masked image is overlaid on the second user image to obtain a superimposed image.
[0116] In one possible implementation, the multiple preset face recognition models include multiple preset face recognition models of different network types.
[0117] Figure 4 The structural diagram of the electronic device 100 provided in the embodiment of the present application is exemplarily shown. Figure 4 As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0118] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0119] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0120] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0121] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0122] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0123] Antenna 1 and antenna 2 can both be used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. Of course, considering the simplicity of design and the influence of other factors, a separate antenna can also be provided for each communication mode. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0124] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0125] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0126] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0127] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0128] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0129] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0130] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0131] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0132] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0133] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0134] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0135] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0136] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.
[0137] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0138] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0139] It is understandable that, in order to realize the above functions, the above-mentioned electronic device 100, etc. includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.
[0140] The embodiment of the present application can divide the functional modules of the electronic device 100, etc. according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0141] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0142] Each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0143] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk.
[0144] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A sample generation method, characterized in that: The method comprises: Acquire a first user image and a second user image; Performing masking on the first user image to obtain a first user masked image; Superimposing the first user masked image and the second user image to obtain a superimposed image; Inputting the superimposed image into one or more preset face recognition models for training to obtain attack samples; The inputting the superimposed image into one or more preset face recognition models for training comprises: Inputting the superimposed image into one or more preset face recognition models to obtain a recognition result; Calculating a loss based on the recognition result and the first user image; The first user masked image is gradient updated based on the loss to obtain a first user masked updated image, and the first user masked updated image is input into one or more preset face recognition models for training.
2. The method according to claim 1, characterized in that Inputting the superimposed image into one or more preset face recognition models for training to obtain attack samples comprises: Performing data enhancement on the superimposed image to obtain an enhanced image; The enhanced image is input into one or more preset face recognition models for training to obtain attack samples.
3. The method according to claim 1 or 2, characterized in that: The first user masked image includes a visible part and an invisible part, and superimposing the first user masked image and the second user image to obtain a superimposed image includes: The visible portion of the first user masked image is overlaid on the second user image to obtain a superimposed image.
4. The method according to any one of claims 1 to 3, characterized in that The multiple preset face recognition models include multiple preset face recognition models of different network types.
5. A payment method, characterized in that: The method comprises: In response to the user's operation, acquiring the user's face image; Performing face detection on the face image; Performing liveness recognition on the detected face using a preset liveness recognition model to obtain a first recognition result; wherein the first recognition result is used to characterize the classification of the face, and the preset liveness recognition model is obtained by training the sample obtained by the method according to any one of claims 1 to 4; Based on the first recognition result, using a preset face recognition model to perform face recognition on the detected face to obtain a second recognition result; wherein the second recognition result is used to characterize the recognized target object, and the preset face recognition model is trained by using a sample obtained by the method according to any one of claims 1 to 4; The payment is completed based on the second identification result.
6. A sample generation system, characterized in that: The system comprises: An acquisition module, used to acquire a first user image and a second user image; a masking module, configured to perform masking on the first user image to obtain a first user masked image; A superposition module, used for superimposing the first user masked image and the second user image to obtain a superimposed image; A generation module, used for inputting the superimposed image into one or more preset face recognition models for training to obtain attack samples; The generation module is also used to input the superimposed image into one or more preset face recognition models to obtain a recognition result; calculate the loss based on the recognition result and the first user image; perform a gradient update on the first user masked image based on the loss to obtain a first user masked updated image, and input the first user masked updated image into one or more preset face recognition models for training.
7. The system according to claim 6, characterized in that The generating module is also used to Performing data enhancement on the superimposed image to obtain an enhanced image; The enhanced image is input into one or more preset face recognition models for training to obtain attack samples.
8. The system according to claim 6 or 7, characterized in that: The first user masked image includes a visible part and an invisible part, and the superposition module is further used to The visible portion of the first user masked image is overlaid on the second user image to obtain a superimposed image.
9. The system according to any one of claims 6 to 8, characterized in that: The multiple preset face recognition models include multiple preset face recognition models of different network types.
10. An electronic device, characterized in that: The device comprises: a memory, wherein the memory is used to store computer program codes, wherein the computer program codes include instructions, and when the electronic device reads the instructions from the memory, the electronic device executes the method as claimed in claim 5.
11. A computer-readable storage medium, characterized in that: It comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method as claimed in claim 5, or, when executed on a sample generation system, cause the sample generation system to execute the method as claimed in any one of claims 1-4.
Citation Information
Patent Citations
Living body face recognition model training method, living body face recognition method and related devices
CN113221767A
Payment system with 3D face recognition and use method
CN113256298A