An automatic driving simulation dangerous scene construction method based on accident parameter generalization
By constructing causal graphs and constraint graphs of accident parameters, training conditional variational autoencoders and performing differentiated sampling, the problems of continuity and physical rationality of hazardous attributes in autonomous driving simulation scenarios are solved, and efficient generation and coverage of hazardous scenarios are achieved.
Patent Information
- Application Number
- CN202611623967.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-20
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies cannot effectively maintain the continuity and physical rationality of hazardous attributes in the construction of autonomous driving simulation scenarios, and fail to take into account the causal relationship and nonlinear coupling relationship of parameters, resulting in insufficient hazardous level and difficulty in guaranteeing physical rationality of the generated scenario.
By constructing a causal graph and constraint graph of accident parameters, an algorithm for mapping causal constraints to feasible regions of the latent space is designed. A conditional variational autoencoder is trained, and the latent space is divided into core parameter subspaces and auxiliary parameter subspaces. The algorithm is trained using orthogonal decoupling loss, inter-layer consistency loss, and hierarchical regularization loss. Differential sampling and hazard assessment constraints are then applied to generate hazardous scenarios.
It improves the causal logic consistency and physical rationality of autonomous driving simulation scenarios, maintains the stability of core hazard characteristics, and enhances the diversity and coverage of scenarios, thereby improving the effectiveness and efficiency of simulation verification.
Smart Images

Figure CN123179933A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of autonomous driving, specifically relating to a method for constructing dangerous scenarios for autonomous driving simulation based on accident parameter generalization. Background Technology
[0002] Autonomous driving safety verification relies on the coverage of hazardous scenarios. To improve verification efficiency with limited resources, extracting parameters from real accident data and generalizing them has become an important approach to generating diverse simulation scenarios. The core issue in constructing hazardous scenarios is how to maintain hazardous attributes while balancing physical plausibility and distribution diversity during generalization.
[0003] In the prior art, Chinese patent application CN115563020A discloses a method and system for generating dangerous test scenarios, electronic devices, and storage media; it acquires a set of natural driving scenarios, performs hazard element analysis on the natural driving scenarios, represents the natural driving scenarios as the state and execution actions of hazard elements, quantifies the exposure, severity, and controllability of each action performed in each state to construct a hazard matrix, and filters out actions with a hazard level greater than the target hazard level from the hazard matrix to generate dangerous test scenarios.
[0004] However, the aforementioned prior art has the following shortcomings.
[0005] First, the risk level constraint acts on the discrete action space. By filtering discrete actions with a risk level greater than the target risk level, the scenario is generated. However, the causal relationship and nonlinear coupling relationship between accident parameters are not transformed into executable constraints in the continuous latent space. Therefore, it is impossible to perform differentiable constraints on the risk attributes during the continuous parameter generation process. This results in the generated scenario being easy to distribute reasonably but with insufficient risk level, and the physical rationality is difficult to guarantee.
[0006] Second, existing methods do not distinguish between core hazard parameters and auxiliary parameters in the latent space, nor do they differentiate sampling control. They usually apply a uniform generalization strength to all parameters, which makes it easy for core hazard features to be lost due to excessive perturbation during the generalization process. The diversity of auxiliary parameters is also limited, making it difficult to balance the preservation of hazard attributes and scene coverage.
[0007] Therefore, how to integrate causality, coupling, and hazard constraints into the generation of continuous parameters, and how to generalize the differences between core and auxiliary parameters in order to improve coverage while maintaining hazard attributes, has become an urgent technical problem to be solved. Summary of the Invention
[0008] The purpose of this invention is to provide a method for constructing dangerous scenarios in autonomous driving simulation based on accident parameter generalization, which can effectively solve the problems mentioned in the background art.
[0009] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0010] A method for constructing hazardous scenarios in autonomous driving simulation based on accident parameter generalization includes: inputting an accident parameter vector and generating a generalized parameter combination;
[0011] Construct a causal graph and constraint graph for accident parameters, divide parameter nodes into environmental, behavioral and consequence layers, establish directed causal edges through a structural causal model framework, calculate partial correlation coefficients and conditional mutual information for parameter pairs to quantify coupling degree, and superimpose physical constraints, boundary constraints and causal constraints to form a constraint graph.
[0012] Design an algorithm to map causal constraints to the feasible region of the latent space. Normalize the causal influence degree and map it to the latent space dimension weight. Adjust the sampling variance according to the latent space dimension weight and the causal constraint strength coefficient. Construct elliptic inequality constraints for nonlinearly coupled parameter pairs. Project the latent space sampling points that do not satisfy the elliptic inequality constraints to the constraint boundary along the ellipse normal direction.
[0013] The conditional variational autoencoder is trained by dividing the latent space into a core parameter subspace and an auxiliary parameter subspace, and is trained by orthogonal decoupling loss, inter-layer consistency loss and hierarchical regularization loss.
[0014] Constrained sampling is performed in the latent space, and differential sampling variance is used for the core parameter subspace and the auxiliary parameter subspace;
[0015] The generated parameters are projected into the implicit space using risk assessment constraints.
[0016] The generalized parameter combination is input into the simulation engine to generate hazardous scenarios and perform closed-loop feedback optimization.
[0017] In summary, this application includes at least one of the following beneficial technical effects:
[0018] 1. This invention unifies the causal relationships, nonlinear coupling relationships, physical boundaries and causal boundaries between accident parameters into dimensional weights, sampling variances and elliptical feasible regions in the latent space, and uses projection to bring outbound sampling points back to the constraint boundaries, thereby executing causal and physical constraints in the continuous parameter generation process, improving the causal logic consistency and physical rationality of the generated dangerous scenarios.
[0019] 2. This invention divides the latent space into a core parameter subspace and an auxiliary parameter subspace through a conditional variational autoencoder, and combines orthogonal decoupling loss, inter-layer consistency loss and hierarchical regularization loss for training. During sampling, differential variance is used for the core hazard parameters and auxiliary parameters to keep the core hazard features such as collision time, relative speed and collision angle stable, while allowing auxiliary parameters such as vehicle type and color to be fully generalized, taking into account both the preservation of hazard attributes and the diversity of scenarios.
[0020] 3. This invention performs gradient projection of generated parameters in the latent space through hazard assessment constraints, and uses the collision detection results and distribution rationality index of the simulation engine for closed-loop feedback optimization, so that the sampling distribution gradually approaches the high-hazard and high-rationality region, thereby improving the coverage, effectiveness and construction efficiency of hazardous scenarios. Attached Figure Description
[0021] Figure 1 A schematic diagram of the overall technical architecture of a method for constructing hazardous scenarios in autonomous driving simulation based on accident parameter generalization;
[0022] Figure 2 A schematic diagram illustrating the core principle framework for generating hazardous scenario parameters based on accident parameter generalization;
[0023] Figure 3 A logical flowchart for the traffic accident data collection and preprocessing stage;
[0024] Figure 4 A schematic diagram of the multi-level interaction relationships and data flow for parameter generalization and multi-dimensional configuration in hazardous scenarios;
[0025] Figure 5 A framework diagram of the interactive testing process between an autonomous driving simulation platform and hazardous scenarios;
[0026] Figure 6 This diagram illustrates a comparison between existing technologies and those used in terms of coverage of hazardous scenarios and efficiency of simulation testing. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of this invention clearer, the following description is provided in conjunction with the appendix. Figure 1 To be continued Figure 6 The present invention will be further described in detail below with reference to specific embodiments.
[0028] This invention provides a method for constructing hazardous scenarios in autonomous driving simulation based on accident parameter generalization, comprising the following core steps: Step S1: Constructing a causal graph and constraint graph of accident parameters; Step S2: Designing a mapping algorithm from causal constraints to the feasible region of the latent space; Step S3: Training a conditional variational autoencoder; Step S4: Performing constrained sampling in the latent space; Step S5: Projecting the generated parameters into the latent space using hazard assessment constraints; Step S6: Inputting the generalized parameter combination into the simulation engine to generate a hazardous scenario and performing closed-loop feedback optimization. The specific implementation methods of each step are described in detail below.
[0029] First, step S1 in this embodiment is described, which mainly involves constructing a causal graph and constraint graph for accident parameters. The accident parameter system is first transformed into a graph representation containing hierarchical structure, causal direction, coupling strength, and constraint boundaries. This provides a basis for subsequent mapping of causal constraints to the feasible region of the latent space, training of conditional variational autoencoders, and constrained sampling. The execution process unfolds according to parameter node definition and layering, causal edge construction, coupling quantification, and constraint graph construction. The specific implementation flow is as follows.
[0030] Step S101: Parameter node definition and layering. The accident parameter system is divided into three layers: environment layer, behavior layer, and consequence layer. The environment layer parameter nodes include weather type, light intensity, road surface friction coefficient μ, road type, and road curvature κ. Weather type is a discrete parameter, with values for sunny, rainy, and foggy days; light intensity is a continuous parameter, ranging from 0 lx to 100,000 lx; road surface friction coefficient μ is a continuous parameter, ranging from 0.1 to 1.0; road type is a discrete parameter, with values for straight road, curve, and intersection; and road curvature κ is a continuous parameter, with units of 1 / m.
[0031] Behavioral layer parameter nodes include vehicle speed Target vehicle speed Relative velocity Relative distance Collision time Vehicle deceleration Steering angle Location of the collision point Collision angle Relative velocity ,unit Relative distance unit Collision time Unit: s; vehicle deceleration unit Steering angle Unit: degree; Location of collision point The parameter is continuous, representing the longitudinal position of the collision point in the road coordinate system, in meters; the collision angle is also continuous. This is a continuous parameter, representing the angle between the driving directions of the vehicle and the target vehicle, in degrees, and within a range. to .
[0032] The consequences layer parameter nodes include collision type, collision severity index (CSI), and whether the airbags are deployed. Collision type is a discrete parameter, with values of rear-end collision, side collision, frontal collision, and scrape; collision severity index (CSI) is a continuous parameter; and whether the airbags are deployed is a Boolean parameter.
[0033] Step S102, causal edge construction, adopts the structural causal model framework, and establishes directed causal edges between parameter nodes through three sources: accident report text, structured accident parameter data, and domain knowledge.
[0034] The accident report text source uses a pre-trained text classification model to identify statements containing causal relationships. Dependency parsing is used to extract cause and effect nodes connected by causal trigger words. Commonly used causal trigger words include "cause," "due to," "because of," and "cause." For example, from "insufficient braking distance due to slippery roads caused by rain," the following nodes are extracted: weather type equal to rainy day is the cause node, road surface friction coefficient μ decreases as the intermediate result, and braking distance increases as the final result. This establishes the following relationships: weather type equals rainy day, road surface friction coefficient μ decreases, and braking distance increases.
[0035] The structured accident parameter data source uses the PC algorithm or GES algorithm to learn the causal structure, and the causal edges between parameters are determined by the conditional independence test. If the probability value of the conditional independence test between the road friction coefficient μ and the collision time TTC is less than 0.05 under the condition of controlling the relative speed Δv, then the road friction coefficient μ and the collision time TTC are determined to constitute a causal edge.
[0036] Domain knowledge sources include traffic regulations, vehicle dynamics equations, and physical constraints to modify the causal graph. The collision time TTC = relative distance d / relative velocity Δv represents the direct causal boundary from relative distance d and relative velocity Δv to collision time TTC. The braking distance formula s = v² / (2μg) establishes a functional relationship between vehicle speed vego, road friction coefficient μ, and braking distance, where g is the gravitational acceleration of approximately 9.8 m / s². Road type imposes boundary constraints on vehicle speed vego, for example, a speed limit of 120 km / h on straight sections of highways and 40 km / h at urban intersections.
[0037] Step S103, Coupling Quantification: For the parameter pair (X,Y), calculate the partial correlation coefficient ρ(X,Y|Z) while controlling other parameters Z. First, calculate ρ(X,Y), ρ(X,Z), and ρ(Y,Z) according to the Pearson correlation coefficient, then substitute them into the formula:
[0038]
[0039] Where ρ(X,Y|Z) is the partial correlation coefficient between X and Y under control Z, ranging from -1 to 1; ρ(X,Y) is the Pearson correlation coefficient between X and Y; ρ(X,Z) is the Pearson correlation coefficient between X and Z; and ρ(Y,Z) is the Pearson correlation coefficient between Y and Z. The Pearson correlation coefficient is the product of the sample covariance of the two variables divided by their respective sample standard deviations. After calculating ρ(X,Y|Z), a t-test is used to determine conditional independence. When |ρ(X,Y|Z)|>0.3 and the test probability is less than 0.05, the parameter pair is considered to have a coupling relationship.
[0040] Simultaneously, conditional mutual information is used to quantify the conditional dependence of coupling strength. For relative velocity Δv and risk level Risk, under the conditions that the road friction coefficient μ takes values of μ0 and μ1 respectively, the conditional mutual information I is calculated according to the conventional definition of information theory, representing the statistical dependence strength of relative velocity Δv and risk level Risk under given road friction coefficient μ values. The conditional mutual information difference is calculated as follows:
[0041]
[0042] Where Diff(I) represents the conditional mutual information difference; I(Δv;Risk|μ=μ0) represents the conditional mutual information between relative velocity Δv and risk risk under the condition that the road friction coefficient μ=μ0; I(Δv;Risk|μ=μ1) represents the conditional mutual information between relative velocity Δv and risk risk under the condition that the road friction coefficient μ=μ1; |·| represents the absolute value operation. μ0 and μ1 are two representative values of the road friction coefficient. In this embodiment, μ0=0.3 and μ1=0.8 are taken.
[0043] Risk is an accident risk score, ranging from 0 to 1, and is calculated as follows: Calculate, where w1 and w2 are weighting coefficients and w1 + w2 = 1. , TTCmax and CSImax are the maximum values of the collision time TTC and collision severity index CSI in the parameter dataset, respectively. w1 and w2 are set according to the importance of collision urgency and consequence severity in hazard assessment; in this embodiment, w1=0.6 and w2=0.4. When Diff(I) exceeds the threshold of 0.2, it is determined that the parameter pair has a conditionally dependent nonlinear coupling relationship, that is, the magnitude of the coupling coefficient changes with the value of the third variable.
[0044] Step S104: Constraint graph construction. Physical constraints, boundary constraints, and causal constraints are superimposed on the causal graph to form a constraint graph.
[0045] Physical constraints include deterministic equation constraints and vehicle dynamics constraints. Deterministic equation constraints include... , Equation constraints can be directly calculated; vehicle dynamics constraints include braking distance formulas and collision energy formulas. Boundary constraints define the physically feasible range of values for each parameter, for example, the road surface friction coefficient μ ranges from 0.1 to 1.0, and the vehicle speed vego ranges according to the road type. Causal constraints are value constraints transmitted through causal chains, for example, when the weather type is rainy, the road surface friction coefficient μ is limited to a range of 0.1 to 0.5.
[0046] Each parameter node in the constraint graph is accompanied by physical constraints, boundary constraints, and causal constraints, and each causal edge is accompanied by a coupling strength or conditional dependency marker.
[0047] Thus far, step S1 yields the causal graph and constraint graph of the accident parameters. The causal graph and constraint graph use the parameter nodes of the environment layer, behavior layer, and consequence layer as the skeleton, the directed edges obtained from text extraction, data learning, and knowledge correction as the causal paths, and the partial correlation coefficient, conditional mutual information, and three types of constraints as the quantification boundaries. This provides input for the subsequent step S2 to convert the causal influence degree, coupling coefficient, and value constraints into latent space dimension weights and elliptical feasible regions.
[0048] Next, step S2 in this embodiment will be described, specifically, designing a mapping algorithm from causal constraints to the feasible region of the latent space. First, the causal graph of the accident parameters obtained in step S1 is compared with the causal strength, coupling relationship, and hierarchical constraints in the constraint graph. Then, these are transformed into dimensional weights, elliptical feasible regions, and auxiliary parameter ranges in the latent space, providing geometric constraint basis for training the conditional variational autoencoder in step S3 and constrained sampling in step S4. The execution process includes causal influence calculation, latent space dimensional weight mapping, sampling variance adjustment, elliptical feasible region construction, projection operation, and hierarchical causal propagation, as detailed below.
[0049] Step S201: Calculate the causal influence degree of each parameter node in the causal graph. Extract all directed edges and the causal influence strength of each directed edge from the causal graph constructed in step S1. For each parameter node in the cause-effect graph traverse all Starting from, with For directed causal edges ending at a certain point, take the absolute value of the causal influence strength of each edge, and then sum all the absolute values. The calculation formula is:
[0050]
[0051] in, For parameter nodes The degree of causal influence; For the first causal graph One parameter node; To and The first causal edge exists One parameter node; For parameter nodes To parameter node The causal influence strength is calculated using the path coefficient estimation method of structural equation modeling, with values ranging from 0 to 1. This is for absolute value operations; Indicates to and There exist all parameter nodes of a directed causal edge. Summation. For example, the causal influence of the TTC node at collision time. .
[0052] Step S202: After normalizing the causal influence degree, map it to the latent space dimension weight, and select the maximum value from all parameter node causal influence degrees obtained in step S201. Divide the causal influence of each parameter node by the maximum value. This yields the latent space dimension weights corresponding to the parameter nodes. The calculation formula is:
[0053]
[0054] in, For parameter nodes The corresponding latent space dimension weights; For parameter nodes The degree of causal influence; The maximum value among all parameter nodes' causal influence degrees is determined by comparing all... The numerical value is obtained. Taking the collision time TTC as an example, if... And it is the maximum value among all parameter nodes, then .
[0055] Step S203: Adjust the sampling variance of the corresponding dimension of the parameter node in the latent space according to the causal influence degree, using the latent space dimension weights obtained in step S202 during the adjustment. Basic sampling variance and causal constraint strength coefficient .
[0056] For each latent space dimension corresponding to a parameter node, subtract the product of the dimension weight and the causal constraint strength coefficient from 1 to obtain the variance reduction factor. Then, multiply the base sampling variance by the variance reduction factor to obtain the sampling variance of the latent space dimension. There is no cross-coupling between the latent space dimensions, and the sampling variance adjustment is performed in parallel as independent scalar operations for each dimension. The calculation formula is:
[0057]
[0058] in, For parameter nodes The sampling variance corresponding to the latent space dimension; Based on the sampling variance, this embodiment takes ; For parameter nodes The corresponding latent space dimension weights; The causal constraint strength coefficient ranges from 0 to 1; in this embodiment, it is taken as... Taking the collision time TTC as an example, if , , ,but .
[0059] Step S204: For parameter pairs with nonlinear coupling, the coupling coefficients are transformed into elliptical constraint boundaries in the latent space. During the transformation, the coupling parameter pairs obtained from the coupling metric in step S1 are used. and Coupling coefficient The sampling variance obtained in step S203 and and feasible region boundary coefficients . Parameter node and Corresponding latent space sample value and For two-dimensional joint variables, construct elliptic inequality constraints:
[0060]
[0061] in, and These are parameter nodes. and The corresponding latent space sampled values; and These are parameter nodes. and The sampling variance corresponding to the latent space dimension is calculated in step S203; For parameter nodes and The coupling coefficient is taken as the partial correlation coefficient obtained by the coupling metric in step S1, with a value range of -1 to 1. For the feasible region boundary coefficient, this embodiment takes... This corresponds to a confidence interval of approximately 95%.
[0062] Step S205: During the latent space sampling process, if the sampling point does not satisfy the elliptical constraint, it is projected onto the constraint boundary along the ellipse normal direction.
[0063] The projection uses the elliptical constraints constructed in step S204 and the latent space sampling points that do not satisfy the elliptical constraints. Calculate the equation of the ellipse. , The difference is obtained by subtracting the right side from the left side of the elliptic constraint inequality in step S204. If... Then calculate the gradient of the ellipse equation. , for sampling points in the hidden space The gradient. Project the sampling points along the inverse direction of the gradient to the elliptical boundary:
[0064]
[0065] in, These are the latent space sampling points after projection; These are the latent space sampling points before projection; The value of the ellipse equation; The gradient of the equation of the ellipse; gradient The L2 norm; gradient The square of the L2 norm. If after one projection If it is still greater than 0, repeat the above calculation until... Or it can reach the maximum number of iterations, 10. Taking the relative velocity Δv and the road friction coefficient μ as an example, which are nonlinearly coupled parameters, if the partial correlation coefficient... Elliptical constraint boundaries limit the joint distribution range of the two in the latent space, preventing sampling points from falling into physically unreasonable areas.
[0066] Step S206: The sampling results of the core parameters are transmitted to the auxiliary parameter subspace, using the sampled values of the core parameter subspace during the transmission. and the functional relationships between parameters defined in step S1 of the cause-effect graph. A causal propagation layer is added before the decoder to calculate the effective range of the auxiliary parameter subspace based on the sampled values of the core parameter subspace.
[0067]
[0068] in, The effective range of the auxiliary parameter subspace; These are the sampled values from the core parameter subspace; The functional relationships between parameters are defined by the causal graph. Based on the causal edges and domain knowledge constraints constructed in step S1, the effective range is calculated for each auxiliary parameter dimension according to the causal chain between it and the core parameter. Each auxiliary parameter dimension is calculated independently, and there is no cross-coupling across auxiliary parameter dimensions.
[0069] Taking the variation of the core parameter relative velocity Δv as an example, based on vehicle dynamics formulas and road condition constraints, the feasible range of the auxiliary parameter, vehicle speed vego, is calculated; the sampled values of the auxiliary parameter subspace are pruned, and if the auxiliary parameter sampled values exceed... Then take Boundary values. Hierarchical causal constraint propagation ensures the transitivity and consistency of causal logic during parameter generation.
[0070] In summary, step S2 together completes the mapping from causal constraints to the feasible region of the latent space; steps S201 to S203 transform the causal influence into latent space dimension weights and sampling variance; steps S204 and S205 transform the coupling coefficients into elliptical feasible regions and projection operations; and step S206 transmits the core parameter sampling results to the auxiliary parameter subspace. The mapping results provide the basis for latent space hierarchical decoupling for the subsequent step S3 of training the conditional variational autoencoder, and provide dimension weights and feasible region boundaries for the constrained sampling in step S4, enabling the generalization of parameters for dangerous scenarios in autonomous driving simulation to satisfy causal logic and physical laws while maintaining the dangerous attributes.
[0071] Following this, step S3 in the embodiments of this application will be described: training a conditional variational autoencoder, and achieving hierarchical decoupling of the latent space through orthogonal decoupling loss, inter-layer consistency loss, and hierarchical regularization loss, dividing the latent space into a core parameter subspace and an auxiliary parameter subspace. The execution process unfolds according to network architecture design, loss function design, training strategy, and model application, as detailed below.
[0072] Step S301, Network architecture design, encoder The input is the accident parameter vector. and condition vector Accident parameter vector Dimensions Equal to the number of parameter nodes defined in step S101, and the condition vector. It includes information such as collision type and target hazard level. The encoder adopts a 3-layer fully connected network structure, with hidden layer dimensions of 128, 64, and 32 respectively. The activation function is the ReLU function, and the output layer contains two branches that output the mean of the latent space distribution. and standard deviation The latent space has a dimension of 16.
[0073] decoder The input is the latent space sampling vector. and condition vector The output is the reconstructed incident parameter vector. The decoder adopts a 3-layer fully connected network structure symmetrical to the encoder, with hidden layer dimensions of 32, 64, and 128 respectively, and an output layer dimension of... The activation function is a linear function. Both the encoder and decoder are fully connected networks and do not contain convolutional layers. The weight matrix is initialized using the Xavier method, and the bias vector is initialized to zero.
[0074] The first 8 dimensions of the latent space are the core parameter subspace, corresponding to the collision point position and relative velocity. Collision Time to Collision (TTC) and Collision Angle The first dimension contains core hazard parameters; the latter eight dimensions form an auxiliary parameter subspace, corresponding to auxiliary parameters such as vehicle model, color, and specific location coordinates. (Accident parameter vector) Before inputting the encoder, the values are standardized according to the mean and standard deviation of each dimension to make each dimension dimensionless.
[0075] Step S302, loss function design, the total loss function is defined as:
[0076]
[0077] in, This is the total loss function; Loss of the lower bound of evidence; This is the orthogonal decoupling loss; This results in inter-layer consistency loss. For hierarchical regularization loss; These are the weight parameters for the orthogonal decoupling loss. The inter-layer consistency loss weight parameter; The weight parameters are for the hierarchical regularization loss. , , The initial value is 0.01 during the pre-training phase, and it is gradually increased to 0.1 with each training round.
[0078] Loss of lower bound of evidence The standard evidence lower bound form of the variational autoencoder is adopted, consisting of two parts: reconstruction loss and KL divergence loss. The reconstruction loss is calculated by the negative log-likelihood of the decoder output and the original input. The KL divergence loss measures the difference between the encoder distribution and the standard normal prior distribution, and is in a conventional form, so it will not be elaborated further.
[0079] Orthogonal decoupling loss Constrain the statistical independence between the core parameter subspace and the auxiliary parameter subspace:
[0080]
[0081] in, This is the orthogonal decoupling loss; For the core parameter subspace; For auxiliary parameter subspace; For the dimension index in the core parameter subspace; For dimension indexes in the auxiliary parameter subspace; For the first in the core parameter subspace Latent space sample values in each dimension; For the first in the auxiliary parameter subspace Latent space sampled values in each dimension; for and covariance; This is for absolute value operations; squaring represents squaring the covariance.
[0082] Inter-layer consistency loss constraints achieve parameter consistency through causal graph propagation:
[0083]
[0084] in, This results in inter-layer consistency loss. The reconstructed values for the core parameters; The reconstructed values for auxiliary parameters; For the steps The functional relationships between parameters defined by the cause-effect graph, and the steps Consistent with the definition, the input is the core parameter value, and the output is the predicted value or effective range of the auxiliary parameters; This is for absolute value operations; squaring means squaring the difference.
[0085] Hierarchical Regularized Loss The sampling variance of the core parameter subspace is less than that of the auxiliary parameter subspace.
[0086]
[0087] in, For hierarchical regularization loss; The mean variance of the sampling for each dimension of the core parameter subspace; The mean variance of the sampled variance for each dimension of the auxiliary parameter subspace; The stratification interval is set to 0.2; This is for calculating the maximum value.
[0088] Step S303, Training Strategy: Train a conditional variational autoencoder on a large-scale accident parameter dataset. The training data comes from public traffic accident databases and simulated accident data, collecting no fewer than 5000 accident parameter samples, covering different collision types, weather conditions, and road types. Data cleaning standards include removing samples with missing key parameters, samples with abnormal timestamps, and samples with physical inconsistencies. Labeling rules are used to label each sample according to collision type, weather type, road type, and hazard level.
[0089] In the pre-training phase, the learning rate was set to 0.001, the Adam optimizer was used, the batch size was set to 32, and the total number of training epochs was 200. The model parameters with the lowest loss on the validation set were selected as the pre-training parameters. In the fine-tuning phase, high-risk scene samples with a collision time TTC of less than 1.5s were selected. The decoder parameters were frozen, and only the encoder parameters were fine-tuned. The learning rate was reduced to 0.0001, and the number of training epochs was 50. The model parameters with the lowest loss on the validation set were selected as the fine-tuning parameters. The training convergence objective was that the value of the total loss function on the validation set decreased by less than 0.001 for 10 consecutive epochs, or the corresponding number of training epochs was reached.
[0090] Based on the above analysis, in step S3, the input accident parameter vector is standardized according to the mean and standard deviation of the training set, and the condition vector is encoded using one-hot encoding. Latent vectors are sampled from a standard normal prior distribution. , will the latent vector With condition vector The input is to the decoder, which outputs a reconstructed accident parameter vector. This vector is then inversely normalized using the mean and standard deviation of the training set to obtain a generalized parameter combination of physical dimensions. The trained conditional variational autoencoder provides a generative model for constrained sampling in the latent space in step S4.
[0091] After the above steps are completed, step S4 in this embodiment is described: constrained sampling is performed in the latent space, and differentiated sampling variance is used for the core parameter subspace and the auxiliary parameter subspace. The execution process unfolds according to the latent space hierarchical sampling, latent space directional sampling, and adaptive adjustment of sampling density, and is specifically implemented according to the following sub-steps.
[0092] Step S401: Hierarchical sampling of the latent space. After the conditional variational autoencoder is trained, it is sampled from the standard normal prior distribution. Mid-sampled latent vector Combined with condition vectors Input the decoder trained in step S3, and the decoder outputs the generalization parameter combination. The vector is 16-dimensional, with the first 8 dimensions corresponding to the core parameter subspace and the last 8 dimensions corresponding to the auxiliary parameter subspace. The sampling variance of the core parameter subspace is set to... The auxiliary parameter subspace sampling variance is set to The variance ratio of the two is 1:3.33.
[0093] The sampling variance of each latent space dimension is processed according to the steps. Chinese formula Further adjustments are needed. Among them, For parameter nodes The sampling variance corresponding to the latent space dimension; The core parameter is the basic sampling variance of the subspace to which this dimension belongs. The subspace dimension is taken as... Auxiliary parameter subspace dimension taken ; For parameter nodes The corresponding latent space dimension weights; Let be the causal constraint strength coefficient, and take . Each dimension is adjusted independently, with no cross-coupling. For dimensions with high causal influence, the sampling variance is within... or It was further reduced on the basis of the previous one.
[0094] During sampling, 100 sets of 16-dimensional latent vectors were sampled from the standard normal prior distribution, with the first 8 dimensions used... The standard deviation, used in the last 8 dimensions The standard deviation of the latent vector and the conditional vector are concatenated and input into the decoder, which outputs 100 sets of generalization parameter combinations.
[0095] Step S401 completes the latent space hierarchical sampling. Hierarchical sampling enables collision time TTC and relative velocity... Core hazard parameters are kept relatively stable within a small range to maintain hazard attributes; auxiliary parameters such as vehicle model and color are allowed to vary within a larger range to increase scenario diversity.
[0096] Step S402: Latent space directional sampling. Select accident parameter samples with target hazard attributes to form a target sample set, such as samples of extremely dangerous scenarios with a collision time TTC of less than 1.0s. For each sample in the target sample set, use the encoder trained in step S3 to obtain the latent space encoding value, and calculate the mean encoding value of the target sample set in the latent space.
[0097] Setting a hidden space reference point Take the global mean of the origin or latent space encoding. Calculate the direction vector from the reference point to the target mean, and perform L2 normalization on the direction vector. Then, on the normalized direction vector, use the sampling amplitude coefficient... Perform directional sampling. The value ranges from 0.5 to 2.0. The larger the value, the closer the sampling point is to the target danger zone. Directional sampling provides targeted control over specific hazard attributes; for example, directional sampling in the TTC direction during short collision times can generate more extreme rear-end collision risk scenarios.
[0098] Step S402 completes latent space directional sampling. Directional sampling actively biases the generated parameters toward the target danger area, increasing the generation ratio of extremely dangerous scenarios.
[0099] Step S403: Adaptive adjustment of sampling density. The latent space is divided into grids. The accident data density of each grid cell is calculated as the ratio of the number of accident samples falling within that grid cell to the total number of samples. Let the... The data density of each grid cell is For parameter regions with sparse accident data (i.e., grid cells with density below a preset threshold), the sampling probability is increased to improve coverage; for parameter regions with dense accident data (i.e., grid cells with density above a preset threshold), the sampling probability is decreased to avoid redundancy. The sampling probability adjustment formula is:
[0100]
[0101] in, The adjusted sampling probability; The sampling probability before adjustment; The adjustment factor is set to 0.5; The data density of the current grid cell; This represents the global maximum data density. The sampling probability is calculated independently for each grid cell, representing the global minimum data density. Grid cells with lower density have a higher sampling probability, while grid cells with density equal to the global maximum data density have no change in sampling probability.
[0102] Step S403 completes the adaptive adjustment of sampling density. Sparse areas of accident data often correspond to dangerous operating conditions with insufficient test coverage. Increasing the sampling probability in sparse areas can improve the coverage of dangerous scenarios, while decreasing the sampling probability in dense areas can avoid generating duplicate scenarios.
[0103] Therefore, step S4 completes the latent space constrained sampling. Layered sampling maintains the stability of core hazard parameters and fully generalizes auxiliary parameters; directional sampling biases the generated parameters towards the target hazard area; and adaptive density adjustment improves the coverage of sparse hazard areas. The combination of generalized parameters obtained from sampling provides input for the hazard assessment constraints and latent space projection in step S5.
[0104] Furthermore, step S5 in this embodiment is described, which involves projecting the generated parameters into the latent space using hazard assessment constraints. Specifically, the gradient of the hazard score with respect to the latent space sampling points is calculated, and the sampling points are moved along the gradient direction until the constraints are met. The execution process unfolds according to the design of hazard quantification indicators, the latent space projection constraint mechanism, and the progressive constraint relaxation strategy.
[0105] Step S501: Establish a collision urgency index by taking the collision time from the generalized parameter combination generated in step S4. Value, collision time With the severe conflict threshold and mild conflict threshold Comparison. Collision time Less than The collision was determined to be a serious conflict; the collision time Greater than The collision time is determined to be without conflict. exist to The conflict is classified as moderate when it occurs between these points.
[0106] step Establish a collision consequence severity index, taking the relative velocity from the generalized parameter combination. and effective quality factor The collision severity index is calculated using the following formula:
[0107]
[0108] in, This refers to the collision severity index. Relative velocity, unit: ; The effective quality factor is a dimensionless quantity, calculated according to the formula. Calculation, where For the sake of vehicle quality, The target vehicle mass is given in kg. For reference, the mass is taken as 1500 kg. The collision angle is in degrees; the vehicle's mass is... and target vehicle quality The vehicle configuration parameters are determined by the simulation scenario.
[0109] step Calculate the overall hazard score, taking the collision time. Collision Severity Index Weighting coefficients and Maximum collision time in the parameter dataset The maximum value of the collision severity index in the parameter dataset. Calculate the overall risk score using the formula:
[0110]
[0111] in, For the comprehensive risk assessment, the value range is: arrive ; As the collision urgency weighting coefficient, this embodiment takes... ; As the weighting coefficient for the severity of collision consequences, this embodiment takes... ; The normalized mapping function for collision time is given by the formula. Calculate the collision time Mapped to arrive The smaller the collision time, the better. The larger; The normalized mapping function for the collision severity index is given by the formula. Calculate the collision severity index Mapped to arrive The larger the collision severity index, the greater the range. The larger; and Collision times in the parameter dataset are respectively and Collision Severity Index The maximum value. Both normalized mapping functions are linearly normalized.
[0112] Step S504, latent space projection constraint mechanism, taking the parameter combination output by the decoder in step S4. Calculate parameter combinations of ,Will Compared with the hazard threshold of 0.6. In this embodiment, 0.6 is chosen as the hazard constraint threshold, based on historical accident data statistics. Samples with a coefficient below 0.6 account for approximately 85% of the total and are considered to have no conflict or a slight conflict. If... If the value is greater than or equal to 0.6, the parameter combination is retained. ;like If the value is below 0.6, the parameter combination will be adjusted. Mapping to feasible points in the latent space.
[0113] The core of the latent space projection operation is to calculate the risk score for latent space sampling points. gradient The sampling points are moved along the gradient direction, the decoding is repeated, and the process is iterated until the constraints are met or the maximum number of iterations is reached.
[0114] Step S505, Latent space projection iteration. Take the first... Latent space sampling points in the next iteration Step size parameters Risk score for hidden space sampling points gradient Update the latent space sampling points according to the iterative formula:
[0115]
[0116] in, For the first The latent space sampling points of the next iteration; For the first The latent space sampling points of the next iteration; The step size parameter is 0.1 in this embodiment; This represents the number of iterations, with a maximum of 10 iterations. For the risk level score, the first Sub-iteration latent space sampling points The gradient of the risk score is obtained by backpropagating the gradient of the decoder output to the latent space sampling point through the chain rule. and All are 16-dimensional vectors, and are added together according to their corresponding dimensions.
[0117] During iteration, if the current sampling point corresponding Below 0.6, calculate right gradient Move the sampling point along the gradient direction; the updated sampling point Regenerate the parameter combination through the decoder; if the new parameter combination... If the value is greater than or equal to 0.6, the iteration stops; otherwise, it continues. The latent space projection operation operates on the latent space rather than the parameter space, ensuring that the generated parameter combinations satisfy the risk constraints while remaining within a reasonable distribution range in the parameter space.
[0118] Step S506: A progressive constraint relaxation strategy is employed. The effective sample rate is taken and compared to 10%. When the effective sample rate is below 10%, meaning fewer than 10 out of 100 samples meet the hazard constraints, a progressive constraint relaxation method is used. The first round of relaxation maintains the hard constraints of the core hazard parameters unchanged, only relaxing the constraint range of auxiliary parameters; the second round of relaxation... constraint threshold from Relaxed to At the same time, maintain the collision severity index The constraints remain unchanged; the third round of relaxation continues to adjust based on the relaxation effects of the first two rounds. Each round of relaxation operation records the relaxation amount and the retention rate of hazardous attributes in the generated samples, used to assess the impact of constraint relaxation on the retention of hazardous attributes.
[0119] At this point, step S5 completes the hazard assessment constraints and latent space projection. The hazard quantification index design establishes a quantification system with two dimensions: collision urgency and collision consequence severity. The latent space projection constraint mechanism moves sampling points to latent space positions that satisfy the hazard constraints through gradient iteration, while the progressive constraint relaxation strategy gradually relaxes the constraints when the effective sample rate is too low. This process ensures that the generalized parameter combination obtained in step S4 satisfies the hazard constraints while maintaining the hazard attributes, providing a suitable parameter combination for step S6 to input into the simulation engine to generate the hazardous scenario.
[0120] Finally, step S6 in this embodiment is described: the generalized parameter combination is input into the simulation engine to generate a hazardous scenario, and closed-loop feedback optimization is performed. Furthermore, the generalized parameter combinations generated in steps S4 to S5 are converted into a scenario configuration recognizable by the simulation engine. The effectiveness of the scenario is verified through simulation operation, and the latent space sampling distribution is adjusted based on the evaluation results, so that the sampling distribution gradually approaches the target area that combines high risk and high rationality. The execution process unfolds according to simulation engine integration, evaluation index calculation, and sampling distribution optimization, as detailed below.
[0121] Step S601: Build a simulation test platform using the CARLA simulation engine. The CARLA simulation engine supports various sensor configurations, dynamic weather systems, and programmable traffic flow, and can simulate vehicle motion, collision detection, and weather changes. In the construction of hazardous scenarios for autonomous driving simulation, the CARLA simulation engine is used to reconstruct a runnable virtual traffic scenario from generalized parameter combinations. Collision detection results are used to verify whether a collision event occurs in the generated scenario.
[0122] Step S602: Generate a scene configuration file. Take the generalized parameter combinations generated in steps S4 to S5 and convert them into the scene configuration file required by the CARLA simulation engine. The conversion process is as follows: configure the road topology based on the road type parameter in the generalized parameter combination; configure the weather system and lighting conditions based on the weather type parameter; configure the initial state of the vehicle based on the vehicle speed vego and the target vehicle speed vagent; configure the vehicle trajectory based on the collision point location and collision angle; and configure the road surface physical parameters based on the road surface friction coefficient μ.
[0123] The scenario configuration file is in JSON format and includes four modules: road, vehicle, weather, and collision. The scenario configuration file is input into the CARLA simulation engine for rapid evaluation. The simulation engine drives vehicle movement and detects collision events according to the configuration file, and the collision detection results are used for subsequent evaluation metric calculations.
[0124] Step S603: Calculate the corrected hazard score, taking the overall hazard score RiskScore calculated in step S5 and the collision detection result output by the CARLA simulation engine in step S602. If the simulation engine detects an actual collision, the overall hazard score RiskScore remains unchanged; if the simulation engine does not detect an actual collision, the overall hazard score RiskScore is multiplied by a reduction factor of 0.5. The reduction factor of 0.5 is based on historical accident data statistics, showing that the theoretical overall hazard score RiskScore for scenarios without actual collisions has a low correlation with the actual hazard. A reduction of 0.5 distinguishes the corrected score from the collision scenario while avoiding direct zeroing that would result in information loss. The corrected overall hazard score RiskScore is used for subsequent sampling distribution optimization.
[0125] Step S604: Calculate the distribution rationality index. Take the generated scenario parameters and the real accident data parameters, and use the Wasserstein distance to measure the distribution difference between the generated scenario and the real accident data in the parameter space. For multidimensional parameter distributions, calculate the Wasserstein distance for each parameter dimension, and then take the arithmetic mean of the Wasserstein distances for all dimensions to obtain the overall distribution rationality index. The smaller the Wasserstein distance, the higher the similarity between the distribution of the generated scenario and the real accident data. The Wasserstein distance is a conventional metric in optimal transport theory, and those skilled in the art can directly calculate it based on the generated scenario parameters and the real accident data parameters.
[0126] Step S605: Sampling probability adjustment. Take the revised overall risk score (RiskScore) from step S603 and the Wasserstein distance obtained in step S604, and calculate the evaluation score for each parameter region. The evaluation score calculation formula is:
[0127]
[0128] in, For the first Evaluation scores for each parameter region; For the first The overall risk score after parameter area correction; For the first Wasserstein distance of each parameter region; This represents the maximum value of the Wasserstein distance across all parameter regions. The risk weighting coefficient is 0.6 in this embodiment; The distribution rationality weighting coefficient is set to 0.4 in this embodiment; and satisfy A higher assessment score indicates a higher risk level and a more reasonable distribution of parameters within the region.
[0129] The evaluation results are fed back to the latent space sampling stage to adjust the sampling strategy. The sampling probability adjustment formula is:
[0130]
[0131] in, The adjusted sampling probability; The sampling probability before adjustment; To adjust the coefficient, this embodiment uses 0.5; For the first Evaluation scores for each parameter region; The average score is evaluated for all parameter regions; The maximum score is evaluated for all parameter regions; The minimum score is evaluated for all parameter regions. When Greater than When the adjustment term is positive, the sampling probability increases; when Less than When the adjustment term is negative, the sampling probability decreases. After adjustment, the sampling probability is normalized so that the sum of the sampling probabilities for all parameter regions is 1.
[0132] After 3 to 5 rounds of iteration, the hidden space sampling distribution gradually approaches the target area that combines high risk and high rationality.
[0133] Step S606: Iteration termination determination. Take the Wasserstein distance of the current round and the Wasserstein distance of the previous round, and calculate the absolute value of the difference between the current round Wasserstein distance and the previous round Wasserstein distance. If the absolute value of the difference for two consecutive rounds is less than the preset threshold of 0.01, it is determined that the sampling distribution has stabilized, the iteration stops, and the final generalized parameter combination is output; if the iteration termination condition is not met, return to step S4 to continue sampling. The final generalized parameter combination is a set of hazardous scenario parameters that meet the hazard constraints and have a reasonable distribution, used for autonomous driving simulation testing.
[0134] Finally, step S6 completes the simulation engine integration, evaluation metric calculation, and sampling distribution optimization. Simulation engine integration converts the generalized parameter combinations into a scenario configuration file executable by the CARLA simulation engine. Evaluation metric calculation assesses the generated scenario from two dimensions: hazard level and distribution rationality. Sampling distribution optimization adjusts the sampling probability based on the evaluation results and iterates until convergence. These processes ensure that the generalized parameter combinations generated in steps S1 to S5, after simulation verification and feedback optimization, yield hazardous scenario parameters with well-maintained hazard attributes and a reasonable distribution, providing comprehensive and physically plausible hazardous conditions for autonomous driving simulation testing.
[0135] To further enhance understanding of this application, specific application examples are provided in the embodiments of this application, as detailed below.
[0136] Specific application example 1:
[0137] Taking a typical rear-end collision scenario as an example, the complete execution flow of the method of the present invention is explained.
[0138] The original accident parameters were set as follows: vehicle speed vego = 60 km / h, target vehicle speed vagent = 40 km / h, relative speed Δv = 20 km / h, relative distance d = 15 m, collision time TTC = 2.7 s, road friction coefficient μ = 0.6, weather type: rain, collision type: rear-end collision. In this scenario, the road friction coefficient μ = 0.6 corresponds to light rain conditions.
[0139] Step S1 constructs the cause-and-effect graph and constraint graph of the accident parameters. The weather type equals rainy day as the cause node. Through the environmental factor transmission path, the road surface friction coefficient μ decreases to 0.6. The decrease in road surface friction coefficient further leads to an increase in braking distance, forming the first cause-and-effect chain: weather type equals rainy day → μ = 0.6 → increased braking distance.
[0140] The vehicle's speed being greater than the target vehicle's speed serves as the causal node. Through the transmission path of increased relative speed, decreased relative distance, and shortened collision time, the risk of a rear-end collision increases, forming a second causal chain: vego>vagent, Δv>0, d decreases, TTC decreases, and the risk of a rear-end collision increases.
[0141] Coupling analysis revealed a nonlinear coupling between Δv and μ. Partial correlation analysis showed a coupling coefficient of 0.42 with a p-value less than 0.01, confirming a conditional dependency between the two. The sample data used in the partial correlation analysis came from a public traffic accident database, with a sample size of no less than 5000 entries. The control variable was the relative distance d. A constraint map was formed by superimposing three types of constraints: physical constraints included deterministic equations such as TTC = d / Δv; boundary constraints included parameter ranges such as μ between 0.1 and 1.0; and causal constraints included causal transmission constraints such as μ not exceeding 0.6 under rainy conditions.
[0142] Step S2 performs the mapping of causal constraints to the feasible region of the latent space, and calculates the causal influence of each parameter: the causal influence CI of Δv is 0.85, the causal influence CI of TTC is 0.92, and the causal influence CI of μ is 0.45. The causal influence is normalized and mapped to the latent space dimension weights: the normalized weight w of TTC is 0.92. The causal constraint strength coefficient γ is set to 0.8, and the basic sampling variance σbase is set to 1.0. The sampling variance σ of the corresponding dimension of TTC is calculated as σ = 1.0 × (1 - 0.92 × 0.8) ≈ 0.264.
[0143] The coupling constraint between Δv and μ is transformed into the boundary of the latent space elliptic feasible region, with coupling coefficient ρ = 0.42 and boundary coefficient κ = 2.0. The elliptic constraint equation is zΔv² / σΔv² + zμ² / σμ² - 2 × 0.42 × zΔv / σΔv × zμ / σμ ≤ (1 - 0.42²) × 4. This elliptic constraint equation is obtained by substituting the elliptic inequality from step S204 into the coupling coefficient ρ = 0.42 and the boundary coefficient κ = 2.0.
[0144] Step S3 executes CVAE training. The encoder receives a 16-dimensional accident parameter vector and a collision type condition vector, and outputs a 16-dimensional latent space distribution parameter. The first 8 dimensions of the latent space are the core parameter subspace, corresponding to parameters such as Δv, TTC, collision point position, and collision angle; the last 8 dimensions are the auxiliary parameter subspace, corresponding to parameters such as vehicle model and color.
[0145] During training, λ1=λ2=λ3=0.1 was set, and the total loss function comprehensively considered ELBO loss, orthogonal decoupling loss, inter-layer consistency loss, and hierarchical regularization loss. Training data came from public traffic accident databases and simulated accident data, collecting no fewer than 5000 accident parameter samples. The cleaning criteria included removing samples with missing key parameters, samples with abnormal timestamps, and samples with unreasonable physical properties. The annotation rules were to label each sample according to collision type, weather type, road type, and hazard level. The learning rate during the pre-training phase was 0.001, using the Adam optimizer, with a batch size of 32, and a total of 200 training epochs.
[0146] In the fine-tuning phase, high-risk scene samples with a TTC of less than 1.5 seconds were selected. The decoder parameters were frozen, and only the encoder parameters were fine-tuned. The learning rate was 0.0001, and the number of training epochs was 50. The training convergence objective was that the validation set loss decreased by less than 0.001 for 10 consecutive epochs. After the two-stage training was completed, the model parameters with the lowest validation set loss were taken as the final parameters.
[0147] Step S4 performs latent space constrained sampling, with the sampling variance of the core parameter subspace set to 0.3 and the sampling variance of the auxiliary parameter subspace set to 1.0. The latent vector of each sampled set is combined with the tail-collision condition and input into the decoder to generate a generalization parameter combination. The number of samples is set to 100 sets. During sampling, the actual sampling variance of the TTC-corresponding dimension is further adjusted to approximately 0.264 based on the causal influence, limiting the sampling range of this dimension to maintain the causal consistency of the TTC. The dimensions corresponding to Δv and μ undergo elliptic constraint checks after sampling; sampling points that do not satisfy the elliptical boundary are projected onto the boundary along the gradient direction.
[0148] Step S5 executes the risk assessment constraint and latent space projection, using a TTC less than 1.5s as the risk constraint condition, and calculates the RiskScore for 100 sets of sampled parameters. If the RiskScore of a certain set of parameters is less than 0.6, perform latent space gradient projection on that set of parameters: calculate the gradient ∇zRiskScore of RiskScore with respect to the latent space sampling point, move the sampling point along the gradient direction, re-decode, and iterate until the RiskScore is greater than or equal to 0.6 or the number of iterations reaches 10. In this test, the effective sample rate was 72%, that is, 72 out of 100 sets of parameters met the risk constraint, and the 72 sets of generalized parameter combinations that met the constraint were output.
[0149] Step S6 performs closed-loop feedback optimization, inputting 72 sets of generalized parameters into the CARLA simulation engine to generate 72 rear-end collision simulation scenarios. The effectiveness of the scenarios is verified based on the collision detection results of the simulation engine: if a set of parameters does not produce a rear-end collision in the simulation, the sampling probability of that parameter region is reduced; if a set of parameters produces a severe collision and has a high RiskScore, the sampling probability of that parameter region is increased. The Wasserstein distance between the generated scenarios and the real rear-end collision data is calculated, and the sampling distribution is adjusted based on the distance value. Steps S4 to S6 are repeated. After 3 to 5 iterations, the sampling distribution tends to stabilize, and the Wasserstein distance decreases and stabilizes below the threshold.
[0150] Specific application example two:
[0151] Taking a typical side-impact accident at an intersection as an example, the applicability of the method of the present invention under different collision types is illustrated. The original accident parameters are set as follows: vehicle speed vego = 45 km / h, target vehicle speed vagent = 30 km / h, collision angle θ = 90°, weather type is sunny with good visibility, road type is intersection, and collision type is side-impact.
[0152] Step S1 constructs a causal graph, establishing a causal chain from the vehicle's speed (vego) to its arrival time at the intersection and then to the collision time window. The vehicle's speed (vego) determines its arrival time at the intersection stop line. The intersection of the arrival time and the target vehicle's crossing time forms the collision time window. The length of the collision time window determines whether a collision occurs and its severity. A coupling relationship between the collision angle θ and the collision severity index (CSI) is established. Collision dynamics analysis shows that the collision energy of a side impact is proportional to sin(θ).
[0153] The collision energy reaches its maximum value when θ = 90°. This proportional relationship originates from the side-impact energy decomposition in collision dynamics, and this application uses it to establish the coupling relationship between the collision angle θ and the collision severity index (CSI). Boundary constraints based on the intersection road type are superimposed: the speed limit inside the intersection is 40 km / h, meaning the initial speeds of vego and vagent are constrained by the road type.
[0154] Step S2 performs causal constraint mapping, calculating the causal influence of the core parameters: CI for the collision time window = 0.88, CI for the collision angle θ = 0.75, and CI for CSI = 0.82. After mapping to latent space dimension weights, the sampling variance of the corresponding dimensions of the core parameters is adjusted accordingly. A coupling constraint is established between the collision angle θ and CSI, forming an elliptical feasible region boundary in the latent space.
[0155] The execution flow of steps S3 to S6 is similar to that of the specific application example 1. The difference lies in that the collision type in the condition vector c is set to side collision, and the TTC threshold in the hazard constraint is adjusted according to the characteristics of side collision, using a collision urgency index specifically for side collisions. Latent space directional sampling can be performed along the direction of a short collision time window or a large collision angle to generate diverse side collision hazard scenarios.
[0156] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention. Therefore, the embodiments should be regarded as exemplary and non-limiting in all respects.
[0157] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
Claims
1. A method for constructing hazardous scenarios in autonomous driving simulation based on accident parameter generalization, comprising inputting an accident parameter vector and generating a generalized parameter combination, characterized in that: Construct a causal graph and constraint graph for accident parameters, divide parameter nodes into environmental, behavioral and consequence layers, establish directed causal edges through a structural causal model framework, calculate partial correlation coefficients and conditional mutual information for parameter pairs to quantify coupling degree, and superimpose physical constraints, boundary constraints and causal constraints to form a constraint graph. Design an algorithm to map causal constraints to the feasible region of the latent space. Normalize the causal influence degree and map it to the latent space dimension weight. Adjust the sampling variance according to the latent space dimension weight and the causal constraint strength coefficient. Construct elliptic inequality constraints for nonlinearly coupled parameter pairs. Project the latent space sampling points that do not satisfy the elliptic inequality constraints to the constraint boundary along the ellipse normal direction. The conditional variational autoencoder is trained by dividing the latent space into a core parameter subspace and an auxiliary parameter subspace, and is trained by orthogonal decoupling loss, inter-layer consistency loss and hierarchical regularization loss. Constrained sampling is performed in the latent space, and differential sampling variance is used for the core parameter subspace and the auxiliary parameter subspace; The generated parameters are projected into the implicit space using risk assessment constraints. The generalized parameter combination is input into the simulation engine to generate hazardous scenarios and perform closed-loop feedback optimization.
2. The method according to claim 1, characterized in that: In designing an algorithm to map causal constraints to the feasible region of the latent space, constructing elliptic inequality constraints includes: With parameter nodes and parameter nodes Corresponding latent space sample value and latent space sample values For two-dimensional joint variables, with parameter nodes and parameter nodes Sampling variance corresponding to the latent space dimension and sampling variance Parameter nodes and parameter nodes Coupling coefficient and feasible region boundary coefficients Construct elliptic inequality constraints; Coupling coefficient Take the partial correlation coefficient obtained from the coupling metric.
3. The method according to claim 1, characterized in that: Projecting latent space sampling points that do not satisfy the elliptic inequality constraint onto the constraint boundary along the ellipse normal direction includes: Calculate the equation value of the ellipse elliptic equation value The difference between the left and right sides of the elliptic inequality constraint is the value obtained by subtracting the right side from the left side. When the ellipse equation value When the gradient is greater than zero, calculate the gradient of the elliptic equation. ; Projecting the latent space sampling points onto the elliptical boundary along the inverse direction of the gradient, the projection formula is: in, These are the latent space sampling points after projection. These are the latent space sampling points before projection. The value of the ellipse equation. The gradient of the equation of the ellipse. gradient L2 norm, gradient The square of the L2 norm; If after one projection If it is still greater than zero, repeat the projection calculation until... Less than or equal to zero or the maximum number of iterations of 10 is reached.
4. The method according to claim 1, characterized in that: In the algorithm for mapping causal constraints to the feasible region of the latent space, a causal propagation layer is added before the decoder of the conditional variational autoencoder. The effective range of the auxiliary parameter subspace is calculated based on the sampled values of the core parameter subspace and the functional relationships between parameters defined by the causal graph. The calculation formula is as follows: in, For the effective range of the auxiliary parameter subspace, These are the sampled values from the core parameter subspace. The functional relationships between parameters are defined by the cause-effect graph; A pruning operation is performed on the sampled values of the auxiliary parameter subspace. If the sampled values of the auxiliary parameter subspace exceed the valid range of the auxiliary parameter subspace, then the boundary value of the valid range of the auxiliary parameter subspace is taken.
5. The method according to claim 1, characterized in that: In the training conditional variational autoencoder, the latent space has a dimension of 16. The first 8 dimensions of the latent space are the core parameter subspace, and the last 8 dimensions of the latent space are the auxiliary parameter subspace. The core parameter subspace corresponds to the collision point position, relative velocity, and collision time. and collision angle; The auxiliary parameter subspace corresponds to the vehicle model and color; The sampling variance of the core parameter subspace is set to 0.3, and the sampling variance of the auxiliary parameter subspace is set to 1.
0.
6. The method according to claim 5, characterized in that: When performing constrained sampling in the latent space The sampling variance of the core parameter subspace is based on 0.3, and is further adjusted according to the latent space dimension weight and causal constraint strength coefficient of each parameter node in the core parameter subspace. The sampling variance of the auxiliary parameter subspace is further adjusted based on the latent space dimension weight and causal constraint strength coefficient of each parameter node in the auxiliary parameter subspace, with a base of 1.
0. For dimensions with high causal influence, the sampling variance is further reduced based on the sampling variance of the core parameter subspace or the sampling variance of the auxiliary parameter subspace.
7. The method according to claim 1, characterized in that: In constructing the causal graph and constraint graph of accident parameters, directed causal edges are established through three sources: accident report text, structured accident parameter data, and domain knowledge. The accident report text source uses a pre-trained text classification model to identify statements containing causal relationships, and uses dependency parsing to extract cause nodes and result nodes connected by causal trigger words; The structured accident parameter data source uses the PC algorithm or GES algorithm to learn the causal structure, and the causal edges between parameters are determined by the conditional independence test; Domain knowledge sources include traffic regulations, vehicle dynamics equations, and physical constraints to modify causal graphs; The quantification of coupling degree includes: calculating the partial correlation coefficient for the parameter pair, and determining that there is a coupling relationship when the absolute value of the partial correlation coefficient is greater than 0.3 and the test probability value is less than 0.05; The conditional dependence of coupling strength is quantified by conditional mutual information. When the difference in conditional mutual information exceeds the threshold of 0.2, it is determined that there is a conditionally dependent nonlinear coupling relationship.
8. The method according to claim 1, characterized in that: Latent space projection of generated parameters through hazard assessment constraints includes: Establish collision urgency indicators and collision consequence severity indicators, with the collision urgency indicator based on collision time. The severity index of collision consequences was determined by comparing it with the severe collision threshold of 0.97s and the mild collision threshold of 1.51s. Sure; Calculate the overall risk score Comprehensive risk score It is obtained by weighted summation of the collision time normalization mapping function and the collision severity index normalization mapping function; When the comprehensive risk score When the risk level is below the risk threshold of 0.6, calculate the comprehensive risk score. For the gradient of the latent space sampling points, move the latent space sampling points along the gradient direction, re-decode, and iterate until the comprehensive risk score is obtained. Greater than or equal to 0.6 or reaching the maximum number of iterations of 10.
9. The method according to claim 1, characterized in that: Performing closed-loop feedback optimization includes: converting the generalized parameter combination into a scene configuration file required by the simulation engine; If the simulation engine detects an actual collision, it will calculate the overall hazard level. The overall hazard score will remain unchanged if the simulation engine does not detect an actual collision. Multiply by a reduction factor of 0.5; Wasserstein distance is used to measure the difference in distribution between generated scenarios and real accident data in the parameter space. Wasserstein distance is calculated for each parameter dimension, and then the arithmetic mean of Wasserstein distances for all dimensions is taken to obtain the overall distribution rationality index. Based on the revised comprehensive risk score The evaluation scores for each parameter region are calculated based on the overall distribution rationality index, and the sampling probability is adjusted according to the evaluation scores. Calculate the absolute value of the difference between the current Wasserstein distance and the previous Wasserstein distance. If the absolute value of the difference is less than the preset threshold of 0.01 for two consecutive rounds, stop the iteration and output the final generalization parameter combination.
10. The method according to claim 8, characterized in that: Projecting the generated parameters into the latent space through risk assessment constraints also includes: taking the effective sample rate and comparing the effective sample rate with a preset effective sample rate threshold of 10%. When the effective sample rate is below 10%, a progressive constraint relaxation method is adopted. The first round of relaxation keeps the hard constraints of the core hazard parameters unchanged and only relaxes the constraint range of the auxiliary parameters. The second round of relaxation adjusts the collision time... The constraint threshold was relaxed from 1.5s to 1.8s while maintaining the collision severity index. With constraints unchanged, each round of relaxation operations records the relaxation amount and the retention rate of hazardous attributes of the generated samples.
Citation Information
Patent Citations
Dangerous test scene generation method and system, electronic equipment and storage medium
CN115563020A
