Detection method and device aiming at patch confrontation sample attack

By calculating the similarity of feature positions of face pictures and inputting them into the detection model, the security problem of the face recognition system in adversarial sample attacks is solved, and the rapid and accurate detection of patch adversarial samples is achieved.

CN119049095APending Publication Date: 2024-11-29HUAWEI TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310618660.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-29
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

Existing facial recognition systems are difficult to effectively detect and identify patched adversarial samples when facing adversarial sample attacks, resulting in security threats.

Method used

By obtaining the feature position similarity between the face image to be detected and the preset face image, the feature similarity matrix and weighted matrix are used to calculate the feature position similarity, and input it into the adversarial sample detection classification model to judge the picture to be detected Whether it is a patch-attack sample.

Benefits of technology

It improves the security of the face recognition system, can quickly and accurately identify patch adversarial samples, and enhances the effect of adversarial sample detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119049095A_ABST
    Figure CN119049095A_ABST
Patent Text Reader

Abstract

The invention provides a method and a device for detecting a patch confrontation sample attack, and the method comprises the steps: obtaining a to-be-detected face image, carrying out the feature extraction based on the to-be-detected face image and a preset face image, and obtaining a feature similarity matrix and a weighting matrix; and then, according to the feature similarity matrix and the weighting matrix, obtaining a feature position similarity vector between a to-be-detected face image and a preset face image, and finally, inputting the feature position similarity vector into a trained confrontation sample detector, so that whether the to-be-detected face image is a confrontation sample face can be determined. The method can achieve the detection of the adversarial sample, and improves the safety of a face recognition system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a detection method and device for patch adversarial sample attacks. Background Art

[0002] In recent years, face recognition technology has been widely used in many fields such as real-person authentication, access control recognition, and financial payment. As a result, there are more and more attacks on face recognition technology. Attackers use counter-attack technology to escape or replace the detected faces, causing the face recognition model to make wrong judgments, which poses a greater threat to the security of the face recognition model. Summary of the invention

[0003] Therefore, how to detect and identify adversarial sample attacks in adversarial attacks on face recognition models is an urgent problem that needs to be solved.

[0004] The present application provides a detection method and device for patch adversarial sample attacks, which are used to detect adversarial samples and improve the security of face recognition systems.

[0005] In a first aspect, the present application provides a detection method for patch adversarial sample attacks. Specifically, the method includes: obtaining a face image to be detected. Then, determining the feature position similarity between the face image to be detected and a preset face image. Finally, based on the feature position similarity, determining that the face image to be detected is a face image for patch adversarial sample attacks.

[0006] Through the above technical solution, the feature position similarity between the face image to be detected and the preset face image can be used to determine whether the face image to be detected is a patch adversarial sample, thereby identifying attacks against the patch adversarial sample, which can improve the security of the face recognition system.

[0007] In one possible design, determining the feature position similarity between the face image to be detected and the preset face image includes: extracting a feature similarity matrix and a weighting matrix based on the face image to be detected and the preset face image; and determining the feature position similarity between the face image to be detected and the preset face image based on the feature similarity matrix and the weighting matrix.

[0008] Through the above technical solution, by utilizing the feature differences between adversarial samples and normal samples in the distribution of position feature similarity measurement matrix, the detection effect of the adversarial sample detector is improved.

[0009] In a possible design, determining the feature position similarity between the face image to be detected and the preset face image according to the feature similarity matrix and the weighting matrix includes:

[0010] C metric =FM sim *W metric

[0011] Among them, FM sim is the feature similarity matrix, W metric is a weighted matrix, each element in the feature similarity matrix represents a feature map vector at a corresponding position, and each element in the weighted matrix represents the importance of the feature map vector at a corresponding position.

[0012] In a possible design, the feature similarity matrix and the weighting matrix respectively conform to the following formulas:

[0013] Represents the cosine similarity of the feature map at the corresponding position (i, j) after vector normalization; Represents the sum of the absolute values ​​of the partial derivatives of the cosine similarity loss of the embedding vector for face vector representation with respect to the neurons of the feature map.

[0014] In a possible design, determining that the face image to be detected is a face image attacked by a patch adversarial sample according to the feature position similarity includes:

[0015] The feature position similarity is input into a preset adversarial sample detection classification model to obtain the probability that the face image to be detected is an adversarial sample face image and a non-adversarial sample face image; if the probability that the face image to be detected is an adversarial sample face image is greater than a set threshold, it is determined that the face image to be detected is a face image attacked by a patch adversarial sample.

[0016] Through the above technical solution, a preset adversarial sample detection and classification model can be used to identify whether the face image to be detected is a face image attacked by a patch adversarial sample, thereby improving the security of the face recognition system.

[0017] In one possible design, the preset adversarial sample detection classification model is trained in the following way:

[0018] A candidate sample is obtained, and a patch adversarial sample is generated based on the candidate sample; then, the feature position similarity between each group of samples is determined based on the candidate sample and the patch adversarial sample; finally, a preset adversarial sample detection classification model is obtained by training based on the feature position similarity between each group of samples.

[0019] Through the above technical solution, a binary adversarial sample detection classification model is obtained by training using the feature position similarity between samples, so that patch adversarial sample attacks can be quickly and accurately identified when the adversarial sample detection classification model is used subsequently.

[0020] In a second aspect, the present application also provides a detection device for patch adversarial sample attacks. The detection device for patch adversarial sample attacks may include an acquisition unit and a determination unit. Exemplarily, the acquisition unit is used to acquire a face image to be detected; the determination unit is used to determine the feature position similarity between the face image to be detected and a preset face image, and determine that the face image to be detected is a face image for patch adversarial sample attacks based on the feature position similarity.

[0021] In a third aspect, the present application also provides a detection device for patch adversarial sample attacks. The detection device for patch adversarial sample attacks includes one or more processors; one or more memories; and one or more computer programs; wherein the one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions, and when the instructions are called and executed by one or more processors, the detection device for patch adversarial sample attacks executes the above-mentioned first aspect and any possible design method of the first aspect.

[0022] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores instructions, which, when executed on a detection device for patch adversarial sample attacks, cause the detection device for patch adversarial sample attacks to execute the method of the first aspect and any possible design of the first aspect.

[0023] In a fifth aspect, the present application further provides a computer program product. When the computer program product is run on a device, the device executes the method of the first aspect of the embodiment of the present application and any possible design of the first aspect.

[0024] For the various possible solutions in the above-mentioned second to fifth aspects and the technical effects that may be achieved by the various possible solutions, please refer to the above-mentioned description of the technical effects that can be achieved by the various possible solutions in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present application;

[0026] Figure 2 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;

[0027] Figure 3 A schematic diagram of a face recognition process provided in an embodiment of the present application;

[0028] Figure 4 A flow chart of a detection method for patch adversarial sample attacks provided in an embodiment of the present application;

[0029] Figure 5 A schematic diagram of a detection device for patch adversarial sample attacks provided in an embodiment of the present application;

[0030] Figure 6 A schematic diagram of the structure of a detection device for patch adversarial sample attacks provided in an embodiment of the present application. DETAILED DESCRIPTION

[0031] The terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and the appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two). The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist; for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0032] References to "one embodiment" or "some embodiments" etc. described in this specification mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connected" includes direct and indirect connections, unless otherwise stated.

[0033] 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.

[0034] In the embodiments of the present application, the words "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.

[0035] First, some terms in the embodiments of the present application are explained to facilitate understanding by those skilled in the art.

[0036] 1. Adversarial Examples

[0037] Adversarial examples are input samples that are created by intentionally adding subtle interference to a dataset, which causes the model to give an incorrect output with high confidence.

[0038] 2. Counterattack

[0039] Adversarial attack refers to the attacker designing a targeted numerical vector (the input of the machine learning algorithm) to make the machine learning model make a wrong judgment. Alternatively, it can also be understood as the process of generating adversarial samples is an adversarial attack.

[0040] 3. Patch adversarial sample attack

[0041] Patch adversarial samples refer to adversarial attack forms that are easy for attackers to implement in the physical world. The attack noise of patch adversarial samples is constrained to an adversarial sample (Patch) in a specific patch area. In face recognition scenarios, this adversarial sample can be worn on the face by attackers, usually in the form of glasses, masks, etc.

[0042] 4. Feature Map

[0043] Refers to the features extracted by each convolution layer of the model. The data exists in three-dimensional form and can be seen as many two-dimensional images stacked together, each of which is called a feature map. It should be understood that the feature map in the embodiment of the present application mainly refers to the feature map before the fully connected layer after the convolution network passes through all the convolution modules.

[0044] For example, Figure 1 An application scenario provided by an embodiment of the present application is shown. Figure 1As shown, the application scenario may include a terminal device 10 and a server 20. Among them, an application that supports face recognition can be installed and run in the terminal device 10. In addition, the terminal device 10 can be any electronic device with a display screen, such as a mobile phone, a tablet computer, a wearable device (for example, a watch, a bracelet, a smart helmet, smart glasses, etc.), a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., which is not limited in the embodiments of the present application. The terminal device 10 involved in the embodiments of the present application may be a foldable terminal, such as a foldable mobile phone, a foldable tablet computer, etc., which is not limited in the present application. In addition, exemplary embodiments of the terminal device 10 include but are not limited to a terminal equipped with Or a terminal device 10 of other operating systems.

[0045] The server 20 may be a single server or a server cluster. Furthermore, the server 20 may also be a cloud server, etc., which is not limited in this application. The server 20 may provide background services for applications running on the terminal device 10. In the embodiment of this application, the server 20 may provide background services for applications supporting face recognition running on the terminal device 10.

[0046] exist Figure 1 In the schematic diagram shown, a communication connection can be established between the terminal device 10 and the server 20 through a communication network, and the communication network can be a local area network (for example, a wireless fidelity (wifi) hotspot network), or a wide area network transferred through a relay device (for example, a fifth-generation mobile communication technology (5G) network), etc., and the present application does not limit this.

[0047] In some embodiments, when a user needs to perform face recognition, such as when face recognition is required to complete a payment task in a payment scenario, the terminal device 10 can collect the user's face image and then send the collected face image to the server 20. Accordingly, after receiving the face image sent by the terminal device 10, the server 20 can process the collected face image, such as performing face positioning and face correction operations, and then extract a feature similarity matrix and a weighting matrix based on the processed face image and the pre-saved face image. Next, the feature similarity matrix and the weighting matrix can be used to calculate the feature position similarity, and finally the feature position similarity vector is input into the trained adversarial sample detector, which can output the result of whether the face image is an adversarial sample face.

[0048] In other embodiments, the terminal device 10 may collect a user's facial image, and then the terminal device 10 may process the collected facial image, such as performing facial positioning and facial correction operations, and then extract a feature similarity matrix and a weighting matrix based on the processed facial image and the pre-saved facial image. Then, the feature similarity matrix and the weighting matrix may be used to calculate the feature position similarity, and finally the feature position similarity vector may be input into a trained adversarial sample detector, which may output a result of whether the facial image is an adversarial sample face.

[0049] That is to say, in the embodiment of the present application, face recognition and detection of adversarial sample faces can be performed by the terminal device 10, or by the server 20, without any specific limitation.

[0050] It should be understood that the embodiments of the present application can be applied in a variety of scenarios using face recognition systems, for example, it can be applied in payment applications that provide face payment functions, or it can also be applied in payment devices that provide face payment functions, or it can also be applied in vending machines with face payment functions, or it can also be applied in access control devices with face recognition, and the embodiments of the present application do not specifically limit this. Alternatively, it can also be understood that the terminal device 10 in the embodiments of the present application can be a terminal running a payment application, or it can also be a payment device that provides face payment functions, or it can also be a vending machine with face payment functions, or it can also be an access control device with face recognition, etc.

[0051] The following introduces Figure 1 The structure of the terminal device 10 in the application scenario shown. Figure 2As shown, the terminal device 10 may include a processor 110, a memory 120, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, a communication module 150, an audio module 160, a sensor module 170, a camera 180, a display screen 190, etc.

[0052] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors. Among them, the controller may be the nerve center and command center of the terminal device 10. The controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions. A memory may also be set in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a high-speed cache memory. The memory may store instructions or data that the processor 110 has just used or circulated. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Repeated access is avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.

[0053] The memory 120 can be used to store computer executable program codes, which include instructions. Alternatively, an external memory card, such as a Micro SD card, can be connected through an external memory interface to expand the storage capacity of the terminal device 10. The external memory card communicates with the processor 110 through the external memory interface to implement a data storage function. For example, files such as pictures and videos are saved in an external memory card. The processor 110 executes various functional applications and data processing of the terminal device 10 by running the instructions stored in the memory 120.

[0054] The USB interface 130 is an interface that complies with USB standard specifications, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 may be used to connect a charger to charge the terminal device 10, and may also be used to transmit data between the terminal device 10 and a peripheral device.

[0055] The charging management module 140 is used to receive charging input from the charger. The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the memory 120, the display screen 190, the camera 180, and the communication module 150.

[0056] The communication module 150 may include a wireless communication module and a mobile communication module. The mobile communication module may provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the terminal device 10. The wireless communication module may provide solutions for wireless communications including wireless local area networks (WLAN) (such as Wi-Fi networks), BT, global navigation satellite system (GNSS), frequency modulation (FM), NFC, infrared technology (IR), etc. applied to the terminal device 10.

[0057] The terminal device 10 can implement audio functions through the audio module 160, such as a speaker, a microphone, and an application processor.

[0058] The sensor module 170 may include a pressure sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, and the like.

[0059] The camera 180 is used to capture static images or videos. The camera 180 may include a front camera and a rear camera. In the embodiment of the present application, the camera 180 may be used to collect facial images.

[0060] The display screen 190 is used to display the display interface of the application, etc. The display screen 190 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 terminal device 10 may include 1 or N display screens 190, where N is a positive integer greater than 1. In an embodiment of the present application, the display screen 190 can be used to display a face image, etc.

[0061] Understandably, Figure 2 The components shown do not constitute a specific limitation on the terminal device 10 , and the terminal device 10 may also include more or fewer components than those shown in the figure, or combine or split some components, or arrange the components differently.

[0062] The process of face recognition technology includes face detection, face correction, face feature extraction and feature comparison. Specifically, the face information in the face picture is enlarged, reduced, rotated, filled and other operations are performed through face positioning detection and face correction algorithms to obtain a face image of fixed size and angle, and then the obtained face image is input into the face recognition model. The face recognition model extracts the face feature vector through the convolutional neural network, and then compares the extracted face feature vector with the pre-registered face feature vector to achieve face recognition.

[0063] For example, Figure 3 FIG. 2 shows a face recognition process provided by an embodiment of the present application. Figure 3 As shown in the figure, face picture 1 and face picture 2 (preset pictures or registered pictures) are used as input pictures of the face recognition model, and then the feature vector of face picture 1 and the feature vector of face picture 2 are obtained through the convolutional neural network's convolutional (Conv) layer, fully-connected (FC) layer, normalization (batchnormalization, BN) layer, and L2-Norm layer. Finally, the face similarity between face picture 1 and face picture 2 is calculated through the feature vector of face picture 1 and the feature vector of face picture 2.

[0064] In the embodiment of the present application, the feature similarity matrix and the weighting matrix can be extracted from the face image after face positioning and face correction and the registered face image, and then the feature similarity matrix and the weighting matrix are used to obtain the feature position similarity of the feature map based on the position information. Then, the calculated feature position similarity of the two images based on the position information is input into the trained adversarial sample detector (or called: multilayer perceptron (MLP) classifier) ​​to determine whether it is a patch adversarial sample attacking the face. In other words, the embodiment of the present application may include two processes: training adversarial sample detector and adversarial sample detection (recognition).

[0065] The following first introduces the training process of the adversarial sample detector involved in the embodiment of the present application. Specifically, it may include the five steps of obtaining candidate samples, generating adversarial samples, generating training data sets, calculating feature position similarity, and training classifiers.

[0066] 1. Obtain candidate samples

[0067] In some embodiments, a standard data set for face recognition (also referred to as a labeled outdoor face data (Labled Faces in the Wild, LFW) data set) can be obtained from the Internet, and then the face images in the LFW data set are processed. Specifically, after the face images in the LFW data set are obtained, the face images in the LFW data set can be filtered according to the degree of deflection of the face, so that the three deflection degrees of the filtered face images (the deflection degrees here refer to the deflection degrees of the face raising, shaking and turning the head) are all less than the set threshold, keeping the face in the face image in the correct position. It can also be understood as: filtering the face images in the LFW data set so that the faces in the filtered face images are positive, rather than faces with a large deflection angle. After filtering the face images in the LFW data set, different photos of the same user and photos of different users can be used as candidate samples.

[0068] 2. Generate adversarial examples

[0069] In some embodiments, an adversarial algorithm can be used to generate adversarial samples based on candidate samples. Exemplarily, the face photos of two users can be spliced, and then noise can be added to the spliced ​​face photos to obtain adversarial samples. For example, if face picture 1 is a face picture of user 1 with a mask, and face picture 2 is a face picture of user 2 with a mask, then part of the face picture 2, the area of ​​the lower half of the face with a mask, can be cropped and then pasted into the area of ​​the lower half of the face with a mask in face picture 1 (or it can be understood as: covering the cropped picture of face picture 2 with the area of ​​the lower half of the face with a mask in face picture 1), and then adding adversarial noise based on the spliced ​​photos to obtain adversarial samples.

[0070] It should be understood that the above is only an example of mask attack. In the embodiments of the present application, physical attacks such as T-shaped glasses attack can also be used, and there is no specific limitation on this.

[0071] 3. Generate training data set

[0072] In some embodiments, after obtaining adversarial samples based on candidate samples, normal samples (referring to samples without adding noise, i.e., candidate samples mentioned above, or also referred to as: initial samples, etc.) and adversarial samples can be combined into a training data set. It should be understood that the training data set may include different sample data of the same user and sample data of different users.

[0073] 4. Feature position similarity calculation

[0074] In some embodiments, the feature position similarity can be calculated by the following formula:

[0075] C metric =FM sim *W metric

[0076] Among them, FM sim is the feature similarity matrix, W metric It is a weighted matrix. Each element in the feature similarity matrix represents the feature map vector at the corresponding position, and each element in the weighted matrix represents the importance of the feature map vector at the corresponding position.

[0077] The similarity at position (i, j) is expressed as follows:

[0078]

[0079] in, Represents the cosine similarity of the (i, j) vector at the corresponding position of the feature map; It represents the partial derivative of the cosine similarity loss L_cos of the embedding vector (EmbeddingVector) used for face vector representation with respect to the FeatureMap neuron. And the result after removing the absolute value according to the corresponding position (i, j, c) and channel (channel). i represents the position number of height, j represents the position number of width, k represents the channel number, and anchor represents the registered face image.

[0080] It should be understood that the number of rows and columns of the matrix is ​​related to the structure of the model, and different models will obtain different matrices. For example, using the FeatureMap layer of the ResNet152 model before entering the FC layer, a 7*7*128 matrix can be obtained. Among them, 7*7 represents the position, and 128 represents the channel, which refers to the depth in the output feature map of the convolution layer.

[0081] In some embodiments, the feature position similarity of the normal sample and the adversarial sample at position (i, j) in the training data set can be calculated in sequence, which can specifically include the similarity between normal sample pairs (the similarity between different samples of the same user and the similarity between different samples of different users) and the similarity between adversarial sample pairs, so that the feature position similarity between all normal samples and adversarial samples can be obtained. For example, taking the ResNet152 model as an example, a 7*7 vector can be obtained after the similarity calculation of each group of samples is completed.

[0082] 5. Training the classifier

[0083] After calculating the feature position similarity between all normal samples and adversarial samples through the above steps, multiple vectors can be input into the model for learning. Finally, the model can learn which samples are normal samples, which samples are adversarial samples, and which positions are different between adversarial samples and normal samples, thereby obtaining an MLP classifier (or: adversarial sample detector). Among them, the number of layers and the number of neural network elements of the MLP classifier can be selected according to the size of the training data set. Exemplarily, the 49 (7*7) dimensional vector obtained above can be used as input to train an MLP binary classification model. It should be understood that the MLP binary classification model in the embodiment of the present application refers to an MLP classifier.

[0084] The following describes how to use the adversarial sample detector to detect adversarial samples. Figure 4 The following is a flow chart of a detection method for patch adversarial sample attacks provided by an embodiment of the present application. Figure 4 As shown, the method may include the following steps:

[0085] Step 401: Obtain a face image to be detected.

[0086] In the embodiment of the present application, the face image to be detected can be input into the adversarial sample detector as an input image. The face image to be detected can be a face image captured by the camera of the terminal device 10 in payment scenarios, access control recognition and other scenarios. After the terminal device 10 captures the face image, the captured face image can be sent to the server 20. Alternatively, after the terminal device 10 captures the face image, it can be saved locally for subsequent processing.

[0087] Step 402: Determine the similarity of feature positions between the face image to be detected and a preset face image.

[0088] It should be understood that the preset face picture is a face picture registered in the system in the face verification scenario.

[0089] In some embodiments, the face image to be detected can be compared with the preset face image to calculate the feature position similarity between the two images. The specific calculation method can refer to the calculation formula of feature position similarity in the training adversarial sample detector above.

[0090] Taking the 7*7*128 matrix obtained by the model as an example, for each face image, there are 49 128-dimensional vectors. Among them, 49 represents the different regional positions of the face, and 128 dimensions represent different feature vectors at each position. Taking a position, such as the forehead on the face, as an example, the similarity between the 128-dimensional vector of the forehead of the face on the face image to be detected and the 128-dimensional vector of the forehead of the face on the preset face image can be calculated. According to the above method, the similarity between the 128-dimensional vector of each position on the collected face image and the preset face image can be calculated.

[0091] Step 403: Determine the probability that the face image to be detected is a patch adversarial sample and a normal sample according to the feature position similarity.

[0092] In some embodiments, the feature position similarity calculated in step 202 is a 49-dimensional vector, which can then be input into a trained adversarial sample detector. The adversarial sample detector can output a two-dimensional vector, the vector value of which is used to characterize the probability that the face image to be detected is a patch adversarial sample and a normal sample.

[0093] Step 404: When the probability that the face image to be detected is a patch adversarial sample is greater than a set threshold, the face image to be detected is determined to be an adversarial sample.

[0094] Step 405: When the probability that the face image to be detected is a patch adversarial sample is less than a set threshold, it is determined that the face image to be detected is a normal sample.

[0095] In the embodiment of the present application, when the probability value of the outputted patch adversarial sample is greater than a set threshold (for example, 0.3), it indicates that the face image to be detected is an adversarial sample; when the probability value of the outputted patch adversarial sample is less than the set threshold, it indicates that the face image to be detected is a normal sample (non-adversarial sample). It should be understood that the set threshold can also be other values ​​such as 0.6, and the present application does not specifically limit this.

[0096] Through the above embodiments, the trained adversarial sample detector can be used to identify whether the input face image is an adversarial sample face image, so that the detection of adversarial samples can be achieved and the security of the face recognition system can be improved. In addition, by utilizing the feature difference between the adversarial sample and the normal sample in the distribution of the position feature similarity measurement matrix, the detection effect of the adversarial sample detector is better.

[0097] It should be noted that all or part of the above embodiments provided in this application can be freely and arbitrarily combined with each other, and the combined technical solutions are also within the scope of this application.

[0098] In order to implement the functions of the method provided in the above embodiment of the present application, the network device may include a hardware structure and / or a software module, and implement the above functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. Whether a function of the above functions is executed in the form of a hardware structure, a software module, or a hardware structure plus a software module depends on the specific application and design constraints of the technical solution.

[0099] Based on the above embodiments, the present application further provides a detection device 500 for patch adversarial sample attacks. The detection device 500 for patch adversarial sample attacks may include an acquisition unit 501 and a determination unit 502 .

[0100] Among them, the acquisition unit 501 is used to obtain the face image to be detected; the determination unit 502 is used to determine the feature position similarity between the face image to be detected and the preset face image, and determine that the face image to be detected is a face image attacked by patch adversarial samples based on the feature position similarity.

[0101] In a possible implementation, the determining unit 502 is specifically configured to determine the feature position similarity between the face image to be detected and the preset face image in the following manner:

[0102] A feature matrix, a feature similarity matrix and a weighting matrix are extracted based on the face image to be detected and the preset face image; and the feature position similarity between the face image to be detected and the preset face image is determined according to the feature matrix, the feature similarity matrix and the weighting matrix.

[0103] In a possible implementation, the determining unit 502 is specifically configured to determine the feature position similarity between the face image to be detected and the preset face image according to the feature matrix, feature similarity matrix and weighting matrix in the following manner:

[0104]

[0105] Among them, FM sim is the feature similarity matrix, W metric is a weighted matrix, each element in the feature similarity matrix represents a feature map vector at a corresponding position, and each element in the weighted matrix represents the importance of the feature map vector at a corresponding position.

[0106] In a possible implementation, the feature matrix, feature similarity matrix and weighting matrix respectively conform to the following formulas:

[0107] It represents the cosine similarity of the feature map after the vector (i, j) is normalized at the corresponding position.

[0108] Represents the sum of the absolute values ​​of the partial derivatives of the cosine similarity loss of the embedding vector for face vector representation with respect to the neurons of the feature map.

[0109] In a possible implementation, the determining unit 502 is specifically configured to determine, according to the feature position similarity, that the face image to be detected is a face image attacked by a patch adversarial sample in the following manner:

[0110] The feature position similarity is input into a preset adversarial sample detection classification model to obtain the probability that the face image to be detected is an adversarial sample face image and a non-adversarial sample face image; if the probability that the face image to be detected is an adversarial sample face image is greater than a set threshold, then the face image to be detected is determined to be a face image attacked by a patch adversarial sample.

[0111] In one possible implementation, the preset adversarial sample detection classification model is trained in the following way:

[0112] Acquire candidate samples, and generate patch adversarial samples based on the candidate samples; determine the feature position similarity between each group of samples based on the candidate samples and the patch adversarial samples; and obtain the preset adversarial sample detection classification model based on the feature position similarity between each group of samples.

[0113] Based on the above embodiments, the present application also provides a detection device for patch adversarial sample attacks, which can be the terminal device 10 or the server 20 in the above embodiments. Figure 6 As shown, the detection device 600 for patch adversarial sample attacks includes: a transceiver 601, a processor 602, and a memory 603. The transceiver 601, the processor 602, and the memory 603 are interconnected. It should be understood that the transceiver 601 can be used to perform Figure 5 The steps performed by the acquisition unit 501 in the illustrated embodiment. The processor 602 is configured to perform Figure 5 The steps performed by the determination unit 502 in the illustrated embodiment.

[0114] Optionally, the transceiver 601, the processor 602 and the memory 603 are interconnected via a bus 604. The bus 804 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0115] The memory 603 is used to store program instructions and data. Specifically, the program instructions may include program codes, which include computer operation instructions. The memory 603 may include random access memory (RAM), and may also include non-volatile memory (non-volatile memory), such as at least one disk memory. The processor 602 calls the program instructions and data stored in the memory 603, so that the detection device 600 for patch countermeasure sample attacks performs the method steps in the above embodiment.

[0116] In the embodiment of the present application, the processor 602 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiment of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor. The software module may be located in the memory 603, and the processor 602 reads the program instructions in the memory 603, and completes the steps of any of the above-mentioned embodiment methods in combination with its hardware.

[0117] In the embodiment of the present application, the memory 603 may be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), etc., or a volatile memory (volatile memory), such as RAM. The memory may also be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory in the embodiment of the present application may also be a circuit or any other device that can implement a storage function, for storing instructions and / or data.

[0118] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0119] Based on the above embodiments, the present application further provides a computer storage medium, in which a computer program is stored. When the computer program is executed by a computer, the computer executes the method provided in the above embodiments.

[0120] A computer program product is also provided in an embodiment of the present application, including instructions, which, when executed on a computer, enable the computer to execute the method provided in the above embodiment.

[0121] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by instructions. These instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0122] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0123] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

Claims

1. A detection method for patch adversarial sample attacks, characterized in that: include: Get the face image to be detected; Determining the similarity of feature positions between the face image to be detected and a preset face image; The face image to be detected is determined to be a face image attacked by a patch adversarial sample according to the feature position similarity.

2. The method according to claim 1, characterized in that The determining of the feature position similarity between the face image to be detected and the preset face image includes: Extracting a feature similarity matrix and a weighting matrix based on the face image to be detected and the preset face image; The feature position similarity between the face image to be detected and a preset face image is determined according to the feature similarity matrix and the weighting matrix.

3. The method according to claim 2, characterized in that Determining the feature position similarity between the face image to be detected and the preset face image according to the feature similarity matrix and the weighting matrix includes: C metric =FM sim *W metric Among them, FM sim is the feature similarity matrix, W metric is a weighted matrix, each element in the feature similarity matrix represents a feature map vector at a corresponding position, and each element in the weighted matrix represents the importance of the feature map vector at a corresponding position.

4. The method according to claim 3, characterized in that The feature similarity matrix and the weighting matrix respectively conform to the following formulas: Represents the cosine similarity of the feature map at the corresponding position (i, j) after vector normalization; Represents the sum of the absolute values ​​of the partial derivatives of the cosine similarity loss of the embedding vector for face vector representation with respect to the neurons of the feature map.

5. The method according to any one of claims 1 to 4, characterized in that The step of determining, according to the feature position similarity, that the face image to be detected is a face image attacked by a patch adversarial sample comprises: Inputting the feature position similarity into a preset adversarial sample detection classification model to obtain the probability that the face image to be detected is a face image of an adversarial sample and a face image of a non-adversarial sample; If the probability of determining that the face image to be detected is a face image of an adversarial sample is greater than a set threshold, then the face image to be detected is determined to be a face image attacked by a patch adversarial sample.

6. The method according to claim 5, characterized in that The preset adversarial sample detection classification model is trained in the following way: Obtain candidate samples, and generate patch adversarial samples based on the candidate samples; Determine the feature position similarity between each group of samples according to the candidate samples and the patch adversarial samples; The preset adversarial sample detection classification model is obtained based on feature position similarity training between each group of samples.

7. A detection device for patch adversarial sample attacks, characterized in that: include: An acquisition unit, used for acquiring a face image to be detected; The determination unit is used to determine the feature position similarity between the face image to be detected and a preset face image, and determine that the face image to be detected is a face image attacked by a patch adversarial sample according to the feature position similarity.

8. The device according to claim 7, characterized in that The determining unit is specifically used to determine the feature position similarity between the face image to be detected and the preset face image in the following manner: Extracting a feature similarity matrix and a weighting matrix based on the face image to be detected and the preset face image; The feature position similarity between the face image to be detected and a preset face image is determined according to the feature similarity matrix and the weighting matrix.

9. The device according to claim 8, characterized in that The determining unit is specifically used to determine the feature position similarity between the face image to be detected and the preset face image according to the feature similarity matrix and the weighting matrix in the following manner: C metric =FM sim *W metric Among them, FM sim is the feature similarity matrix, W metric is a weighted matrix, each element in the feature similarity matrix represents a feature map vector at a corresponding position, and each element in the weighted matrix represents the importance of the feature map vector at a corresponding position.

10. The device according to claim 9, characterized in that The feature similarity matrix and the weighting matrix respectively conform to the following formulas: Represents the cosine similarity of the feature map at the corresponding position (i, j) after vector normalization; Represents the sum of the absolute values ​​of the partial derivatives of the cosine similarity loss of the embedding vector for face vector representation with respect to the neurons of the feature map.

11. The device according to any one of claims 7 to 10, characterized in that The determining unit is specifically used to determine that the face image to be detected is a face image attacked by a patch adversarial sample according to the feature position similarity in the following manner: Inputting the feature position similarity into a preset adversarial sample detection classification model to obtain the probability that the face image to be detected is a face image of an adversarial sample and a face image of a non-adversarial sample; If the probability of determining that the face image to be detected is a face image of an adversarial sample is greater than a set threshold, then the face image to be detected is determined to be a face image attacked by a patch adversarial sample.

12. The device according to claim 11, characterized in that The preset adversarial sample detection classification model is trained in the following way: Obtain candidate samples, and generate patch adversarial samples based on the candidate samples; Determine the feature position similarity between each group of samples according to the candidate samples and the patch adversarial samples; The preset adversarial sample detection classification model is obtained based on feature position similarity training between each group of samples.

13. A patch adversarial sample attack detection device, characterized in that: The patch anti-sample attack detection device includes one or more processors; one or more memories and one or more computer programs; Wherein, the one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions, which, when called and executed by the one or more processors, enable the patch adversarial sample attack detection device to execute the method according to any one of claims 1-6.

14. A computer-readable storage medium storing instructions, characterized in that: When the instruction is executed on a patch adversarial sample attack detection device, the patch adversarial sample attack detection device is enabled to perform the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • IDF dynamic calculation block weighting coefficient-based face recognition system

    CN107103270A

  • Adversarial patch generation method and system, adversarial patch detection model training method and system and adversarial patch defense method and system

    CN111340008A

  • Face confrontation sample defense method, face confrontation sample defense device and medium

    CN114677717A