Method, device, computer storage medium and terminal for determining black box attack algorithm
By constructing and optimizing the black box attack algorithm, the problems of poor black box attack algorithm effectiveness and high consumption of computing resources in the existing technology are solved, and the black box attack algorithm that meets the preset computing requirements is automatically and efficiently obtained, thereby improving performance.
Patent Information
- Application Number
- CN202110494774.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-07
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-05-07
AI Technical Summary
Existing decision-based black box attack algorithms are ineffective and require technical expert design. Moreover, the automatic discovery method relies on search space design, consumes a lot of computing resources, and is not as good as the performance of algorithms designed by human experts.
By randomly selecting programs in the form of static single assignments, adding basic operations in Euclidean space, deleting programs that do not use vector parameters and do not reduce the sample distance, a black box attack algorithm is constructed, and optimized by the random walk algorithm, it automatically and efficiently obtains preset operations that satisfy The required black box attack algorithm.
It achieves automatic and efficient determination of black-box attack algorithms without relying on technical experts, reduces computing resource consumption, and improves algorithm performance.
Smart Images

Figure CN113128616B_ABST
Abstract
Description
Technical Field
[0001] This article relates to but is not limited to neural network technology, and in particular to a method, device, computer storage medium and terminal for determining a black box attack algorithm. Background Art
[0002] In the related technologies, black box attack algorithms for decision-based black box scenarios are generally designed by technical experts and have poor results; methods based on automatic discovery of machine learning algorithms rely on technical experts to design the search space; automatic discovery classifier algorithms using basic mathematical operators as basic components require a large amount of computing resources, and their performance cannot be compared with algorithms designed by human experts.
[0003] An applicable black-box attack algorithm that does not rely on technical experts has become an urgent need. Summary of the invention
[0004] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
[0005] The embodiments of the present invention provide a method, an apparatus, a computer storage medium and a terminal for determining a black box attack algorithm, which can automatically and efficiently determine the black box attack algorithm.
[0006] An embodiment of the present invention provides a method for determining a black box attack algorithm, including:
[0007] A first program of one or more static single assignment forms is randomly selected;
[0008] Adding a first preset number of basic operations of the Euclidean space to each first program, respectively, to obtain one or more second programs corresponding to each first program;
[0009] Deleting a second program that does not use a preset vector parameter and does not reduce a sample distance from the obtained one or more second programs;
[0010] When the number of the remaining second programs reaches a preset number, each of the remaining second programs is added to the random walk algorithm to obtain a black box attack algorithm corresponding to each second program;
[0011] A black box attack algorithm that meets preset operation requirements is selected from the obtained black box attack algorithms; wherein the sample distance includes: the distance between the adversarial sample and the original sample.
[0012] On the other hand, an embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium stores a computer program, and when the computer program is executed by a processor, the method for determining a black box attack algorithm is implemented.
[0013] In another aspect, an embodiment of the present invention further provides a terminal, comprising: a memory and a processor, wherein the memory stores a computer program; wherein:
[0014] The processor is configured to execute the computer program in the memory;
[0015] When the computer program is executed by the processor, the method for determining the black box attack algorithm as described above is implemented.
[0016] In another aspect, an embodiment of the present invention further provides a device for determining a black box attack algorithm, comprising: a selection unit, an addition unit, a deletion unit, a loading unit and a processing unit; wherein,
[0017] The selection unit is configured to randomly select one or more first programs in a static single assignment form; the adding unit is configured to respectively add a first preset value of basic operations of the Euclidean space to each first program to obtain one or more second programs corresponding to each first program;
[0018] The deleting unit is configured to: delete the second program that does not use the preset vector parameter and does not reduce the sample distance from the obtained more than one second program;
[0019] The loading unit is configured to: when the number of the remaining second programs reaches a preset number, each of the remaining second programs is added to the random walk algorithm to obtain a black box attack algorithm corresponding to each second program;
[0020] The processing unit is configured to: select a black box attack algorithm that meets a preset operation requirement from the obtained black box attack algorithms;
[0021] The sample distance includes: the distance between the adversarial sample and the original sample.
[0022] The embodiment of the present invention randomly selects more than one first program in the form of static single assignment; adds a first preset value of basic operations of Euclidean space to each first program, and obtains more than one second program corresponding to each first program; deletes the second program that does not use the preset vector parameter and does not reduce the sample distance from the obtained more than one second program; when the number of the remaining second programs reaches the preset number, each of the remaining second programs is added to the random walk algorithm to obtain the black box attack algorithm corresponding to each second program; selects the black box attack algorithm that meets the preset operation requirements from the obtained black box attack algorithms; wherein the sample distance includes: the distance between the adversarial sample and the original sample. The embodiment of the present invention takes the first program in the form of static single assignment as the basis, constructs a black box attack algorithm by adding the screened second program containing vector parameters and reducing sample distance to the random walk algorithm, and realizes the automatic and efficient acquisition of the black box attack algorithm by judging the operation performance of the constructed black box attack algorithm.
[0023] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present invention and do not constitute a limitation on the technical solution of the present invention.
[0025] Figure 1 A flow chart of a method for determining a black box attack algorithm according to an embodiment of the present invention;
[0026] Figure 2 A structural block diagram of a device for determining a black box attack algorithm according to an embodiment of the present invention;
[0027] Figure 3 A flowchart of an example random search algorithm for the application of the present invention;
[0028] Figure 4 The figure is a processing flow chart of a random walk algorithm according to an example of the present invention. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the present invention more clear, the embodiments of the present invention will be described in detail with reference to the accompanying drawings. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other arbitrarily without conflict.
[0030] The steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions. Also, although a logical sequence is shown in the flowchart, in some cases, the steps shown or described can be performed in a sequence different from that shown here.
[0031] Figure 1 Flow chart of a method for determining a black box attack algorithm according to an embodiment of the present invention. Figure 1 As shown, including:
[0032] Step 101, randomly selecting one or more first programs in a static single assignment form;
[0033] It should be noted that the static single assignment form of the program in the embodiment of the present invention is a program well known to those skilled in the art and will not be described in detail here.
[0034] Step 102: adding a first preset value of basic operations of the Euclidean space to each first program to obtain one or more second programs corresponding to each first program;
[0035] Step 103, deleting the second program that does not use the preset vector parameter and the second program that does not reduce the sample distance from the obtained one or more second programs;
[0036] Step 104: when the number of the remaining second programs reaches a preset number, each of the remaining second programs is added to the random walk algorithm to obtain a black box attack algorithm corresponding to each second program;
[0037] In the random walk algorithm lacking a specific noise generating function, the embodiment of the present invention sets the generated second programs as the noise generating function in the random walk algorithm, thereby obtaining the black box attack algorithm corresponding to each second program.
[0038] Step 105: Select a black box attack algorithm that meets preset operation requirements from the obtained black box attack algorithms;
[0039] Among them, the sample distance includes: the distance between the adversarial sample and the original sample.
[0040] It should be noted that the sample distance in the embodiment of the present invention refers to inputting vector sample parameter data (including: adversarial samples, original samples and Gaussian noise) into the program to obtain the sample to be analyzed output after the program is executed; the distance from the adversarial sample to the original sample is the sample distance, and the reduction of the sample distance refers to the situation where the distance between the sample to be analyzed and the original sample is less than the sample distance.
[0041] In an exemplary embodiment, the original sample and the adversarial sample of the embodiment of the present invention include: a vector composed of red, green and blue (RGB) values of each pixel contained in the image.
[0042] The embodiment of the present invention randomly selects more than one first program in the form of static single assignment; adds a first preset value of basic operations of Euclidean space to each first program, and obtains more than one second program corresponding to each first program; deletes the second program that does not use the preset vector parameter and does not reduce the sample distance from the obtained more than one second program; when the number of the remaining second programs reaches the preset number, each of the remaining second programs is added to the random walk algorithm to obtain the black box attack algorithm corresponding to each second program; selects the black box attack algorithm that meets the preset operation requirements from the obtained black box attack algorithms; wherein the sample distance includes: the distance between the adversarial sample and the original sample. The embodiment of the present invention takes the first program in the form of static single assignment as the basis, constructs a black box attack algorithm by adding the screened second program containing vector parameters and reducing sample distance to the random walk algorithm, and realizes the automatic and efficient acquisition of the black box attack algorithm by judging the operation performance of the constructed black box attack algorithm.
[0043] In an exemplary embodiment, the basic operations of the Euclidean space in the embodiment of the present invention include:
[0044] The first and second basic operations;
[0045] Among them, the first category of basic operations includes: vector subtraction, vector binary norm and scalar division; the second category of basic operations includes one or any combination of the following: scalar addition, scalar subtraction, scalar multiplication, vector addition, vector scalar division, vector scalar multiplication and vector dot product, etc.
[0046] It should be noted that the basic operations of the Euclidean space in the embodiment of the present invention can be analyzed and adjusted by those skilled in the art through the performance of the black box attack algorithm determined based on the first program.
[0047] In an exemplary embodiment, step 101 of the embodiment of the present invention adds a first preset value of basic operations of the Euclidean space, including:
[0048] adding a first class of basic operations having configured vector parameters to the first program;
[0049] To the first program to which the first type of basic operations have been added, one basic operation from the Euclidean space is randomly selected for addition each time until the number of basic operations added to the first program reaches a first preset value.
[0050] In an exemplary embodiment, the first type of basic operations of the configured vector parameters in the embodiment of the present invention include:
[0051] Vector subtraction v = original sample parameters - adversarial sample parameters; vector subtraction is expressed as a function: SUB.VV (original sample parameters, adversarial sample parameters);
[0052] The vector takes the second norm d=||v||2; the vector takes the second norm and is expressed by the function: NORM.V(v);
[0053] Scalar division u=v / d; scalar division is expressed by the function: DIV.SS(v, d).
[0054] In the embodiment of the present invention, the original sample parameters and the adversarial sample parameters are configured as the operation parameters of vector subtraction; vector subtraction is represented as v, and v is configured as the operation parameter of vector two norm d; v and d are configured as the operation parameters of scalar division u, and u = v / d is obtained. Based on the above association, the first type of basic operation is processed by configuring vector parameters.
[0055] It should be noted that the original sample parameters, adversarial sample parameters and Gaussian noise parameters in the embodiment of the present invention refer to undetermined factors in the function to be assigned specific numerical values; the subsequent description includes the first original sample, the first adversarial sample and the first Gaussian noise and other original samples, adversarial samples and Gaussian noise as specific numerical values of the undetermined factors.
[0056] In an exemplary embodiment, the embodiment of the present invention randomly selects one of the basic operations in the Euclidean space for addition each time, including:
[0057] Each time, a basic operation is randomly selected from all basic operations in the Euclidean space;
[0058] The vector parameters of the randomly selected basic operation are determined according to the preset parameter selection strategy.
[0059] In an exemplary embodiment, the embodiment of the present invention determines the vector parameters of the randomly selected basic operation according to a preset parameter selection strategy, including:
[0060] When the randomly selected basic operation contains two vector parameters, the parameters of the randomly selected basic operation are selected in any of the following ways:
[0061] Randomly selecting two return values of the basic operations already in the first program as vector parameters with a first preset probability;
[0062] Randomly select one from the return values of the basic operations already in the first program as one of the two vector parameters and select one from the return values of the basic operations already in the first program that have not been used as one of the two vector parameters with a second preset probability;
[0063] Two unused return values of existing basic operations in the first program are selected as vector parameters with a third predetermined probability.
[0064] It should be noted that each basic operation added to the first program in the embodiment of the present invention will have one or two vector parameters and a return value. The type of the return value can be determined according to the specific operation, and the type of the return value can be a scalar or a vector. The parameters of the basic operation can be vectors or scalars. There are several basic operations in the first program, and each operation includes: an operation name, parameters, and a return value. If the return value of a first operation in the first program is a vector parameter of another first operation, then the return value of the former is called used, otherwise the return value of this basic operation is called a return value that has not been used.
[0065] In an exemplary embodiment, the first preset probability, the second preset probability and the third preset probability may be equal, for example, all take 1 / 3; in an exemplary embodiment, the first preset probability, the second preset probability and the third preset probability may be different;
[0066] In an exemplary embodiment, the embodiment of the present invention determines the vector parameters of the randomly selected basic operation according to a preset parameter selection strategy, including:
[0067] When the randomly selected basic operation contains a vector parameter, the parameter of the randomly selected basic operation is selected in any of the following ways:
[0068] Randomly select one from the return values of the basic operations already in the first program as a vector parameter with a fourth preset probability;
[0069] A vector parameter is selected from unused return values of existing basic operations in the first program with a fifth predetermined probability.
[0070] In an exemplary embodiment, the fourth preset probability and the fifth preset probability may be equal, for example, both are 1 / 2; in an exemplary embodiment, the fourth preset probability and the fifth preset probability may be different.
[0071] In an exemplary embodiment, step 102 of the embodiment of the present invention deletes the second program that does not use the preset vector parameter and the second program that does not reduce the sample distance, including:
[0072] A second procedure for determining vector parameters of unused noise generating functions by a static analysis method; and a second procedure for deleting the determined vector parameters of unused noise generating functions;
[0073] Determining by property testing the second procedure that does not reduce the sample distance; deleting the determined second procedure that does not reduce the sample distance;
[0074] Among them, the vector parameters of the noise generation function include: original sample parameters, adversarial sample parameters and Gaussian noise parameters.
[0075] It should be noted that the static analysis method and property test are existing algorithms in the relevant technology and will not be described in detail here. There is no order of precedence for the static analysis method and property test in the embodiment of the present invention, and those skilled in the art can adjust according to the efficiency of the execution process.
[0076] In an exemplary embodiment, the embodiment of the present invention determines the second procedures that do not reduce the sample distance through a property test, including for each second procedure:
[0077] Randomly select first vector parameter data of the second preset value group; the first vector parameter data includes: a first original sample with specific values of the original sample parameters, a first adversarial sample with specific values of the adversarial sample parameters, and a first Gaussian noise with specific values of the Gaussian noise parameters;
[0078] Input the selected first vector parameter data of the second preset value group into the second program, and obtain the second preset value first samples to be analyzed outputted after the second program is executed;
[0079] For each set of first vector parameter data, a first distance to be compared between the first sample to be analyzed and the first original sample, and a first sample distance between the first adversarial sample and the first original sample are calculated;
[0080] When the first distances to be compared of all groups are smaller than the corresponding first sample distances, it is determined that the second program reduces the sample distances; when more than one group of first distances to be compared are greater than or equal to the corresponding first sample distances, it is determined that the second program does not reduce the sample distances.
[0081] The first vector parameter data of the embodiment of the present invention may be randomly selected from pre-set vector parameter data, or may be randomly generated by a person skilled in the art based on an existing random generation function.
[0082] In an exemplary embodiment, the embodiment of the present invention selects a black box attack algorithm that meets a preset operation requirement from the obtained black box attack algorithms, including:
[0083] For the image classifier and the same second original sample, each black box attack algorithm is used to perform a first preset number of operations, and a second sample distance from the second adversarial sample obtained by each black box attack algorithm to the second original sample is calculated;
[0084] The black box attack algorithm with the smallest second sample distance is determined as the black box attack algorithm that meets the preset operation requirements.
[0085] In an exemplary embodiment, after selecting a black box attack algorithm that meets a preset operation requirement from the obtained black box attack algorithms, the method of the embodiment of the present invention further includes:
[0086] Determine all black-box attack algorithms that meet preset operation requirements obtained within a preset time length; use the determined black-box attack algorithm that meets the preset operation requirements to perform a second preset number of operations on the third preset value of the third original sample, calculate the mean of the third sample distances from all third adversarial samples obtained by the black-box attack algorithm that meets the preset operation requirements to the third original sample, and obtain the third sample distance mean;
[0087] The black box attack algorithm with the smallest third sample distance mean is determined as the final black box attack algorithm that meets the preset operation requirements.
[0088] In an exemplary embodiment, when the embodiment of the present invention uses a processor with medium or high computing power in the related art to perform the above processing, the preset time can be about 1 to 10 hours; the stronger the computing power of the processor, the longer the preset time. In an exemplary embodiment, within the preset time, the black box attack algorithm with the smallest second sample distance can reach a certain order of magnitude. Generally, this order of magnitude can be in the range of 1,000 to 100,000; the larger the order of magnitude, the longer the time required, and the final black box attack algorithm that meets the preset computing requirements is obtained, and the performance is also better.
[0089] In an exemplary instance, an embodiment of the present invention may only determine a black box attack algorithm with the smallest second sample distance; only determining a black box attack algorithm with the smallest second sample distance generally has no impact on the black box attack algorithm finally determined to meet the preset computing requirements.
[0090] In an exemplary embodiment, the method of the embodiment of the present invention further includes:
[0091] Through the random walk algorithm, adversarial samples of the noise generation function contained in the black box attack algorithm that meet the preset operation requirements are determined.
[0092] An embodiment of the present invention further provides a computer storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method for determining a black box attack algorithm is implemented.
[0093] The embodiment of the present invention further provides a terminal, comprising: a memory and a processor, wherein a computer program is stored in the memory; wherein:
[0094] The processor is configured to execute the computer program in the memory;
[0095] When the computer program is executed by a processor, the method for determining the black box attack algorithm as described above is implemented.
[0096] Figure 2 FIG. 1 is a structural block diagram of a device for determining a black box attack algorithm according to an embodiment of the present invention, such as Figure 2As shown, it includes: a selection unit, an addition unit, a deletion unit, a loading unit and a processing unit; wherein,
[0097] The selection unit is configured to randomly select one or more first programs in a static single assignment form; the adding unit is configured to respectively add a first preset value of basic operations of the Euclidean space to each first program to obtain one or more second programs corresponding to each first program;
[0098] The deleting unit is configured to: delete the second program that does not use the preset vector parameter and does not reduce the sample distance from the obtained more than one second program;
[0099] The loading unit is configured to: when the number of the remaining second programs reaches a preset number, each of the remaining second programs is added to the random walk algorithm to obtain a black box attack algorithm corresponding to each second program;
[0100] The processing unit is configured to: select a black box attack algorithm that meets a preset operation requirement from the obtained black box attack algorithms;
[0101] Among them, the sample distance includes: the distance between the adversarial sample and the original sample.
[0102] The embodiment of the present invention adds a first preset value of basic operations of the Euclidean space to each randomly selected first program in the form of static single assignment, and obtains a corresponding second program; deletes the second program that does not use the preset vector parameter and does not reduce the sample distance; when the number of remaining second programs reaches the preset number, the preset number of second programs are added to the random walk algorithm to obtain the black box attack algorithm corresponding to each second program; from the obtained black box attack algorithms, a black box attack algorithm that meets the preset operation requirements is selected; wherein the sample distance includes: the distance between the adversarial sample and the original sample. The embodiment of the present invention takes the first program in the form of static single assignment as the basis, and realizes the automatic and efficient acquisition of the black box attack algorithm.
[0103] In an exemplary embodiment, the basic operations of the Euclidean space in the embodiment of the present invention include:
[0104] The first and second basic operations;
[0105] Among them, the first category of basic operations includes: vector subtraction, vector binary norm and scalar division; the second category of basic operations includes one or any combination of the following: scalar addition, scalar subtraction, scalar multiplication, vector addition, vector scalar division, vector scalar multiplication and vector dot product, etc.
[0106] In an exemplary embodiment, the adding unit of the embodiment of the present invention is configured as:
[0107] adding a first class of basic operations having configured vector parameters to the first program;
[0108] To the first program to which the first type of basic operations have been added, one basic operation from the Euclidean space is randomly selected for addition each time until the number of basic operations added to the first program reaches a first preset value.
[0109] In an exemplary embodiment, the first type of basic operations of the configured vector parameters in the embodiment of the present invention include:
[0110] Vector subtraction v = original sample parameters - adversarial sample parameters; vector subtraction is expressed as a function: SUB.VV (original sample parameters, adversarial sample parameters);
[0111] The vector takes the second norm d=||v||2; the vector takes the second norm and is expressed by the function: NORM.V(v);
[0112] Scalar division u=v / d; scalar division is expressed by the function: DIV.SS(v, d).
[0113] In an exemplary embodiment, the adding unit of the embodiment of the present invention is configured to randomly select one from the basic operations of the Euclidean space for adding each time, including:
[0114] Each time, a basic operation is randomly selected from all basic operations in the Euclidean space;
[0115] The vector parameters of the randomly selected basic operation are determined according to the preset parameter selection strategy.
[0116] In an exemplary embodiment, the adding unit of the embodiment of the present invention is configured to determine the vector parameters of the randomly selected basic operation according to a preset parameter selection strategy, including:
[0117] When the randomly selected basic operation contains two vector parameters, the parameters of the randomly selected basic operation are selected in any of the following ways:
[0118] Randomly selecting two return values of the basic operations already in the first program as vector parameters with a first preset probability;
[0119] Randomly select one from the return values of the basic operations already in the first program as one of the two vector parameters and select one from the return values of the basic operations already in the first program that have not been used as one of the two vector parameters with a second preset probability;
[0120] Two unused return values of existing basic operations in the first program are selected as vector parameters with a third predetermined probability.
[0121] In an exemplary embodiment, the adding unit of the embodiment of the present invention is configured to determine the vector parameters of the randomly selected basic operation according to a preset parameter selection strategy, including:
[0122] When the randomly selected basic operation contains a vector parameter, the parameter of the randomly selected basic operation is selected in any of the following ways:
[0123] Randomly select one from the return values of the basic operations already in the first program as a vector parameter with a fourth preset probability;
[0124] A vector parameter is selected from unused return values of existing basic operations in the first program with a fifth predetermined probability.
[0125] In an exemplary embodiment, the deletion unit of the embodiment of the present invention includes a first deletion module and a second deletion module; wherein,
[0126] The first deletion module is configured to: determine the second program of the vector parameter of the unused noise generating function by a static analysis method; delete the determined second program of the vector parameter of the unused noise generating function;
[0127] The second deletion module is configured to: determine the second program that does not reduce the sample distance through the property test; delete the determined second program that does not reduce the sample distance;
[0128] Among them, the vector parameters of the noise generation function include: original sample parameters, adversarial sample parameters and Gaussian noise parameters.
[0129] In an exemplary embodiment, the second deletion module of the embodiment of the present invention is configured to, for each second program:
[0130] Randomly select first vector parameter data of the second preset value group; the first vector parameter data includes: a first original sample with specific values of the original sample parameters, a first adversarial sample with specific values of the adversarial sample parameters, and a first Gaussian noise with specific values of the Gaussian noise parameters;
[0131] Input the selected first vector parameter data of the second preset value group into the second program, and obtain the second preset value first samples to be analyzed outputted after the second program is executed;
[0132] For each set of first vector parameter data, a first distance to be compared between the first sample to be analyzed and the first original sample, and a first sample distance between the first adversarial sample and the first original sample are calculated;
[0133] When the first distances to be compared of all groups are smaller than the corresponding first sample distances, it is determined that the second program reduces the sample distances; when more than one group of first distances to be compared are greater than or equal to the corresponding first sample distances, it is determined that the second program does not reduce the sample distances.
[0134] In an exemplary embodiment, the processing unit of the embodiment of the present invention is configured as follows:
[0135] For the image classifier and the same second original sample, each black box attack algorithm is used to perform a first preset number of operations, and a second sample distance from the second adversarial sample obtained by each black box attack algorithm to the second original sample is calculated;
[0136] The black box attack algorithm with the smallest second sample distance is determined as the black box attack algorithm that meets the preset operation requirements.
[0137] In an exemplary embodiment, the processing unit of the embodiment of the present invention is further configured to:
[0138] Determine all black-box attack algorithms that meet preset operation requirements obtained within a preset time length; use the determined black-box attack algorithm that meets the preset operation requirements to perform a second preset number of operations on the third preset value of the third original sample, calculate the mean of the third sample distances from all third adversarial samples obtained by the black-box attack algorithm that meets the preset operation requirements to the third original sample, and obtain the third sample distance mean;
[0139] The black box attack algorithm with the smallest third sample distance mean is determined as the final black box attack algorithm that meets the preset operation requirements.
[0140] In an exemplary instance, if a process of determining a final black box attack algorithm that meets the preset computing requirements is performed for all black box attack algorithms that meet the preset computing requirements obtained within a preset time length, an embodiment of the present invention can select one or more black box attack algorithms with the smallest second sample distance from the black box attack algorithms constructed by a preset number of second programs as the black box attack algorithms that meet the preset computing requirements.
[0141] In an exemplary embodiment, the apparatus of the embodiment of the present invention further includes a unit for determining an adversarial sample, which is configured as follows:
[0142] Through the random walk algorithm, adversarial samples of the noise generation function contained in the black box attack algorithm that meet the preset operation requirements are determined.
[0143] The following briefly describes the embodiments of the present invention through application examples. The application examples are only used to illustrate the embodiments of the present invention and are not used to limit the protection scope of the present invention.
[0144] Application Examples
[0145] This application example defines more than four basic operations in Euclidean spaces based on a compiled language, and the basic operations include scalar operations and vector operations. In an exemplary instance, the basic operations in more than four Euclidean spaces of an embodiment of the present invention include: first-category basic operations and second-category basic operations; wherein, the first-category basic operations include: vector subtraction, vector two-norm, and scalar division; the second-category basic operations include one or any combination of the following: scalar addition, scalar subtraction, scalar multiplication, vector addition, vector scalar division, vector scalar multiplication, and vector dot product. The embodiment of the present invention may define the search space as: a set consisting of a first program in a static single assignment form (SSA) of a length of a first preset value of basic operations; wherein the first program in the static single assignment form accepts three vector parameters of the noise generation function: original sample parameters, adversarial sample parameters, and Gaussian noise parameters; the first preset value is determined based on the analysis of the operation effect and the operation efficiency, the first preset value is too small, which affects the effect of determining the black box attack algorithm, and the first preset value is too large, which affects the efficiency of searching and determining the black box attack algorithm; in an exemplary embodiment, the first preset value of the embodiment of the present invention may be a number within 10 to 50, such as 20;
[0146] The embodiment of the present invention determines the black box attack algorithm through a random search algorithm; wherein the random search algorithm of the embodiment of the present invention includes an algorithm of prior knowledge and pruning knowledge. Figure 3 The flowchart of the random search algorithm of the present invention is shown as follows: Figure 3 As shown, including:
[0147] Step 301, add a first type of basic operation to a first program in a static single assignment form randomly selected; the first type of basic operation includes: vector subtraction, vector two-norm and scalar division; the first type of basic operation is represented by the expression: v = SUB.VV (original sample parameters, adversarial sample parameters) = original sample parameters - adversarial sample parameters, d = NORM.V (v) = || v || 2 and u = DIV.SS (v, d) = v / d;
[0148] Step 302: randomly select one basic operation from the Euclidean space to add to the first program to which the first type of basic operations have been added, until the number of basic operations added to the first program reaches a first preset value;
[0149] The basic operation randomly added one by one in the embodiment of the present invention may be a basic operation of the first category or a basic operation of the second category;
[0150] Step 303: Delete the second program that does not use the preset vector parameter and the second program that does not reduce the sample distance.
[0151] The inventors of the present application analyzed and found that the second program containing vector parameters of the unused noise generation function contained a noise generation function which necessarily did not contain vector parameters, and the black box attack algorithm generated based on this program had poor performance.
[0152] In an illustrative example, the present application example determines through a property test that the second procedure of the sample distance is not reduced.
[0153] In an exemplary embodiment, the present application example deletes the second programs that do not reduce the sample distance through a property test, including for each second program:
[0154] Randomly select the first vector parameter data (x01, x1, n1) of the second preset value group; wherein x01 represents the first original sample in the first vector parameter data, x1 represents the first adversarial sample in the first vector parameter data, and n1 represents the first Gaussian noise in the first vector parameter data; the vector parameter data is the data corresponding to the vector parameter, that is, the original sample data corresponding to the original sample parameter, the adversarial sample data corresponding to the adversarial sample parameter, and the Gaussian noise data corresponding to the Gaussian noise parameter; the second preset value may be 10;
[0155] Input the selected first vector sample parameter data of the second preset value group into the second program, and obtain the second preset value first sample to be analyzed x1' output after the second program is executed;
[0156] The distance between each first sample to be analyzed x1' and the first original sample x01 is calculated. If the calculated distance is greater than the distance from the corresponding first adversarial sample x1 to the first original sample x01, it is determined that the program does not reduce the sample distance deletion program.
[0157] The application example of the present invention repeatedly executes steps 301 to 303, and counts the number of second programs remaining after deleting the second program. When the number of second programs reaches a preset number (e.g., 150), a program for constructing a black box attack algorithm is selected from the preset number of second programs.
[0158] In an exemplary instance, an embodiment of the present invention can use a preset number as a grouping basis to perform subsequent determination processing of the black box attack algorithm, that is, continuously execute the processing of steps 301 to 303 within a preset time period, and when the second program reaches the preset number, perform subsequent operations.
[0159] In an exemplary embodiment, this application example adds each of the remaining second programs to the random walk algorithm to obtain a black box attack algorithm corresponding to each second program, including:
[0160] Add the second program to the random walk algorithm respectively to obtain the corresponding black box attack algorithm;
[0161] For the image classifier and the same second original sample x02, perform a first preset number of steps of operation through each black-box attack algorithm obtained; calculate the second sample distance from the second adversarial sample x2 obtained by each black-box attack algorithm to the second original sample x02; determine one or more black-box attack algorithms with the smallest second sample distance; the first preset number of steps can be 100 steps.
[0162] This application example executes the above-mentioned processing for a preset time, completes several times the second program, and the number of cycles reaches a preset number, and each cycle obtains a set of one or more black-box attack algorithms with the smallest second sample distance. For all the determined one or more black-box attack algorithms with the smallest second sample distance, perform a second preset number of steps on the third preset number of sheets (for example, 10 sheets) of third original samples x03, calculate the mean of the third sample distances from all third adversarial samples x3 to the third original sample x03 obtained by the black-box attack algorithm, and obtain the third sample distance mean; the second preset number of steps can be 10,000 steps). In an exemplary embodiment, considering the computing performance, the third original samples can be original samples of different categories;
[0163] The black box attack algorithm with the smallest mean distance is determined as the black box attack algorithm that meets the preset operation requirements.
[0164] In an exemplary embodiment, the application example method also includes: determining the adversarial sample of the noise generating function included in the black-box attack algorithm through a random walk algorithm. The random walk algorithm for determining the adversarial sample includes an image classifier for evaluating the performance of the black-box attack algorithm composed of each noise generating function generate(x0, x, n). In order to distinguish and determine the image classifier mentioned in the black-box attack algorithm, the image classifier is subsequently determined as the second image classifier; in an exemplary embodiment, the running speed of the second image classifier of the embodiment of the present invention generally needs to meet certain computing requirements; for example, it needs to meet the classification of 60,000 images on the CIFAR-10 data set per second. According to processing efficiency and cost, this application example can run the second image classifier by adapting an applicable processor.
[0165] The random walk algorithm for determining the adversarial sample of the noise generation function included in the black-box attack algorithm in this application example receives two inputs: a fourth original sample x04 and an initialized fourth adversarial sample x4, where the fourth adversarial sample x4 is an initialized picture classified by the second image classifier as a type different from that of the fourth original sample x04; in an exemplary instance, the fourth adversarial sample x4 can be obtained by adding random standard multivariate Gaussian noise to the fourth original sample x04; the goal of the random walk algorithm in this application example is to generate a fourth adversarial sample x4 that is as far away from the fourth original sample x04 as possible; Figure 4 This is a processing flow chart of the random walk algorithm used in the present invention, as shown in FIG. Figure 4 As shown, including:
[0166] Step 401, obtaining an initialized fourth adversarial sample x4 through initialization processing;
[0167] Step 402 : Sample a random standard multivariate fourth Gaussian noise n4 . In an exemplary embodiment, the fourth Gaussian noise n4 of this application example can be obtained by sampling from a preset random standard multivariate Gaussian noise distribution function.
[0168] Step 403, generating a noise generating function generate(x04, x4, n4) according to the sampled fourth Gaussian noise n4;
[0169] Step 404, generating a fourth random walk image x4' to be analyzed by using the generated noise generation function generate(x04, x4, n4);
[0170] Step 405: Determine the classification of the fourth image to be analyzed x4' by the second image classifier, and determine whether the classification of the fourth image to be analyzed x4' is the same as that of the fourth adversarial sample x4;
[0171] In an exemplary embodiment, the category of the fourth image x4' to be analyzed in this application example can be determined by querying the second image classifier; when the fourth image x4' to be analyzed is determined to be misclassified, it means that the fourth image x4' to be analyzed and the fourth adversarial sample x4 belong to the same category and both belong to adversarial samples;
[0172] Step 406: when it is determined that the fourth image to be analyzed x4' and the fourth adversarial sample x4 are of the same classification, determine whether the distance from the fourth image to be analyzed x4' to the fourth original sample x04 is less than the distance from the fourth adversarial sample x4 to the fourth original sample x04;
[0173] Step 407: When it is determined that the distance between the fourth image to be analyzed x4' and the fourth original sample x04 is less than the distance between the fourth adversarial sample x4 and the fourth original sample x04, the fourth image to be analyzed x4' is updated to the fourth adversarial sample x4;
[0174] Step 408: According to whether the fourth image to be analyzed x4' is classified the same as the fourth adversarial sample x4, a step size parameter in the noise generation function generate(x04, x4, n4) is adjusted by a negative feedback regulator;
[0175] Step 409, determine whether the number of sampling of the fourth Gaussian noise n4 is less than the preset number threshold; when the number of sampling of the fourth Gaussian noise n4 is less than the preset number threshold, return to step 402 and continue to execute the processing of steps 402 to 408; when the number of sampling of the fourth Gaussian noise n4 is greater than or equal to the number threshold, execute step 410; in an exemplary instance, the number threshold can be set by a technician in this field based on experience, for example, 20,000 times.
[0176] Step 410: Use the fourth adversarial sample x4 updated last time as the adversarial sample x in generate(x04, x4, n4).
[0177] In the related art, the noise generation function generate(x0, x, n) in the random walk algorithm is artificially designed by technical experts. The application example of the present invention obtains generate(x0, x, n) based on automatic search, and updates the adversarial samples by sampling random standard multivariate Gaussian noise and updating the adversarial samples according to the distance between pictures. The noise generation function generate(x0, x, n) generated based on the updated adversarial samples can improve the computing performance of the black box attack algorithm.
[0178] “A person skilled in the art will appreciate that all or some of the steps, systems, and functional modules / units in the above disclosed methods may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a transient medium). As is known in the art, As is well known to those skilled in the art, the term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, as is well known to those skilled in the art, communication media typically contains computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media. "
Claims
1. A method for determining a black box attack algorithm, comprising: A first program of one or more static single assignment forms is randomly selected; Adding a first preset number of basic operations of the Euclidean space to each first program, respectively, to obtain one or more second programs corresponding to each first program; Deleting a second program that does not use a preset vector parameter and a second program that does not reduce a sample distance from the obtained one or more second programs; When the number of the remaining second programs reaches a preset number, each of the remaining second programs is added to the random walk algorithm to obtain a black box attack algorithm corresponding to each second program; Selecting a black box attack algorithm that meets preset operation requirements from the obtained black box attack algorithms; Among them, the sample distance includes: the distance between the adversarial sample and the original sample; the adding of the first preset value of basic operations in the Euclidean space includes: adding the first type of basic operations configured with the vector parameters to the first program; randomly selecting one from the basic operations of the Euclidean space to add to the first program to which the first type of basic operations have been added, until the number of the basic operations added to the first program is the first preset value; the deleting of the second program that does not use the preset vector parameters and the second program that does not reduce the sample distance includes: determining the second program that does not use the vector parameters of the noise generation function through a static analysis method; deleting the determined second program that does not use the vector parameters of the noise generation function; determining the second program that does not reduce the sample distance through a property test; deleting the determined second program that does not reduce the sample distance; the vector parameters of the noise generation function include: original sample parameters, adversarial sample parameters and Gaussian noise parameters.
2. The method according to claim 1, characterized in that The basic operations of the Euclidean space include: The first and second basic operations; The first type of basic operations include: vector subtraction, vector two-norm and scalar division; The second category of basic operations includes one or any combination of the following: scalar addition, scalar subtraction, scalar multiplication, vector addition, vector scalar division, vector scalar multiplication and vector dot product.
3. The method according to claim 1, characterized in that The first type of basic operations of the configured vector parameters include: Vector subtraction v==original sample parameters-adversarial sample parameters; The vector takes the binorm d=||v||2; Scalar division u=v / d.
4. The method according to claim 1, characterized in that Each time, one of the basic operations in the Euclidean space is randomly selected for addition, including: Each time, a basic operation is randomly selected from all the basic operations of the Euclidean space; The vector parameters of the randomly selected basic operations are determined according to a preset parameter selection strategy.
5. The method according to claim 4, characterized in that The step of determining the vector parameters of the randomly selected basic operation according to the preset parameter selection strategy includes: When the randomly selected basic operation includes two vector parameters, the parameters of the randomly selected basic operation are selected in any one of the following ways: Randomly selecting two of the return values of the basic operations already in the first program as the vector parameters with a first preset probability; randomly selecting one from the return values of the basic operations already in the first program as one of the two vector parameters and selecting one from the return values of the basic operations already in the first program that have not been used as one of the two vector parameters with a second preset probability; Two unused return values of the basic operations already in the first program are selected as the vector parameters with a third preset probability.
6. The method according to claim 4, characterized in that The step of determining the vector parameters of the randomly selected basic operation according to the preset parameter selection strategy includes: When the randomly selected basic operation includes a vector parameter, the parameter of the randomly selected basic operation is selected in any one of the following ways: randomly selecting one from the return values of the basic operations already in the first program as the vector parameter with a fourth preset probability; A selection is made with a fifth preset probability from unused return values of the basic operations already in the first program as the vector parameter.
7. The method according to any one of claims 1 to 6, characterized in that: The second process of determining that the sample distance is not reduced by the property test comprises for each of the second processes: Randomly select first vector parameter data of the second preset value group; the first vector parameter data includes: a first original sample with a specific value of the original sample parameter, a first adversarial sample with a specific value of the adversarial sample parameter, and a first Gaussian noise with a specific value of the Gaussian noise parameter; Input the selected first vector parameter data of the second preset value group into a second program, and obtain a second preset value number of first samples to be analyzed outputted after the second program is executed; For each set of the first vector parameter data, calculating a first distance to be compared between a first sample to be analyzed and a first original sample, and a first sample distance between a first adversarial sample and the first original sample; When the first distances to be compared of all groups are smaller than the corresponding first sample distances, it is determined that the second program reduces the sample distances; when more than one group of the first distances to be compared are greater than or equal to the corresponding first sample distances, it is determined that the second program does not reduce the sample distances.
8. The method according to any one of claims 1 to 6, characterized in that: The step of selecting a black box attack algorithm that meets preset operation requirements from the obtained black box attack algorithms includes: For the image classifier and the same second original sample, by performing a first preset number of operations by each of the obtained black-box attack algorithms, a second sample distance from a second adversarial sample obtained by the operation of each of the black-box attack algorithms to the second original sample is calculated; The black-box attack algorithm with the smallest second sample distance is determined as the black-box attack algorithm that meets the preset operation requirements.
9. The method according to any one of claims 1 to 6, characterized in that: After selecting a black box attack algorithm that meets the preset operation requirements from the obtained black box attack algorithms, the method further includes: Determine all the black-box attack algorithms that meet the preset operation requirements obtained within a preset time length; use the determined black-box attack algorithm that meets the preset operation requirements to perform a second preset number of steps on the third preset value sheet third original sample, calculate the mean of the third sample distances from all third adversarial samples obtained by the black-box attack algorithm that meets the preset operation requirements to the third original sample, and obtain the third sample distance mean; The black-box attack algorithm with the smallest third sample distance mean is determined as the final black-box attack algorithm that meets the preset operation requirements.
10. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: By means of a random walk algorithm, an adversarial sample of the noise generating function included in the black box attack algorithm that meets the preset operation requirements is determined.
11. A computer storage medium, wherein a computer program is stored in the computer storage medium, and when the computer program is executed by a processor, the method for determining a black-box attack algorithm according to any one of claims 1 to 10 is implemented.
12. A terminal, comprising: A memory and a processor, wherein the memory stores a computer program; wherein, The processor is configured to execute the computer program in the memory; When the computer program is executed by the processor, the method for determining a black-box attack algorithm according to any one of claims 1 to 10 is implemented.
13. A device for determining a black box attack algorithm, comprising: Select unit, add unit, delete unit, load unit and process unit; among them, The selection unit is configured to: randomly select one or more first programs in static single assignment form; The adding unit is configured to: add a first preset value of basic operations of the Euclidean space to each first program, respectively, to obtain one or more second programs corresponding to each first program; wherein, adding the first preset value of basic operations of the Euclidean space includes: adding a first type of basic operations with configured vector parameters to the first program; randomly selecting one from the basic operations of the Euclidean space to add to the first program to which the first type of basic operations have been added, each time until the number of basic operations added to the first program reaches the first preset value; The deleting unit is configured to: delete the second program that does not use the preset vector parameters and does not reduce the sample distance from the obtained one or more second programs; wherein, deleting the second program that does not use the preset vector parameters and does not reduce the sample distance includes: determining the second program that does not use the vector parameters of the noise generating function through a static analysis method; deleting the determined second program that does not use the vector parameters of the noise generating function; determining the second program that does not reduce the sample distance through a property test; deleting the determined second program that does not reduce the sample distance; the vector parameters of the noise generating function include: original sample parameters, adversarial sample parameters and Gaussian noise parameters; The loading unit is configured to: when the number of the remaining second programs reaches a preset number, each of the remaining second programs is added to the random walk algorithm to obtain a black box attack algorithm corresponding to each second program; The processing unit is configured to: select a black box attack algorithm that meets a preset operation requirement from the obtained black box attack algorithms; The sample distance includes: the distance between the adversarial sample and the original sample.
