WO2024000989A1 - 对抗样本的检测方法、系统、设备及非易失性可读存储介质 - Google Patents

对抗样本的检测方法、系统、设备及非易失性可读存储介质 Download PDF

Info

Publication number
WO2024000989A1
WO2024000989A1 PCT/CN2022/130983 CN2022130983W WO2024000989A1 WO 2024000989 A1 WO2024000989 A1 WO 2024000989A1 CN 2022130983 W CN2022130983 W CN 2022130983W WO 2024000989 A1 WO2024000989 A1 WO 2024000989A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
recognition result
similarity
classification recognition
tested
Prior art date
Application number
PCT/CN2022/130983
Other languages
English (en)
French (fr)
Inventor
张英杰
史宏志
温东超
赵健
崔星辰
尹云峰
Original Assignee
浪潮(北京)电子信息产业有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 浪潮(北京)电子信息产业有限公司 filed Critical 浪潮(北京)电子信息产业有限公司
Publication of WO2024000989A1 publication Critical patent/WO2024000989A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4053Scaling of whole images or parts thereof, e.g. expanding or contracting based on super-resolution, i.e. the output image resolution being higher than the sensor resolution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/761Proximity, similarity or dissimilarity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks

Definitions

  • This application relates to the field of artificial intelligence technology, and in particular to a detection method, system, equipment and non-volatile readable storage medium for adversarial samples.
  • Adversarial examples are samples in which subtle disturbances that are imperceptible to humans are deliberately added to the input samples, causing the model to give an incorrect output with a high degree of confidence.
  • Adversarial attacks mainly occur when constructing adversarial samples. Then the adversarial samples are input to the machine learning model just like normal data, and deceptive recognition results are obtained.
  • adversarial examples will threaten the application of deep learning in security-sensitive fields.
  • adversarial examples are usually trained so that the model is not affected by adversarial examples.
  • this method is more complicated and may not necessarily achieve good training results for different types of adversarial examples.
  • some solutions will identify adversarial samples, but the current identification accuracy is low.
  • the purpose of this application is to provide an adversarial sample detection method, system, equipment and non-volatile readable storage medium to effectively respond to adversarial sample attacks.
  • a detection method for adversarial examples including:
  • the image to be tested is determined to be an adversarial sample.
  • the obtained first classification recognition result for the image to be tested is expressed as: P[p1, p2,...pi...,pn]
  • the obtained second classification recognition result for the first output image is expressed as is: Q[q1, q2,...qi...,qn];
  • n represents the number of labels of the classification model
  • i is a positive integer and 1 ⁇ i ⁇ n
  • pi represents the probability value that the image to be tested belongs to the i-th category
  • qi represents the first Outputs the probability value that the image belongs to the i-th class.
  • determining the similarity between the first classification recognition result and the second classification recognition result includes:
  • the first similarity is used to reflect the degree of similarity between the probability value distribution of the first classification recognition result and the probability value distribution of the second classification recognition result;
  • the second similarity is used to reflect the degree of similarity between the ranking status of the probability values of different categories in the first classification recognition result and the ranking status of the probability values of different categories in the second classification recognition result.
  • the first similarity is the first similarity determined through the following operations:
  • the cosine distance between the first classification recognition result and the second classification recognition result is used as the determined first similarity.
  • the first similarity is the first similarity determined through the following operations:
  • the cosine distance is normalized, and the normalized value is used as the determined first similarity.
  • the second similarity is a second similarity determined through the following operations:
  • pii represents the numerical ranking of pi among p1 to pn, and the ranking of the maximum probability value is 1, and the ranking of the minimum probability value is n.
  • qii represents the numerical ranking of qi among q1 to qn.
  • x represents that the top x positions of the first sorting result and the second sorting result are consistent
  • u represents the first The number of digits at the same position in a sorting result and the second sorting result is the same.
  • determining the similarity between the first classification recognition result and the second classification recognition result includes:
  • the first similarity and the second similarity are multiplied, and the multiplication result is used as the determined similarity between the first classification recognition result and the second classification recognition result.
  • the classification model is a multi-category convolutional neural network classification model based on the normalized exponential function softmax.
  • the method further includes:
  • the method further includes:
  • the adversarial sample is detected again on the image to be tested, and when the image to be tested is still determined to be an adversarial sample, prompt information is output.
  • the preset threshold is the threshold determined through the following operations:
  • the similarity between the third classification recognition result and the fourth classification recognition result is determined and used as a preset threshold.
  • Optional also includes:
  • the minimum value among the preset thresholds determined each time is used as the final preset threshold.
  • An adversarial sample detection system including:
  • an image super-resolution model building module configured to build an image super-resolution model for improving image resolution
  • a first execution module configured to input the image to be tested into the image super-resolution model and obtain a first output image output by the image super-resolution model
  • a classification recognition module configured to respectively input the image to be tested and the first output image into a classification model, and obtain the first classification recognition result for the image to be tested and the first classification recognition result for the first output image.
  • a similarity judgment module is configured to determine the similarity between the first classification recognition result and the second classification recognition result, and determine whether the similarity is higher than a preset threshold; if not, trigger the 2. Execution module;
  • the second execution module is configured to determine that the image to be tested is an adversarial sample.
  • a detection device for adversarial samples including:
  • the processor is configured to execute the computer program to implement the steps of the adversarial sample detection method as described above.
  • a computer-readable storage medium A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the steps of the method for detecting adversarial samples as described above are implemented.
  • the solution of this application detects adversarial samples based on the characteristics of adversarial samples, and can detect adversarial samples conveniently and quickly without the need for adversarial sample training as in traditional solutions.
  • an image super-resolution model can be constructed.
  • the image super-resolution model can improve the image resolution.
  • the image to be tested is input to the image super-resolution model to obtain the first output image output by the image super-resolution model.
  • An output image has a higher resolution than the image under test.
  • a first classification recognition result for the image to be tested and a second classification recognition result for the first output image can be obtained. If the image to be tested is an adversarial sample, the similarity between the first classification recognition result and the second classification recognition result will be low, that is, the similarity between the two is not higher than the preset threshold, and it can be determined that the image to be tested is an adversarial sample. sample. And if the image to be tested is an adversarial sample, the similarity between the first classification recognition result and the second classification recognition result will be higher than the preset threshold. It can be seen that the solution of this application can detect adversarial samples conveniently and accurately.
  • Figure 1 is an implementation flow chart of an adversarial sample detection method in this application
  • Figure 2 is a schematic structural diagram of an adversarial sample detection system in this application.
  • Figure 3 is a schematic structural diagram of an adversarial sample detection device in this application.
  • the core of this application is to provide a detection method for adversarial samples, which can detect adversarial samples conveniently and accurately.
  • FIG 1 is an implementation flow chart of an adversarial sample detection method in this application.
  • the adversarial sample detection method may include the following steps:
  • Step S101 Construct an image super-resolution model for image processing.
  • the image super-resolution model can super-resolve the LR (low-resolution, low-resolution) image to obtain the SR (super-resolution, super-resolution) image, that is, the image super-resolution model can improve the image resolution.
  • the super-resolution model can directly use the trained deep learning model, such as EDSR (Enhanced Deep Super-Resolution Network), RDN (Residual Dense Network, residual dense network) and other general super-resolution models do not need to be retrained. That is to say, when performing the operation of building an image super-resolution model in step S101, by downloading the trained deep learning model, the construction of the image super-resolution model is completed.
  • the required image super-resolution model can also be independently constructed and trained, which does not affect the implementation of this application.
  • Step S102 Input the image to be tested to the image super-resolution model, and obtain the first output image output by the image super-resolution model. Wherein, the resolution of the first output image is higher than the image to be tested.
  • model mapping ability of the image super-resolution model can be used to map non-manifold adversarial samples onto the natural image manifold. This will greatly affect the classification probability of the adversarial sample images, and for normal The classification probability of the image has little effect.
  • the image super-resolution model may output a first output image corresponding to the image to be tested. It can be understood that since the image super-resolution model can improve the image resolution, the resolution of the first output image is higher than the image to be tested.
  • Step S103 Input the image to be tested and the first output image into the classification model respectively, and obtain the first classification recognition result for the image to be tested and the second classification recognition result for the first output image.
  • the type of classification model can be set and adjusted as needed, as long as it can achieve image classification.
  • both the first classification recognition result and the second classification recognition result can be A form consisting of a set of probability values representing different categories can be used to more conveniently and accurately reflect the similarity between the first classification recognition result and the second classification recognition result.
  • the obtained first classification recognition result for the image to be tested is expressed as: P[p1, p2,...pi...,pn], and the obtained first classification recognition result for the first output image is
  • the second classification recognition result is expressed as: Q[q1, q2,...qi...,qn];
  • n represents the number of labels of the classification model
  • i is a positive integer and 1 ⁇ i ⁇ n
  • pi represents the probability value that the image to be tested belongs to the i-th category
  • qi represents that the first output image belongs to the i-th category. probability value.
  • n can also be called the number of class labels, and can usually take more than two values.
  • pi represents the probability value that the image to be tested belongs to the i-th category.
  • the meaning of the category 1 label can be is orange
  • the meaning of the second type label can be nectarine
  • the meaning of the third type label can be orange
  • p1 30%
  • p2 60%
  • the model believes that the image to be tested has a 30% probability of being an orange, a 60% probability of being a nectarine, and a 10% probability of being an orange.
  • the classification model can be a multi-category convolutional neural network classification model based on the normalized exponential function softmax.
  • the first classification recognition result can be expressed as: P[p1, p2 ,...pi...,pn]
  • the second classification recognition result can be expressed as: Q[q1, q2,...qi..., qn].
  • this classification model can convert the output results of multiple classifications into a probability distribution ranging from [0, 1] and summing to 1, which is beneficial to ensuring the accuracy of subsequent similarity comparisons.
  • Step S104 Determine the similarity between the first classification recognition result and the second classification recognition result, and determine whether the similarity is higher than a preset threshold. If not, execute step S105.
  • Step S105 Determine the image to be tested as an adversarial sample.
  • the first classification recognition result and the second classification recognition result are respectively obtained, and the similarity between the first classification recognition result and the second classification recognition result can be determined.
  • the first classification recognition result and the second classification recognition result are significantly different, that is, the difference between the first classification recognition result and the second classification recognition result is The similarity between them will not be higher than the preset threshold.
  • the image to be tested is a normal sample, the similarity between the first classification recognition result and the second classification recognition result will be higher than the preset threshold, so It can be determined that the image to be tested is not an adversarial sample.
  • determining the similarity between the first classification recognition result and the second classification recognition result described in step S104 may include:
  • the first similarity is used to reflect the degree of similarity between the probability value distribution of the first classification recognition result and the probability value distribution of the second classification recognition result;
  • the second similarity is used to reflect the degree of similarity between the ranking status of the probability values of different classes in the first classification recognition result and the ranking status of the probability values of different classes in the second classification recognition result.
  • the first classification recognition result can be expressed as: P[p1, p2,...pi...,pn] and the second classification recognition result can be expressed as: Q[q1, q2, ...qi..., qn].
  • the similarity between the probability value distribution of the first classification recognition result and the probability value distribution of the second classification recognition result can reflect the similarity between the first classification recognition result and the second classification recognition result to a certain extent. , therefore the similarity between the first classification recognition result and the second classification recognition result can be determined based on the first similarity.
  • the degree of similarity between the ranking status of the probability values of different categories in the first classification recognition result and the ranking status of the probability values of different categories in the second classification recognition result can also be determined to a certain extent.
  • the above reflects the similarity between the first classification recognition result and the second classification recognition result. Therefore, the similarity between the first classification recognition result and the second classification recognition result can also be determined based on the second similarity.
  • the similarity between the first classification recognition result and the second classification recognition result can also be determined based on the first similarity and the second similarity at the same time, which does not affect the implementation of the present application.
  • the first similarity reflects the degree of similarity between the probability value distribution of the first classification recognition result and the probability value distribution of the second classification recognition result. Therefore, the calculation method of the first similarity can also be multiple. It only needs to be able to realize the function of the first degree of similarity.
  • the first similarity can be is the first similarity determined through the following operations:
  • the cosine distance between the first classification recognition result and the second classification recognition result is used as the determined first similarity.
  • the cosine distance cos ⁇ between the first classification recognition result and the second classification recognition result can be expressed as: i represents the i-th category, and the value range of cosine distance cos ⁇ is [-1, 1].
  • Cosine distance can reflect the probability distribution of two images. When the cosine distance is 1, it indicates the probability value of the two images. The distribution is consistent. The smaller the cosine distance, the greater the difference in probability value distribution.
  • the first similarity is the first similarity determined through the following operations:
  • the cosine distance is normalized, and the normalized value is used as the determined first similarity.
  • the cosine distance is also normalized in this embodiment, that is, the normalized value is used as the determined first similarity.
  • cos ⁇ ′ (1+cos ⁇ )/2, where cos ⁇ ′ is the value after normalization of the cosine distance cos ⁇ , which is the first similarity determined in this implementation.
  • this application considers that the degree of similarity between the probability value distribution of the first classification recognition result and the probability value distribution of the second classification recognition result can, to a certain extent, reflect the difference between the first classification recognition result and the second classification recognition result.
  • the similarity between the two classification recognition results however, the similarity between the probability value distributions cannot completely represent the classification results of the two images, because the ranking of the first classification recognition result and the second classification recognition result is also very important. Therefore, in practical applications, the similarity between the first classification recognition result and the second classification recognition result is usually determined based on the first similarity and the second similarity.
  • the second similarity is used to reflect the similarity between the ranking status of the probability values of different categories in the first classification recognition result and the ranking status of the probability values of different categories in the second classification recognition result.
  • Optional calculation method There are many kinds.
  • the second degree of similarity is the second degree of similarity determined through the following operations:
  • pii represents the numerical ranking of pi among p1 to pn, and the ranking of the maximum probability value is 1, and the ranking of the minimum probability value is n.
  • qii represents the numerical ranking of qi among q1 to qn. , and the ranking of the maximum probability value is 1, and the ranking of the minimum probability value is n. The number of digits with the same value at the same position in the sorted result.
  • SP argsort(P)
  • the first classification recognition result is P[0.2, 0.3, 0.25, 0.2, 0.05], then after sorting, the returned index number is SP[3, 1, 2, 4, 5]. That is to say, in the first classification recognition result P, each probability value is ranked according to its numerical value, the largest one is ranked 1, and the smallest probability value is ranked n.
  • you can set the ranking in order for example, set the ranking that appears first, that is, when the probability values are the same, the lower the number of the class label, the higher the ranking.
  • the first sorting result is SP[3,1,2,4,5]
  • determining the similarity between the first classification recognition result and the second classification recognition result based on the first similarity and the second similarity there may be multiple optional methods. For example, in an optional situation, consider Addition and multiplication are more convenient ways. Therefore, based on the first similarity and the second similarity, determining the similarity between the first classification recognition result and the second classification recognition result may include:
  • the first similarity and the second similarity are multiplied, and the multiplication result is used as the determined similarity between the first classification recognition result and the second classification recognition result.
  • the first similarity and the second similarity can usually be multiplied to determine the similarity between the first classification recognition result and the second classification recognition result. This method is very accurate, that is, it can be very accurate. to detect adversarial examples.
  • This application needs to compare the determined similarity between the first classification recognition result and the second classification recognition result with a preset threshold.
  • the threshold can be preset by the staff, for example, based on experience, and can be based on actual Adjust the situation.
  • the preset threshold is a threshold determined through the following operations:
  • the similarity between the third classification recognition result and the fourth classification recognition result is determined and used as a preset threshold.
  • the process is similar to that performed on the image to be tested.
  • the normal image is used as input to the image super-resolution model to obtain a second output image output by the image super-resolution model.
  • the resolution of the second output image will be higher than the normal image input to the image super-resolution model.
  • a third classification recognition result for the normal image and a fourth classification recognition result for the second output image are obtained.
  • the determined similarity between the third classification recognition result and the fourth classification recognition result may be used as a preset threshold.
  • K is a positive integer. That is, in an optional implementation of this application, it may also include:
  • the minimum value among the preset thresholds determined each time is used as the final preset threshold.
  • the preset thresholds calculated according to the above process may be different. Therefore, in order to avoid misjudgments, in this embodiment, the preset thresholds determined each time are The minimum value is used as the final preset threshold. In addition, in some cases, the value of the preset threshold can be slightly lowered on this basis, so that all kinds of normal images can pass the detection of adversarial samples in this application without misjudgment.
  • the method further includes:
  • the adversarial sample is detected again on the image to be tested, and when the image to be tested is still determined to be an adversarial sample, a prompt message is output.
  • This implementation method takes into account that in some cases, errors in the calculation process may occur due to program errors and other reasons, thereby obtaining erroneous detection results. Therefore, after determining that the image to be tested is an adversarial sample, the image to be tested will be re-analyzed as an adversarial sample. Detection, if the image to be tested is still determined to be an adversarial sample, a prompt message can be output to remind the staff for subsequent processing.
  • the image to be tested may also include:
  • adversarial examples are samples that deliberately add some subtle interference that is imperceptible to humans in the input sample, causing the model to give an incorrect output with a high degree of confidence.
  • the existence of adversarial examples will threaten the application of deep learning in security-sensitive fields. Therefore, in this implementation, after it is determined that the image to be tested is an adversarial sample, the collection information of the image to be tested is recorded, that is, the source of the adversarial sample is recorded, so that subsequent staff can perform corresponding processing.
  • the solution of this application detects adversarial samples based on the characteristics of adversarial samples, and can detect adversarial samples conveniently and quickly without the need for adversarial sample training as in traditional solutions.
  • an image super-resolution model for improving image resolution can be constructed, and then the image to be tested is input to the image super-resolution model to obtain the first output image output by the image super-resolution model, and the image to be tested is and the first output image are input into the classification model, a first classification recognition result for the image to be tested and a second classification recognition result for the first output image can be obtained. If the image to be tested is an adversarial sample, the similarity between the first classification recognition result and the second classification recognition result will be low, that is, the similarity between the two is not higher than the preset threshold, and it can be determined that the image to be tested is an adversarial sample. sample. And if the image to be tested is an adversarial sample, the similarity between the first classification recognition result and the second classification recognition result will be higher than the preset threshold. It can be seen that the solution of this application can detect adversarial samples conveniently and accurately.
  • embodiments of the present application also provide an adversarial sample detection system, which can be mutually referenced with the above.
  • FIG. 2 is a schematic structural diagram of an adversarial sample detection system in this application, including:
  • the image super-resolution model building module 201 is configured to build an image super-resolution model for image processing
  • the first execution module 202 is configured to input the image to be tested to the image super-resolution model and obtain a first output image output by the image super-resolution model, where the resolution of the first output image is higher than the image to be tested;
  • the classification recognition module 203 is configured to input the image to be tested and the first output image into the classification model respectively, and obtain the first classification recognition result for the image to be tested and the second classification recognition result for the first output image;
  • the similarity judgment module 204 is configured to determine the similarity between the first classification recognition result and the second classification recognition result, and determine whether the similarity is higher than a preset threshold, and if not, trigger the second execution module 205;
  • the second execution module 205 is configured to determine that the image to be tested is an adversarial sample.
  • the obtained first classification recognition result for the image to be tested is expressed as: P[p1, p2,...pi...,pn]
  • the obtained second classification recognition result for the first output image is The classification recognition result is expressed as: Q[q1, q2,...qi...,qn];
  • n represents the number of labels of the classification model
  • i is a positive integer and 1 ⁇ i ⁇ n
  • pi represents the probability value that the image to be tested belongs to the i-th category
  • qi represents that the first output image belongs to the i-th category. probability value.
  • the similarity judgment module 204 determines the similarity between the first classification recognition result and the second classification recognition result, and can be used for:
  • the first similarity is used to reflect the degree of similarity between the probability value distribution of the first classification recognition result and the probability value distribution of the second classification recognition result;
  • the second similarity is used to reflect the degree of similarity between the ranking status of the probability values of different classes in the first classification recognition result and the ranking status of the probability values of different classes in the second classification recognition result.
  • the first similarity is the first similarity determined by the similarity judgment module 204 through the following operations:
  • the cosine distance between the first classification recognition result and the second classification recognition result is used as the determined first similarity.
  • the first similarity is the first similarity determined by the similarity judgment module 204 through the following operations:
  • the cosine distance is normalized, and the normalized value is used as the determined first similarity.
  • the second similarity is the second similarity determined by the similarity judgment module 204 through the following operations:
  • pii represents the numerical ranking of pi among p1 to pn, and the ranking of the maximum probability value is 1, and the ranking of the minimum probability value is n.
  • qii represents the numerical ranking of qi among q1 to qn. , and the ranking of the maximum probability value is 1, and the ranking of the minimum probability value is n. The number of digits with the same value at the same position in the sorted result.
  • the similarity judgment module 204 determines the similarity between the first classification recognition result and the second classification recognition result based on the first similarity and the second similarity, which can be used for :
  • the first similarity and the second similarity are multiplied, and the multiplication result is used as the determined similarity between the first classification recognition result and the second classification recognition result.
  • the classification model may be a multi-category convolutional neural network classification model based on the normalized exponential function softmax.
  • the recording module is configured to record the collection information of the image to be tested after the second execution module 205 determines that the image to be tested is an adversarial sample.
  • a loop execution module is also included, which is configured to re-detect the adversarial sample on the image to be tested after the second execution module 205 determines that the image to be tested is an adversarial sample, and when still When the image to be tested is determined to be an adversarial sample, a prompt message is output.
  • the preset threshold is a threshold determined through the following operations:
  • the similarity between the third classification recognition result and the fourth classification recognition result is determined and used as a preset threshold.
  • the minimum value among the preset thresholds determined each time is used as the final preset threshold.
  • embodiments of the present application also provide an adversarial sample detection device and a computer-readable storage medium, which may be mutually referenced with the above.
  • a computer program is stored on the computer-readable storage medium.
  • the steps of the adversarial sample detection method in any of the above embodiments are implemented.
  • the computer-readable storage media mentioned here include random access memory (RAM, Random Access Memory), memory, read-only memory (ROM, Read-Only Memory), electrically programmable ROM, electrically erasable programmable ROM, registers, and hard disks. , removable disk, CD-ROM (Compact Disc Read-Only Memory, read-only optical disk), or any other form of storage media known in the technical field.
  • the adversarial sample detection equipment may include:
  • Memory 301 is configured to store computer programs
  • the processor 302 is configured to execute a computer program to implement the steps of the adversarial sample detection method in any of the above embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Multimedia (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Molecular Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Image Analysis (AREA)

Abstract

本申请公开了一种对抗样本的检测方法、系统、设备及非易失性可读存储介质,应用于人工智能技术领域,包括:构建用于进行图像处理的图像超分辨率模型;将待测图像输入至所述图像超分辨率模型,得到所述图像超分辨率模型输出的高分辨率的第一输出图像;分别将所述待测图像和所述第一输出图像输入至分类模型中,得到针对所述待测图像的第一分类识别结果和针对所述第一输出图像的第二分类识别结果;确定出所述第一分类识别结果与所述第二分类识别结果之间的相似度,并判断所述相似度是否高于预设阈值;如果否,则确定所述待测图像为对抗样本。应用本申请的方案,能够方便,准确地检测出对抗样本。

Description

对抗样本的检测方法、系统、设备及非易失性可读存储介质
相关申请的交叉引用
本申请要求于2022年06月30日提交中国专利局,申请号为202210763784.8,申请名称为“对抗样本的检测方法、系统、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能技术领域,特别是涉及一种对抗样本的检测方法、系统、设备及非易失性可读存储介质。
背景技术
对抗样本是在输入样本中故意添加一些人无法察觉的细微干扰的样本,从而导致模型以高置信度给出一个错误的输出。对抗性攻击主要发生在构造对抗样本的时候,之后对抗样本就如正常数据一样输入至机器学习模型,并得到欺骗性的识别结果。
对抗样本的存在会使得深度学习在安全敏感性领域的应用受到威胁。目前,通常是针对对抗样本进行训练,使得模型能够不受对抗样本的影响,但是这样的方式较为复杂,且对于不同类型的对抗样本,未必都能够取得较好的训练效果。此外,还有部分方案会进行对抗样本的识别,但目前识别的准确度较低。
综上所述,如何有效地应对对抗样本的攻击,是目前本领域技术人员急需解决的技术问题。
发明内容
本申请的目的是提供一种对抗样本的检测方法、系统、设备及非易失性可读存储介质,以有效地应对对抗样本的攻击。
为解决上述技术问题,本申请提供如下技术方案:
一种对抗样本的检测方法,包括:
构建用于提高图像分辨率的图像超分辨率模型;
将待测图像输入至所述图像超分辨率模型,得到所述图像超分辨率模型输出的第一输出图像;
分别将所述待测图像和所述第一输出图像输入至分类模型中,得到针对所述待测图像的第一分类识别结果和针对所述第一输出图像的第二分类识别结果;
确定出所述第一分类识别结果与所述第二分类识别结果之间的相似度,并判断所述相似度是否高于预设阈值;
如果否,则确定所述待测图像为对抗样本。
可选的,得到的针对所述待测图像的第一分类识别结果表示为:P[p1,p2,…pi…,pn],得到的针对所述第一输出图像的第二分类识别结果表示为:Q[q1,q2,…qi…,qn];
其中,n表示的是所述分类模型的标签数量,i为正整数且1≤i≤n,pi表示的是所述待测图像属于第i类的概率值,qi表示的是所述第一输出图像属于第i类的概率值。
可选的,所述确定出所述第一分类识别结果与所述第二分类识别结果之间的相似度,包括:
基于第一相似度和/或第二相似度,确定出所述第一分类识别结果与所述第二分类识别结果之间的相似度;
其中,所述第一相似度用于反映所述第一分类识别结果的概率值分布,与所述第二分类识别结果的概率值分布之间的相似程度;
所述第二相似度用于反映所述第一分类识别结果中的不同类的概率值的排名状态,与所述第二分类识别结果中的不同类的概率值的排名状态之间的相似程度。
可选的,所述第一相似度为通过以下操作确定出的第一相似度:
将所述第一分类识别结果与所述第二分类识别结果之间的余弦距离作为确定出的第一相似度。
可选的,所述第一相似度为通过以下操作确定出的第一相似度:
确定出所述第一分类识别结果与所述第二分类识别结果之间的余弦距离;
将所述余弦距离归一化,并将归一化之后的数值作为确定出的第一相似度。
可选的,所述第二相似度为通过以下操作确定出的第二相似度:
将第一分类识别结果转换为第一排序结果SP[p11,p22,…pii…,pnn];
将第二分类识别结果转换为第二排序结果SQ[q11,q22,…qii…,qnn];
通过R=(x+u)/2n,确定出的第二相似度R的数值;
其中,pii表示的是在p1至pn中,pi的数值大小排名,且最大概率值的排名为1,最小概率值的排名为n,qii表示的是在q1至qn中,qi的数值大小排名,且最大概率值的排名为1,最小概率值的排名为n,x表示的是所述第一排序结果与所述第二排序结果的前x 位是一致的,u表示的是所述第一排序结果与所述第二排序结果中在相同位置处数值相同的位数。
可选的,基于第一相似度和第二相似度,确定出所述第一分类识别结果与所述第二分类识别结果之间的相似度,包括:
将所述第一相似度与第二相似度求和,并将求和结果作为确定出的所述第一分类识别结果与所述第二分类识别结果之间的相似度;
或者;
将所述第一相似度与第二相似度相乘,并将相乘结果作为确定出的所述第一分类识别结果与所述第二分类识别结果之间的相似度。
可选的,所述分类模型为基于归一化指数函数softmax的多类别卷积神经网络分类模型。
可选的,在所述确定所述待测图像为对抗样本之后,还包括:
记录所述待测图像的采集信息。
可选的,在所述确定所述待测图像为对抗样本之后,还包括:
对所述待测图像重新进行一次对抗样本的检测,并且当仍然将所述待测图像确定为对抗样本时,输出提示信息。
可选的,预设阈值为通过以下操作确定出的阈值:
预先将正常图像输入至所述图像超分辨率模型,得到所述图像超分辨率模型输出的第二输出图像;
分别将所述正常图像和所述第二输出图像输入至分类模型中,得到针对所述正常图像的第三分类识别结果和针对所述第二输出图像的第四分类识别结果;
确定出所述第三分类识别结果与所述第四分类识别结果之间的相似度,并作为预设阈值。
可选的,还包括:
选取K张不同的正常图像作为输入,以重复确定出预设阈值的过程;
将各次确定出的预设阈值中的最小值作为最终确定的预设阈值。
一种对抗样本的检测系统,包括:
图像超分辨率模型构建模块,被设置为构建用于提高图像分辨率的图像超分辨率模型;
第一执行模块,被设置为将待测图像输入至所述图像超分辨率模型,得到所述图像超分辨率模型输出的第一输出图像;
分类识别模块,被设置为分别将所述待测图像和所述第一输出图像输入至分类模型中,得到针对所述待测图像的第一分类识别结果和针对所述第一输出图像的第二分类识别结果;
相似度判断模块,被设置为确定出所述第一分类识别结果与所述第二分类识别结果之间的相似度,并判断所述相似度是否高于预设阈值,如果否,则触发第二执行模块;
所述第二执行模块,被设置为确定所述待测图像为对抗样本。
一种对抗样本的检测设备,包括:
存储器,被设置为存储计算机程序;
处理器,被设置为执行所述计算机程序以实现如上述所述的对抗样本的检测方法的步骤。
一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如上述所述的对抗样本的检测方法的步骤。
应用本申请实施例所提供的技术方案,考虑到利用图像超分辨率模型的模型映射能力,可以将非流形对抗样本映射到自然图像流形上,这样会极大影响对抗样本图像的分类概率,而对于正常图像的分类概率影响很小。因此,本申请的方案基于对抗样本的该种特性进行对抗样本的检测,可以方便,快速地检测出对抗样本,而不需要如传统方案中进行对抗样本的训练。
可选的,可以构建图像超分辨率模型,图像超分辨率模型可以提高图像分辨率,之后将待测图像输入至图像超分辨率模型,得到图像超分辨率模型输出的第一输出图像,第一输出图像的分辨率高于待测图像。分别将待测图像和第一输出图像输入至分类模型中,可以得到针对待测图像的第一分类识别结果和针对第一输出图像的第二分类识别结果。如果待测图像是对抗样本,则第一分类识别结果与第二分类识别结果之间的相似度会较低,即二者的相似度不高于预设阈值,便可以确定待测图像为对抗样本。而如果待测图像是对抗样本,则第一分类识别结果与第二分类识别结果之间的相似度会高于预设阈值。可以看出,本申请的方案能够方便,准确地检测出对抗样本。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请中一种对抗样本的检测方法的实施流程图;
图2为本申请中一种对抗样本的检测系统的结构示意图;
图3为本申请中一种对抗样本的检测设备的结构示意图。
具体实施方式
本申请的核心是提供一种对抗样本的检测方法,能够方便,准确地检测出对抗样本。
为了使本技术领域的人员更好地理解本申请方案,下面结合附图和可选实施方式对本申请作进一步的详细说明。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
请参考图1,图1为本申请中一种对抗样本的检测方法的实施流程图,该对抗样本的检测方法可以包括以下步骤:
步骤S101:构建用于进行图像处理的图像超分辨率模型。
图像超分辨率模型可以对LR(low-resolution,低分辨率)图像进行超分辨率,从而获得SR(super-resolution,超分辨率)图像,即图像超分辨率模型可以提高图像分辨率。
在实际应用中,为了增强方案实施的便捷性,超分辨率模型可以直接采用训练好的深度学习模型,例如可以选用EDSR(Enhanced Deep Super-Resolution Network,增强的深度超分辨网络),RDN(Residual Dense Network,残差密集网络)等通用的超分辨率模型,便不需要重新训练。也就是说,在执行步骤S101的构建图像超分辨率模型的操作时,通过下载训练好的深度学习模型,便完成了对于图像超分辨率模型的构建。当然,部分场合中,也可以自主构建所需要的图像超分辨率模型并训练,并不影响本申请的实施。
步骤S102:将待测图像输入至图像超分辨率模型,得到图像超分辨率模型输出的第一输出图像。其中,第一输出图像的分辨率高于待测图像。
本申请的方案中,是考虑到可以利用图像超分辨率模型的模型映射能力,将非流形对抗样本映射到自然图像流形上,这样会极大影响对抗样本图像的分类概率,而对于正常图像的分类概率影响很小。
将待测图像输入至图像超分辨率模型之后,图像超分辨率模型可以输出对应于待测图像的第一输出图像。可以理解的是,由于图像超分辨率模型可以提高图像分辨率,因此第一输出图像的分辨率高于待测图像。
步骤S103:分别将待测图像和第一输出图像输入至分类模型中,得到针对待测图像的第 一分类识别结果和针对第一输出图像的第二分类识别结果。
分类模型的类型可以根据需要进行设定和调整,只要能够实现图像分类即可。
例如在本申请的一种可选实施方式中,考虑到后续需要比较第一分类识别结果与第二分类识别结果之间的相似度,因此,第一分类识别结果和第二分类识别结果均可以采用由一组表示不同类的概率值构成的形式,这样可以较为方便、准确地反映出第一分类识别结果与第二分类识别结果之间的相似度。
即,在本申请的一种可选实施方式中,得到的针对待测图像的第一分类识别结果表示为:P[p1,p2,…pi…,pn],得到的针对第一输出图像的第二分类识别结果表示为:Q[q1,q2,…qi…,qn];
其中,n表示的是分类模型的标签数量,i为正整数且1≤i≤n,pi表示的是待测图像属于第i类的概率值,qi表示的是第一输出图像属于第i类的概率值。
n也可以称为类标签数量,通常可以取两个以上的值。pi表示的是待测图像属于第i类的概率值,例如一种可选场合中n=3,p1=30%,p2=60%,p3=10%,且例如第1类标签的含义可以为橘子,第2类标签的含义可以为油桃,第3类标签的含义可以为橙子,则p1=30%,p2=60%,p3=10%,表示的是对于该待测图像,分类模型认为该待测图像有30%的概率为橘子,有60%的概率为油桃,有10%的概率为橙子。
在一种可选场合中,分类模型可以为基于归一化指数函数softmax的多类别卷积神经网络分类模型,采用该分类模型时,第一分类识别结果便可以表示为:P[p1,p2,…pi…,pn],第二分类识别结果便可以表示为:Q[q1,q2,…qi…,qn]。并且,该分类模型可以将多分类的输出结果转换成范围在[0,1]并且和为1的概率分布,有利于保障后续进行相似度比较的准确性。
步骤S104:确定出第一分类识别结果与第二分类识别结果之间的相似度,并判断相似度是否高于预设阈值。如果否,则执行步骤S105。
步骤S105:确定待测图像为对抗样本。
通过分类模型,分别得到第一分类识别结果与第二分类识别结果,便可以确定出第一分类识别结果与第二分类识别结果之间的相似度。如上文的描述,由于对抗样本的特征,会使得当待测图像为对抗样本时,第一分类识别结果与第二分类识别结果差异较大,即第一分类识别结果与第二分类识别结果之间的相似度不会高于预设阈值,相应的,如果待测图像是正常的样本时,第一分类识别结果与第二分类识别结果之间的相似度便会高于预设阈值,便可以确定待测图像不是对抗样本。
确定出第一分类识别结果与第二分类识别结果之间的相似度的可选方式有多种,根据需要进行设定即可。
在本申请的一种可选实施方式中,步骤S104描述的确定出第一分类识别结果与第二分类识别结果之间的相似度,可以包括:
基于第一相似度和/或第二相似度,确定出第一分类识别结果与第二分类识别结果之间的相似度;
其中,第一相似度用于反映第一分类识别结果的概率值分布,与第二分类识别结果的概率值分布之间的相似程度;
第二相似度用于反映第一分类识别结果中的不同类的概率值的排名状态,与第二分类识别结果中的不同类的概率值的排名状态之间的相似程度。
该种实施方式考虑到,在上述实施方式中,第一分类识别结果可以表示为:P[p1,p2,…pi…,pn],第二分类识别结果可以表示为:Q[q1,q2,…qi…,qn]。而第一分类识别结果的概率值分布,与第二分类识别结果的概率值分布之间的相似程度,可以在一定程度上反映出第一分类识别结果与第二分类识别结果之间的相似度,因此可以基于第一相似度确定出第一分类识别结果与第二分类识别结果之间的相似度。
并且,除了概率值分布情况,在第一分类识别结果中不同类的概率值的排名状态,与第二分类识别结果中不同类的概率值的排名状态之间的相似程度,也可以在一定程度上反映出第一分类识别结果与第二分类识别结果之间的相似度,因此,也可以基于第二相似度确定出第一分类识别结果与第二分类识别结果之间的相似度。
此外,还可以同时基于第一相似度和第二相似度,确定出第一分类识别结果与第二分类识别结果之间的相似度,均不影响本申请的实施。
如上文的描述,第一相似度反映的是第一分类识别结果的概率值分布,与第二分类识别结果的概率值分布之间的相似程度,因此第一相似度的计算方式也可以有多种,能够实现第一相似度的功能即可。
而在本申请的一种可选实施方式中,考虑到余弦距离可以较为准确地反映出第一分类识别结果与第二分类识别结果之间的概率值分布的差异,因此,第一相似度可以为通过以下操作确定出的第一相似度:
将第一分类识别结果与第二分类识别结果之间的余弦距离作为确定出的第一相似度。
第一分类识别结果与第二分类识别结果之间的余弦距离cosθ用公式可以表示为:
Figure PCTCN2022130983-appb-000001
i表示第i个分类,余弦距离cosθ的取值范围为[-1,1],余弦距离可以反映出表示两个图像的概率分布情况,当余弦距离为1时,说明两个图像的概率值分布是一致的,余弦距离越小,说明概率值分布的差异越大。
可选的,在本申请的一种可选实施方式中,第一相似度为通过以下操作确定出的第一相似度:
确定出第一分类识别结果与第二分类识别结果之间的余弦距离;
将余弦距离归一化,并将归一化之后的数值作为确定出的第一相似度。
该种实施方式中,考虑到余弦距离cosθ的取值范围为[-1,1],部分场合中,需要联合第一相似度和第二相似度来确定出第一分类识别结果与第二分类识别结果之间的相似度,因此为了便于计算,该种实施方式中还会对余弦距离归一化,即,将归一化之后的数值作为确定出的第一相似度。
由于余弦距离cosθ的取值范围为[-1,1],因此,归一化的公式可以表示为:
cosθ′=(1+cosθ)/2,此处的cosθ′即为余弦距离cosθ归一化之后的数值,也即该种实施方式中确定出的第一相似度。
如上文的描述,本申请考虑到,第一分类识别结果的概率值分布,与第二分类识别结果的概率值分布之间的相似程度,可以在一定程度上反映出第一分类识别结果与第二分类识别结果之间的相似度,但是,概率值分布之间的相似程度不能完全代表两张图像的分类结果,因为第一分类识别结果与第二分类识别结果中的排名也是很重要的。因此,实际应用中,通常是基于第一相似度和第二相似度,来确定出第一分类识别结果与第二分类识别结果之间的相似度。
第二相似度用于反映第一分类识别结果中的不同类的概率值的排名状态,与第二分类识别结果中的不同类的概率值的排名状态之间的相似程度,可选的计算方式有多种。
在本申请的一种可选实施方式中,第二相似度为通过以下操作确定出的第二相似度:
将第一分类识别结果转换为第一排序结果SP[p11,p22,…pii…,pnn];
将第二分类识别结果转换为第二排序结果SQ[q11,q22,…qii…,qnn];
通过R=(x+u)/2n,确定出的第二相似度R的数值;
其中,pii表示的是在p1至pn中,pi的数值大小排名,且最大概率值的排名为1,最小概率值的排名为n,qii表示的是在q1至qn中,qi的数值大小排名,且最大概率值的排名为1,最小概率值的排名为n,x表示的是第一排序结果与第二排序结果的前x位是一致的,u表示的 是第一排序结果与第二排序结果中在相同位置处数值相同的位数。
例如一种可选场合中,可以采用排序算法argsort,即,SP=argsort(P),SQ=argsort(Q),通过排序算法,可以将数组中的元素从大到小排序并返回数组的索引序号。
例如一种可选场合中,第一分类识别结果为P[0.2,0.3,0.25,0.2,0.05],则进行排序之后,返回的索引序号为SP[3,1,2,4,5]。也就是说,在第一分类识别结果P中,各个概率值按照数值大小排名,最大的排名为1,最小概率值的排名为n。此外需要说明的是,当概率值相同时,可以设定按照顺序进行前后排名,例如设定先出现的排名在前,即概率值相同时,类标签的编号越低,排名越靠前。
将第一分类识别结果转换为第一排序结果SP,将第二分类识别结果转换为第二排序结果SQ之后,便可以通过R=(x+u)/2n,确定出的第二相似度R的数值。例如上述例子中,得到的第一排序结果为SP[3,1,2,4,5],例如得到的第二排序结果为SQ[3,1,5,4,2],可以看出,SP和SQ的前2位是一致的,从第3位开始不一致,因此该例子中x=2。而5个数值中,有4个位置处的数值是一致的,即第1位置,第2位置以及第4位置是一致的,因此该例子中u=3。
在基于第一相似度和第二相似度确定出第一分类识别结果与第二分类识别结果之间的相似度时,可选方式也可以有多种,例如一种可选场合中,考虑到相加和相乘是较为方便的方式,因此,基于第一相似度和第二相似度,确定出第一分类识别结果与第二分类识别结果之间的相似度,可以包括:
将第一相似度与第二相似度求和,并将求和结果作为确定出的第一分类识别结果与第二分类识别结果之间的相似度;
或者;
将第一相似度与第二相似度相乘,并将相乘结果作为确定出的第一分类识别结果与第二分类识别结果之间的相似度。
实际应用中,通常可以将第一相似度与第二相似度相乘,确定出第一分类识别结果与第二分类识别结果之间的相似度,这样的方式准确度非常高,即可以非常准确地检测出对抗样本。
例如一种可选场合中,其中一个待测样本的第一相似度为0.8563,第二相似度为1,而另一个待测样本的第一相似度为0.9927,第二相似度为0.1666,则对于其中一个待测样本,最终确定出的相似度为1*0.8563=0.8563,对于另一个待测样本,最终确定出的相似度为0.1666*0.9927=0.16545。可以看出,将第一相似度与第二相似度相乘,使得当第一相似 度或者第二相似度较小时,最终的相似度会降低很多,这才是符合逻辑的设计,可以准确地检测出对抗样本。
本申请需要将确定出的第一分类识别结果与第二分类识别结果之间的相似度,与预设阈值比较,该阈值可以由工作人员预先设定,例如根据经验设定,并可以根据实际情况进行调整。
在本申请的一种可选实施方式中,预设阈值为通过以下操作确定出的阈值:
预先将正常图像输入至图像超分辨率模型,得到图像超分辨率模型输出的第二输出图像;
分别将正常图像和第二输出图像输入至分类模型中,得到针对正常图像的第三分类识别结果和针对第二输出图像的第四分类识别结果;
确定出第三分类识别结果与第四分类识别结果之间的相似度,并作为预设阈值。
该种实施方式中,与待测图像所执行的流程相似。将正常图像作为输入,输入至图像超分辨率模型,从而得到图像超分辨率模型输出的第二输出图像。第二输出图像的分辨率会高于输入至图像超分辨率模型的正常图像。进而通过分类模型,得到针对正常图像的第三分类识别结果和针对第二输出图像的第四分类识别结果。最后,可以将确定出的第三分类识别结果与第四分类识别结果之间的相似度,作为预设阈值。
可选的,在实际应用中,考虑到通过上述方式确定出的预设阈值存在一定的偶然性,因此可以再进行K次测试,K为正整数。即在本申请的一种可选实施方式中,还可以包括:
选取K张不同的正常图像作为输入,以重复确定出预设阈值的过程;
将各次确定出的预设阈值中的最小值作为最终确定的预设阈值。
需要说明的是,对于不同的正常图像而言,按照上述流程计算出的预设阈值可能是不同的,因此为了避免误判,该种实施方式中,是将各次确定出的预设阈值中的最小值作为最终确定的预设阈值。此外,部分场合中,还可以在此基础上,略微降低预设阈值的取值,以使得各种正常图像都能够通过本申请针对对抗样本的检测,不会出现误判的情况。
可选的,在本申请的一种可选实施方式中,在确定待测图像为对抗样本之后,还包括:
对待测图像重新进行一次对抗样本的检测,并且当仍然将待测图像确定为对抗样本时,输出提示信息。
该种实施方式考虑到,部分场合中由于程序出错等原因可能导致计算过程出错,进而得到错误的检测结果,因此,在确定待测图像为对抗样本之后,会对待测图像重新进行一次对抗样本的检测,如果仍然将待测图像确定为对抗样本时,则可以输出提示信息以提醒工作人 员进行后续处理。
在本申请的一种可选实施方式中,在确定待测图像为对抗样本之后,还可以包括:
记录待测图像的采集信息。
如上文的描述,对抗样本是在输入样本中故意添加一些人无法察觉的细微干扰的样本,从而导致模型以高置信度给出一个错误的输出。对抗样本的存在会使得深度学习在安全敏感性领域的应用受到威胁。因此,该种实施方式中,在确定待测图像为对抗样本之后,会记录待测图像的采集信息,即记录下该对抗样本的来源,以便后续工作人员进行相应处理。
采集信息的项目可以有多种,例如可以包括待测图像的检测端的信息,传输路径信息,存储信息等等,以便工作人员可以按照采集信息进行排查,以避免或者预防对抗样本的产生。
应用本申请实施例所提供的技术方案,考虑到利用图像超分辨率模型的模型映射能力,可以将非流形对抗样本映射到自然图像流形上,这样会极大影响对抗样本图像的分类概率,而对于正常图像的分类概率影响很小。因此,本申请的方案基于对抗样本的该种特性进行对抗样本的检测,可以方便,快速地检测出对抗样本,而不需要如传统方案中进行对抗样本的训练。
可选的,可以构建用于提高图像分辨率的图像超分辨率模型,之后将待测图像输入至图像超分辨率模型,得到图像超分辨率模型输出的第一输出图像,分别将待测图像和第一输出图像输入至分类模型中,可以得到针对待测图像的第一分类识别结果和针对第一输出图像的第二分类识别结果。如果待测图像是对抗样本,则第一分类识别结果与第二分类识别结果之间的相似度会较低,即二者的相似度不高于预设阈值,便可以确定待测图像为对抗样本。而如果待测图像是对抗样本,则第一分类识别结果与第二分类识别结果之间的相似度会高于预设阈值。可以看出,本申请的方案能够方便,准确地检测出对抗样本。
相应于上面的方法实施例,本申请实施例还提供了一种对抗样本的检测系统,可与上文相互对应参照。
参见图2所示,为本申请中一种对抗样本的检测系统的结构示意图,包括:
图像超分辨率模型构建模块201,被设置为构建用于进行图像处理的图像超分辨率模型;
第一执行模块202,被设置为将待测图像输入至图像超分辨率模型,得到图像超分辨率模型输出的第一输出图像,其中,第一输出图像的分辨率高于待测图像;
分类识别模块203,被设置为分别将待测图像和第一输出图像输入至分类模型中,得到 针对待测图像的第一分类识别结果和针对第一输出图像的第二分类识别结果;
相似度判断模块204,被设置为确定出第一分类识别结果与第二分类识别结果之间的相似度,并判断相似度是否高于预设阈值,如果否,则触发第二执行模块205;
第二执行模块205,被设置为确定待测图像为对抗样本。
在本申请的一种可选实施方式中,得到的针对待测图像的第一分类识别结果表示为:P[p1,p2,…pi…,pn],得到的针对第一输出图像的第二分类识别结果表示为:Q[q1,q2,…qi…,qn];
其中,n表示的是分类模型的标签数量,i为正整数且1≤i≤n,pi表示的是待测图像属于第i类的概率值,qi表示的是第一输出图像属于第i类的概率值。
在本申请的一种可选实施方式中,相似度判断模块204确定出第一分类识别结果与第二分类识别结果之间的相似度,可以用于:
基于第一相似度和/或第二相似度,确定出第一分类识别结果与第二分类识别结果之间的相似度;
其中,第一相似度用于反映第一分类识别结果的概率值分布,与第二分类识别结果的概率值分布之间的相似程度;
第二相似度用于反映第一分类识别结果中的不同类的概率值的排名状态,与第二分类识别结果中的不同类的概率值的排名状态之间的相似程度。
在本申请的一种可选实施方式中,第一相似度为相似度判断模块204通过以下操作确定出的第一相似度:
将第一分类识别结果与第二分类识别结果之间的余弦距离作为确定出的第一相似度。
在本申请的一种可选实施方式中,第一相似度为相似度判断模块204通过以下操作确定出的第一相似度:
确定出第一分类识别结果与第二分类识别结果之间的余弦距离;
将余弦距离归一化,并将归一化之后的数值作为确定出的第一相似度。
在本申请的一种可选实施方式中,第二相似度为相似度判断模块204通过以下操作确定出的第二相似度:
将第一分类识别结果转换为第一排序结果SP[p11,p22,…pii…,pnn];
将第二分类识别结果转换为第二排序结果SQ[q11,q22,…qii…,qnn];
通过R=(x+u)/2n,确定出的第二相似度R的数值;
其中,pii表示的是在p1至pn中,pi的数值大小排名,且最大概率值的排名为1,最小概 率值的排名为n,qii表示的是在q1至qn中,qi的数值大小排名,且最大概率值的排名为1,最小概率值的排名为n,x表示的是第一排序结果与第二排序结果的前x位是一致的,u表示的是第一排序结果与第二排序结果中在相同位置处数值相同的位数。
在本申请的一种可选实施方式中,相似度判断模块204基于第一相似度和第二相似度,确定出第一分类识别结果与第二分类识别结果之间的相似度,可以用于:
将第一相似度与第二相似度求和,并将求和结果作为确定出的第一分类识别结果与第二分类识别结果之间的相似度;
或者;
将第一相似度与第二相似度相乘,并将相乘结果作为确定出的第一分类识别结果与第二分类识别结果之间的相似度。
在本申请的一种可选实施方式中,分类模型可以为基于归一化指数函数softmax的多类别卷积神经网络分类模型。
在本申请的一种可选实施方式中,还包括:
记录模块,被设置为在第二执行模块205确定待测图像为对抗样本之后,记录待测图像的采集信息。
在本申请的一种可选实施方式中,还包括循环执行模块,被设置为在第二执行模块205确定待测图像为对抗样本之后,对待测图像重新进行一次对抗样本的检测,并且当仍然将待测图像确定为对抗样本时,输出提示信息。
在本申请的一种可选实施方式中,预设阈值为通过以下操作确定出的阈值:
预先将正常图像输入至图像超分辨率模型,得到图像超分辨率模型输出的第二输出图像;
分别将正常图像和第二输出图像输入至分类模型中,得到针对正常图像的第三分类识别结果和针对第二输出图像的第四分类识别结果;
确定出第三分类识别结果与第四分类识别结果之间的相似度,并作为预设阈值。
在本申请的一种可选实施方式中,还包括:
选取K张不同的正常图像作为输入,以重复确定出预设阈值的过程;
将各次确定出的预设阈值中的最小值作为最终确定的预设阈值。
相应于上面的方法和系统实施例,本申请实施例还提供了一种对抗样本的检测设备以及一种计算机可读存储介质,可与上文相互对应参照。计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现如上述任一实施例中的对抗样本的检测方法的步骤。这 里所说的计算机可读存储介质包括随机存储器(RAM,Random Access Memory)、内存、只读存储器(ROM,Read-Only Memory)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM(Compact Disc Read-Only Memory,只读光盘)、或技术领域内所公知的任意其它形式的存储介质。
可参阅图3,该对抗样本的检测设备可以包括:
存储器301,被设置为存储计算机程序;
处理器302,被设置为执行计算机程序以实现如上述任一实施例中的对抗样本的检测方法的步骤。
还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本文中应用了个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的技术方案及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以对本申请进行若干改进和修饰,这些改进和修饰也落入本申请的保护范围内。

Claims (20)

  1. 一种对抗样本的检测方法,包括:
    构建用于进行图像处理的图像超分辨率模型;
    将待测图像输入至所述图像超分辨率模型,得到所述图像超分辨率模型输出的第一输出图像,其中,所述第一输出图像的分辨率高于所述待测图像;
    分别将所述待测图像和所述第一输出图像输入至分类模型中,得到针对所述待测图像的第一分类识别结果和针对所述第一输出图像的第二分类识别结果;
    确定出所述第一分类识别结果与所述第二分类识别结果之间的相似度,并判断所述相似度是否高于预设阈值;
    如果否,则确定所述待测图像为对抗样本。
  2. 根据权利要求1所述的对抗样本的检测方法,其中,得到的针对所述待测图像的第一分类识别结果表示为:P[p 1,p 2,…p i…,p n],得到的针对所述第一输出图像的第二分类识别结果表示为:Q[q 1,q 2,…q i…,q n];
    其中,n表示的是所述分类模型的标签数量,i为正整数且1≤i≤n,p i表示的是所述待测图像属于第i类的概率值,q i表示的是所述第一输出图像属于第i类的概率值。
  3. 根据权利要求2所述的对抗样本的检测方法,其中,所述确定出所述第一分类识别结果与所述第二分类识别结果之间的相似度,包括:
    基于第一相似度和/或第二相似度,确定出所述第一分类识别结果与所述第二分类识别结果之间的相似度;
    其中,所述第一相似度用于反映所述第一分类识别结果的概率值分布,与所述第二分类识别结果的概率值分布之间的相似程度;
    所述第二相似度用于反映所述第一分类识别结果中的不同类的概率值的排名状态,与所述第二分类识别结果中的不同类的概率值的排名状态之间的相似程度。
  4. 根据权利要求3所述的对抗样本的检测方法,其中,所述第一相似度为通过以下操作确定出的第一相似度:
    将所述第一分类识别结果与所述第二分类识别结果之间的余弦距离作为确定出的第一相似度。
  5. 根据权利要求3所述的对抗样本的检测方法,其中,所述第一相似度为通过以下操作确定出的第一相似度:
    确定出所述第一分类识别结果与所述第二分类识别结果之间的余弦距离;
    将所述余弦距离归一化,并将归一化之后的数值作为确定出的第一相似度。
  6. 根据权利要求5所述的对抗样本的检测方法,其中,所述确定出所述第一分类识别结果与所述第二分类识别结果之间的余弦距离,包括:
    Figure PCTCN2022130983-appb-100001
    其中,cosθ为所述余弦距离,i表示第i个分类;余弦距离cosθ的取值范围为[-1,1],余弦距离用于指示两个图像的概率分布情况,在所述余弦距离为1的情况下,所述两个图像的概率值分布一致,所述余弦距离越小,所述两个图像的概率分布差异越大。
  7. 根据权利要求6所述的对抗样本的检测方法,其中,所述将所述余弦距离归一化,并将归一化之后的数值作为确定出的第一相似度,包括:
    通过归一化公式对所述余弦距离cosθ进行归一化,其中,所述归一化公式为:cosθ′=(1+cosθ)/2,所述cosθ′为所述余弦距离cosθ归一化之后的数值作为确定出的第一相似度。
  8. 根据权利要求3所述的对抗样本的检测方法,其中,所述第二相似度为通过以下操作确定出的第二相似度:
    将第一分类识别结果转换为第一排序结果SP[p 11,p 22,…p ii…,p nn];
    将第二分类识别结果转换为第二排序结果SQ[q 11,q 22,…q ii…,q nn];
    通过R=(x+u)/2n,确定出的第二相似度R的数值;
    其中,p ii表示的是在p 1至p n中,p i的数值大小排名,且最大概率值的排名为1,最小概率值的排名为n,q ii表示的是在q 1至q n中,q i的数值大小排名,且最大概率值的排名为1,最小概率值的排名为n,x表示的是所述第一排序结果与所述第二排序结果的前x位是一致的,u表示的是所述第一排序结果与所述第二排序结果中在相同位置处数值相同的位数。
  9. 根据权利要求8所述的对抗样本的检测方法,其中,
    所述将第一分类识别结果转换为第一排序结果SP[p11,p22,…pii…,pnn],包括:将所述第一分类识别结果输入排序算法SP=argsort(P),通过所述排序算法SP=argsort(P),将数组中的元素从大到小排序并返回数组的索引序号,得到所述第一排序结果SP[p11,p22,…pii…,pnn];
    所述将第二分类识别结果转换为第二排序结果SQ[q 11,q 22,…q ii…,q nn],包括:将所述第一分类识别结果输入排序算法SQ=argsort(Q),通过所述排序算法SQ=argsort (Q),将数组中的元素从大到小排序并返回数组的索引序号,得到所述第二排序结果SQ[q 11,q 22,…q ii…,q nn]。
  10. 根据权利要求3所述的对抗样本的检测方法,其中,基于第一相似度和第二相似度,确定出所述第一分类识别结果与所述第二分类识别结果之间的相似度,包括:
    将所述第一相似度与第二相似度求和,并将求和结果作为确定出的所述第一分类识别结果与所述第二分类识别结果之间的相似度;
    或者;
    将所述第一相似度与第二相似度相乘,并将相乘结果作为确定出的所述第一分类识别结果与所述第二分类识别结果之间的相似度。
  11. 根据权利要求1所述的对抗样本的检测方法,其中,所述分类模型为基于归一化指数函数softmax的多类别卷积神经网络分类模型。
  12. 根据权利要求1所述的对抗样本的检测方法,其中,在所述确定所述待测图像为对抗样本之后,还包括:
    记录所述待测图像的采集信息。
  13. 根据权利要求12所述的对抗样本的检测方法,其中,所述记录所述待测图像的采集信息,包括:
    记录所述待测图像对应的对抗样本的来源作为所述采集信息。
  14. 根据权利要求13所述的对抗样本的检测方法,其中,所述记录所述待测图像对应的对抗样本的来源作为所述采集信息,包括:
    记录所述待测图像的检测端信息、传输路径信息和存储信息作为所述采集信息。
  15. 根据权利要求1所述的对抗样本的检测方法,其中,在所述确定所述待测图像为对抗样本之后,还包括:
    对所述待测图像重新进行一次对抗样本的检测,并且当仍然将所述待测图像确定为对抗样本时,输出提示信息。
  16. 根据权利要求1至15任一项所述的对抗样本的检测方法,其中,预设阈值为通过以下操作确定出的阈值:
    预先将正常图像输入至所述图像超分辨率模型,得到所述图像超分辨率模型输出的第二输出图像;
    分别将所述正常图像和所述第二输出图像输入至分类模型中,得到针对所述正常图像的第三分类识别结果和针对所述第二输出图像的第四分类识别结果;
    确定出所述第三分类识别结果与所述第四分类识别结果之间的相似度,并作为预设 阈值。
  17. 根据权利要求16所述的对抗样本的检测方法,其中,还包括:
    选取K张不同的正常图像作为输入,以重复确定出预设阈值的过程;
    将各次确定出的预设阈值中的最小值作为最终确定的预设阈值。
  18. 一种对抗样本的检测系统,包括:
    图像超分辨率模型构建模块,被设置为构建用于进行图像处理的图像超分辨率模型;
    第一执行模块,被设置为将待测图像输入至所述图像超分辨率模型,得到所述图像超分辨率模型输出的第一输出图像,其中,所述第一输出图像的分辨率高于所述待测图像;
    分类识别模块,被设置为分别将所述待测图像和所述第一输出图像输入至分类模型中,得到针对所述待测图像的第一分类识别结果和针对所述第一输出图像的第二分类识别结果;
    相似度判断模块,被设置为确定出所述第一分类识别结果与所述第二分类识别结果之间的相似度,并判断所述相似度是否高于预设阈值,如果否,则触发第二执行模块;
    所述第二执行模块,被设置为确定所述待测图像为对抗样本。
  19. 一种对抗样本的检测设备,包括:
    存储器,被设置为存储计算机程序;
    处理器,被设置为执行所述计算机程序以实现如权利要求1至17任一项所述的对抗样本的检测方法的步骤。
  20. 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至17任一项所述的对抗样本的检测方法的步骤。
PCT/CN2022/130983 2022-06-30 2022-11-09 对抗样本的检测方法、系统、设备及非易失性可读存储介质 WO2024000989A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210763784.8A CN115115884A (zh) 2022-06-30 2022-06-30 对抗样本的检测方法、系统、设备及存储介质
CN202210763784.8 2022-06-30

Publications (1)

Publication Number Publication Date
WO2024000989A1 true WO2024000989A1 (zh) 2024-01-04

Family

ID=83330940

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/130983 WO2024000989A1 (zh) 2022-06-30 2022-11-09 对抗样本的检测方法、系统、设备及非易失性可读存储介质

Country Status (2)

Country Link
CN (1) CN115115884A (zh)
WO (1) WO2024000989A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115115884A (zh) * 2022-06-30 2022-09-27 浪潮(北京)电子信息产业有限公司 对抗样本的检测方法、系统、设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112329837A (zh) * 2020-11-02 2021-02-05 北京邮电大学 一种对抗样本检测方法、装置、电子设备及介质
US20210192357A1 (en) * 2018-05-17 2021-06-24 Magic Leap, Inc. Gradient adversarial training of neural networks
CN113128505A (zh) * 2021-04-29 2021-07-16 河北工程大学 局部可视对抗样本的检测方法、装置、设备和存储介质
CN113780363A (zh) * 2021-08-17 2021-12-10 广州大学 一种对抗样本防御方法、系统、计算机及介质
CN115115884A (zh) * 2022-06-30 2022-09-27 浪潮(北京)电子信息产业有限公司 对抗样本的检测方法、系统、设备及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210192357A1 (en) * 2018-05-17 2021-06-24 Magic Leap, Inc. Gradient adversarial training of neural networks
CN112329837A (zh) * 2020-11-02 2021-02-05 北京邮电大学 一种对抗样本检测方法、装置、电子设备及介质
CN113128505A (zh) * 2021-04-29 2021-07-16 河北工程大学 局部可视对抗样本的检测方法、装置、设备和存储介质
CN113780363A (zh) * 2021-08-17 2021-12-10 广州大学 一种对抗样本防御方法、系统、计算机及介质
CN115115884A (zh) * 2022-06-30 2022-09-27 浪潮(北京)电子信息产业有限公司 对抗样本的检测方法、系统、设备及存储介质

Also Published As

Publication number Publication date
CN115115884A (zh) 2022-09-27

Similar Documents

Publication Publication Date Title
CN110889463A (zh) 一种样本标注方法、装置、服务器及机器可读存储介质
CN109543674B (zh) 一种基于生成对抗网络的图像拷贝检测方法
WO2024000989A1 (zh) 对抗样本的检测方法、系统、设备及非易失性可读存储介质
CN110287806A (zh) 一种基于改进ssd网络的交通标志识别方法
CN112016638A (zh) 一种钢筋簇的识别方法、装置、设备及存储介质
CN112181490B (zh) 功能点评估法中功能类别的识别方法、装置、设备及介质
WO2021227295A1 (zh) 一种基于cnn的癌细胞多尺度缩放定位检测方法
CN111738290B (zh) 图像检测方法、模型构建和训练方法、装置、设备和介质
CN113761867A (zh) 地址识别方法、装置、计算机设备及存储介质
CN112131354A (zh) 答案筛选方法、装置、终端设备和计算机可读存储介质
CN115063410B (zh) 一种基于无锚点目标检测的钢管计数方法
CN109739840A (zh) 数据空值处理方法、装置及终端设备
CN111582307B (zh) 签到结果判定方法、系统、存储介质、计算机程序、终端
CN105824871B (zh) 一种图片检测方法与设备
CN112926577B (zh) 一种医疗票据图像结构化方法和装置、计算机可读介质
CN107704072A (zh) 一种手势交互过程中用户手势的自动纠错方法
CN114238062A (zh) 板卡烧录装置性能分析方法、装置、设备及可读存储介质
WO2021017638A2 (zh) 一种判断任意两个技术系统相似程度的方法
CN112232288A (zh) 一种基于深度学习的卫星图目标识别方法及系统
CN113723508B (zh) 票据图像分类方法、装置、计算设备和存储介质
CN114565044B (zh) 印章识别方法及系统
CN115019136B (zh) 抗边界点漂移的目标关键点检测模型训练方法及检测方法
CN112784632B (zh) 一种输电线路安全隐患检测方法及装置
CN110728615B (zh) 基于序贯假设检验的隐写分析方法、终端设备及存储介质
CN115829005B (zh) 面向卷积神经分类网络的缺陷自动诊断与修复方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22949072

Country of ref document: EP

Kind code of ref document: A1