Neuron behavior mode guided deep neural network test case generation method

The deep neural network test case generation method guided by neuronal behavior patterns solves the problem that the existing technology is difficult to effectively explore the entire input space, improves the effectiveness of fuzz testing, and ensures the discovery of extreme boundary situations and potential false behaviors in other regions.

CN119988226APending Publication Date: 2025-05-13NANJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510085166.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-20
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

Existing deep neural network testing methods are difficult to effectively explore the entire input space, resulting in extreme boundary conditions and potential false behaviors in other regions being ignored.

Method used

Through the test case generation method guided by neuronal behavior patterns, intermediate test inputs are generated using seed input lists and random image changes, and appropriate test inputs are selected through perturbation degree judgment and Minhill distance judgment, increasing seed diversity and exploring a wider input space.

Benefits of technology

Improved the effectiveness of deep neural network coverage-guided fuzz testing, ensuring discovery of extreme boundary conditions and potential misbehavior behavior in other regions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988226A_ABST
    Figure CN119988226A_ABST
Patent Text Reader

Abstract

The invention provides a neuronal behavior mode guided deep neural network test case generation method. The method comprises the following steps: S1, obtaining a seed input list; s2, acquiring intermediate test input; S2.1, selecting one original seed input of the seed input list as the input of the tested deep neural network model, and returning an original classification label corresponding to the original seed input by the deep neural network model; s2.2, applying a random image change to the original seed input, so that the original seed input varies, and generating an intermediate test input; s3, disturbance degree judgment is carried out on the intermediate test input, and fuzzy testing is carried out on the intermediate test input meeting the limitation through operation of the deep neural network model; s4, performing classification label comparison and Minkowski distance judgment in sequence to detect whether an error behavior exists in the intermediate test input; according to the method, the Minkowski distance is utilized to select the diversity of the seeds, more error behaviors of the deep neural network model are detected, and the test effectiveness of the deep neural network is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of deep neural network, and in particular to a method for generating deep neural network test cases guided by neuron behavior patterns. Background Art

[0002] Deep learning systems are increasingly being used in safety-related fields, such as self-driving cars, medical diagnostic systems, and flight collision avoidance systems. In order to ensure that these systems do not lead to irreversible consequences in actual applications, it is particularly important to conduct deep testing to ensure the reliability of the system. However, there are significant differences between traditional software testing methods and deep learning systems, which makes the former's testing methods and evaluation indicators unable to be directly applied to deep learning systems. Therefore, how to effectively test deep learning systems has become a significant topic in current research.

[0003] Deep neural network testing is an important means to ensure the quality of deep learning systems and has received widespread attention from researchers in related fields. Existing research results can be mainly divided into three types: deep neural network test metrics, test input generation, and test prediction. Test metrics can be divided into two types: coverage and robustness. The former is mainly used to measure the adequacy of DNN system testing; the latter is mainly used to measure the adversarial sample detection ability of DNN models. Test input generation methods can also be generally divided into two categories: coverage-based test input generation and adversarial-based test input generation. Both methods are based on certain indicators to generate corresponding test samples that meet the rules; for example, the former generally requires maximizing some coverage indicators, while the latter requires generating input samples that can cause the model to produce incorrect prediction results, that is, adversarial samples. Test prediction usually refers to measuring whether the output results of deep neural network models under different input scenarios are consistent with the estimated results.

[0004] At present, some studies have proposed coverage-guided fuzz testing methods. A key step of this method is to iteratively select neurons and calculate their gradients, and then apply small perturbations to the seed input to maximize coverage and discover adversarial samples. The mutated seeds are highly similar to the original seeds, which limits the diversity of the explored input space. This method tends to explore the local area of ​​the seed input rather than the entire input space, which may cause some extreme boundary cases to go undetected. At the same time, potential erroneous behaviors in other areas of the input space may be ignored. Summary of the invention

[0005] In view of the deficiencies in the prior art, the present invention provides a method for generating deep neural network test cases guided by neuron behavior patterns, which solves the problems mentioned in the background technology.

[0006] To achieve the above objectives, the present invention is implemented through the following technical solutions:

[0007] A method for generating deep neural network test cases guided by neuron behavior patterns, the method comprising the following steps:

[0008] S1. Get the seed input list:

[0009] Select a certain number of seed inputs from the test data to form a seed input list;

[0010] S2. Get intermediate test input:

[0011] S2.1. Select an original seed input from the seed input list as the input of the deep neural network model under test, and the deep neural network model returns the original classification label corresponding to the original seed input;

[0012] S2.2, applying random image changes to the original seed input to mutate the original seed input and generate an intermediate test input;

[0013] S3, determine the disturbance degree of the intermediate test input, remove the intermediate test input whose disturbance degree does not meet the limit, and run the deep neural network model to perform fuzzy testing on the intermediate test input that meets the limit;

[0014] S4. Perform classification label comparison and Minkowski distance judgment in sequence to detect whether there is any erroneous behavior in the intermediate test input.

[0015] Furthermore, the step of selecting a certain number of seed inputs from the test data to form a seed input list specifically includes:

[0016] S1.1. Randomly select a certain number of test data that can be correctly recognized by the deep neural network model from all test data;

[0017] S1.2. Test data with a long retention time are preferentially selected as original seed inputs. Multiple original seed inputs form a seed input list.

[0018] Furthermore, the random image changes include image contrast, image brightness, image blur, image noise, image translation, image scaling, image shearing and image rotation.

[0019] Furthermore, the limit of the disturbance degree is determined by the L2 norm.

[0020] Furthermore, the classification label comparison is specifically as follows:

[0021] The intermediate test input is used as the input of the deep neural network model, and the deep neural network model returns the test classification label corresponding to the intermediate test input;

[0022] Compare the test classification labels with the original classification labels to determine whether erroneous behavior occurs in the deep neural network model:

[0023] If yes, the label comparison is inconsistent, there is an erroneous behavior in the deep neural network model, and an adversarial sample is obtained;

[0024] No, the labels are consistent and there is no erroneous behavior in the deep neural network model.

[0025] Proceed to the next step of Min's distance judgment.

[0026] Furthermore, the Minkowski distance is specifically determined as follows:

[0027] Calculate the Minkowski distance between the intermediate test input and the seed input in the seed queue that is the nearest neighbor of the intermediate test input, and determine whether the Minkowski distance value is greater than the set threshold:

[0028] If yes, the Minkowski distance is greater than the set threshold, the intermediate test input is added to the seed input list, and the deep neural network model continues to be fuzzy tested;

[0029] If not, the Minkowski distance is not greater than the set threshold, and the deep neural network model fuzzy test ends.

[0030] A device for generating deep neural network test cases guided by neuron behavior patterns, comprising a processor and a memory; the memory is used to store programs; the processor executes the program to implement any of the methods described above.

[0031] A computer-readable storage medium stores a program, wherein the program is executed by a processor to implement any of the methods described above.

[0032] The present invention provides a method for generating deep neural network test cases guided by neuron behavior patterns. Compared with the prior art, it has the following beneficial effects:

[0033] The present invention generates deep neural network test cases based on the guidance of neuron behavior patterns, selects mutated seeds by the distance between them, thereby increasing seed diversity, exploring a wider input space, and improving the effectiveness of fuzzy testing guided by deep neural network coverage. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0035] Figure 1 A schematic diagram of the working steps of the method for generating deep neural network test cases guided by neuron behavior patterns of the present invention is shown. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0037] In order to solve the technical problems in the background technology, the following deep neural network test case generation method guided by neuron behavior pattern is given:

[0038] Combination Figure 1 As shown, the method for generating deep neural network test cases guided by neuron behavior patterns provided by the present invention comprises the following steps:

[0039] S1. Get the seed input list:

[0040] Select a certain number of seed inputs from the test data to form a seed input list;

[0041] S1.1. Randomly select a certain number of test data that can be correctly identified by the deep neural network model from all the test data; in the above process, the random selection method can adopt a uniform random sampling strategy or implement sampling operations based on probability distribution to ensure that the selected test data is both random and highly representative. The probability distribution involved here is constructed by comprehensively considering the characteristic distribution of the test data itself, as well as the sensitivity of the deep neural network model to different features and other factors.

[0042] S1.2. Give priority to test data with a long retention time as the original seed input, and multiple original seed inputs form a seed input list. In the above process, according to the order of the length of time the data is added to the seed queue, the test data that has been retained in the queue for a long time is preferentially selected, and it is established as the seed input required for fuzzy testing, and a seed input list is formed accordingly. This type of seed input has the unique potential to activate different areas of the neural network. The root of this is the in-depth exploration of the complex structure of the neural network and the response characteristics of neurons, which covers rich and diverse feature information, and can provide a diverse starting base for a series of subsequent test processes;

[0043] S2. Get intermediate test input:

[0044] S2.1. Select an original seed input from the seed input list as the input of the deep neural network model under test. The deep neural network model returns the original classification label corresponding to the original seed input. This classification label accurately reflects the model's preliminary judgment conclusion on the seed input based on the existing training knowledge system.

[0045] S2.2, apply random image changes to the original seed input to mutate the original seed input and generate intermediate test inputs; random image changes include image contrast, image brightness, image blur, image noise, image translation, image scaling, image shearing and image rotation. In this process, the parameter setting range involved in each transformation operation is closely determined based on the task type undertaken by the deep neural network model and the common image change range in actual application scenarios.

[0046] S3. Determine the disturbance degree of the intermediate test input, remove the intermediate test input whose disturbance degree does not meet the limit, and run the deep neural network model to perform fuzzy testing on the intermediate test input that meets the limit; in this process, accurately calculate the disturbance degree of the newly generated intermediate test input. Once the disturbance degree meets the preset limit conditions, add this intermediate test input to the seed input list to carry out further mutation operations and continue to advance the fuzzy testing process of the deep neural network model;

[0047] S4. Perform classification label comparison and Minkowski distance judgment in sequence to detect whether there is any erroneous behavior in the intermediate test input.

[0048] In this embodiment, the limit of the disturbance degree is determined by the L2 norm.

[0049] The degree of perturbation ensures that the newly generated intermediate seed is a legitimate test input, and the difference between it and the corresponding original seed input must be imperceptible to humans. Therefore, the L2 norm is used to ensure that the difference between the added perturbation and the original sample remains within a certain range. The L2 norm is the square root of the sum of the squares of each element. The smaller the L2 norm, the more difficult it is for humans to detect the adversarial sample. The definition of the L2 norm is:

[0050]

[0051] In this embodiment, the classification label comparison is specifically as follows: the intermediate test input is used as the input of the deep neural network model, and the deep neural network model returns the test classification label corresponding to the intermediate test input; the test classification label is compared with the original classification label to determine whether an erroneous behavior occurs in the deep neural network model: if yes, the label comparison is inconsistent, there is an erroneous behavior in the deep neural network model, and an adversarial sample is obtained; if not, the label comparison is consistent, there is no erroneous behavior in the deep neural network model, and the next step of Minkowski distance judgment is performed. The adversarial samples mentioned above refer specifically to those special samples that can induce the deep neural network model to produce classification conclusions that are contrary to the expected results, and they play a pivotal role in the process of discovering vulnerabilities and weaknesses in the deep neural network model.

[0052] The Minkowski distance judgment is specifically as follows: calculate the Minkowski distance between the intermediate test input and the seed input that is the nearest neighbor of the intermediate test input in the seed queue, and determine whether the Minkowski distance value is greater than the set threshold: if yes, the Minkowski distance is greater than the set threshold, add the intermediate test input to the seed input list, and continue to perform fuzzy testing on the deep neural network model; if no, the Minkowski distance is not greater than the set threshold, and the fuzzy testing of the deep neural network model ends. The definition of Minkowski distance is as follows:

[0053]

[0054] Where X=(x1,x2,x3,...,x n ), Y=(y1,y2,y3,...,y n ).

[0055] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function; whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this article;

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

[0057] In the several embodiments provided herein, it should be understood that the disclosed systems, devices and methods can be implemented in other ways; for example, the device embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed; in addition, the mutual coupling or direct coupling or communication connection shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, or can be electrical, mechanical or other forms of connection;

[0058] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of this article;

[0059] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit; the above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units;

[0060] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium; based on such an understanding, the technical solution of this article is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of this article; and the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes;

[0061] Specific embodiments are used in this article to illustrate the principles and implementation methods of this article. The description of the above embodiments is only used to help understand the methods and core ideas of this article. At the same time, for general technicians in this field, according to the ideas of this article, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on this article.

Claims

1. A method for generating deep neural network test cases guided by neuron behavior patterns, characterized in that: The generation method includes the following steps: S1. Get the seed input list: Select a certain number of seed inputs from the test data to form a seed input list; S2. Get intermediate test input: S2.

1. Select an original seed input from the seed input list as the input of the deep neural network model under test, and the deep neural network model returns the original classification label corresponding to the original seed input; S2.2, applying random image changes to the original seed input to mutate the original seed input and generate an intermediate test input; S3, determine the disturbance degree of the intermediate test input, remove the intermediate test input whose disturbance degree does not meet the limit, and run the deep neural network model to perform fuzzy testing on the intermediate test input that meets the limit; S4. Perform classification label comparison and Minkowski distance judgment in sequence to detect whether there is any erroneous behavior in the intermediate test input.

2. The method for generating deep neural network test cases guided by neuron behavior patterns according to claim 1, characterized in that: The step of selecting a certain number of seed inputs from the test data to form a seed input list specifically includes: S1.

1. Randomly select a certain number of test data that can be correctly recognized by the deep neural network model from all test data; S1.

2. Test data with a long retention time are preferentially selected as original seed inputs. Multiple original seed inputs form a seed input list.

3. The method for generating deep neural network test cases guided by neuron behavior patterns according to claim 1, characterized in that: The random image changes include image contrast, image brightness, image blur, image noise, image translation, image scaling, image shearing and image rotation.

4. The method for generating deep neural network test cases guided by neuron behavior patterns according to claim 1, characterized in that: The limit of the perturbation degree is determined by the L2 norm.

5. The method for generating deep neural network test cases guided by neuron behavior patterns according to claim 1, characterized in that: The classification label comparison is specifically as follows: The intermediate test input is used as the input of the deep neural network model, and the deep neural network model returns the test classification label corresponding to the intermediate test input; Compare the test classification labels with the original classification labels to determine whether erroneous behavior occurs in the deep neural network model: If yes, the label comparison is inconsistent, there is an erroneous behavior in the deep neural network model, and an adversarial sample is obtained; If not, the label comparison is consistent, there is no erroneous behavior in the deep neural network model, and the next step is to determine the Minkowski distance.

6. The method for generating deep neural network test cases guided by neuron behavior patterns according to claim 5, characterized in that: The Minkowski distance is specifically determined as follows: Calculate the Minkowski distance between the intermediate test input and the seed input in the seed queue that is the nearest neighbor of the intermediate test input, and determine whether the Minkowski distance value is greater than the set threshold: If yes, the Minkowski distance is greater than the set threshold, the intermediate test input is added to the seed input list, and the deep neural network model continues to be fuzzy tested; If not, the Minkowski distance is not greater than the set threshold, and the deep neural network model fuzzy test ends.

7. A device for generating deep neural network test cases guided by neuron behavior patterns, characterized in that: It comprises a processor and a memory; the memory is used to store a program; the processor executes the program to implement the method as described in any one of claims 1-6.

8. A computer-readable storage medium, characterized in that: The storage medium stores a program, and the program is executed by a processor to implement the method according to any one of claims 1 to 6.