CN116386111A - Face recognition-oriented patch attack countermeasure method - Google Patents
Face recognition-oriented patch attack countermeasure method Download PDFInfo
- Publication number
- CN116386111A CN116386111A CN202310334750.1A CN202310334750A CN116386111A CN 116386111 A CN116386111 A CN 116386111A CN 202310334750 A CN202310334750 A CN 202310334750A CN 116386111 A CN116386111 A CN 116386111A
- Authority
- CN
- China
- Prior art keywords
- patch
- attack
- face recognition
- image
- gradient
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 72
- 239000013598 vector Substances 0.000 claims abstract description 26
- 239000011159 matrix material Substances 0.000 claims description 16
- 238000012549 training Methods 0.000 claims description 11
- 238000013507 mapping Methods 0.000 claims description 9
- 238000004364 calculation method Methods 0.000 claims description 3
- 238000000605 extraction Methods 0.000 claims description 3
- 238000007781 pre-processing Methods 0.000 claims description 3
- 230000008569 process Effects 0.000 claims description 3
- 238000012546 transfer Methods 0.000 claims description 3
- 230000009466 transformation Effects 0.000 claims description 3
- 238000011478 gradient descent method Methods 0.000 claims description 2
- 230000006870 function Effects 0.000 abstract description 18
- 238000013135 deep learning Methods 0.000 abstract description 5
- 230000007123 defense Effects 0.000 abstract description 5
- 238000013461 design Methods 0.000 abstract description 5
- 238000011156 evaluation Methods 0.000 abstract description 4
- 238000012795 verification Methods 0.000 abstract description 3
- 238000002474 experimental method Methods 0.000 description 18
- 230000000694 effects Effects 0.000 description 10
- 238000012360 testing method Methods 0.000 description 8
- 238000013508 migration Methods 0.000 description 3
- 230000005012 migration Effects 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 235000000332 black box Nutrition 0.000 description 1
- 230000001186 cumulative effect Effects 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 230000001815 facial effect Effects 0.000 description 1
- 238000009499 grossing Methods 0.000 description 1
- 230000001939 inductive effect Effects 0.000 description 1
- 238000011835 investigation Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000005728 strengthening Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/10—Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
- G06V40/16—Human faces, e.g. facial parts, sketches or expressions
- G06V40/161—Detection; Localisation; Normalisation
- G06V40/166—Detection; Localisation; Normalisation using acquisition arrangements
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/74—Image or video pattern matching; Proximity measures in feature spaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
- G06V10/774—Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/10—Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
- G06V40/16—Human faces, e.g. facial parts, sketches or expressions
- G06V40/168—Feature extraction; Face representation
- G06V40/171—Local features and components; Facial parts ; Occluding parts, e.g. glasses; Geometrical relationships
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T10/00—Road transport of goods or passengers
- Y02T10/10—Internal combustion engine [ICE] based vehicles
- Y02T10/40—Engine management systems
Landscapes
- Engineering & Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Theoretical Computer Science (AREA)
- General Health & Medical Sciences (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Oral & Maxillofacial Surgery (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Human Computer Interaction (AREA)
- Artificial Intelligence (AREA)
- Computing Systems (AREA)
- Databases & Information Systems (AREA)
- Evolutionary Computation (AREA)
- Medical Informatics (AREA)
- Software Systems (AREA)
- Image Analysis (AREA)
Abstract
Description
技术领域technical field
本发明属于深度学习领域,涉及一种面向人脸识别的对抗补丁攻击方法。The invention belongs to the field of deep learning and relates to a face recognition-oriented anti-patch attack method.
背景技术Background technique
对抗样本攻击方法是指在原始输入图像的局部或全局增设肉眼不易察觉的扰动,以干预分类或回归等深度学习网络对输入的判断。它通常通过极小的噪声存在与图片中,而这些噪声正是通过利用网络复杂迭代的结构特征来专门制定的,通过利用梯度、输出向量等特点迭代输入图片从而诱导网络误判。对抗样本攻击的存在为市面上绝大多数的身份信息核验系统、自动驾驶系统以及目标检测系统带来了很大的潜在威胁,研究并提出相应攻击办法对成功防御和加强实际应用中的网络带来了很大的价值。The adversarial example attack method refers to adding perturbations imperceptible to the naked eye to the original input image locally or globally to interfere with the input judgment of deep learning networks such as classification or regression. It usually exists in the picture through very small noise, and these noises are specially formulated by using the structural characteristics of the complex iteration of the network, and iterates the input picture by using the gradient, output vector and other characteristics to induce network misjudgment. The existence of adversarial sample attacks has brought great potential threats to the vast majority of identity information verification systems, automatic driving systems, and target detection systems on the market. Researching and proposing corresponding attack methods is crucial to successful defense and strengthening of network belts in practical applications. Comes great value.
目前对抗样本的方法可以分为局部攻击方法和全局攻击方法两种,其中全局攻击方法是在输入图像整体上盖上一层生成的对抗噪声,从而将原输入图像变成对抗样本。这种方法在现实生活中的意义不大,因为攻击者很难将相关图片在输入系统之前捕获并修改。而局部扰动攻击方法更易迁移到物理世界,它是以在输入图片的局部区域隐藏一块微小对抗补丁的形式来篡改输入图像,从而诱导网络做出错误判断。对于这类补丁形式的扰动更有利于迁移到现实世界中,从而对现实中的应用带来极大的威胁。由于这些对抗样本类方法不需要操作网络和训练集,只是在测试的样本上进行篡改,因此实施起来的难度较低,研究这些攻击方法才能更有效的为应用增设相应防御提高系统的鲁棒性。At present, the methods of adversarial examples can be divided into local attack methods and global attack methods. The global attack method is to cover the input image with a layer of generated adversarial noise, thereby turning the original input image into an adversarial example. This approach is less relevant in real life as it is difficult for an attacker to capture and modify the relevant images before they are fed into the system. The local perturbation attack method is easier to migrate to the physical world. It tampers with the input image by hiding a small adversarial patch in a local area of the input image, thereby inducing the network to make wrong judgments. Perturbations in the form of such patches are more conducive to migration to the real world, which poses a great threat to real-world applications. Since these adversarial sample methods do not need to operate the network and training sets, but only tamper with the test samples, the difficulty of implementation is relatively low. Only by studying these attack methods can it be more effective to add corresponding defenses to the application and improve the robustness of the system. .
现有的基于补丁的攻击方法都是在针对网络梯度上进行扰动生成的,由于深度学习网络是通过不断迭代和卷积推测最终结果的,每一层的输出结果都将作为下一层的输入进行计算,所以通过向原始正确类别梯度的反方向设计损失函数,可以有效的误导网络每一层对正确类别的判断,从而累积下来最终判断出错。现有的方法大都是利用这种想法设计迭代补丁的损失函数而忽略了生成补丁隐蔽性的考虑,隐蔽性也是对一个补丁效果考量的重要标准之一。Existing patch-based attack methods are generated by perturbation on the network gradient. Since the deep learning network infers the final result through continuous iteration and convolution, the output of each layer will be used as the input of the next layer. Therefore, by designing the loss function in the opposite direction of the gradient of the original correct category, it can effectively mislead the judgment of each layer of the network on the correct category, so that the cumulative final judgment is wrong. Most of the existing methods use this idea to design the loss function of the iterative patch and ignore the consideration of the concealment of the generated patch. The concealment is also one of the important criteria for considering the effect of a patch.
发明内容Contents of the invention
有鉴于此,本发明的目的在于提供一种面向人脸识别的对抗补丁攻击方法。In view of this, the object of the present invention is to provide a face recognition-oriented anti-patch attack method.
为达到上述目的,本发明提供如下技术方案:To achieve the above object, the present invention provides the following technical solutions:
一种面向人脸识别的对抗补丁攻击方法,该方法包括以下步骤:A face recognition-oriented anti-patch attack method, the method comprises the following steps:
S1:选择随机补丁进行预处理,切割出口罩形状与输入类原图进行拼接,模拟口罩在人脸的图片做为初始输入;S1: Select a random patch for preprocessing, cut out the shape of the mask and stitch it with the original input image, and simulate the image of the mask on the face as the initial input;
S2:生成图片和原始图像交给网络进行特征提取,分别得到两个的图片的映射向量输出,并记录下特征值;S2: The generated picture and the original image are handed over to the network for feature extraction, and the mapping vector outputs of the two pictures are respectively obtained, and the feature values are recorded;
S3:将对抗补丁合成图片输出向量与真实类的输出向量带入损失函数计算,通过梯度方向更新补丁像素并生成全新的对抗补丁;S3: Bring the output vector of the anti-patch synthetic image and the output vector of the real class into the loss function calculation, update the patch pixels through the gradient direction and generate a new anti-patch;
S4:进行迭代,重复第一步操作达到约设置迭代次数阈值,输出最终的对抗补丁。S4: Iterate, repeat the first step to reach the set iteration threshold, and output the final confrontation patch.
可选的,所述S4中,进行迭代的迭代方法是对每张图片x连续重复m次训练,计算扰动r时复用上一步的梯度,为保证速度且增强隐蔽性,整体epoch会除以m;其中r的更新公式为:Optionally, in S4, the iterative method for iteration is to repeat the training m times for each picture x continuously, and reuse the gradient of the previous step when calculating the disturbance r. In order to ensure the speed and enhance the concealment, the overall epoch will be divided by m; where the update formula of r is:
rt+1=rt+∈·sign(g)r t+1 =r t +∈·sign(g)
其中sign(g)代表梯度方向,∈为预设的超参数来控制梯度方向到大小;其中输入x,标签y对于损失函数的梯度写为:Where sign(g) represents the gradient direction, ∈ is the preset hyperparameter to control the gradient direction to size; where the input x, label y is for the loss function The gradient of is written as:
具体的迭代步骤算法如下:The specific iterative step algorithm is as follows:
对于原始输入样本x及对应的标签y,选择出书补丁p0进行训练;在N/m次迭代过程中,每轮对补丁进行更新;在其中的每一轮内,第一步对图片x进行补丁的覆盖得到全新的人脸图片,进而模拟佩戴口罩;第二步通过损失函数L(x0,y,θ)计算损失值;第三步计算损失函数对应的梯度第四步通过随机梯度下降方法更新模型参数θ,更新公式为:/>通过更新后的θ对输入x更新梯度,从而得到更新对抗补丁的梯度方向/>最终在原始补丁上累加上梯度方向单位值,即p0←p0+∈·sign(gadv);重复第四步m次直到得到梯度下降结束;For the original input sample x and the corresponding label y, select the book patch p 0 for training; in the N/m iteration process, the patch is updated in each round; in each round, the first step is to image x Cover the patch to get a brand new face picture, and then simulate wearing a mask; the second step calculates the loss value through the loss function L(x 0 , y, θ); the third step calculates the gradient corresponding to the loss function The fourth step is to update the model parameter θ through the stochastic gradient descent method, and the update formula is: /> Update the gradient of the input x through the updated θ, so as to obtain the gradient direction of the updated anti-patch /> Finally, the gradient direction unit value is accumulated on the original patch, that is, p 0 ←p 0 +∈·sign(g adv ); repeat the fourth step m times until the end of the gradient descent;
总的损失函数为:The overall loss function is:
其中Padv代表生成的对抗补丁,P0代表未进行迭代的初始补丁,这里选择随机噪声,x代表输入人脸图像,xt代表目标对象;Where P adv represents the generated confrontation patch, P 0 represents the initial patch that has not been iterated, here we choose random noise, x represents the input face image, and x t represents the target object;
相似损失函数对于定向攻击写成:The similarity loss function is written as:
ltsim(Padv,x,xt)=cos(em(T(Padv,x)),em(xt))l tsim (P adv , x, x t ) = cos(em(T(P adv , x)), em(x t ))
其中em(...)代表将图片输入给人脸识别网络输出的映射向量(Embedding),T(...)代表将将补丁转到人脸上的变换操作,cos(...)是向量之间的余弦距离;对于非定向攻击,相似损失函数的形式是:Among them, em(...) represents the mapping vector (Embedding) that inputs the image to the output of the face recognition network, T(...) represents the transformation operation that will transfer the patch to the face, and cos(...) is cosine distance between vectors; for non-directed attacks, the similarity loss function is of the form:
lutsim(Padv,x,xt)=-cos(em(T(Padv,x),em(x))l utsim (P adv , x, x t )=-cos(em(T(P adv , x), em(x))
通过最小化生成映射向量与目标向量的余弦距离来诱导网络误判;风格损失表示为生成补丁和初始补丁之间的格莱姆矩阵的差:The network misjudgment is induced by minimizing the cosine distance between the generated mapping vector and the target vector; the style loss is expressed as the difference of the Graham matrix between the generated patch and the original patch:
其中G(...)是格莱姆矩阵,用来表示特定图结构和计算相关性系数的矩阵,描述图中结点之间的关系和一个内部网层的结构;采用格拉姆矩阵来保持补丁来自原始的风格性;原始的格拉姆矩阵需要迭代网络的底层到高层,每次把最高层的输入带入损失一同参与迭代。Among them, G(...) is a Graham matrix, which is used to represent a specific graph structure and a matrix for calculating correlation coefficients, describing the relationship between nodes in the graph and the structure of an internal network layer; the Graham matrix is used to maintain The patch comes from the original style; the original Gram matrix needs to iterate from the bottom layer to the top layer of the network, and each time the input of the highest layer is brought into the loss to participate in the iteration together.
本发明的有益效果在于:本发明所提出的基于对抗口罩补丁的对抗样本攻击方法,相比于一般对抗补丁方法提出了更适合人脸识别模型的口罩形状且提出更适合应用场景的隐蔽性生成方法,提高了此类方法的攻击鲁棒性,增加在现实世界中攻击成功的可能性。本发明的主要创新在于针对人脸识别系统设计一种生成扰动的方法,相关损失函数通过针对人脸识别网络对嵌入向量的依赖并通过设计风格损失的环节增强补丁的隐蔽性,从而大大提升攻击现实系统的可能性。在现实生活中的例如,攻击者可以假冒其他身份进行人脸核验,通过后盗用他人账户信息等。该攻击方法给防御提出一种隐蔽性相关的评估标准。The beneficial effect of the present invention is that: compared with the general adversarial patch method, the adversarial sample attack method based on the adversarial mask patch proposed by the present invention proposes a mask shape that is more suitable for the face recognition model and proposes a concealment generation that is more suitable for the application scene method, which improves the attack robustness of such methods and increases the possibility of successful attacks in the real world. The main innovation of the present invention is to design a method for generating disturbances for the face recognition system. The correlation loss function enhances the concealment of the patch by aiming at the dependence of the face recognition network on the embedding vector and through the link of design style loss, thereby greatly improving the attack Possibility of real systems. In real life, for example, attackers can pretend to be other identities for face verification, and then steal other people's account information after passing. This attack method proposes a stealth-related evaluation criterion for the defense.
与一般攻击分类类型的对抗样本相比,本方法可以更好的利用人脸识别网络的信息生成更具针对性的方法补丁,对于人脸识别算法这种类间距离较大但类内距离较小的攻击数据来说,更合适人脸识别模型的损失函数才能更好的在现实中完成攻击。有了更好的攻击效果则可以为对抗防御、对抗训练等领域带来新的突破。Compared with adversarial samples of general attack classification types, this method can better use the information of the face recognition network to generate more targeted method patches. For the face recognition algorithm, the inter-class distance is large but the intra-class distance is small For the attack data, the loss function that is more suitable for the face recognition model can better complete the attack in reality. With better attack effects, it can bring new breakthroughs in areas such as confrontation defense and confrontation training.
与相关人脸方法的分类攻击补丁相比,本方法新增的隐蔽性方法可以更好的因此补丁,从而可以更有效地针对现实世界中的人脸识别系统。通过风格损失和平滑损失的辅助能够将目标特征信息更柔和的隐藏进周边像素信息,从而在实现效果上更加自然且隐蔽。Compared with the classification attack patch of the related face method, the new concealment method of this method can be better patched, so that it can more effectively target the face recognition system in the real world. With the assistance of style loss and smoothing loss, the target feature information can be softly hidden into the surrounding pixel information, so that the effect is more natural and concealed.
本发明的其他优点、目标和特征在某种程度上将在随后的说明书中进行阐述,并且在某种程度上,基于对下文的考察研究对本领域技术人员而言将是显而易见的,或者可以从本发明的实践中得到教导。本发明的目标和其他优点可以通过下面的说明书来实现和获得。Other advantages, objects and features of the present invention will be set forth in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the investigation and research below, or can be obtained from Taught in the practice of the present invention. The objects and other advantages of the invention may be realized and attained by the following specification.
附图说明Description of drawings
为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作优选的详细描述,其中:In order to make the purpose of the present invention, technical solutions and advantages clearer, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:
图1为于扰动多样性增强的单步迭代对抗训练方法整体流程图;Figure 1 is the overall flow chart of the single-step iterative confrontation training method based on the enhancement of disturbance diversity;
图2为非定向攻击对抗口罩相似度实验;Figure 2 is a non-directional attack against mask similarity experiment;
图3为定向攻击对抗口罩相似度实验;Figure 3 shows the similarity experiment of directed attacks against masks;
图4为模型之间的迁移性比较试验。Figure 4 is a comparison test of the mobility between the models.
具体实施方式Detailed ways
以下通过特定的具体实例说明本发明的实施方式,本领域技术人员可由本说明书所揭露的内容轻易地了解本发明的其他优点与功效。本发明还可以通过另外不同的具体实施方式加以实施或应用,本说明书中的各项细节也可以基于不同观点与应用,在没有背离本发明的精神下进行各种修饰或改变。需要说明的是,以下实施例中所提供的图示仅以示意方式说明本发明的基本构想,在不冲突的情况下,以下实施例及实施例中的特征可以相互组合。Embodiments of the present invention are described below through specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific implementation modes, and various modifications or changes can be made to the details in this specification based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the diagrams provided in the following embodiments are only schematically illustrating the basic concept of the present invention, and the following embodiments and the features in the embodiments can be combined with each other in the case of no conflict.
其中,附图仅用于示例性说明,表示的仅是示意图,而非实物图,不能理解为对本发明的限制;为了更好地说明本发明的实施例,附图某些部件会有省略、放大或缩小,并不代表实际产品的尺寸;对本领域技术人员来说,附图中某些公知结构及其说明可能省略是可以理解的。Wherein, the accompanying drawings are for illustrative purposes only, and represent only schematic diagrams, rather than physical drawings, and should not be construed as limiting the present invention; in order to better illustrate the embodiments of the present invention, some parts of the accompanying drawings may be omitted, Enlargement or reduction does not represent the size of the actual product; for those skilled in the art, it is understandable that certain known structures and their descriptions in the drawings may be omitted.
本发明实施例的附图中相同或相似的标号对应相同或相似的部件;在本发明的描述中,需要理解的是,若有术语“上”、“下”、“左”、“右”、“前”、“后”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此附图中描述位置关系的用语仅用于示例性说明,不能理解为对本发明的限制,对于本领域的普通技术人员而言,可以根据具体情况理解上述术语的具体含义。In the drawings of the embodiments of the present invention, the same or similar symbols correspond to the same or similar components; , "front", "rear" and other indicated orientations or positional relationships are based on the orientations or positional relationships shown in the drawings, which are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the referred devices or elements must It has a specific orientation, is constructed and operated in a specific orientation, so the terms describing the positional relationship in the drawings are for illustrative purposes only, and should not be construed as limiting the present invention. For those of ordinary skill in the art, the understanding of the specific meaning of the above terms.
一种基于对抗口罩补丁的对抗样本攻击方法,其特征在于,包括以下步骤:An adversarial sample attack method based on an anti-mask patch, characterized in that it comprises the following steps:
步骤S1:选择随机补丁进行预处理,切割出口罩形状与输入类原图进行拼接,模拟口罩在人脸的图片做为初始输入。Step S1: Select a random patch for preprocessing, cut out the shape of the mask and stitch it with the original input image, and use the image of the simulated mask on the face as the initial input.
步骤S2:生成图片和原始图像交给网络进行特征提取,分别得到两个的图片的映射向量输出,并记录下特征值。Step S2: The generated picture and the original image are sent to the network for feature extraction, and the mapping vector outputs of the two pictures are respectively obtained, and the feature values are recorded.
步骤S3:将对抗补丁合成图片输出向量与真实类的输出向量带入损失函数计算,通过梯度方向更新补丁像素并生成全新的对抗补丁。Step S3: Bring the output vector of the anti-patch synthetic image and the output vector of the real class into the loss function calculation, update the patch pixels through the gradient direction and generate a new anti-patch.
步骤S4:重复第一步操作达到约设置迭代次数阈值,输出最终的对抗补丁。Step S4: Repeat the first step to reach the set iteration threshold, and output the final confrontation patch.
进一步的,迭代方法是对每张图片x连续重复m次训练,计算扰动r时复用上一步的梯度,为了保证速度且增强隐蔽性,整体epoch会除以m。其中r的更新公式为:Further, the iterative method is to repeat the training m times continuously for each image x, and reuse the gradient of the previous step when calculating the disturbance r. In order to ensure the speed and enhance the concealment, the overall epoch will be divided by m. The update formula of r is:
rt+1=rt+∈·sign(g),r t + 1 = r t + ∈ · sign(g),
其中sign(g)代表梯度方向,∈为预设的超参数来控制梯度方向到大小。其中输入x,标签y对于损失函数的梯度可以写为Where sign(g) represents the gradient direction, and ∈ is a preset hyperparameter to control the gradient direction to size. where the input x, the label y for the loss function The gradient of can be written as
这种迭代的方法可以有效的防止补丁过度满足梯度方向,从而导致图像与目标特征太过相似,进而降低了攻击方法的隐蔽性。This iterative method can effectively prevent the patch from over-satisfying the gradient direction, which will cause the image to be too similar to the target feature, thereby reducing the concealment of the attack method.
具体的迭代步骤算法如下:The specific iterative step algorithm is as follows:
总的损失函数可以写成The overall loss function can be written as
其中Padv代表生成的对抗补丁,P0代表未进行迭代的初始补丁,这里选择随机噪声,x代表输入人脸图像,xt代表目标对象。Where P adv represents the generated adversarial patch, P 0 represents the initial patch without iteration, where random noise is selected, x represents the input face image, and x t represents the target object.
相似损失函数对于定向攻击可以写成The similarity loss function can be written as
lutsim(Padv,x,xt)=cos(em(T(Padv,x),em(xt))l utsim (P adv , x, x t ) = cos(em(T(P adv , x), em(x t ))
其中em(...)代表将图片输入给人脸识别网络输出的映射向量(Embedding),T(...)代表将将补丁转到人脸上的变换操作,cos(...)是向量之间的余弦距离。对于非定向攻击,相似损失函数的形式是:Among them, em(...) represents the mapping vector (Embedding) that inputs the image to the output of the face recognition network, T(...) represents the transformation operation that will transfer the patch to the face, and cos(...) is Cosine distance between vectors. For non-directed attacks, the form of the similarity loss function is:
lutsim(Padv,x,xt)=-cos(em(T(Padv,x)),em(x))l utsim (P adv , x, x t )=-cos(em(T(P adv , x)), em(x))
通过最小化生成映射向量与目标向量的余弦距离来诱导网络误判。风格损失可以表示为生成补丁和初始补丁之间的格莱姆矩阵的差:The network misjudgment is induced by minimizing the cosine distance between the generated mapping vector and the target vector. The style loss can be expressed as the difference of the Graham matrix between the generated patch and the original patch:
其中G(...)是格莱姆矩阵(Gram matrix),它是一种用来表示特定图结构和计算相关性系数的矩阵,它能够描述图中结点之间的关系,用来描述一个内部网层的结构。这里采用格拉姆矩阵来保持补丁来自原始的风格,从而增强方法的隐匿性。原始的格拉姆矩阵需要迭代网络的底层到高层,而由于本方法本身就要反复输入给网络进行补丁的更新,故每次只需要把最高层的输入带入损失一同参与迭代即可。Among them, G(...) is the Gram matrix (Gram matrix), which is a matrix used to represent a specific graph structure and calculate the correlation coefficient. It can describe the relationship between nodes in the graph and is used to describe An intranet layer structure. Here the Gram matrix is used to keep the patch from the original style, thus enhancing the concealment of the method. The original Gram matrix needs to iterate from the bottom layer to the top layer of the network, and since this method itself needs to be repeatedly input to the network for patch update, it only needs to bring the input of the highest layer into the loss and participate in the iteration together.
实施例一Embodiment one
如图1所示,为本发明的基于对抗口罩补丁的对抗样本攻击方法点整体流程图。为了验证方法的有效性我们设计了相关隐蔽性和相似度测试的实验。As shown in FIG. 1 , it is an overall flow chart of the method of adversarial sample attack based on the anti-mask patch of the present invention. In order to verify the effectiveness of the method, we designed experiments related to concealment and similarity testing.
根据相关实验需要,本发明总计提出相关评价指标:According to the needs of relevant experiments, the present invention proposes relevant evaluation indexes in total:
余弦相似度:衡量人脸识别中十分重要的一个度量指标,通过衡量两个人脸图像中的特征向量之间的余弦夹脚来验证身份。在本文的实验中对人脸的面部特征进行提取,计算余弦距离来衡量生成对抗样本的可靠性。在本文的物理世界和数字世界实验中都采用了此评估方法来验证口罩的攻击能力。Cosine similarity: It is a very important metric in face recognition, and the identity is verified by measuring the cosine clamp between the feature vectors in two face images. In the experiment in this paper, the facial features of the face are extracted, and the cosine distance is calculated to measure the reliability of generating adversarial samples. This evaluation method is adopted in both the physical world and digital world experiments in this paper to verify the attack capability of masks.
攻击成功率:一种衡量整体方法是否成功的指标,在物理世界实验中识别率并不能得到保证,且一帧视频中也存在许多无效的截图,故需要通过对多组图片进行分批次实验,通过统计相似度通过特定阈值的图片次数占统计批次图片的总数的比例来衡量整体系统是否能够攻击成功。对于定向攻击,成功率的表达式可以写成:Attack success rate: an index to measure the success of the overall method. In the physical world experiment, the recognition rate cannot be guaranteed, and there are many invalid screenshots in a frame of video, so it is necessary to conduct batch experiments on multiple groups of pictures , measure whether the overall system can be successfully attacked by counting the ratio of the number of pictures whose similarity passes a specific threshold to the total number of pictures in the statistical batch. For targeted attacks, the expression for the success rate can be written as:
其中I代表测试样本图像,代表攻击目标图像。where I represents the test sample image, Represents an attack target image.
峰值信噪比(Peak Signal-to-Noise Ratio):由于数字世界方法致力于在提升样本隐蔽性的前提下,保证补丁攻击的有效性,所以衡量隐匿性仍然是十分重要的一个指标。本文通过峰值信噪比来对比干净图像X和附带对抗补丁噪声图片Y。首先,定义两张输入为mxn图片的均方差为:Peak Signal-to-Noise Ratio (Peak Signal-to-Noise Ratio): Since the digital world method is committed to ensuring the effectiveness of patch attacks on the premise of improving the concealment of samples, measuring concealment is still a very important indicator. In this paper, we compare the clean image X and the image Y with anti-patch noise by peak signal-to-noise ratio. First, define the mean square error of two input mxn images as:
在基础上给出峰值信噪比的表达式为:The expression for the peak signal-to-noise ratio given on the basis is:
其中是图像中可能的最大像素值,这里按照每个像素都由8位的二进制表示,最大像素取值为255。对于彩色图像,需要计算RGB三个通道分别的PSNR值之后取平均值得出最终的信噪比。in Is the maximum possible pixel value in the image, where each pixel is represented by 8-bit binary, and the maximum pixel value is 255. For color images, it is necessary to calculate the PSNR values of the three channels of RGB and then take the average value to obtain the final signal-to-noise ratio.
方法隐蔽性实验method concealment experiment
针对隐蔽性实验我们选择ResNet-18主干网络的在预训练模型采用MS-Celeb-1M人脸数据集进行,在整个训练过程中的参数设置分别为批大小(batch size)64,学习率初始化为0.01,迭代次数和epoch轮数都设置为100。本文中所有实验均在NVIDIA Tesla V100服务器上运行,主要的深度学习框架是Pytorch 1.7,图像处理框架为OpenCV 4.5.2。经过迭代后生成对抗口罩进行隐蔽性测试,我们在三个不同的随机数种子上分别做了三次实验,并取三次实验结果的均值作为最终结果,数据指标结果见表1。For the concealment experiment, we choose the pre-training model of the ResNet-18 backbone network to use the MS-Celeb-1M face dataset. The parameter settings during the entire training process are respectively batch size (batch size) 64, and the learning rate is initialized as 0.01, the number of iterations and the number of epoch rounds are set to 100. All experiments in this paper are run on NVIDIA Tesla V100 server, the main deep learning framework is Pytorch 1.7, and the image processing framework is OpenCV 4.5.2. After iterative generation of confrontation masks for concealment testing, we conducted three experiments on three different random number seeds, and took the average of the three experimental results as the final result. The data index results are shown in Table 1.
从表1中可以看出,在经历过足够迭代次数后补丁仍然可以保持一定的隐蔽效果。对于补丁类的对抗样本方法都需要尽力让补丁内含有误导网络的特征信息从而容易暴露,本实验的测试是以初始话的随机扰动为基准进行比较,通过本方法的隐蔽损失来隐藏迭代产生特征。图3中第一列为佩戴对抗补丁口罩的人脸图像,第二列为佩戴随机扰动初始补丁的人脸图像,第三列为数据库内原图。表1中第一列为佩戴对抗口罩后与原图的PSRN值得分,第二列为佩戴随机口罩与原图的PSRN得分,佩戴蓝色口罩的信噪比得分约为20,来模拟人眼观察人脸对是否佩戴口罩的一般区别。It can be seen from Table 1 that the patch can still maintain a certain concealment effect after a sufficient number of iterations. For the patch-type adversarial sample method, it is necessary to try to make the patch contain characteristic information that misleads the network so as to be easily exposed. The test in this experiment is based on the random disturbance of the initial words for comparison, and the hidden loss of this method is used to hide the characteristics of the iterative generation. . The first column in Figure 3 is the face image wearing the anti-patch mask, the second column is the face image wearing the initial random perturbation patch, and the third column is the original image in the database. In Table 1, the first column is the PSRN score of the original image after wearing the confrontation mask, and the second column is the PSRN score of the original image and the random mask. The SNR score of wearing a blue mask is about 20, to simulate the human eye Observe the general difference between face pairs and whether they wear masks or not.
方法相似性实验method similarity experiment
通过上述实验分析,本文在隐蔽性上提出了相对成功的对抗补丁方法。在样本有较强隐蔽性的前提下,进行相似度得分比较,在CASIA-WebFace前一千类上进行实验,分析原样本、随机扰动样本和对抗口罩补丁样本方法与真确类别进行余弦相似度比较,得出如图2及图3的结果。Through the above experimental analysis, this paper proposes a relatively successful anti-patch method in terms of concealment. On the premise that the sample has strong concealment, compare the similarity score, conduct experiments on the first thousand classes of CASIA-WebFace, analyze the original sample, random perturbation sample and anti-mask patch sample method and compare the cosine similarity with the real class , get the results shown in Figure 2 and Figure 3.
图2及图3中的横坐标代表口罩类型,从左到右依次是0号无口罩、1号对抗口罩、2号随机扰动口罩和3号白口罩。纵坐标代表样本在网络中测试得到的余弦相似度得分。其中绿色点为离群值,代表偏离大部分样本分布的次数样本结果值。从实验结果可以看出对抗口罩和随机扰动口罩有较好的攻击效果,对于定向攻击方法有更优于随机扰动的效果。因为在非定向攻击中,攻击目标的类别较为复杂多样,随机噪声更容易命中部分特征从而造成干扰,但在定向攻击上,实验要求的目标域有限且成功率偏低。本文中的非定向攻击方法可以将人脸识别模型的精确度降低到[0.2,0.4]的区间内,较原始0.5以上的相似度在攻击效果上得到明显下降;将非定向攻击攻击可以将原始错误的[0.2,0.3]相似度值诱导至0.5以上。The abscissas in Figure 2 and Figure 3 represent the mask types, from left to right there are No. 0 no mask, No. 1 confrontation mask, No. 2 random perturbation mask, and No. 3 white mask. The vertical axis represents the cosine similarity score obtained by testing the samples in the network. Among them, the green points are outliers, which represent the number of sample result values that deviate from most sample distributions. From the experimental results, it can be seen that the anti-mask and random perturbation mask have a better attack effect, and the effect of the directional attack method is better than that of random perturbation. Because in non-directional attacks, the types of attack targets are more complex and diverse, random noise is more likely to hit some features and cause interference, but in directional attacks, the target domain required by the experiment is limited and the success rate is low. The non-directional attack method in this paper can reduce the accuracy of the face recognition model to the interval [0.2, 0.4], and the attack effect is significantly reduced compared with the original similarity above 0.5; the non-directional attack can reduce the original False [0.2, 0.3] similarity values induced above 0.5.
在所有的主干网络下对ArcFace和CosFace及MegFace三种模型下进行迁移性测试实验,口罩生成的主干网络基于ResNet50,在不同主干网络的不同人脸识别模型下的实验结果如图4,其中x坐标代表攻击补丁口罩的类型,从左到右依次是对抗口罩、随机扰动口罩、蓝口罩以及无口罩的原始图片,y坐标代表网络模型类别,从下至上依次是ArcFace-ResNet18、CosFace-ResNet18、ArcFace-ResNet34、CosFace-ResNet34、ArcFace-ResNet50、CosFace-ResNet50、ArcFace-ResNet101、CosFace-ResNet101、MegFace-ResNet101,z坐标代表相似度得分。从实验结果可以看出,在基于ResNet50的主干网络训练的对抗补丁在模型之间均可表现出有效的攻击能力。特别地,可以发现在ResNet网络模型的深度更深的时候有稍好的攻击效果,即对于每一种口罩类型存在一个随深度增加而降低的相似度得分。这种情况在攻击方法中也是常见的,经过更深层的网络迭代会导致每次得到的错误随着层数的更新而深化。特别地,当采用ResNet50的主干网络时,攻击属于白盒攻击方法,在攻击效果的表现上更为突出,当方法攻击其他主干网络的其他类别模型时,攻击方法属于黑盒方法,对于攻击结果上也有不错的得分。由于本方法的攻击损失函数基于网络输出向量之间的余弦距离,这种方法多是人脸识别模型的共同处理方式,故在方法之间存在一定的迁移性。Migration test experiments were carried out under three models of ArcFace, CosFace and MegFace under all backbone networks. The backbone network generated by masks is based on ResNet50. The experimental results under different face recognition models of different backbone networks are shown in Figure 4, where x The coordinates represent the type of attack patch mask, from left to right are confrontation mask, random perturbation mask, blue mask and the original picture without mask, the y coordinate represents the network model category, from bottom to top are ArcFace-ResNet18, CosFace-ResNet18, ArcFace-ResNet34, CosFace-ResNet34, ArcFace-ResNet50, CosFace-ResNet50, ArcFace-ResNet101, CosFace-ResNet101, MegFace-ResNet101, the z coordinate represents the similarity score. From the experimental results, it can be seen that the adversarial patches trained on the ResNet50-based backbone network can show effective attack capabilities between models. In particular, it can be found that when the depth of the ResNet network model is deeper, there is a slightly better attack effect, that is, for each mask type, there is a similarity score that decreases as the depth increases. This situation is also common in attack methods. After deeper network iterations, the errors obtained each time will deepen as the number of layers is updated. In particular, when the backbone network of ResNet50 is used, the attack belongs to the white-box attack method, and the performance of the attack effect is more prominent. When the method attacks other types of models of other backbone networks, the attack method belongs to the black-box method. For the attack results Also has a good score. Since the attack loss function of this method is based on the cosine distance between network output vectors, this method is mostly a common processing method of face recognition models, so there is a certain degree of migration between methods.
表1隐蔽性PSNR指标得分Table 1 Covert PSNR index score
以上实验以及相关的结果分析验证了本发明所提对抗训练方法的有效性。The above experiments and analysis of related results verify the effectiveness of the adversarial training method proposed in the present invention.
最后说明的是,以上实施例仅用以说明本发明的技术方案而非限制,尽管参照较佳实施例对本发明进行了详细说明,本领域的普通技术人员应当理解,可以对本发明的技术方案进行修改或者等同替换,而不脱离本技术方案的宗旨和范围,其均应涵盖在本发明的权利要求范围当中。Finally, it is noted that the above embodiments are only used to illustrate the technical solutions of the present invention without limitation. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be carried out Modifications or equivalent replacements, without departing from the spirit and scope of the technical solution, should be included in the scope of the claims of the present invention.
Claims (2)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310334750.1A CN116386111A (en) | 2023-03-31 | 2023-03-31 | Face recognition-oriented patch attack countermeasure method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310334750.1A CN116386111A (en) | 2023-03-31 | 2023-03-31 | Face recognition-oriented patch attack countermeasure method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116386111A true CN116386111A (en) | 2023-07-04 |
Family
ID=86962856
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310334750.1A Pending CN116386111A (en) | 2023-03-31 | 2023-03-31 | Face recognition-oriented patch attack countermeasure method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116386111A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116778128A (en) * | 2023-08-15 | 2023-09-19 | 武汉大学 | Anti-patch re-projection method and system based on three-dimensional reconstruction |
CN116913259A (en) * | 2023-09-08 | 2023-10-20 | 中国电子科技集团公司第十五研究所 | Voice recognition countermeasure method and device combined with gradient guidance |
-
2023
- 2023-03-31 CN CN202310334750.1A patent/CN116386111A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116778128A (en) * | 2023-08-15 | 2023-09-19 | 武汉大学 | Anti-patch re-projection method and system based on three-dimensional reconstruction |
CN116778128B (en) * | 2023-08-15 | 2023-11-17 | 武汉大学 | Anti-patch re-projection method and system based on three-dimensional reconstruction |
CN116913259A (en) * | 2023-09-08 | 2023-10-20 | 中国电子科技集团公司第十五研究所 | Voice recognition countermeasure method and device combined with gradient guidance |
CN116913259B (en) * | 2023-09-08 | 2023-12-15 | 中国电子科技集团公司第十五研究所 | Voice recognition countermeasure method and device combined with gradient guidance |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110991299B (en) | Confrontation sample generation method aiming at face recognition system in physical domain | |
Wang et al. | Fca: Learning a 3d full-coverage vehicle camouflage for multi-view physical adversarial attack | |
CN116386111A (en) | Face recognition-oriented patch attack countermeasure method | |
Rossolini et al. | On the real-world adversarial robustness of real-time semantic segmentation models for autonomous driving | |
CN114067444A (en) | Face spoofing detection method and system based on meta-pseudo label and illumination invariant feature | |
CN112364745A (en) | Method and device for generating countermeasure sample and electronic equipment | |
Gragnaniello et al. | Perceptual quality-preserving black-box attack against deep learning image classifiers | |
CN111476727B (en) | A video motion enhancement method for face-changing video detection | |
CN113255816B (en) | Directed attack against patch generation method and device | |
CN111783890B (en) | A Defense Method Against Small Pixel Adversarial Samples in Image Recognition | |
Ding et al. | A low-query black-box adversarial attack based on transferability | |
CN112989359B (en) | A Backdoor Attack Method for Person Re-ID Model Based on Triplet Loss | |
Zheng et al. | An effective adversarial attack on person re-identification in video surveillance via dispersion reduction | |
Lin et al. | Robust source camera identification against adversarial attacks | |
CN115481716A (en) | Physical world counter attack method based on deep network foreground activation feature transfer | |
Qiao et al. | Scalable universal adversarial watermark defending against facial forgery | |
CN113420289B (en) | Hidden poisoning attack defense method and device for deep learning model | |
Ling et al. | FDT: Improving the transferability of adversarial examples with frequency domain transformation | |
Liu et al. | Transferable adversarial examples based on global smooth perturbations | |
Gong et al. | KerbNet: A QoE-aware kernel-based backdoor attack framework | |
CN117436077A (en) | A federated learning backdoor attack method based on image steganography | |
CN116824695A (en) | A non-local defense method for pedestrian re-identification based on feature denoising | |
CN115880546A (en) | Confrontation robustness evaluation method based on class activation mapping chart and terminal equipment | |
CN113570564B (en) | Multi-definition fake face video detection method based on multi-path convolution network | |
CN113052167B (en) | A raster map data protection method based on adversarial patch |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |