Autonomous driving simulation test scene generation method, system, device and storage medium
By generating diverse autonomous driving test scenarios through the differential evolution algorithm and utilizing multi-elite individual guidance strategies and dynamic parameter adjustment, the problem of low quality of existing test scenario generation is solved, thereby improving test efficiency and safety.
Patent Information
- Application Number
- CN202510278999.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-03-11
AI Technical Summary
Existing methods for generating autonomous driving test scenarios are of low quality and have difficulty detecting potentially dangerous situations, mainly because traditional methods lack an effective exploration mechanism.
A test scenario generation method based on the differential evolution algorithm is adopted. With the multi-elite individual guidance strategy and the dynamically adjusted scaling factor F and the number of elite individuals m, diverse test scenarios are generated through mutation and crossover operations. The linear weighted fitness value evaluation of multiple traffic indicators is combined to record key data and analyze traffic accidents.
It improves testing efficiency, discovers potential safety hazards, generates high-quality test scenarios, and improves the safety and reliability of autonomous driving software.
Smart Images

Figure CN119808597B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of autonomous driving technology, and specifically relates to a method, system, device and storage medium for generating an autonomous driving simulation test scenario. Background Art
[0002] With the rapid development of autonomous driving technology, ensuring that autonomous vehicles can operate safely and reliably in various complex environments has become a critical issue in research and engineering practice. To fully evaluate the safety of autonomous driving systems, they must be subjected to extensive and in-depth testing.
[0003] High-quality test scenarios are crucial for discovering potential system issues because they increase the likelihood of finding defects in autonomous driving systems. However, existing testing methods often generate low-quality test scenarios. This is primarily due to the lack of effective exploration mechanisms used in traditional methods, which rely on predefined rules or random generation strategies, making it difficult to discover new and potentially dangerous situations. Summary of the Invention
[0004] In response to the above problems, the present invention provides a method, system, electronic device and storage medium for generating autonomous driving simulation test scenarios, aiming to improve test efficiency and the success rate of finding problem scenarios.
[0005] According to a first aspect of an embodiment of the present disclosure, a method for generating an autonomous driving simulation test scenario is provided. The method generates a test scenario based on a differential evolution algorithm, comprising the following steps:
[0006] Set the scaling factor F and mutation factor C of the differential evolution algorithm r and the maximum number of iterations G, the scaling factor F is used to control the step size of the mutation operation, and the mutation factor C r Used to control the probability of mutation operation;
[0007] Initialize the test scenario population, including setting the size N of the initial population and generating random test scenarios as the initial population;
[0008] Determine whether the current test iteration number g is greater than the maximum iteration number G. If it is greater, the iteration is terminated; if it is less, based on the scaling factor F and the variation factor C r and the maximum number of iterations G, adopt the multi-elite individual guidance strategy to perform test scenario mutation operation on the test scenario and generate the mutation scenario X n ;
[0009] Change scene X n Compared with the baseline scenario X g Cross-Generation Cross-Scene X u ;
[0010] Determine cross-scene Xu Is the fitness value of the benchmark scenario X g If the fitness value is greater than , the cross scene X is selected. u Add the next generation test scenario; otherwise select the baseline scenario X g Add the next generation test scenario, the benchmark scenario X g For the current test scenario, the fitness value is the linear weighted sum of multiple traffic indicators;
[0011] Import next-generation test scenarios into the simulator, allowing the autonomous driving software under test to execute the driving tasks set in the test scenarios and record key data;
[0012] Based on the recorded key data, analyze whether a traffic accident has occurred. If a traffic accident has occurred, add the test scenario to the dangerous scenario library; if no traffic accident has occurred, put the test scenario into the historical scenario library; add 1 to the test iteration number, and return to determine whether the current test iteration number g is greater than the maximum iteration number G.
[0013] In some embodiments, a multi-elite individual guidance strategy is used to perform a test scenario mutation operation on the test scenario, specifically including the following steps:
[0014] Calculate the relative improvement rate of the fitness value between the current test scenario and the previous generation test scenario. If the relative improvement rate does not exceed the threshold, select a scenario from the historical mutation scenario library as the mutation scenario X. n Otherwise, the leader individual is calculated based on multiple elite individuals, including the following steps:
[0015] Arrange the individuals in the current test scene population in descending order according to their fitness values, and select the top m individuals as elite individuals;
[0016] According to the fitness value of the elite individuals, the weighted average is calculated to obtain the leader individual X e ;
[0017] Generate a mutation scenario X based on the baseline scenario, the leader individual, and an individual randomly selected from the population n .
[0018] In some embodiments, a variant scenario X is generated. n The specific expression is: , X g is the base scene, F is the scaling factor, X e For the leadership individual; X r is another individual randomly selected from the population.
[0019] In some embodiments, the method further comprises dynamically adjusting the scaling factor F, ie, making the scaling factor F inversely proportional to the current iteration number according to the initial value and the final value of the scaling factor, the current iteration number and the maximum iteration number G.
[0020] In some embodiments, the method further includes dynamically adjusting the number m of elite individuals, that is, the initial value of the number m of elite individuals is half of the population number N, and gradually decreases as the current number of iterations increases.
[0021] In some embodiments, the mutated scene X n Compared with the baseline scenario X g Cross-Generation Cross-Scene X u , specifically including the following steps:
[0022] For each scenario, we traverse all parameters and transform the mutated scenario X into n Compared with the baseline scenario X g Cross-Generation X u , the selection criteria of parameters are:
[0023] Generate a random number in the interval [0, 1]. If the random number is less than the mutation factor C r , then the parameter selection mutation scenario X n Otherwise, select the benchmark scenario X g parameter.
[0024] In some embodiments, the fitness value f is calculated as:
[0025] f = w 1⋅( MaxDist − minDist )+ w 2⋅(− laneDeviationCount )+ w 3⋅(− trafficRuleViolationCount )
[0026] in, w 1, w 2, w 3 are the weights set for the minimum relative distance, the number of lane departures, and the number of traffic rule violations; MaxDist Indicates the preset maximum safe distance between the tested vehicle and the NPC vehicle. minDist Indicates the minimum relative distance between the tested vehicle and the NPC vehicle, laneDeviationCount Indicates the number of lane departures, trafficRuleViolationCount Indicates the number of traffic violations.
[0027] According to a second aspect of an embodiment of the present disclosure, a system for generating a simulation test scenario for autonomous driving is provided. The system generates a test scenario based on a differential evolution algorithm, comprising:
[0028] Mutation operation setting module, used to set the scaling factor F and mutation factor C of the differential evolution algorithm r and the maximum number of iterations G, the scaling factor F is used to control the step size of the mutation operation, and the mutation factor C r Used to control the probability of mutation operation;
[0029] The test scenario initialization module is used to initialize the test scenario population, including setting the size N of the initial population and generating random test scenarios as the initial population;
[0030] The test scenario mutation operation module is used to determine whether the current test iteration number g is greater than the maximum iteration number G. If it is greater, the iteration is terminated; if it is less, the test scenario is modified based on the scaling factor F and the mutation factor C. r and the maximum number of iterations G, adopt the multi-elite individual guidance strategy to perform test scenario mutation operation on the test scenario and generate the mutation scenario X n ;
[0031] Cross-scenario generation module, used to transform the mutated scenario X n Compared with the baseline scenario X g Cross-Generation Cross-Scene X u ;
[0032] Next generation test scenario selection module for judging cross-scenario X u Is the fitness value of the benchmark scenario X g If the fitness value is greater than , the cross scene X is selected. u Add the next generation test scenario; otherwise select the baseline scenario X g Add the next generation test scenario, the benchmark scenario X g For the current test scenario, the fitness value is the linear weighted sum of multiple traffic indicators;
[0033] The test module is used to import the next-generation test scenarios into the simulator. The autonomous driving software under test executes the driving tasks set in the test scenarios and records key data.
[0034] The accident judgment module is used to analyze whether a traffic accident has occurred based on the recorded key data. If a traffic accident has occurred, the test scenario will be added to the dangerous scenario library; if no traffic accident has occurred, the test scenario will be placed in the historical scenario library; the test iteration number is increased by 1, and a result is returned to determine whether the current test iteration number g is greater than the maximum iteration number G.
[0035] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned method for generating a simulation test scenario for autonomous driving when executing the program.
[0036] According to a fourth aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the steps of the above-mentioned method for generating an autonomous driving simulation test scenario are implemented.
[0037] The present disclosure provides a method, system, electronic device, and storage medium for generating autonomous driving simulation test scenarios, aiming to design an efficient algorithm that can automatically generate test scenarios for autonomous driving simulation tests. Specifically:
[0038] This paper designs a test scenario generation method based on the Differential Evolution Algorithm (DE). This method can automatically generate diverse traffic scenarios, improve testing efficiency, and discover potential safety hazards of autonomous driving software.
[0039] The algorithm uses a multi-elite individual guidance strategy to more efficiently explore the solution space. During the mutation operation, multiple elite individuals (i.e., individuals with high fitness) are introduced as guides. This strategy enables the algorithm to comprehensively consider the information of multiple excellent individuals in each generation, thereby improving the convergence speed.
[0040] The algorithm of the present invention can dynamically adjust the scaling factor F and the number parameter m of elite individuals according to the current state of the population at different stages;
[0041] The algorithm of the present invention will save historical variation scenarios. When it converges to a certain degree, it will reselect the variation direction based on the historical variation scenarios. By reselecting the variation direction, the algorithm can jump out of the local optimal solution and continue to explore areas that have not been fully explored, thereby improving the global search capability.
[0042] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention;
[0044] Figure 1 This is a flow chart of a method for generating an autonomous driving simulation test scenario according to an embodiment of the present invention;
[0045] Figure 2 This is a flow chart of the test scenario variation operation performed in an embodiment of the present invention;
[0046] Figure 3 2 is a schematic diagram of the structure of an autonomous driving simulation test scenario generation system according to an embodiment of the present invention;
[0047] Figure 4 It is a schematic diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The present invention will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are intended only to illustrate the present invention and are not intended to limit the present invention. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions relevant to the present invention, not all structures.
[0049] Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the steps as sequential processes, many of the steps can be implemented in parallel, concurrently, or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0050] The present invention provides the following embodiments for a method, system, electronic device, and storage medium for generating an autonomous driving simulation test scenario:
[0051] A test scenario generation method based on adaptive differential evolution algorithm and guided by multiple elite individuals. The flow chart of the autonomous driving simulation test scenario generation method based on differential evolution is as follows: Figure 1 As shown, the following steps are included:
[0052] Step 1: Set the scaling factor F, mutation factor Cr and maximum number of iterations G of the differential evolution algorithm. The scaling factor F is used to control the step size of the mutation operation, and the mutation factor C is used to control the maximum number of iterations G. r This is used to control the probability of the mutation operation. In the preferred embodiment, the mutation factor is initially set to 0.8. The maximum number of iterations G sets the maximum number of iterations of the algorithm to prevent infinite loops. In step 5, the algorithm dynamically adjusts the scaling factor F through an adaptive method, which is described in detail in step 5.
[0053] Step 2: Initialize the test scenario population, including setting the size N of the initial population and generating a random test scenario as the initial population;
[0054] In this step, it is necessary to define the representation of the scene, clarify which parameters are used to construct the scene, and then define their value ranges to ensure that the parameter symbols satisfy the physical meaning.
[0055] Based on the six-layer scenario description model, the embodiment selects parameters such as road type (city streets, highways, rural roads), traffic density (free-flowing, lightly congested, heavily congested), weather conditions (clear, rainy, foggy, snowy), time of day (daytime, dusk, nighttime), lighting conditions, surrounding environment (stationary obstacles, dynamic obstacles such as pedestrians and animals), and vehicle state (speed, acceleration, steering angle) to describe the scenario. Therefore, each test scenario is composed of several parameters that define the driving mission, road environment, weather conditions, and other factors for the tested vehicle and NPC vehicle.
[0056] Then, the size of the initial population is set to N, indicating that there are N test scenarios in the initial population. Then, N random test scenarios are generated as the initial population, and the parameters of each scenario are randomly initialized.
[0057] Step 3: Determine whether the current test iteration number g is greater than the maximum iteration number G. If it is greater, end the iteration; if it is less, then calculate the number of iterations based on the scaling factor F and the variation factor C. r and the maximum number of iterations G, adopt the multi-elite individual guidance strategy to perform test scenario mutation operation on the test scenario and generate the mutation scenario X n ;
[0058] Step 4: Test the scene variation operation, such as Figure 2 As shown, the specific steps include:
[0059] Step 41: Calculate the relative improvement rate. The relative change in fitness between the current generation and the previous generation is used to determine whether the algorithm is close to the optimal solution. Determine the relative improvement rate of fitness between the current test scenario and the previous generation test scenario. If the relative improvement rate does not exceed the threshold, select a scenario from the historical scenario library as the variant scenario X. n , otherwise the leader individual is calculated based on multiple elite individuals.
[0060] Specifically, the embodiment creates a data structure to store historical mutation scenarios and their fitness values. In each generation, the generated mutation scenarios and their fitness values are saved to the historical mutation scenario library. Before the mutation begins, the relative improvement rate r of the best fitness value of the scenario in this generation and the previous generation is calculated. If r is less than a threshold, a scenario is selected from the historical scenario library as X. n , otherwise the leader individual is calculated based on multiple elite individuals.
[0061] The calculation formula of relative improvement rate r is as follows: , where fc is the fitness value of the current generation, f p is the fitness value of the previous generation.
[0062] Step 42, calculating the leader individual based on multiple elite individuals, includes the following steps:
[0063] Arrange the individuals in the current test scene population in descending order according to their fitness values, and select the top m individuals as elite individuals;
[0064] According to the fitness value of the elite individuals, the weighted average is calculated to obtain the leader individual X e .
[0065] ,
[0066] Among them, X b is the individual with the highest fitness value among the first m individuals in the current population, X w It is the individual with the lowest fitness value among the first m individuals in the current population.
[0067] Step 43: Generate a variant scenario X based on the baseline scenario, the leader individual, and a random individual. n .
[0068] The specific formula is , where X g is the individual currently selected for mutation (i.e., the baseline scenario), which will be combined with the other two individuals to generate a new mutation scenario; X e It is a leader individual obtained by weighted averaging multiple high fitness individuals (i.e., elite individuals); X r It is another individual randomly selected from the population to increase the diversity of the mutation process and prevent the algorithm from falling into a local optimal solution.
[0069] Step 44: At different stages of mutation, the scaling factor F and the number of elite individuals m need to be dynamically adjusted.
[0070] The scaling factor F is dynamically adjusted, that is, according to the initial value and final value of the scaling factor, the current number of iterations and the maximum number of iterations G, the scaling factor F is inversely proportional to the current number of iterations.
[0071] Specifically, in the early stages of the algorithm, the goal is to enhance exploration capabilities and broaden the search space. Therefore, a larger scaling factor F is typically set to increase the duration of the variable step and select more elite individuals (a larger m) to provide diverse search directions. Later in the algorithm, the primary goal is to further refine the search and improve exploitation capabilities. At this point, the scaling factor F is further reduced to ensure that the search is concentrated in the most promising areas. Simultaneously, the value of m is reduced to allow the leading individual to focus more closely on the current optimal solution. The scaling factor F is calculated as follows: , where F start is the initial value of the scaling factor, F end is the final value of the scaling factor, g is the current iteration number, and G is the preset maximum iteration number.
[0072] The number of elite individuals m is dynamically adjusted, that is, the initial value of the number of elite individuals m is half of the population number N, and gradually decreases with the increase of the current number of iterations.
[0073] Specifically, the number of elite individuals m will gradually decrease with the number of test rounds. The initial value of the number of elite individuals m is set to half of the population N. As the number of test rounds g increases, the value of m will gradually decrease. The calculation formula is as follows: , where the round(k) function represents the maximum value of integers less than or equal to k.
[0074] Step 5: Mutate scene X n Compared with the baseline scenario X g Cross-Generation Cross-Scene X u ;
[0075] The specific steps include:
[0076] For each scenario, we traverse all parameters and transform the mutated scenario X into n Compared with the baseline scenario X g Cross-Generation X u , the selection criteria of parameters are:
[0077] Generate a random number in the interval [0, 1]. If the random number is less than the mutation factor Cr, the parameter selects the mutation scenario X. n Otherwise, select the benchmark scenario X g parameter.
[0078] In the specific implementation process, since each scene contains multiple parameters, each scene is actually equivalent to a multi-dimensional vector, and each dimension is a parameter. It is necessary to traverse all dimensions and transform the mutated scene X n Compared with the baseline scenario X g Cross-Generation X u For each dimension j (1≤j≤D), a new scene X is generated according to the following formula: u,j :
[0079] , where rand(0,1) means generating a random number in the interval [0, 1].
[0080] Step 6: Determine the cross scene X u The fitness value f(X u ) is smaller than the baseline scenario Xg The fitness value f(X g ), if it is greater than, select cross scene X u Add the next generation test scenario; otherwise select the baseline scenario X g Add the next generation test scenario, the benchmark scenario X g For the current test scenario;
[0081] Specifically, a linear function was designed to calculate the fitness value, which is used to assess the probability of a traffic accident in each test scenario. Specifically, a linear model was constructed based on multiple key indicators, including the minimum relative distance between two vehicles, the number of lane departures, and the number of traffic rule violations. By taking the weighted sum of these indicators, we were able to quantify the safety of each test scenario and, accordingly, assess its probability of a traffic accident.
[0082] The calculation formula of fitness value f is:
[0083] f = w 1⋅( MaxDist − minDist )+ w 2⋅(− laneDeviationCount )+ w 3⋅(− trafficRuleViolationCount )
[0084] in, w 1, w 2, w 3 are the weights set for the minimum relative distance, the number of lane departures, and the number of traffic rule violations; MaxDist Indicates the preset maximum safe distance between the tested vehicle and the NPC vehicle. minDist Indicates the minimum relative distance between the tested vehicle and the NPC vehicle, laneDeviationCount Indicates the number of lane departures, trafficRuleViolationCount Indicates the number of traffic violations.
[0085] Step 7: Import the next-generation test scenario into the simulator. The autonomous driving software under test executes the driving task set in the test scenario and records key data.
[0086] Specifically, the test scenario is imported into the simulator, and the autonomous driving software under test performs the driving tasks specified in the test scenario, while the NPC vehicle also performs the driving tasks specified in the test scenario. During the test, the behavior of the autonomous driving software under test and the NPC vehicle is monitored in real time, and key data such as vehicle trajectory, speed, acceleration, and collision events are recorded. This data will be used for subsequent analysis and evaluation.
[0087] Step 8: Based on the recorded key data, analyze whether a traffic accident has occurred. If a traffic accident has occurred, add the test scenario to the dangerous scenario library. If no traffic accident has occurred, add it to the historical scenario library. Increase the test iteration number by 1, and return to step 3 to determine whether the current test iteration number g is greater than the maximum iteration number G.
[0088] Another embodiment is used to illustrate an autonomous driving simulation test scenario generation system 300. The system 300 generates test scenarios based on a differential evolution algorithm, including:
[0089] The mutation operation setting module 310 is used to set the scaling factor F and mutation factor C of the differential evolution algorithm. r and the maximum number of iterations G, the scaling factor F is used to control the step size of the mutation operation, and the mutation factor C r Used to control the probability of mutation operation;
[0090] A test scenario initialization module 320 is used to initialize the test scenario population, including setting the size N of the initial population and generating a random test scenario as the initial population;
[0091] The test scenario variation operation module 330 is used to determine whether the current test iteration number g is greater than the maximum iteration number G. If it is greater, the iteration is terminated; if it is less, the test scenario variation operation module 330 is used to determine whether the current test iteration number g is greater than the maximum iteration number G. If ... r and the maximum number of iterations G, adopt the multi-elite individual guidance strategy to perform test scenario mutation operation on the test scenario and generate the mutation scenario X n ;
[0092] The cross-scenario generation module 340 is used to convert the variant scenario X n Compared with the baseline scenario X g Cross-Generation Cross-Scene X u ;
[0093] Next generation test scenario selection module 350, used to determine the cross scenario X u Is the fitness value of the benchmark scenario X g If the fitness value is greater than , the cross scene X is selected. u Add the next generation test scenario; otherwise select the baseline scenario X g Add the next generation test scenario, the benchmark scenario X g For the current test scenario, the fitness value is the linear weighted sum of multiple traffic indicators;
[0094] Testing module 360 is used to import the next generation test scenarios into the simulator, and the autonomous driving software under test executes the driving tasks set in the test scenarios and records key data;
[0095] The accident judgment module 370 is used to analyze whether a traffic accident has occurred based on the recorded key data. If a traffic accident has occurred, the test scenario will be added to the dangerous scenario library; if no traffic accident has occurred, the test scenario will be placed in the historical scenario library; the test iteration number is increased by 1, and it is returned to determine whether the current test iteration number g is greater than the maximum iteration number G.
[0096] The test scenario variation operation module 330 specifically includes the following steps:
[0097] Determine the relative improvement rate of the fitness value between the current test scenario and the previous generation test scenario. If the relative improvement rate does not exceed the threshold, select a scenario from the historical scenario library as the mutation scenario X. n Otherwise, the leader individual is calculated based on multiple elite individuals, including the following steps:
[0098] Arrange the individuals in the current test scene population in descending order according to their fitness values, and select the top m individuals as elite individuals;
[0099] According to the fitness value of the elite individuals, the weighted average is calculated to obtain the leader individual X e ;
[0100] Generate a variant scenario X based on the baseline scenario, the leader individual, and a random individual n .
[0101] In addition to the above modules, the system may also include other components. However, since these components are irrelevant to the content of the embodiments of the present disclosure, their illustration and description are omitted here.
[0102] The other specific working processes of the autonomous driving simulation test scenario generation system 300 refer to the description of the above-mentioned embodiment of the autonomous driving simulation test scenario generation method and will not be repeated here.
[0103] Another embodiment is used to illustrate that the system of the present invention can also be used with the help of Figure 4 The architecture of the computing device shown is implemented. Figure 4 The architecture of the computing device is shown in FIG. Figure 4 As shown, a computer system 410, a system bus 430, one or more CPUs 440, an input / output 420, a memory 450, etc. The memory 450 can store various data or files used for computer processing and / or communication, as well as program instructions executed by the CPU, including the method for generating a test scenario for an autonomous driving simulation according to an embodiment. Figure 4 The architecture shown is only exemplary and may be adjusted based on actual needs when implementing different devices. Figure 4One or more components in. The memory 450, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as the program instructions / modules corresponding to the autonomous driving simulation test scenario generation method in the embodiment of the present invention (for example, the variation operation setting module 310, the test scenario initialization module 320, the test scenario variation operation module 330, the cross-scenario generation module 340, the next-generation test scenario selection module 350, the test module 360 and the accident judgment module 370 in the autonomous driving simulation test scenario generation system 300). One or more CPUs 440 execute various functional applications and data processing of the system of the present invention by running the software programs, instructions and modules stored in the memory 450, that is, to implement the above-mentioned autonomous driving simulation test scenario generation method, which generates test scenarios based on the differential evolution algorithm and includes the following steps:
[0104] Set the scaling factor F and mutation factor C of the differential evolution algorithm r and the maximum number of iterations G, the scaling factor F is used to control the step size of the mutation operation, and the mutation factor C r Used to control the probability of mutation operation;
[0105] Initialize the test scenario population, including setting the size N of the initial population and generating random test scenarios as the initial population;
[0106] Determine whether the current test iteration number g is greater than the maximum iteration number G. If it is greater, the iteration is terminated; if it is less, based on the scaling factor F and the variation factor C r and the maximum number of iterations G, adopt the multi-elite individual guidance strategy to perform test scenario mutation operation on the test scenario and generate the mutation scenario X n ;
[0107] Change scene X n Compared with the baseline scenario X g Cross-Generation Cross-Scene X u ;
[0108] Determine cross-scene X u Is the fitness value of the benchmark scenario X g If the fitness value is greater than , the cross scene X is selected. u Add the next generation test scenario; otherwise select the baseline scenario X g Add the next generation test scenario, the benchmark scenario X g For the current test scenario, the fitness value is the linear weighted sum of multiple traffic indicators;
[0109] Import next-generation test scenarios into the simulator, allowing the autonomous driving software under test to execute the driving tasks set in the test scenarios and record key data;
[0110] Based on the recorded key data, analyze whether a traffic accident has occurred. If a traffic accident has occurred, add the test scenario to the dangerous scenario library; if no traffic accident has occurred, put the test scenario into the historical scenario library; add 1 to the test iteration number, and return to determine whether the current test iteration number g is greater than the maximum iteration number G.
[0111] Of course, the processor of the server provided in the embodiment of the present invention is not limited to executing the method operations described above, but can also execute related operations in the autonomous driving simulation test scenario generation method provided in any embodiment of the present invention.
[0112] The memory 450 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created based on the use of the terminal, etc. In addition, the memory 450 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 450 may further include a memory remotely located relative to one or more CPUs 440, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0113] The input / output 420 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The input / output 420 may also include a display device such as a display screen.
[0114] Embodiments of the present invention also provide a non-transitory computer-readable storage medium storing a computer program that, when executed by a processor, implements the autonomous driving simulation test scenario generation method described in the above embodiments. The computer-readable storage medium of the embodiments of the present invention may be any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0115] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0116] The program code contained on the storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0117] In addition, other specific working processes of a non-temporary computer-readable storage medium refer to the description of the above-mentioned embodiment of the autonomous driving simulation test scenario generation method and will not be repeated here.
[0118] In summary, the technical solutions provided by the above embodiments include a method, system, electronic device, and storage medium for generating a simulation test scenario for autonomous driving. The disclosed embodiments provide a method, system, electronic device, and storage medium for generating a simulation test scenario for autonomous driving. The method of the present invention is an active learning method based on a multi-centroid contrast autoencoder. It can effectively reduce the dimensionality of network traffic features based on the multi-centroid contrast autoencoder and filter samples that affect data distribution for fine-tuning, thereby improving the detection efficiency of the model. The backbone model of the multi-centroid contrast autoencoder is used to represent network traffic features, making full use of the statistical characteristics of traffic to obtain a more effective feature representation. In addition, the method of the present invention proposes an effective sample collection method that combines the nearest centroid ratio and uncertainty to directly filter out sample sets that affect distribution differences, which is conducive to further fine-tuning. Furthermore, the method of the present invention allows the distribution characteristics of network traffic to be continuously learned in a flexible manner using the multi-centroid contrast autoencoder, the nearest centroid ratio, and uncertainty sampling, without forgetting the learned distribution characteristics, thereby protecting the target network system from malicious attacks. In summary, the method of the present invention has excellent dimensionality reduction and representation capabilities for high-dimensional features, and has a continuous and efficient ability to distinguish between normal traffic and malicious traffic.
[0119] In this document, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a step or method that comprises a series of elements includes not only those elements, but also includes other elements not expressly listed, or also includes elements inherent to such step or method.
[0120] The above is a further detailed description of the present invention in conjunction with specific preferred embodiments, and the specific implementation of the present invention should not be considered to be limited to these descriptions. For those skilled in the art to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, and all of these should be considered to fall within the scope of protection of the present invention.
Claims
1. A method for generating an autonomous driving simulation test scenario, characterized in that: The method generates test scenarios based on a differential evolution algorithm and includes the following steps: Set the scaling factor F and mutation factor C of the differential evolution algorithm r and the maximum number of iterations G, the scaling factor F is used to control the step size of the mutation operation, and the mutation factor C r Used to control the probability of mutation operation; Initialize the test scenario population, including setting the size N of the initial population and generating random test scenarios as the initial population; Determine whether the current test iteration number g is greater than the maximum iteration number G. If it is greater, the iteration is terminated; if it is less, based on the scaling factor F and the variation factor C r and the maximum number of iterations G, adopt the multi-elite individual guidance strategy to perform test scenario mutation operation on the test scenario and generate the mutation scenario X n ; Change scene X n Compared with the baseline scenario X g Cross-Generation Cross-Scene X u ; Determine cross-scene X u Is the fitness value of the benchmark scenario X g If the fitness value is greater than , the cross scene X is selected. u Add the next generation test scenario; otherwise select the baseline scenario X g Add the next generation test scenario, the benchmark scenario X g For the current test scenario, the fitness value is the linear weighted sum of multiple traffic indicators; Import next-generation test scenarios into the simulator, allowing the autonomous driving software under test to execute the driving tasks set in the test scenarios and record key data; Based on the recorded key data, analyze whether a traffic accident has occurred. If a traffic accident has occurred, add the test scenario to the dangerous scenario library; if no traffic accident has occurred, add the test scenario to the historical scenario library; increase the test iteration number by 1, and return to determine whether the current test iteration number g is greater than the maximum iteration number G; The multi-elite individual guidance strategy is used to perform test scenario mutation operations on the test scenario, which specifically includes the following steps: Calculate the relative improvement rate of the fitness value between the current test scenario and the previous generation test scenario. If the relative improvement rate does not exceed the threshold, select a scenario from the historical mutation scenario library as the mutation scenario X. n Otherwise, the leader individual is calculated based on multiple elite individuals, including the following steps: Arrange the individuals in the current test scene population in descending order according to their fitness values, and select the top m individuals as elite individuals; According to the fitness value of the elite individuals, the weighted average is calculated to obtain the leader individual X e ; Generate a mutation scenario X based on the baseline scenario, the leader individual, and an individual randomly selected from the population n ; The specific expression for generating the mutation scenario Xn is: , X g is the base scene, F is the scaling factor, X e For the leadership individual; X r is another individual randomly selected from the population.
2. The method for generating an autonomous driving simulation test scenario according to claim 1, wherein: The method further comprises dynamically adjusting the scaling factor F, that is, according to the initial value and the final value of the scaling factor, the current number of iterations and the maximum number of iterations G, making the scaling factor F inversely proportional to the current number of iterations.
3. The method for generating an autonomous driving simulation test scenario according to claim 1, wherein: The method further includes dynamically adjusting the number m of elite individuals, that is, the initial value of the number m of elite individuals is half of the population number N, and gradually decreases as the current number of iterations increases.
4. The method for generating an autonomous driving simulation test scenario according to claim 1, wherein: Change scene X n Compared with the baseline scenario X g Cross-Generation Cross-Scene X u , specifically including the following steps: For each scenario, we traverse all parameters and transform the mutated scenario X into n Compared with the baseline scenario X g Cross-Generation X u , the selection criteria of parameters are: Generate a random number in the interval [0, 1]. If the random number is less than the mutation factor C r , then the parameter selection mutation scenario X n Otherwise, select the benchmark scenario X g parameter.
5. The method for generating an autonomous driving simulation test scenario according to claim 1, wherein: The calculation formula of fitness value f is: f = w 1⋅( MaxDist − minDist )+ w 2⋅(− laneDeviationCount )+ w 3⋅(− trafficRuleViolationCount ) in, w 1, w 2, w 3 are the weights set for the minimum relative distance, the number of lane departures, and the number of traffic rule violations; MaxDist Indicates the preset maximum safe distance between the tested vehicle and the NPC vehicle. minDist Indicates the minimum relative distance between the tested vehicle and the NPC vehicle, laneDeviationCount Indicates the number of lane departures, trafficRuleViolationCount Indicates the number of traffic violations.
6. An autonomous driving simulation test scenario generation system, characterized in that: The system generates test scenarios based on the differential evolution algorithm, including: Mutation operation setting module, used to set the scaling factor F and mutation factor C of the differential evolution algorithm r and the maximum number of iterations G, the scaling factor F is used to control the step size of the mutation operation, and the mutation factor C r Used to control the probability of mutation operation; The test scenario initialization module is used to initialize the test scenario population, including setting the size N of the initial population and generating random test scenarios as the initial population; The test scenario mutation operation module is used to determine whether the current test iteration number g is greater than the maximum iteration number G. If it is greater, the iteration is terminated; if it is less, the test scenario is modified based on the scaling factor F and the mutation factor C. r and the maximum number of iterations G, adopt the multi-elite individual guidance strategy to perform test scenario mutation operation on the test scenario and generate the mutation scenario X n ; Cross-scenario generation module, used to transform the mutated scenario X n Compared with the baseline scenario X g Cross-Generation Cross-Scene X u ; Next generation test scenario selection module for judging cross-scenario X u Is the fitness value of the benchmark scenario X g If the fitness value is greater than , the cross scene X is selected. u Add the next generation test scenario; otherwise select the baseline scenario X g Add the next generation test scenario, the benchmark scenario X g For the current test scenario, the fitness value is the linear weighted sum of multiple traffic indicators; The test module is used to import the next-generation test scenarios into the simulator. The autonomous driving software under test executes the driving tasks set in the test scenarios and records key data. The accident judgment module is used to analyze whether a traffic accident has occurred based on the recorded key data. If a traffic accident has occurred, the test scenario is added to the dangerous scenario library; if no traffic accident has occurred, the test scenario is placed in the historical scenario library; the test iteration number is increased by 1, and a return is returned to determine whether the current test iteration number g is greater than the maximum iteration number G; The multi-elite individual guidance strategy is used to perform test scenario mutation operations on the test scenario, which specifically includes the following steps: Calculate the relative improvement rate of the fitness value between the current test scenario and the previous generation test scenario. If the relative improvement rate does not exceed the threshold, select a scenario from the historical mutation scenario library as the mutation scenario X. n Otherwise, the leader individual is calculated based on multiple elite individuals, including the following steps: Arrange the individuals in the current test scene population in descending order according to their fitness values, and select the top m individuals as elite individuals; According to the fitness value of the elite individuals, the weighted average is calculated to obtain the leader individual X e ; Generate a mutation scenario X based on the baseline scenario, the leader individual, and an individual randomly selected from the population n ; The specific expression for generating the mutation scenario Xn is: , X g is the base scene, F is the scaling factor, X e For the leadership individual; X r is another individual randomly selected from the population.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the method for generating an autonomous driving simulation test scenario as described in any one of claims 1 to 5 are implemented.
8. A non-transitory computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instructions are executed by the processor, the steps of the method for generating an autonomous driving simulation test scenario as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Test case generation method, system and equipment based on genetic algorithm and medium
CN114185800A
Automatic driving scene test case generation method and device
CN117909249A