Automatic driving scene generation method, device and equipment based on particle swarm algorithm

By using a particle swarm optimization algorithm to generate autonomous driving scenarios, and by optimizing trajectories with cubic Bézier curves and grid search algorithms, combined with vehicle motion recognition and scene parameter iteration, the problem of low efficiency of genetic algorithms in high-dimensional parameter calculation is solved, and efficient scene generation is achieved.

CN122470879APending Publication Date: 2026-07-28FOSHAN POWER SUPPLY BUREAU GUANGDONG POWER GRID
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FOSHAN POWER SUPPLY BUREAU GUANGDONG POWER GRID
Filing Date
2026-06-08
Publication Date
2026-07-28

AI Technical Summary

Technical Problem

Existing methods for generating autonomous driving scenarios based on genetic algorithms are inefficient in high-dimensional parameter calculations and require a large number of parameter settings, which are time-consuming and labor-intensive, and cannot ensure the efficiency of scenario generation.

Method used

An autonomous driving scene generation method based on particle swarm optimization is adopted. The method generates an optimized smooth curve by using cubic Bézier curves, optimizes the trajectory distance by combining grid search algorithm, and optimizes and iterates the scene parameters based on the target trajectory curve and vehicle action recognition results until the preset conditions are met, thus generating the target scene.

Benefits of technology

It improves the efficiency of autonomous driving scenario generation, reduces the amount of data processing, lowers the complexity of data processing, enables group collaborative search, simplifies hyperparameter settings, and ensures the high efficiency of scenario generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122470879A_ABST
    Figure CN122470879A_ABST
Patent Text Reader

Abstract

The application discloses an automatic driving scene generation method, device and equipment based on a particle swarm algorithm, which comprises the following steps: generating an optimized smooth curve according to an original trajectory curve of an automatic driving vehicle based on a cubic Bezier curve; taking the minimum trajectory distance as the target, and optimizing and searching the vehicle trajectory by using a grid search algorithm to obtain a target trajectory curve; analyzing the vehicle action according to a plurality of continuous trajectory points of the target trajectory curve to obtain a vehicle action recognition result; performing parameter optimization iteration based on the particle swarm algorithm according to the target trajectory curve, the vehicle action recognition result and a scene weather intensity coefficient until a preset iteration condition is reached to obtain an optimized parameter population; and generating an automatic driving scene according to the parameters of the optimized parameter population to obtain a target generated scene. The application can solve the technical problem that the existing scene generation scheme based on a genetic algorithm has low calculation efficiency for high-dimensional parameters, requires a large number of parameter settings, is time-consuming and laborious, and cannot ensure the efficiency of scene generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of autonomous driving technology, and in particular to a method, apparatus and device for generating autonomous driving scenes based on particle swarm optimization algorithm. Background Technology

[0002] Autonomous driving is gradually moving from the laboratory into everyday life. Unlike other artificial intelligence technologies, autonomous driving algorithms are the "brain" of autonomous vehicles, directly controlling all aspects of the vehicle's movement and thus affecting the safety of occupants. Therefore, ensuring the safety and reliability of autonomous driving algorithms has become a crucial aspect of the deployment of autonomous driving. Consequently, the industry commonly uses simulation-based testing (SBT) methods, which test the safety of autonomous driving algorithms in simulated environments using various manually or automatically constructed test scenarios. In this process, generating accurate, reliable, and realistic test scenarios is fundamental to all subsequent testing steps.

[0003] Currently, the most widely used scene generation method is based on genetic algorithms to search for various parameters within the scene and then generate a test scene based on the search parameters. However, this type of method suffers from slow convergence and low efficiency when solving high-dimensional parameter problems, i.e., generating test scenes with a large number of parameters. At the same time, genetic algorithms rely on the setting of multiple complex hyperparameters such as crossover rate and mutation rate, so the optimization process is complicated, and hyperparameter tuning is time-consuming and laborious, and the results may not be satisfactory, failing to meet current scene generation requirements. Summary of the Invention

[0004] This application provides a method, apparatus, and device for generating autonomous driving scenes based on particle swarm optimization, which addresses the technical problem that existing scene generation schemes based on genetic algorithms have low efficiency in calculating high-dimensional parameters, require a large number of parameter settings, are time-consuming and labor-intensive, and cannot ensure the efficiency of scene generation.

[0005] In view of this, the first aspect of this application provides a method for generating autonomous driving scenes based on particle swarm optimization, including:

[0006] An optimized smooth curve is generated based on the original trajectory curve of the autonomous vehicle using cubic Bézier curves. The original trajectory curve includes multiple original trajectory data.

[0007] With the goal of minimizing the trajectory distance, a grid search algorithm is used to optimize the vehicle trajectory search to obtain the target trajectory curve. The trajectory distance is the Euclidean distance between the original trajectory curve and the optimized smooth curve.

[0008] The vehicle motion is analyzed based on multiple consecutive trajectory points in the target trajectory curve to obtain the vehicle motion recognition result.

[0009] Based on the particle swarm optimization algorithm, scene parameters are optimized iteratively according to the target trajectory curve, the vehicle action recognition result and the scene weather intensity coefficient until the preset iteration conditions are met, and an optimized parameter population is obtained.

[0010] Based on the parameters of the optimized parameter population, an autonomous driving scenario is generated, resulting in the target generated scenario.

[0011] Preferably, the optimized smooth curve generated based on the cubic Bézier curve is derived from the original trajectory curve of the autonomous vehicle. The original trajectory curve includes multiple original trajectory data, including:

[0012] Multiple original trajectory data are collected from the original trajectory curve of the autonomous vehicle according to a preset sampling rate. The original trajectory data includes the vehicle's lateral offset and the vehicle's longitudinal offset.

[0013] After generating a polyline trajectory curve based on the original trajectory data, the polyline trajectory curve is smoothed using a cubic Bézier curve to obtain an optimized smooth curve.

[0014] Preferably, the step of optimizing the vehicle trajectory using a grid search algorithm with the objective of minimizing the trajectory distance to obtain the target trajectory curve, wherein the trajectory distance is the Euclidean distance between the original trajectory curve and the optimized smooth curve, includes:

[0015] The optimized smooth curve is backsampled based on the data interval of the original trajectory curve to obtain backsampled data;

[0016] The Euclidean distance between the original trajectory curve and the optimized smooth curve is calculated based on the backsampled data and the original trajectory data to obtain the trajectory distance;

[0017] With the goal of minimizing the trajectory distance, a grid search algorithm is used to optimize the trajectory data on the optimized smooth curve to obtain the target trajectory curve.

[0018] Preferably, the step of analyzing vehicle movements based on multiple consecutive trajectory points in the target trajectory curve to obtain vehicle movement recognition results includes:

[0019] Select any number of consecutive trajectory points in the target trajectory curve and calculate the lateral distance between any two adjacent trajectory points;

[0020] If the lateral distance is greater than the distance threshold, the vehicle action is determined to be a lane change; otherwise, the vehicle action is determined to be a straight-going action.

[0021] Multiple consecutive trajectory points are arbitrarily selected in the target trajectory curve. The first and last trajectory points are selected for geometric analysis, and it is determined whether the vehicle action is a turn, thus obtaining the vehicle action recognition result.

[0022] The vehicle action recognition results include lane changing, going straight, and turning.

[0023] Preferably, the step of using particle swarm optimization to iterate and optimize scene parameters based on the target trajectory curve, the vehicle motion recognition result, and the scene weather intensity coefficient until a preset iteration condition is met, thereby obtaining a population of optimized parameters, includes:

[0024] Based on the particle swarm optimization algorithm, parameter initialization processing is performed according to the target trajectory curve, the vehicle action recognition result and the scene weather intensity coefficient to obtain the initial population;

[0025] After calculating the fitness function value based on the scenario simulation results, the particle positions and velocities in the initial population are iteratively optimized based on the adaptive inertia weight until the preset iteration conditions are met, thus obtaining the optimized parameter population.

[0026] The second aspect of this application provides an autonomous driving scene generation device based on particle swarm optimization algorithm, including:

[0027] The curve optimization unit is used to generate an optimized smooth curve based on the original trajectory curve of the autonomous vehicle using a cubic Bézier curve. The original trajectory curve includes multiple original trajectory data.

[0028] The curve search unit is used to optimize the vehicle trajectory by using a grid search algorithm with the goal of minimizing the trajectory distance, and obtain the target trajectory curve. The trajectory distance is the Euclidean distance between the original trajectory curve and the optimized smooth curve.

[0029] The action recognition unit is used to analyze vehicle actions based on multiple consecutive trajectory points in the target trajectory curve to obtain vehicle action recognition results.

[0030] The parameter optimization unit is used to perform scene parameter optimization iteration based on the particle swarm algorithm, according to the target trajectory curve, the vehicle action recognition result and the scene weather intensity coefficient, until the preset iteration conditions are met, and to obtain the optimized parameter population.

[0031] The scene generation unit is used to generate an autonomous driving scene based on the parameters of the optimized parameter population, thereby obtaining the target generated scene.

[0032] Preferably, the curve optimization unit is specifically used for:

[0033] Multiple original trajectory data are collected from the original trajectory curve of the autonomous vehicle according to a preset sampling rate. The original trajectory data includes the vehicle's lateral offset and the vehicle's longitudinal offset.

[0034] After generating a polyline trajectory curve based on the original trajectory data, the polyline trajectory curve is smoothed using a cubic Bézier curve to obtain an optimized smooth curve.

[0035] Preferably, the curve search unit is specifically used for:

[0036] The optimized smooth curve is backsampled based on the data interval of the original trajectory curve to obtain backsampled data;

[0037] The Euclidean distance between the original trajectory curve and the optimized smooth curve is calculated based on the backsampled data and the original trajectory data to obtain the trajectory distance;

[0038] With the goal of minimizing the trajectory distance, a grid search algorithm is used to optimize the trajectory data on the optimized smooth curve to obtain the target trajectory curve.

[0039] Preferably, the action recognition unit is specifically used for:

[0040] Select any number of consecutive trajectory points in the target trajectory curve and calculate the lateral distance between any two adjacent trajectory points;

[0041] If the lateral distance is greater than the distance threshold, the vehicle action is determined to be a lane change; otherwise, the vehicle action is determined to be a straight-going action.

[0042] Multiple consecutive trajectory points are arbitrarily selected in the target trajectory curve. The first and last trajectory points are selected for geometric analysis, and it is determined whether the vehicle action is a turn, thus obtaining the vehicle action recognition result.

[0043] The vehicle action recognition results include lane changing, going straight, and turning.

[0044] The third aspect of this application provides an autonomous driving scene generation device based on particle swarm optimization algorithm, the device including a processor and a memory;

[0045] The memory is used to store program code and transmit the program code to the processor;

[0046] The processor is used to generate an autonomous driving scene based on the particle swarm algorithm, as described in the first aspect of the instructions in the program code.

[0047] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0048] This application provides a method for generating autonomous driving scenes based on particle swarm optimization (PSO) algorithm, comprising: generating an optimized smooth curve based on the original trajectory curve of an autonomous vehicle using a cubic Bézier curve, wherein the original trajectory curve includes multiple original trajectory data; optimizing the vehicle trajectory using a grid search algorithm with the objective of minimizing the trajectory distance to obtain a target trajectory curve, wherein the trajectory distance is the Euclidean distance between the original trajectory curve and the optimized smooth curve; analyzing vehicle actions based on multiple consecutive trajectory points in the target trajectory curve to obtain vehicle action recognition results; performing scene parameter optimization iterations based on the PSO algorithm, according to the target trajectory curve, vehicle action recognition results, and scene weather intensity coefficient, until a preset iteration condition is reached to obtain an optimized parameter population; and generating an autonomous driving scene based on the parameters of the optimized parameter population to obtain the target generated scene.

[0049] The autonomous driving scene generation method based on particle swarm optimization (PSO) provided in this application combines trajectory data and action recognition of autonomous vehicles with initial preprocessing of parameters related to autonomous driving scene generation. This not only enables data filtering but also reduces the amount of data processing, thereby lowering data processing complexity to some extent. Furthermore, choosing PSO to optimize scene construction parameters enables collaborative search, alleviating the difficulty of genetic algorithms in handling high-dimensional parameters. Moreover, the hyperparameters involved in PSO are relatively simple, requiring less time and effort to set. From an algorithmic perspective, this further improves the efficiency of scene construction parameter optimization, ensuring high-efficiency scene generation. Therefore, this application solves the technical problems of existing scene generation schemes based on genetic algorithms, which suffer from low computational efficiency for high-dimensional parameters, require numerous parameter settings, are time-consuming and labor-intensive, and cannot guarantee high-efficiency scene generation. Attached Figure Description

[0050] Figure 1 A flowchart illustrating the autonomous driving scene generation method based on particle swarm optimization algorithm provided in this application embodiment;

[0051] Figure 2 This is a schematic diagram of the structure of an autonomous driving scene generation device based on particle swarm optimization algorithm provided in an embodiment of this application. Detailed Implementation

[0052] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0053] For easier understanding, please refer to Figure 1 The embodiments of the autonomous driving scene generation method based on particle swarm optimization provided in this application include:

[0054] Step 101: Generate an optimized smooth curve based on the original trajectory curve of the autonomous vehicle using cubic Bézier curves. The original trajectory curve includes multiple original trajectory data.

[0055] Further, step 101 includes:

[0056] Multiple raw trajectory data are collected from the original trajectory curve of the autonomous vehicle according to a preset sampling rate. The raw trajectory data includes the vehicle's lateral offset and longitudinal offset.

[0057] After generating a polyline trajectory curve based on the original trajectory data, a cubic Bézier curve is used to smooth the polyline trajectory curve to obtain an optimized smooth curve.

[0058] It should be noted that autonomous driving test scenarios include, but are not limited to, virtual or real scenarios of road structure, traffic participants (e.g., vehicles, pedestrians), environmental conditions (e.g., weather, lighting), and vehicle status (e.g., speed, position); test scenarios are used to verify the safety of autonomous driving systems.

[0059] The raw trajectory curve of an autonomous vehicle includes multiple raw trajectory data, which can be expressed as: ,in, , These represent the vehicle's lateral offset and longitudinal offset, respectively. The preset sampling rate selected in this embodiment can be expressed as... The adoption rate represents the data sampling interval, i.e., the percentage of data collected per interval. Each trajectory point collects one data point; by using a preset sampling rate, multiple raw trajectory data points can be collected. Then, by connecting these data points with straight line segments, a polyline trajectory curve can be obtained.

[0060] A cubic Bézier curve is a vector parametric curve defined by four control points: two endpoints and two control points. It calculates any point on the curve using the defined start point, two control points, and end point, thereby generating target curves of arbitrary shape and curvature. Due to its good balance between smoothness, flexibility, and computational complexity, the cubic Bézier curve is the most widely used form of Bézier curve in fields such as computer graphics, typography, animation, and industrial modeling.

[0061] The core of cubic Bézier curves is a mathematical expression based on the range of values ​​for the parameter t, constructed using Bernstein basis functions. "Cubic" refers to the highest power of parameter t being 3, ensuring second-order geometric continuity (curvature continuity) at the connection points, resulting in a visually very smooth curve. In contrast, quadratic curves only guarantee tangent continuity, while higher-order curves may introduce unnecessary fluctuations and increase computational complexity. Because the polygonal trajectory curve is uneven, this embodiment uses cubic Bézier curves to smooth it, obtaining an optimized smooth curve. If the four control points are defined as... , , , Therefore, the general formula for cubic Bézier curves can be expressed as:

[0062]

[0063] Where parameters The interpolation coefficients are used for trajectory data collection. The value can generate continuous and smooth trajectory coordinate points. .

[0064] In a specific embodiment, the original trajectory curve can be the initial driving path output by the upstream decision-making module and navigation module of the autonomous vehicle, which consists of multiple sets of continuous original trajectory data. A single set of original trajectory data is a two-dimensional plane coordinate point. In some extended embodiments, it can also include heading angle, driving speed, timestamp, and road constraint attributes. All original trajectory data are arranged in sequence according to the vehicle's driving order to form a discrete set of original trajectory points.

[0065] The generated optimized smooth curve refers to the continuous smooth trajectory obtained by piecewise fitting, adaptive solution of control points, and curvature constraint correction based on the original discrete trajectory point set. It satisfies the three core conditions of position continuity, heading angle continuity, and curvature continuity during vehicle driving, avoids sudden turns and abrupt acceleration and deceleration, and improves driving comfort and driving safety.

[0066] Because the original trajectory curve is affected by navigation sampling errors, fluctuations in upstream decision-making algorithms, and sensor noise, the curve data will contain redundant points and abnormal deviations. Direct fitting will lead to distortion of the smooth curve. Therefore, this embodiment can also perform preprocessing to optimize the original trajectory. Specifically, this can include outlier removal, redundancy point simplification, and data sorting correction. Among these, outlier removal can specifically use the neighborhood distance threshold method to calculate the straight-line distance between a single trajectory point and its two adjacent points. If the distance exceeds the threshold, the trajectory point can be determined to be a noise outlier and directly removed. The threshold can be set according to the actual situation, for example, 3m for passenger cars and 1m for autonomous vehicles.

[0067] Redundant point simplification can be achieved by using the Douglas-Puk algorithm to reduce collinear redundant trajectory points. While preserving the overall direction and inflection point characteristics of the original trajectory, densely repeated sampling points within straight sections are removed, reducing the computational load for subsequent curve fitting. Data sorting correction can be performed by re-sorting all trajectory points according to timestamps or the vehicle's direction of travel, preventing fitting failures caused by misaligned trajectory points.

[0068] Limited by the fitting range of a single cubic Bézier curve, the original trajectory in this embodiment cannot be directly fitted to a large number of trajectory points locally. In this case, the original trajectory can be divided into two segmented modes, and then freely switched according to different driving scenarios.

[0069] Furthermore, to make the fitted optimized smooth curve more consistent with actual characteristics, a heading angle constraint can be added during the curve fitting process. This involves combining the vehicle's heading angle with the control point's position to ensure that the heading at the beginning and end of the curve is completely consistent with the original trajectory curve, eliminating splicing offset. Specifically, a starting tangent direction vector can be generated based on the starting heading angle, and then the coordinates of the first control point are obtained by offsetting along the positive direction of the tangent along the average spacing of trajectory points within the sub-segment. Similarly, a ending tangent direction vector can be generated based on the ending heading angle, and the coordinates of the second control point are obtained by offsetting along the negative direction of the tangent. The configured constraint conditions are: the first derivative at the starting point of the curve matches the starting heading of the original trajectory, and the first derivative at the ending point of the curve matches the ending heading of the original trajectory.

[0070] In one specific implementation method, the data point set of the original trajectory curve is first collected, totaling 18 sets of two-dimensional coordinate trajectory point data. The original trajectory is a polyline shape, with obvious curve jumps at turning points, which can easily cause steering vibration when the vehicle is driven directly. In the preprocessing stage, two sets of noise anomalies can be removed, and four sets of redundant straight line points can be simplified using the Douglas-Puk algorithm, ultimately retaining 12 sets of valid trajectory points. Next, the curvature adaptive segmentation mode can be used to identify the two turning points, dividing the trajectory into three sub-segments: a straight line segment before the curve, a right-hand curve segment, and a straight line segment after the curve. Then, a unified heading angle constraint scheme is used to solve for the intermediate control points of the cubic Bézier curves corresponding to the three sub-segments. Then, constraint correction can be performed by combining the maximum curvature of the vehicle at low speed, and three smooth curves are fitted respectively. Finally, the three curve segments are seamlessly spliced ​​together in second order, and sampling can generate the optimized trajectory, i.e., the optimized smooth curve. Moreover, after actual testing, it was found that the curvature fluctuation amplitude of the optimized trajectory was reduced by 75%, the speed change of the vehicle's steering angle was smooth, and there was no driving vibration.

[0071] Step 102: With the goal of minimizing the trajectory distance, the vehicle trajectory is optimized using a grid search algorithm to obtain the target trajectory curve. The trajectory distance is the Euclidean distance between the original trajectory curve and the optimized smooth curve.

[0072] Further, step 102 includes:

[0073] The optimized smooth curve is backsampled based on the data interval of the original trajectory curve to obtain backsampled data;

[0074] The Euclidean distance between the original trajectory curve and the optimized smoothed curve is calculated based on the backsampled data and the original trajectory data to obtain the trajectory distance.

[0075] With the goal of minimizing the trajectory distance, a grid search algorithm is used to optimize the trajectory data on the smooth curve to obtain the target trajectory curve.

[0076] It should be noted that to calculate the distance between the original trajectory curve and the optimized smoothing curve, it is necessary to determine the corresponding data points on the two curves. Therefore, the original trajectory data points on the original trajectory curve are used as a reference, and data sampling is performed on the optimized smoothing curve based on their data intervals. This embodiment uses a backsampling method to obtain multiple data points and obtain backsampled data. The backsampling operation differs from conventional forward sampling. It uses the data intervals of the original trajectory as a benchmark and performs fixed-point interpolation sampling on the continuous optimized smoothing curve in reverse to ensure that the sampling points of the optimized curve correspond one-to-one with the points of the original trajectory.

[0077] The specific backsampling process is as follows: First, the starting point of the optimized smooth curve is used as the initial sampling point for backsampling, and the driving position and time label of the first trajectory point of the original trajectory are matched synchronously. Then, with the reference sampling interval D as the step size, the cubic Bézier curve parameter t is inversely interpolated along the vehicle driving direction of the optimized smooth curve. Next, the interpolated parameter t is substituted into the cubic Bézier curve coordinate calculation formula to generate discrete sampling points. Finally, sampling is continuously iterated until the paper sampling points cover the entire optimized smooth curve, and the backsampling dataset is obtained. Moreover, the number of points and the arrangement order of the backsampling dataset are completely consistent with the original trajectory data.

[0078] Understandably, during the backsampling process, it is forbidden to change the original shape of the optimized smooth curve. Only fixed-point interpolation sampling is required. At the same time, the original trajectory timestamp parameter is bound to achieve bidirectional point alignment under the same time and driving mileage. This can avoid the matching misalignment problem caused by simple spatial sampling.

[0079] Next, the distance between data points can be calculated based on the original trajectory data and the backsampled data. Combining multiple data points to calculate the distance allows us to describe the distance between two curves, i.e., the trajectory distance. Here, Euclidean distance is chosen to describe the trajectory distance, and the specific calculation process is expressed as follows:

[0080]

[0081] in, This represents the Euclidean distance between two points on the trajectory. , These represent trajectory points on the optimized smooth curve and the original trajectory curve, respectively; This represents the function for calculating Euclidean distance.

[0082] The grid search algorithm in this embodiment is a global enumeration optimization algorithm for Bézier curve control points. By defining the parameter search interval and discrete grid for the control point coordinates, it traverses all parameter combinations within the grid and selects the control point parameters corresponding to the minimum trajectory distance. It features high algorithm stability, no loss of the global optimal solution, and adaptability to low-computing-power scenarios in vehicles. The search process requires exhaustive searching in a given parameter space, evaluating the performance of each parameter combination, and selecting the best combination. The grid search algorithm is simple, deterministic, and parallelizable, but its computational cost increases exponentially with the number of parameters and candidate values, making it only suitable for low-dimensional, small-range parameter spaces.

[0083] This embodiment uses a grid search algorithm to optimize the trajectory data on the optimized smooth curve. The search objective is to minimize the trajectory distance, that is, to minimize the distance between the optimized smooth curve and the original trajectory curve. The combination of trajectory points that meets this evaluation condition is selected. Then, the backsampled data points in the backsampling operation are removed, and the target trajectory curve is generated based on the trajectory points retained by the optimized smooth curve.

[0084] During the traversal optimization process, each set of traversal parameters needs to be refitted to generate a completely new optimized smooth curve. Then, invalid parameter combinations that result in curve curvature exceeding the vehicle's maximum steering curvature, directional jumps, or lane boundary intrusions are eliminated. Furthermore, the global trajectory distance loss of all valid parameter combinations can be calculated, and the control point combination with the smallest loss value is selected as the optimal control point. Based on the optimal control point, a cubic Bézier curve can be refitted to seamlessly stitch together multiple curve segments, thereby obtaining the target trajectory curve that satisfies both smoothness and curvature constraints while maintaining the highest degree of fit with the original trajectory.

[0085] In a specific implementation case, firstly, the initial optimized curve is backsampled with a fixed step size of 1m to obtain 12 sets of backsampled discrete points that correspond one-to-one with the original trajectory. Then, the global trajectory distance of the initial curve is calculated using the mean square error (MSE), with an initial loss value of 0.186. Next, the intermediate control points of the three Bézier curve segments are locked, the coordinate floating range is set to ±1.0m, and the grid step size is 0.1m to generate the corresponding parameter search grid. Furthermore, all grid parameter combinations are traversed, invalid solutions with excessive curvature are eliminated, and the optimal control point corresponding to the minimum loss value of 0.042 is selected. Finally, the control points are updated and the curve is refitted to generate the final target trajectory curve. After optimization, the trajectory offset is reduced by 77.4%, balancing smoothness and the fit of the original trajectory, perfectly adapting to the requirements of vehicles turning right.

[0086] It should be noted that the grid search algorithm can also employ a hierarchical grid search algorithm, which combines coarse and fine search modes. First, a large step size is used to determine the approximate range of the optimal solution, and then a smaller step size is used for finer optimization. This can reduce algorithm time by 30%-50% while maintaining accuracy. Furthermore, for critical driving areas such as curves and intersections, the weight of the Euclidean distance calculation for corresponding points can be increased to prioritize ensuring trajectory fitting accuracy in complex road sections. Moreover, in the process of multi-objective joint optimization, a constraint on minimizing curvature fluctuation can be superimposed on the minimum trajectory distance, simultaneously achieving the dual optimization goals of high trajectory fitting and high smoothness.

[0087] Step 103: Analyze vehicle actions based on multiple consecutive trajectory points in the target trajectory curve to obtain vehicle action recognition results.

[0088] Further, step 103 includes:

[0089] Select multiple consecutive trajectory points arbitrarily in the target trajectory curve, and calculate the lateral distance between any two adjacent trajectory points;

[0090] If the lateral distance is greater than the distance threshold, the vehicle action is determined to be a lane change; otherwise, the vehicle action is determined to be a straight-going action.

[0091] Multiple consecutive trajectory points are randomly selected in the target trajectory curve. The first and last trajectory points are selected for geometric analysis, and it is determined whether the vehicle action is a turn, thus obtaining the vehicle action recognition result.

[0092] Vehicle motion recognition results include lane changes, going straight, and turning.

[0093] It should be noted that the target trajectory curve includes multiple target trajectory points. The vehicle's actions can be analyzed based on these target trajectory points. This embodiment mainly considers the vehicle's actions such as lane changing, going straight, and turning.

[0094] K consecutive trajectory points can be pre-selected from multiple target trajectory points. K can range from 5 to 20, preferably 8 to 12. Selecting too few points makes the system susceptible to trajectory noise, while selecting too many points reduces the real-time performance of action recognition, hindering timely responses to vehicle dynamic changes. The lateral distance between adjacent trajectory points can then be calculated. This lateral distance directly reflects the vehicle's lateral movement, eliminating interference from longitudinal displacement. If the lateral distance exceeds a distance threshold... If the distance is less than the threshold, it indicates that the vehicle has changed lanes; This indicates that the vehicle has been traveling in a straight line.

[0095] It is understandable that lateral distance is the directional distance relative to the vehicle's direction of travel. That is, if the vehicle is traveling straight, then the lateral line is perpendicular to the line in the direction of travel. In other words, with the direction of travel as the longitudinal direction, the line perpendicular to the direction of travel is the lateral direction. The offset distance between two adjacent trajectory points in the lateral direction is the lateral distance here, which is used to characterize the magnitude of the vehicle's lateral offset.

[0096] In addition, distance threshold It needs to be set according to the actual scenario. It is a pre-calibrated lateral offset judgment threshold used to distinguish between normal straight-going disturbances and active lane-changing behavior of vehicles. Specifically, it can be calibrated according to lane width, vehicle size and driving speed. There are no restrictions here.

[0097] The turning motion is derived from analyzing arbitrarily selected m consecutive trajectory points, but geometric analysis is required based on these trajectory points. Specifically, the process involves selecting the first trajectory point from the m consecutive trajectory points. and the last trajectory point This eliminates the need to repeatedly capture the trajectory, reducing the computational load of the algorithm; then, perpendicular lines are drawn based on the tangents of the two points on the curve, and the intersection of the two perpendicular lines is denoted as... Then, at the intersection point Draw a circle with the center as the center, denoted as . The radius of the circle can be expressed as:

[0098]

[0099] Next, circle Perform uniform sampling to obtain m trajectory points; then calculate the circle based on the distance calculation formula. The distance between the trajectory and the trajectory formed by m trajectory points is the circular distance; if the circular distance is less than a threshold... If the trajectory is a turning trajectory, then the current vehicle action is a turning action. The above method can obtain the vehicle action analysis results for all trajectory points, meaning the vehicle action recognition results include going straight, changing lanes, and turning.

[0100] In a specific lane-change scenario, 10 consecutive trajectory points on the target trajectory curve can be captured, and a distance threshold of 1.5m can be set. After calculation, the lateral distance between adjacent trajectory points within the segment is 2.1m, which is greater than the distance threshold, and the vehicle action is directly determined to be a lane change.

[0101] In a specific turning scenario, 10 consecutive trajectory points can be captured. The maximum lateral distance between all adjacent points is 0.7m, which is less than the 1.5m distance threshold. Further, the vector angle between the first and last trajectory points is calculated. The deflection angle is 18°, which is greater than the 10° turning angle threshold, and the vehicle action is determined to be turning.

[0102] In a specific straight-ahead scenario, continuous trajectory points can be captured for detection. All lateral distances are less than the distance threshold, and the deflection angle of the first and last trajectory point vectors is only 4°, which does not reach the turning threshold. Therefore, the vehicle's action is determined to be straight-ahead.

[0103] Step 104: Based on the particle swarm optimization algorithm, optimize and iterate the scene parameters according to the target trajectory curve, vehicle action recognition results and scene weather intensity coefficient until the preset iteration conditions are met, and obtain the optimized parameter population.

[0104] Further, step 104 includes:

[0105] Based on the particle swarm optimization algorithm, parameter initialization is performed according to the target trajectory curve, vehicle motion recognition results and scene weather intensity coefficient to obtain the initial population;

[0106] After calculating the fitness function value based on the scenario simulation results, the position and velocity of particles in the initial population are iteratively optimized based on the adaptive inertia weight until the preset iteration conditions are met, thus obtaining the optimized parameter population.

[0107] It should be noted that after vehicle action recognition is completed, the target trajectory curve, vehicle action recognition results, and scene weather intensity coefficient are used as inputs. A particle swarm optimization (PSO) algorithm can be employed to adaptively iteratively optimize the scene parameters related to autonomous driving trajectory planning and underlying control. Since conventional fixed parameters cannot adapt to different weather conditions such as sunny, rainy, foggy, and nighttime, and cannot dynamically adapt parameters based on different vehicle actions such as straight driving, lane changing, and turning, this embodiment uses the PSO algorithm to perform iterative optimization of parameters under multiple operating conditions. It also introduces adaptive inertial weights to balance global and local search capabilities, ultimately outputting a converged population of optimized parameters. This achieves a comprehensive optimization of trajectory tracking performance, driving comfort, and driving safety under different weather conditions and driving actions.

[0108] Particle swarm optimization (PSO) is a heuristic optimization method based on swarm intelligence. It simulates the social behavior of flocks of birds or schools of fish, where individuals, or particles, collaborate to find the optimal solution within the solution space. In this algorithm, each particle represents a potential solution, possessing both position and velocity, which are continuously updated during iteration. Particles iteratively approach the optimal solution by sharing individual and collective experience. PSO does not require gradient information, making it suitable for discontinuous, non-differentiable, and highly complex problems. It has a simple structure, few parameters, fast convergence, and is easy to implement, possessing strong global search capabilities. Therefore, this embodiment selects this algorithm to iteratively optimize scene parameters, obtaining a population of optimized parameters.

[0109] In this embodiment, the parameter initialization process, besides generating the initial population, also needs to initialize various hyperparameters of the particle swarm optimization algorithm, including particle swarm size, particle dimension, and maximum number of iterations. Specific initialization operations can be performed according to actual conditions and will not be elaborated here. Generating the initial population includes initializing the positions and velocities of the particles in the population; while the optimized parameter population is a set of particles, each particle corresponding to a complete set of scene control parameters. After the population converges iteratively, all the optimal particles constitute the optimized parameter population for subsequent use.

[0110] The test scenario parameters for autonomous vehicles include, but are not limited to, trajectory curves, vehicle movements, scene weather intensity coefficients, and scene time. These scenario parameters can all be encoded as particle vectors to generate an initial population. The particle position vectors in the population are expressed as follows: ,in, This represents the motion parameters of the NPC (Non-Player Character) autonomous vehicle in the test scenario. Indicates the scene weather intensity coefficient. Indicates the time of the scene.

[0111] Furthermore, NPC autonomous vehicles are defined in contrast to EGO vehicles, which are the vehicles being tested in autonomous driving test scenarios; while NPC vehicles are other vehicles besides EGO vehicles, and NPC vehicles are often key factors that pose a safety threat to EGO vehicles.

[0112] The particle position vectors in the particle swarm are used as test scene parameters to generate and run a simulation on a simulation platform. Then, the fitness function value of each particle is calculated based on the simulation results.

[0113]

[0114] in, , These are the weighting coefficients. This refers to the time to collision, meaning that if the vehicle continues traveling at its current speed, the earliest it could collide with the other vehicle is... The time after which a collision occurs can be understood as the earliest collision time. The fitness function represents the diversity of a scene and is calculated based on the Euclidean distance of the parameters. It comprehensively assesses the danger and diversity of a scene.

[0115] This embodiment introduces adaptive inertia weights to optimize and update the fitness value, position, and velocity of individual particles in the population. The particle velocity update process can be expressed as follows:

[0116]

[0117] in, , They represent the first Second and third The particle velocity of the next step. , These are individual learning factors and group learning factors, respectively. , A random number within the interval [0,1], used to increase the randomness of the search; , These represent the optimal solution found by an individual and the optimal solution found by the entire population, respectively. This represents the position vector of the particle during iteration; This represents the adaptive inertia weight, which increases with the number of iterations. Dynamic decay:

[0118]

[0119] in, , This indicates the upper and lower limits of the adaptive inertia weight values. This represents the maximum number of iterations. Using adaptive inertia weights to update parameters can give the algorithm strong global convergence in the early stages and strong local convergence in the later stages. It can be understood that adaptive inertia weights are weight factors used in particle swarm optimization to regulate the iteration speed of particles. They can dynamically change with the number of iterations, increasing the weight in the early stages to expand the global search range and decreasing the weight in the later stages to enhance local refinement optimization, thus avoiding premature convergence or getting trapped in local optima.

[0120] After updating the particle positions and velocities, an updated particle swarm can be obtained; then, the fitness function value needs to be recalculated, and the scene operation results generated by these parameters need to be comprehensively evaluated and analyzed. At the same time, the adaptive inertia weights are updated according to the number of iterations.

[0121] If the difference between the fitness function values ​​obtained from two iterations is less than a predetermined value, or if the maximum number of iterations is reached, then the preset iteration conditions are met, and the iteration can be terminated. The resulting parameter population or parameter combination is the optimal scenario parameter population, i.e., the optimized parameter population. It can be understood that the test scenario generated by the obtained optimized parameter population meets the evaluation conditions, meaning the overall scenario evaluation result is good and can meet the needs of the actual scenario.

[0122] In a specific embodiment, taking rainy urban roads and lane-changing scenarios as an example: the weather intensity coefficient is set to 0.55, the vehicle action recognition result is lane change, and the optimized target trajectory curve is input; the particle population size is initialized to 30, and the maximum number of iterations is 100; the lateral deviation threshold is tightened in conjunction with rainy road conditions, and the steering coefficient optimization range is widened in conjunction with lane-changing actions. During the iteration process, the adaptive inertia weight is linearly reduced from 0.9 to 0.4, with the goal of minimizing the overall tracking error. When the iteration reaches the 62nd generation, the population converges, and compared with the initial fixed parameters, the trajectory tracking error is reduced by 16.3%, and the steering angular velocity fluctuation is reduced by 21.5%, which can effectively adapt to rainy lane-changing driving scenarios.

[0123] The algorithm logic can be improved according to the actual situation. For example, a dynamic learning factor can be introduced, and an adaptive inertial weight can be configured to adjust the algorithm's search performance synchronously. A chaotic initialization strategy can also be added to improve the diversity of the initial population. Alternatively, a dedicated subpopulation can be maintained for different vehicle actions to achieve differentiated and precise optimization of parameters in multiple action scenarios.

[0124] Step 105: Generate an autonomous driving scenario based on the parameters of the optimized parameter population to obtain the target generated scenario.

[0125] The scene generation process is based on the converged optimized parameter population, completing parameter parsing, parameter filtering, parameter binding, and scene element configuration. It uniformly constructs an autonomous driving simulation / real-vehicle operation scene adapted to the current driving environment and vehicle actions, and outputs the final target generated scene. Scene generation can solve the shortcomings of traditional autonomous driving scene parameters, such as single parameters, poor adaptability, and inability to dynamically update with weather and driving actions, thus improving the realism of scene simulation and the adaptability to real-vehicle trajectory tracking and control.

[0126] Specifically, in the parameter selection phase, multi-dimensional scene control parameters corresponding to all particles can be extracted from the optimized parameter population. Combined with the current real-time operating conditions and constraints, the optimal control parameter set is selected from the optimized parameter population. The selection criteria include the current scene weather intensity coefficient, vehicle motion recognition results, and the curvature characteristics of the target trajectory curve. Specifically: for highly sensitive operating conditions such as severe weather, lane changes, and turns, the globally optimal particle parameters with the lowest fitness value and the smallest safety penalty are prioritized; for normal straight-ahead sunny operating conditions, high-quality particle parameters whose fitness meets the threshold requirements can be randomly selected from the population to reduce system computational overhead.

[0127] Before building a standardized scenario, it is necessary to extract scenario elements and break down the autonomous driving target generation scenario into five basic elements, and simultaneously retrieve the corresponding pre-recorded data: First, environmental elements, which directly reuse the current scenario weather intensity coefficient and map it to weather types such as sunny, rainy, foggy, and night; second, road elements, which reconstruct the road direction, lane width, and road curvature based on the target trajectory curve; third, trajectory elements, which use the previously optimized target trajectory curve as the main driving trajectory of the scenario; fourth, vehicle elements, which input the basic physical parameters of the vehicle, including vehicle size, maximum steering angle, and maximum speed; and fifth, control elements, which import the optimal scenario parameters obtained from the above screening as the underlying control constraints of the vehicle.

[0128] Next, the parameters are mapped to the corresponding control modules of the scene to complete the scene parameter configuration. Specifically, the selected optimal parameter combination is mapped to the corresponding control modules of the scene. The trajectory tracking weight parameter is applied to the path tracking module to adjust the degree to which the vehicle follows the target trajectory; the steering damping coefficient and steering response coefficient are configured to the lateral control module to match the steering characteristics under turning and lane changing actions; the speed constraint coefficient and acceleration / deceleration constraint coefficient are configured to the longitudinal control module, and combined with the weather intensity coefficient, the maximum driving speed and impact are dynamically limited; the lateral deviation threshold is used as the scene safety constraint threshold to determine whether the vehicle has a risk of lane departure under the current weather conditions.

[0129] Finally, environmental elements, road elements, trajectory elements, vehicle elements, and optimized control elements are structurally integrated to complete the scene format encapsulation and generate a complete target generation scene. The target generation scene has a unified data interface, which can be imported into simulation software such as Prescan and Carsim for multi-condition autonomous driving algorithm verification; on the other hand, it can be directly sent to the on-board planning and control unit to realize dynamic parameter adaptive control in real vehicle environment.

[0130] Taking a left-turn scenario in urban rainy weather as an example: The optimal particle parameters are selected globally based on the optimized parameter population; a light rain condition with a weather intensity coefficient of 0.6 is retrieved, and left-turn vehicle actions are bound to it, with the Bézier-optimized target trajectory curve imported; the optimized steering damping parameters, low-speed tracking parameters, and maximum lateral deviation parameters for rainy weather are configured to the lateral and longitudinal control modules respectively; all elements are integrated and encapsulated to generate the target generation scenario. In this scenario, the vehicle can adapt to the low-adhesion road surface characteristics in rainy weather, reducing steering vibration and improving the accuracy of curve trajectory tracking.

[0131] In addition, multiple sets of optimization parameters with different gradients can be imported from the population at the same time according to actual needs to generate multiple sets of differentiated parallel scenarios, which are adapted to three driving styles: aggressive, neutral, and conservative. Historical optimization parameters can also be stored to build a scenario parameter database, enabling rapid reuse of similar weather and vehicle action scenarios and improving scenario generation efficiency.

[0132] The autonomous driving scene generation method based on particle swarm optimization (PSO) provided in this application combines trajectory data and action recognition of autonomous vehicles with initial preprocessing of parameters related to autonomous driving scene generation. This not only enables data filtering but also reduces the amount of data processing, thereby lowering data processing complexity to some extent. Furthermore, choosing PSO to optimize scene construction parameters enables collaborative search, alleviating the difficulty of genetic algorithms in handling high-dimensional parameters. Moreover, the hyperparameters involved in PSO are relatively simple, requiring less time and effort to set; this further improves the efficiency of scene construction parameter optimization from an algorithmic perspective, ensuring high efficiency in scene generation. Therefore, this application addresses the technical problems of existing scene generation schemes based on genetic algorithms, which suffer from low computational efficiency for high-dimensional parameters, require numerous parameter settings, are time-consuming and labor-intensive, and cannot guarantee high efficiency in scene generation.

[0133] For easier understanding, please refer to Figure 2 This application provides an embodiment of an autonomous driving scene generation device based on particle swarm optimization algorithm, including:

[0134] The curve optimization unit 201 is used to generate an optimized smooth curve based on the original trajectory curve of the autonomous vehicle using a cubic Bézier curve. The original trajectory curve includes multiple original trajectory data.

[0135] The curve search unit 202 is used to optimize the vehicle trajectory search using a grid search algorithm with the goal of minimizing the trajectory distance, and obtain the target trajectory curve. The trajectory distance is the Euclidean distance between the original trajectory curve and the optimized smooth curve.

[0136] The action recognition unit 203 is used to analyze vehicle actions based on multiple consecutive trajectory points in the target trajectory curve to obtain vehicle action recognition results.

[0137] The parameter optimization unit 204 is used to perform scene parameter optimization iteration based on the particle swarm algorithm, according to the target trajectory curve, vehicle action recognition results and scene weather intensity coefficient, until the preset iteration conditions are met, and to obtain the optimized parameter population.

[0138] The scene generation unit 205 is used to generate an autonomous driving scene based on the parameters of the optimized parameter population, thereby obtaining the target generated scene.

[0139] Furthermore, the curve optimization unit 201 is specifically used for:

[0140] Multiple raw trajectory data are collected from the original trajectory curve of the autonomous vehicle according to a preset sampling rate. The raw trajectory data includes the vehicle's lateral offset and longitudinal offset.

[0141] After generating a polyline trajectory curve based on the original trajectory data, a cubic Bézier curve is used to smooth the polyline trajectory curve to obtain an optimized smooth curve.

[0142] Furthermore, the curve search unit 202 is specifically used for:

[0143] The optimized smooth curve is backsampled based on the data interval of the original trajectory curve to obtain backsampled data;

[0144] The Euclidean distance between the original trajectory curve and the optimized smoothed curve is calculated based on the backsampled data and the original trajectory data to obtain the trajectory distance.

[0145] With the goal of minimizing the trajectory distance, a grid search algorithm is used to optimize the trajectory data on the smooth curve to obtain the target trajectory curve.

[0146] Furthermore, the action recognition unit 203 is specifically used for:

[0147] Select multiple consecutive trajectory points arbitrarily in the target trajectory curve, and calculate the lateral distance between any two adjacent trajectory points;

[0148] If the lateral distance is greater than the distance threshold, the vehicle action is determined to be a lane change; otherwise, the vehicle action is determined to be a straight-going action.

[0149] Multiple consecutive trajectory points are randomly selected in the target trajectory curve. The first and last trajectory points are selected for geometric analysis, and it is determined whether the vehicle action is a turn, thus obtaining the vehicle action recognition result.

[0150] Vehicle motion recognition results include lane changes, going straight, and turning.

[0151] Furthermore, the parameter optimization unit is specifically used for:

[0152] Based on the particle swarm optimization algorithm, parameter initialization processing is performed according to the target trajectory curve, the vehicle action recognition result and the scene weather intensity coefficient to obtain the initial population;

[0153] After calculating the fitness function value based on the scenario simulation results, the particle positions and velocities in the initial population are iteratively optimized based on the adaptive inertia weight until the preset iteration conditions are met, thus obtaining the optimized parameter population.

[0154] It should be noted that autonomous driving test scenarios include, but are not limited to, virtual or real scenarios of road structure, traffic participants (e.g., vehicles, pedestrians), environmental conditions (e.g., weather, lighting), and vehicle status (e.g., speed, position); test scenarios are used to verify the safety of autonomous driving systems.

[0155] The raw trajectory curve of an autonomous vehicle includes multiple raw trajectory data, which can be expressed as: ,in, , These represent the vehicle's lateral offset and longitudinal offset, respectively. The preset sampling rate selected in this embodiment can be expressed as... The adoption rate represents the data sampling interval, i.e., the percentage of data collected per interval. Each trajectory point collects one data point; by using a preset sampling rate, multiple raw trajectory data points can be collected. Then, by connecting these data points with straight line segments, a polyline trajectory curve can be obtained.

[0156] A cubic Bézier curve is a vector parametric curve defined by four control points: two endpoints and two control points. It calculates any point on the curve using the defined start point, two control points, and end point, thereby generating target curves of arbitrary shape and curvature. Due to its good balance between smoothness, flexibility, and computational complexity, the cubic Bézier curve is the most widely used form of Bézier curve in fields such as computer graphics, typography, animation, and industrial modeling.

[0157] The core of cubic Bézier curves is a mathematical expression based on the range of values ​​for the parameter t, constructed using Bernstein basis functions. "Cubic" refers to the highest power of parameter t being 3, ensuring second-order geometric continuity (curvature continuity) at the connection points, resulting in a visually very smooth curve. In contrast, quadratic curves only guarantee tangent continuity, while higher-order curves may introduce unnecessary fluctuations and increase computational complexity. Because the polygonal trajectory curve is uneven, this embodiment uses cubic Bézier curves to smooth it, obtaining an optimized smooth curve. If the four control points are defined as... , , , Therefore, the general formula for cubic Bézier curves can be expressed as:

[0158]

[0159] Where parameters The interpolation coefficients are used for trajectory data collection. The value can generate continuous and smooth trajectory coordinate points. .

[0160] In a specific embodiment, the original trajectory curve can be the initial driving path output by the upstream decision-making module and navigation module of the autonomous vehicle, which consists of multiple sets of continuous original trajectory data. A single set of original trajectory data is a two-dimensional plane coordinate point. In some extended embodiments, it can also include heading angle, driving speed, timestamp, and road constraint attributes. All original trajectory data are arranged in sequence according to the vehicle's driving order to form a discrete set of original trajectory points.

[0161] The generated optimized smooth curve refers to the continuous smooth trajectory obtained by piecewise fitting, adaptive solution of control points, and curvature constraint correction based on the original discrete trajectory point set. It satisfies the three core conditions of position continuity, heading angle continuity, and curvature continuity during vehicle driving, avoids sudden turns and abrupt acceleration and deceleration, and improves driving comfort and driving safety.

[0162] Because the original trajectory curve is affected by navigation sampling errors, fluctuations in upstream decision-making algorithms, and sensor noise, the curve data will contain redundant points and abnormal deviations. Direct fitting will lead to distortion of the smooth curve. Therefore, this embodiment can also perform preprocessing to optimize the original trajectory. Specifically, this can include outlier removal, redundancy point simplification, and data sorting correction. Among these, outlier removal can specifically use the neighborhood distance threshold method to calculate the straight-line distance between a single trajectory point and its two adjacent points. If the distance exceeds the threshold, the trajectory point can be determined to be a noise outlier and directly removed. The threshold can be set according to the actual situation, for example, 3m for passenger cars and 1m for autonomous vehicles.

[0163] Redundant point simplification can be achieved by using the Douglas-Puk algorithm to reduce collinear redundant trajectory points. While preserving the overall direction and inflection point characteristics of the original trajectory, densely repeated sampling points within straight sections are removed, reducing the computational load for subsequent curve fitting. Data sorting correction can be performed by re-sorting all trajectory points according to timestamps or the vehicle's direction of travel, preventing fitting failures caused by misaligned trajectory points.

[0164] Limited by the fitting range of a single cubic Bézier curve, the original trajectory in this embodiment cannot be directly fitted to a large number of trajectory points locally. In this case, the original trajectory can be divided into two segmented modes, and then freely switched according to different driving scenarios.

[0165] Furthermore, to make the fitted optimized smooth curve more consistent with actual characteristics, a heading angle constraint can be added during the curve fitting process. This involves combining the vehicle's heading angle with the control point's position to ensure that the heading at the beginning and end of the curve is completely consistent with the original trajectory curve, eliminating splicing offset. Specifically, a starting tangent direction vector can be generated based on the starting heading angle, and then the coordinates of the first control point are obtained by offsetting along the positive direction of the tangent along the average spacing of trajectory points within the sub-segment. Similarly, a ending tangent direction vector can be generated based on the ending heading angle, and the coordinates of the second control point are obtained by offsetting along the negative direction of the tangent. The configured constraint conditions are: the first derivative at the starting point of the curve matches the starting heading of the original trajectory, and the first derivative at the ending point of the curve matches the ending heading of the original trajectory.

[0166] In one specific implementation method, the data point set of the original trajectory curve is first collected, totaling 18 sets of two-dimensional coordinate trajectory point data. The original trajectory is a polyline shape, with obvious curve jumps at turning points, which can easily cause steering vibration when the vehicle is driven directly. In the preprocessing stage, two sets of noise anomalies can be removed, and four sets of redundant straight line points can be simplified using the Douglas-Puk algorithm, ultimately retaining 12 sets of valid trajectory points. Next, the curvature adaptive segmentation mode can be used to identify the two turning points, dividing the trajectory into three sub-segments: a straight line segment before the curve, a right-hand curve segment, and a straight line segment after the curve. Then, a unified heading angle constraint scheme is used to solve for the intermediate control points of the cubic Bézier curves corresponding to the three sub-segments. Then, constraint correction can be performed by combining the maximum curvature of the vehicle at low speed, and three smooth curves are fitted respectively. Finally, the three curve segments are seamlessly spliced ​​together in second order, and sampling can generate the optimized trajectory, i.e., the optimized smooth curve. Moreover, after actual testing, it was found that the curvature fluctuation amplitude of the optimized trajectory was reduced by 75%, the speed change of the vehicle's steering angle was smooth, and there was no driving vibration.

[0167] It should be noted that to calculate the distance between the original trajectory curve and the optimized smoothing curve, it is necessary to determine the corresponding data points on the two curves. Therefore, the original trajectory data points on the original trajectory curve are used as a reference, and data sampling is performed on the optimized smoothing curve based on their data intervals. This embodiment uses a backsampling method to obtain multiple data points and obtain backsampled data. The backsampling operation differs from conventional forward sampling. It uses the data intervals of the original trajectory as a benchmark and performs fixed-point interpolation sampling on the continuous optimized smoothing curve in reverse to ensure that the sampling points of the optimized curve correspond one-to-one with the points of the original trajectory.

[0168] The specific backsampling process is as follows: First, the starting point of the optimized smooth curve is used as the initial sampling point for backsampling, and the driving position and time label of the first trajectory point of the original trajectory are matched synchronously. Then, with the reference sampling interval D as the step size, the cubic Bézier curve parameter t is inversely interpolated along the vehicle driving direction of the optimized smooth curve. Next, the interpolated parameter t is substituted into the cubic Bézier curve coordinate calculation formula to generate discrete sampling points. Finally, sampling is continuously iterated until the paper sampling points cover the entire optimized smooth curve, and the backsampling dataset is obtained. Moreover, the number of points and the arrangement order of the backsampling dataset are completely consistent with the original trajectory data.

[0169] Understandably, during the backsampling process, it is forbidden to change the original shape of the optimized smooth curve. Only fixed-point interpolation sampling is required. At the same time, the original trajectory timestamp parameter is bound to achieve bidirectional point alignment under the same time and driving mileage. This can avoid the matching misalignment problem caused by simple spatial sampling.

[0170] Next, the distance between data points can be calculated based on the original trajectory data and the backsampled data. Combining multiple data points to calculate the distance allows us to describe the distance between two curves, i.e., the trajectory distance. Here, Euclidean distance is chosen to describe the trajectory distance, and the specific calculation process is expressed as follows:

[0171]

[0172] in, This represents the Euclidean distance between two points on the trajectory. , These represent trajectory points on the optimized smooth curve and the original trajectory curve, respectively; This represents the function for calculating Euclidean distance.

[0173] The grid search algorithm in this embodiment is a global enumeration optimization algorithm for Bézier curve control points. By defining the parameter search interval and discrete grid for the control point coordinates, it traverses all parameter combinations within the grid and selects the control point parameters corresponding to the minimum trajectory distance. It features high algorithm stability, no loss of the global optimal solution, and adaptability to low-computing-power scenarios in vehicles. The search process requires exhaustive searching in a given parameter space, evaluating the performance of each parameter combination, and selecting the best combination. The grid search algorithm is simple, deterministic, and parallelizable, but its computational cost increases exponentially with the number of parameters and candidate values, making it only suitable for low-dimensional, small-range parameter spaces.

[0174] This embodiment uses a grid search algorithm to optimize the trajectory data on the optimized smooth curve. The search objective is to minimize the trajectory distance, that is, to minimize the distance between the optimized smooth curve and the original trajectory curve. The combination of trajectory points that meets this evaluation condition is selected. Then, the backsampled data points in the backsampling operation are removed, and the target trajectory curve is generated based on the trajectory points retained by the optimized smooth curve.

[0175] During the traversal optimization process, each set of traversal parameters needs to be refitted to generate a completely new optimized smooth curve. Then, invalid parameter combinations that result in curve curvature exceeding the vehicle's maximum steering curvature, directional jumps, or lane boundary intrusions are eliminated. Furthermore, the global trajectory distance loss of all valid parameter combinations can be calculated, and the control point combination with the smallest loss value is selected as the optimal control point. Based on the optimal control point, a cubic Bézier curve can be refitted to seamlessly stitch together multiple curve segments, thereby obtaining the target trajectory curve that satisfies both smoothness and curvature constraints while maintaining the highest degree of fit with the original trajectory.

[0176] In a specific implementation case, firstly, the initial optimized curve is backsampled with a fixed step size of 1m to obtain 12 sets of backsampled discrete points that correspond one-to-one with the original trajectory. Then, the global trajectory distance of the initial curve is calculated using the mean square error (MSE), with an initial loss value of 0.186. Next, the intermediate control points of the three Bézier curve segments are locked, the coordinate floating range is set to ±1.0m, and the grid step size is 0.1m to generate the corresponding parameter search grid. Furthermore, all grid parameter combinations are traversed, invalid solutions with excessive curvature are eliminated, and the optimal control point corresponding to the minimum loss value of 0.042 is selected. Finally, the control points are updated and the curve is refitted to generate the final target trajectory curve. After optimization, the trajectory offset is reduced by 77.4%, balancing smoothness and the fit of the original trajectory, perfectly adapting to the requirements of vehicles turning right.

[0177] It should be noted that the grid search algorithm can also employ a hierarchical grid search algorithm, which combines coarse and fine search modes. First, a large step size is used to determine the approximate range of the optimal solution, and then a smaller step size is used for finer optimization. This can reduce algorithm time by 30%-50% while maintaining accuracy. Furthermore, for critical driving areas such as curves and intersections, the weight of the Euclidean distance calculation for corresponding points can be increased to prioritize ensuring trajectory fitting accuracy in complex road sections. Moreover, in the process of multi-objective joint optimization, a constraint on minimizing curvature fluctuation can be superimposed on the minimum trajectory distance, simultaneously achieving the dual optimization goals of high trajectory fitting and high smoothness.

[0178] It should be noted that the target trajectory curve includes multiple target trajectory points. The vehicle's actions can be analyzed based on these target trajectory points. This embodiment mainly considers the vehicle's actions such as lane changing, going straight, and turning.

[0179] K consecutive trajectory points can be pre-selected from multiple target trajectory points. K can range from 5 to 20, preferably 8 to 12. Selecting too few points makes the system susceptible to trajectory noise, while selecting too many points reduces the real-time performance of action recognition, hindering timely responses to vehicle dynamic changes. The lateral distance between adjacent trajectory points can then be calculated. This lateral distance directly reflects the vehicle's lateral movement, eliminating interference from longitudinal displacement. If the lateral distance exceeds a distance threshold... If the distance is less than the threshold, it indicates that the vehicle has changed lanes; This indicates that the vehicle has been traveling in a straight line.

[0180] It is understandable that lateral distance is the directional distance relative to the vehicle's direction of travel. That is, if the vehicle is traveling straight, then the lateral line is perpendicular to the line in the direction of travel. In other words, with the direction of travel as the longitudinal direction, the line perpendicular to the direction of travel is the lateral direction. The offset distance between two adjacent trajectory points in the lateral direction is the lateral distance here, which is used to characterize the magnitude of the vehicle's lateral offset.

[0181] In addition, distance threshold It needs to be set according to the actual scenario. It is a pre-calibrated lateral offset judgment threshold used to distinguish between normal straight-going disturbances and active lane-changing behavior of vehicles. Specifically, it can be calibrated according to lane width, vehicle size and driving speed. There are no restrictions here.

[0182] The turning motion is derived from analyzing arbitrarily selected m consecutive trajectory points, but geometric analysis is required based on these trajectory points. Specifically, the process involves selecting the first trajectory point from the m consecutive trajectory points. and the last trajectory point This eliminates the need to repeatedly capture the trajectory, reducing the computational load of the algorithm; then, perpendicular lines are drawn based on the tangents of the two points on the curve, and the intersection of the two perpendicular lines is denoted as... Then, at the intersection point Draw a circle with the center as the center, denoted as . The radius of the circle can be expressed as:

[0183]

[0184] Next, circle Perform uniform sampling to obtain m trajectory points; then calculate the circle based on the distance calculation formula. The distance between the trajectory and the trajectory formed by m trajectory points is the circular distance; if the circular distance is less than a threshold... If the trajectory is a turning trajectory, then the current vehicle action is a turning action. The above method can obtain the vehicle action analysis results for all trajectory points, meaning the vehicle action recognition results include going straight, changing lanes, and turning.

[0185] In a specific lane-change scenario, 10 consecutive trajectory points on the target trajectory curve can be captured, and a distance threshold of 1.5m can be set. After calculation, the lateral distance between adjacent trajectory points within the segment is 2.1m, which is greater than the distance threshold, and the vehicle action is directly determined to be a lane change.

[0186] In a specific turning scenario, 10 consecutive trajectory points can be captured. The maximum lateral distance between all adjacent points is 0.7m, which is less than the 1.5m distance threshold. Further, the vector angle between the first and last trajectory points is calculated. The deflection angle is 18°, which is greater than the 10° turning angle threshold, and the vehicle action is determined to be turning.

[0187] In a specific straight-ahead scenario, continuous trajectory points can be captured for detection. All lateral distances are less than the distance threshold, and the deflection angle of the first and last trajectory point vectors is only 4°, which does not reach the turning threshold. Therefore, the vehicle's action is determined to be straight-ahead.

[0188] It should be noted that after vehicle action recognition is completed, the target trajectory curve, vehicle action recognition results, and scene weather intensity coefficient are used as inputs. A particle swarm optimization (PSO) algorithm can be employed to adaptively iteratively optimize the scene parameters related to autonomous driving trajectory planning and underlying control. Since conventional fixed parameters cannot adapt to different weather conditions such as sunny, rainy, foggy, and nighttime, and cannot dynamically adapt parameters based on different vehicle actions such as straight driving, lane changing, and turning, this embodiment uses the PSO algorithm to perform iterative optimization of parameters under multiple operating conditions. It also introduces adaptive inertial weights to balance global and local search capabilities, ultimately outputting a converged population of optimized parameters. This achieves a comprehensive optimization of trajectory tracking performance, driving comfort, and driving safety under different weather conditions and driving actions.

[0189] Particle swarm optimization (PSO) is a heuristic optimization method based on swarm intelligence. It simulates the social behavior of flocks of birds or schools of fish, where individuals, or particles, collaborate to find the optimal solution within the solution space. In this algorithm, each particle represents a potential solution, possessing both position and velocity, which are continuously updated during iteration. Particles iteratively approach the optimal solution by sharing individual and collective experience. PSO does not require gradient information, making it suitable for discontinuous, non-differentiable, and highly complex problems. It has a simple structure, few parameters, fast convergence, and is easy to implement, possessing strong global search capabilities. Therefore, this embodiment selects this algorithm to iteratively optimize scene parameters, obtaining a population of optimized parameters.

[0190] In this embodiment, the parameter initialization process, besides generating the initial population, also needs to initialize various hyperparameters of the particle swarm optimization algorithm, including particle swarm size, particle dimension, and maximum number of iterations. Specific initialization operations can be performed according to actual conditions and will not be elaborated here. Generating the initial population includes initializing the positions and velocities of the particles in the population; while the optimized parameter population is a set of particles, each particle corresponding to a complete set of scene control parameters. After the population converges iteratively, all the optimal particles constitute the optimized parameter population for subsequent use.

[0191] The test scenario parameters for autonomous vehicles include, but are not limited to, trajectory curves, vehicle movements, scene weather intensity coefficients, and scene time. These scenario parameters can all be encoded as particle vectors to generate an initial population. The particle position vectors in the population are expressed as follows: ,in, This represents the motion parameters of the NPC (Non-Player Character) autonomous vehicle in the test scenario. Indicates the scene weather intensity coefficient. Indicates the time of the scene.

[0192] Furthermore, NPC autonomous vehicles are defined in contrast to EGO vehicles, which are the vehicles being tested in autonomous driving test scenarios; while NPC vehicles are other vehicles besides EGO vehicles, and NPC vehicles are often key factors that pose a safety threat to EGO vehicles.

[0193] The particle position vectors in the particle swarm are used as test scene parameters to generate and run a simulation on a simulation platform. Then, the fitness function value of each particle is calculated based on the simulation results.

[0194]

[0195] in, , These are the weighting coefficients. This refers to the time to collision, meaning that if the vehicle continues traveling at its current speed, the earliest it could collide with the other vehicle is... The time after which a collision occurs can be understood as the earliest collision time. The fitness function represents the diversity of a scene and is calculated based on the Euclidean distance of the parameters. It comprehensively assesses the danger and diversity of a scene.

[0196] This embodiment introduces adaptive inertia weights to optimize and update the fitness value, position, and velocity of individual particles in the population. The particle velocity update process can be expressed as follows:

[0197]

[0198] in, , They represent the first Second and third The particle velocity of the next step. , These are individual learning factors and group learning factors, respectively. , A random number within the interval [0,1], used to increase the randomness of the search; , These represent the optimal solution found by an individual and the optimal solution found by the entire population, respectively. This represents the position vector of the particle during iteration; This represents the adaptive inertia weight, which increases with the number of iterations. Dynamic decay:

[0199]

[0200] in, , This indicates the upper and lower limits of the adaptive inertia weight values. This represents the maximum number of iterations. Using adaptive inertia weights to update parameters can give the algorithm strong global convergence in the early stages and strong local convergence in the later stages. It can be understood that adaptive inertia weights are weight factors used in particle swarm optimization to regulate the iteration speed of particles. They can dynamically change with the number of iterations, increasing the weight in the early stages to expand the global search range and decreasing the weight in the later stages to enhance local refinement optimization, thus avoiding premature convergence or getting trapped in local optima.

[0201] After updating the particle positions and velocities, an updated particle swarm can be obtained; then, the fitness function value needs to be recalculated, and the scene operation results generated by these parameters need to be comprehensively evaluated and analyzed. At the same time, the adaptive inertia weights are updated according to the number of iterations.

[0202] If the difference between the fitness function values ​​obtained from two iterations is less than a predetermined value, or if the maximum number of iterations is reached, then the preset iteration conditions are met, and the iteration can be terminated. The resulting parameter population or parameter combination is the optimal scenario parameter population, i.e., the optimized parameter population. It can be understood that the test scenario generated by the obtained optimized parameter population meets the evaluation conditions, meaning the overall scenario evaluation result is good and can meet the needs of the actual scenario.

[0203] In a specific embodiment, taking rainy urban roads and lane-changing scenarios as an example: the weather intensity coefficient is set to 0.55, the vehicle action recognition result is lane change, and the optimized target trajectory curve is input; the particle population size is initialized to 30, and the maximum number of iterations is 100; the lateral deviation threshold is tightened in conjunction with rainy road conditions, and the steering coefficient optimization range is widened in conjunction with lane-changing actions. During the iteration process, the adaptive inertia weight is linearly reduced from 0.9 to 0.4, with the goal of minimizing the overall tracking error. When the iteration reaches the 62nd generation, the population converges, and compared with the initial fixed parameters, the trajectory tracking error is reduced by 16.3%, and the steering angular velocity fluctuation is reduced by 21.5%, which can effectively adapt to rainy lane-changing driving scenarios.

[0204] The algorithm logic can be improved according to the actual situation. For example, a dynamic learning factor can be introduced, and an adaptive inertial weight can be configured to adjust the algorithm's search performance synchronously. A chaotic initialization strategy can also be added to improve the diversity of the initial population. Alternatively, a dedicated subpopulation can be maintained for different vehicle actions to achieve differentiated and precise optimization of parameters in multiple action scenarios.

[0205] The scene generation process is based on the converged optimized parameter population, completing parameter parsing, parameter filtering, parameter binding, and scene element configuration. It uniformly constructs an autonomous driving simulation / real-vehicle operation scene adapted to the current driving environment and vehicle actions, and outputs the final target generated scene. Scene generation can solve the shortcomings of traditional autonomous driving scene parameters, such as single parameters, poor adaptability, and inability to dynamically update with weather and driving actions, thus improving the realism of scene simulation and the adaptability to real-vehicle trajectory tracking and control.

[0206] Specifically, in the parameter selection phase, multi-dimensional scene control parameters corresponding to all particles can be extracted from the optimized parameter population. Combined with the current real-time operating conditions and constraints, the optimal control parameter set is selected from the optimized parameter population. The selection criteria include the current scene weather intensity coefficient, vehicle motion recognition results, and the curvature characteristics of the target trajectory curve. Specifically: for highly sensitive operating conditions such as severe weather, lane changes, and turns, the globally optimal particle parameters with the lowest fitness value and the smallest safety penalty are prioritized; for normal straight-ahead sunny operating conditions, high-quality particle parameters whose fitness meets the threshold requirements can be randomly selected from the population to reduce system computational overhead.

[0207] Before building a standardized scenario, it is necessary to extract scenario elements and break down the autonomous driving target generation scenario into five basic elements, and simultaneously retrieve the corresponding pre-recorded data: First, environmental elements, which directly reuse the current scenario weather intensity coefficient and map it to weather types such as sunny, rainy, foggy, and night; second, road elements, which reconstruct the road direction, lane width, and road curvature based on the target trajectory curve; third, trajectory elements, which use the previously optimized target trajectory curve as the main driving trajectory of the scenario; fourth, vehicle elements, which input the basic physical parameters of the vehicle, including vehicle size, maximum steering angle, and maximum speed; and fifth, control elements, which import the optimal scenario parameters obtained from the above screening as the underlying control constraints of the vehicle.

[0208] Next, the parameters are mapped to the corresponding control modules of the scene to complete the scene parameter configuration. Specifically, the selected optimal parameter combination is mapped to the corresponding control modules of the scene. The trajectory tracking weight parameter is applied to the path tracking module to adjust the degree to which the vehicle follows the target trajectory; the steering damping coefficient and steering response coefficient are configured to the lateral control module to match the steering characteristics under turning and lane changing actions; the speed constraint coefficient and acceleration / deceleration constraint coefficient are configured to the longitudinal control module, and combined with the weather intensity coefficient, the maximum driving speed and impact are dynamically limited; the lateral deviation threshold is used as the scene safety constraint threshold to determine whether the vehicle has a risk of lane departure under the current weather conditions.

[0209] Finally, environmental elements, road elements, trajectory elements, vehicle elements, and optimized control elements are structurally integrated to complete the scene format encapsulation and generate a complete target generation scene. The target generation scene has a unified data interface, which can be imported into simulation software such as Prescan and Carsim for multi-condition autonomous driving algorithm verification; on the other hand, it can be directly sent to the on-board planning and control unit to realize dynamic parameter adaptive control in real vehicle environment.

[0210] Taking a left-turn scenario in urban rainy weather as an example: The optimal particle parameters are selected globally based on the optimized parameter population; a light rain condition with a weather intensity coefficient of 0.6 is retrieved, and left-turn vehicle actions are bound to it, with the Bézier-optimized target trajectory curve imported; the optimized steering damping parameters, low-speed tracking parameters, and maximum lateral deviation parameters for rainy weather are configured to the lateral and longitudinal control modules respectively; all elements are integrated and encapsulated to generate the target generation scenario. In this scenario, the vehicle can adapt to the low-adhesion road surface characteristics in rainy weather, reducing steering vibration and improving the accuracy of curve trajectory tracking.

[0211] In addition, multiple sets of optimization parameters with different gradients can be imported from the population at the same time according to actual needs to generate multiple sets of differentiated parallel scenarios, which are adapted to three driving styles: aggressive, neutral, and conservative. Historical optimization parameters can also be stored to build a scenario parameter database, enabling rapid reuse of similar weather and vehicle action scenarios and improving scenario generation efficiency.

[0212] The autonomous driving scene generation device based on particle swarm optimization (PSO) provided in this application combines trajectory data and action recognition of autonomous vehicles with initial preprocessing of parameters related to autonomous driving scene generation. This not only enables data filtering but also reduces the amount of data processing, thereby lowering data processing complexity to some extent. Furthermore, choosing PSO to optimize scene construction parameters allows for collaborative search, alleviating the difficulty of genetic algorithms in handling high-dimensional parameters. Moreover, the hyperparameters involved in PSO are relatively simple and do not require time-consuming and laborious settings; this further improves the efficiency of scene construction parameter optimization from an algorithmic perspective, ensuring high efficiency in scene generation. Therefore, this application addresses the technical problems of existing scene generation schemes based on genetic algorithms, which suffer from low computational efficiency for high-dimensional parameters, require numerous parameter settings, are time-consuming and laborious, and cannot guarantee high efficiency in scene generation.

[0213] This application also provides an autonomous driving scene generation device based on particle swarm optimization algorithm, the device including a processor and a memory;

[0214] The memory is used to store program code and transfer the program code to the processor;

[0215] The processor is used to execute the autonomous driving scene generation method based on particle swarm optimization algorithm in the above method embodiment according to the instructions in the program code.

[0216] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0217] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0218] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0219] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for executing all or part of the steps of the methods described in the various embodiments of this application through a computer device (which may be a personal computer, server, or network device, etc.). The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.

[0220] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for generating autonomous driving scenarios based on particle swarm optimization, characterized in that, include: An optimized smooth curve is generated based on the original trajectory curve of the autonomous vehicle using cubic Bézier curves. The original trajectory curve includes multiple original trajectory data. With the goal of minimizing the trajectory distance, a grid search algorithm is used to optimize the vehicle trajectory search to obtain the target trajectory curve. The trajectory distance is the Euclidean distance between the original trajectory curve and the optimized smooth curve. The vehicle motion is analyzed based on multiple consecutive trajectory points in the target trajectory curve to obtain the vehicle motion recognition result. Based on the particle swarm optimization algorithm, scene parameters are optimized iteratively according to the target trajectory curve, the vehicle action recognition result and the scene weather intensity coefficient until the preset iteration conditions are met, and an optimized parameter population is obtained. Based on the parameters of the optimized parameter population, an autonomous driving scenario is generated, resulting in the target generated scenario.

2. The method for generating autonomous driving scenes based on particle swarm optimization as described in claim 1, characterized in that, The method for generating an optimized smooth curve based on cubic Bézier curves from the original trajectory curve of the autonomous vehicle, wherein the original trajectory curve includes multiple original trajectory data, including: Multiple original trajectory data are collected from the original trajectory curve of the autonomous vehicle according to a preset sampling rate. The original trajectory data includes the vehicle's lateral offset and the vehicle's longitudinal offset. After generating a polyline trajectory curve based on the original trajectory data, the polyline trajectory curve is smoothed using a cubic Bézier curve to obtain an optimized smooth curve.

3. The method for generating autonomous driving scenarios based on particle swarm optimization as described in claim 1, characterized in that, The process involves optimizing the vehicle trajectory using a grid search algorithm, with the goal of minimizing the trajectory distance, to obtain a target trajectory curve. The trajectory distance is the Euclidean distance between the original trajectory curve and the optimized smoothed curve, and includes: The optimized smooth curve is backsampled based on the data interval of the original trajectory curve to obtain backsampled data; The Euclidean distance between the original trajectory curve and the optimized smooth curve is calculated based on the backsampled data and the original trajectory data to obtain the trajectory distance; With the goal of minimizing the trajectory distance, a grid search algorithm is used to optimize the trajectory data on the optimized smooth curve to obtain the target trajectory curve.

4. The method for generating autonomous driving scenarios based on particle swarm optimization as described in claim 1, characterized in that, The process of analyzing vehicle movements based on multiple consecutive trajectory points in the target trajectory curve to obtain vehicle movement recognition results includes: Select any number of consecutive trajectory points in the target trajectory curve and calculate the lateral distance between any two adjacent trajectory points; If the lateral distance is greater than the distance threshold, the vehicle action is determined to be a lane change; otherwise, the vehicle action is determined to be a straight-going action. Multiple consecutive trajectory points are arbitrarily selected in the target trajectory curve. The first and last trajectory points are selected for geometric analysis, and it is determined whether the vehicle action is a turn, thus obtaining the vehicle action recognition result. The vehicle action recognition results include lane changing, going straight, and turning.

5. The method for generating autonomous driving scenes based on particle swarm optimization as described in claim 1, characterized in that, The particle swarm optimization algorithm optimizes scene parameters iteratively based on the target trajectory curve, the vehicle motion recognition result, and the scene weather intensity coefficient until a preset iteration condition is met, resulting in a population of optimized parameters, including: Based on the particle swarm optimization algorithm, parameter initialization processing is performed according to the target trajectory curve, the vehicle action recognition result and the scene weather intensity coefficient to obtain the initial population; After calculating the fitness function value based on the scenario simulation results, the particle positions and velocities in the initial population are iteratively optimized based on the adaptive inertia weight until the preset iteration conditions are met, thus obtaining the optimized parameter population.

6. An autonomous driving scene generation device based on particle swarm optimization algorithm, characterized in that, include: The curve optimization unit is used to generate an optimized smooth curve based on the original trajectory curve of the autonomous vehicle using a cubic Bézier curve. The original trajectory curve includes multiple original trajectory data. The curve search unit is used to optimize the vehicle trajectory by using a grid search algorithm with the goal of minimizing the trajectory distance, and obtain the target trajectory curve. The trajectory distance is the Euclidean distance between the original trajectory curve and the optimized smooth curve. The action recognition unit is used to analyze vehicle actions based on multiple consecutive trajectory points in the target trajectory curve to obtain vehicle action recognition results. The parameter optimization unit is used to perform scene parameter optimization iteration based on the particle swarm algorithm, according to the target trajectory curve, the vehicle action recognition result and the scene weather intensity coefficient, until the preset iteration conditions are met, and to obtain the optimized parameter population. The scene generation unit is used to generate an autonomous driving scene based on the parameters of the optimized parameter population, thereby obtaining the target generated scene.

7. The autonomous driving scene generation device based on particle swarm optimization algorithm according to claim 6, characterized in that, The curve optimization unit is specifically used for: Multiple original trajectory data are collected from the original trajectory curve of the autonomous vehicle according to a preset sampling rate. The original trajectory data includes the vehicle's lateral offset and the vehicle's longitudinal offset. After generating a polyline trajectory curve based on the original trajectory data, the polyline trajectory curve is smoothed using a cubic Bézier curve to obtain an optimized smooth curve.

8. The autonomous driving scene generation device based on particle swarm optimization algorithm according to claim 6, characterized in that, The curve search unit is specifically used for: The optimized smooth curve is backsampled based on the data interval of the original trajectory curve to obtain backsampled data; The Euclidean distance between the original trajectory curve and the optimized smooth curve is calculated based on the backsampled data and the original trajectory data to obtain the trajectory distance; With the goal of minimizing the trajectory distance, a grid search algorithm is used to optimize the trajectory data on the optimized smooth curve to obtain the target trajectory curve.

9. The autonomous driving scene generation device based on particle swarm optimization algorithm according to claim 6, characterized in that, The action recognition unit is specifically used for: Select any number of consecutive trajectory points in the target trajectory curve and calculate the lateral distance between any two adjacent trajectory points; If the lateral distance is greater than the distance threshold, the vehicle action is determined to be a lane change; otherwise, the vehicle action is determined to be a straight-going action. Multiple consecutive trajectory points are arbitrarily selected in the target trajectory curve. The first and last trajectory points are selected for geometric analysis, and it is determined whether the vehicle action is a turn, thus obtaining the vehicle action recognition result. The vehicle action recognition results include lane changing, going straight, and turning.

10. An autonomous driving scene generation device based on particle swarm optimization algorithm, characterized in that, The device includes a processor and a memory; The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the autonomous driving scene generation method based on the particle swarm algorithm as described in any one of claims 1-5 according to the instructions in the program code.