Simulation scene generation method and device, electronic equipment and storage medium

Generating autonomous driving simulation scenarios through large language model analysis and gradient updates is solved, and the problem of difficult to take into account both scenario generalization and accuracy in the existing technology is solved, and the balance between diversification and accuracy of simulation scenarios is achieved to meet the needs of autonomous driving simulation.

CN120371691APending Publication Date: 2025-07-25GUANGZHOU AUTOMOBILE GROUP CO LTD
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202510355319.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The existing autonomous driving simulation scenario generation method is difficult to take into account both the generalization and accuracy of the scenario and cannot meet the needs of autonomous driving scenarios.

Method used

The pre-trained large language model is used to parse the driving scene description language, generate execution scripts, and generate a target scene parameter set through structured mapping, loss functions and gradient updates, and finally convert the scene description file into a simulated scene file with a preset standard format.

Benefits of technology

The balance between generalization and accuracy of simulation scenario generation is achieved. The generated simulation scenario supports a variety of scenario descriptions and parameter generalization to meet the needs of autonomous driving simulation scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371691A_ABST
    Figure CN120371691A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a simulation scene generation method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a driving scene description language input by a user, employing a pre-trained large language model to analyze the driving scene description language, obtaining an execution script, carrying out the structural mapping of scene parameters in the execution script, and obtaining a simulation scene; generating a scene description file, determining a loss function of the scene parameter set, carrying out gradient updating on the scene parameter set according to the loss function to obtain a target scene parameter set, updating the scene description file according to the target scene parameter set, and carrying out format conversion on the updated scene description file to obtain the scene description file. And obtaining a simulation scene file in a preset standard format. According to the embodiment of the invention, the driving scene description language is automatically converted into the execution script by utilizing the large language model, the scene parameters are adjusted through the loss function and gradient updating, the accurate and effective simulation scene file is obtained, and the balance between generalization and accuracy of scene generation is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of driving simulation, and in particular, to a method, device, electronic device, and storage medium for generating a simulation scene. Background Art

[0002] With the progress of technology, people have paid more and more attention to the autonomous driving technology of automobiles. Autonomous driving has become a popular research field in recent years. Limited by factors such as complex and changeable traffic scenarios and expensive test costs, traditional open-road tests and closed test field tests are difficult to meet the strict requirements of autonomous driving technology for reliability and robustness. Therefore, driving simulation based on digital virtual simulation technology has become one of the important means of current autonomous driving simulation tests.

[0003] At present, the methods for generating simulation scenarios for autonomous driving mainly include two categories: one is to generate simulation scenarios for autonomous driving based on real vehicle driving videos. According to the video data generated by vehicle driving and the attitude data of the vehicle itself, the driving speed, motion trajectory, and position information of the vehicle and traffic participants are determined through a preset video ranging algorithm to form an autonomous driving simulation scenario. The other is to generate simulation scenarios for autonomous driving based on a preset scenario database. The scenario variable features are determined according to the scenario requirements in the test requirements, the target scenario variable samples are selected from the scenario variable samples in the preset scenario database, and the target simulation scenario is generated by sampling based on the data distribution characteristics of the target scenario variable samples. However, the simulation scenario generation method based on real vehicle driving videos depends on a large amount of real driving data, resulting in insufficient generalization ability and being unable to generate diverse and complex scenarios. The simulation scenario generation method based on a preset database has low authenticity and accuracy of scenario generation. Thus, it is difficult to balance the current scenario generalization and scenario accuracy, and thus it is impossible to meet the autonomous driving scenario requirements. Summary of the Invention

[0004] The embodiments of the present application provide a method, device, electronic device, and storage medium for generating a simulation scene, aiming to solve the problem that it is difficult to balance the current scenario generalization and scenario accuracy and unable to meet the autonomous driving scenario requirements, and to achieve a balance between the generalization and accuracy of the simulation scene and meet the autonomous driving scenario requirements.

[0005] To solve the above problems, the present application discloses a method for generating a simulation scene, the method comprising:

[0006] Obtain a driving scene description language input by a user;

[0007] Parse the driving scene description language by using a pre-trained large language model to obtain an execution script; wherein, the execution script includes scenario parameters corresponding to the driving scene description language;

[0008] Structurally map the scenario parameters in the execution script to generate a scenario description file; wherein, the scenario description file includes a set of scenario parameters.

[0009] Determine the loss function of the set of scenario parameters, perform gradient update on the set of scenario parameters according to the loss function to obtain a set of target scenario parameters, and update the scenario description file according to the set of target scenario parameters.

[0010] Convert the updated scenario description file to a simulation scenario file in a preset standard format.

[0011] According to the above technical means, using a large language model to automatically convert the driving scenario description language into an execution script, thereby obtaining a structured scenario description file, supporting various scenario descriptions and parameter generalization, and adjusting the scenario parameters through the loss function and gradient update, so as to convert the optimized scenario description file into an accurate and effective simulation scenario file, achieving a balance between the generalization and accuracy of scenario generation, and further meeting the needs of autonomous driving simulation scenarios.

[0012] Optionally, use a pre-trained large language model to parse the driving scenario description language to obtain an execution script; wherein, the execution script includes the scenario parameters corresponding to the driving scenario description language, including:

[0013] Input the driving scenario description language into the pre-trained large language model, use the large language model to parse the driving scenario description language, and identify the scenario parameters included in the driving scenario description language.

[0014] Convert the scenario parameters into structured data, and output an execution script according to the structured data.

[0015] According to the above technical means, using a large language model to process the driving scenario description language can quickly and accurately extract effective scenario parameters from the natural language description, reduce the workload of manual parsing, and the automatically generated execution script can be used as the basis for simulation scenarios, supporting various scenario descriptions and parameter generalization, and meeting different driving simulation requirements.

[0016] Optionally, structurally map the scenario parameters in the execution script to generate a scenario description file; wherein, the scenario description file includes a set of scenario parameters, including:

[0017] Determine the data structure of the scenario parameters in the execution script.

[0018] According to the preset mapping rules and the data structure of the scenario parameters, convert the scenario parameters into a structured table to obtain a set of scenario parameters.

[0019] Map the set of scene parameters to a preset format file to generate a scene description file.

[0020] According to the above technical means, by automatically converting an execution script into a structured table, manual operations are reduced. Through structured data processing, it is ensured that the generated Excel file is accurate, supports custom mapping rules and Excel formats, and displays the scene parameters in a table form, facilitating subsequent scene file conversion and adapting to different simulation requirements.

[0021] Optionally, determining the loss function of the set of scene parameters, performing gradient update on the set of scene parameters according to the loss function to obtain a target set of scene parameters, and updating the scene description file according to the target set of scene parameters includes:

[0022] In response to the generation of the scene description file, call a preset scene balancer; wherein, the preset scene balancer includes a loss function and a gradient update algorithm;

[0023] Determine the loss function of the set of scene parameters in the preset scene balancer, and perform gradient update on the set of scene parameters according to the loss function to obtain a target set of scene parameters;

[0024] Replace the set of scene parameters in the scene description file with the target set of scene parameters to obtain an updated scene description file.

[0025] Optionally, determining the loss function of the set of scene parameters in the preset scene balancer, performing gradient update on the set of scene parameters according to the loss function to obtain a target set of scene parameters includes:

[0026] Determine the scene parameters to be optimized in the set of scene parameters, and determine the loss function of the scene parameters to be optimized in the preset scene balancer;

[0027] Determine the target of the loss function of the scene parameters to be optimized according to the target generated by the predefined simulation scenario;

[0028] Adjust the scene parameters to be optimized using the gradient update algorithm, and monitor the loss function value of the scene parameters to be optimized;

[0029] When it is monitored that the loss function value of the scene parameters to be optimized is reduced to the target value, update the adjusted scene parameters to the target set of scene parameters.

[0030] According to the above technical means, the scene parameters are adjusted through the loss function and gradient update, so as to convert the optimized scene description file format into an accurate and effective simulation scene file, achieving a balance between the generalization and accuracy of scene generation.

[0031] Optionally, before calling the preset scene balancer in response to the generation of the scene description file, the method further includes:

[0032] Collect historical simulation scenes in advance and obtain the scene parameters in the historical simulation scenes;

[0033] Construct a scene balancer according to the scene parameters in the historical simulation scenes; wherein, the scene balancer includes a loss function and a gradient update algorithm.

[0034] According to the above technical means, the distribution of the simulation scene is optimized through the scene balancer, ensuring the balance between the generated scenes being both diverse and accurate. The generated scenes are rich and diverse and closer to the real traffic environment, meeting the requirements of the autonomous driving simulation test scene. The scene generation process is optimized through the scene balancer, reducing the generation of invalid scenes and further improving the generation efficiency of the simulation scene.

[0035] Optionally, the converting the updated scene description file into a simulation scene file in a preset standard format includes:

[0036] Create a text file in a preset standard format;

[0037] Map the set of target scene parameters in the updated scene description file to the text file for format conversion to obtain a simulation scene file.

[0038] According to the above technical means, by automatically converting an Excel file into a simulation scene file in XOSC format containing complete simulation scene information, it adapts to different simulation requirements, conforms to the simulation standard, is convenient to integrate into the simulation platform, and users can quickly generate a new XOSC file by modifying the Excel file, supporting rapid iteration and simulation testing.

[0039] To solve the above problems, the present application also discloses a simulation scene generation device, and the device includes:

[0040] An information acquisition module, configured to acquire a driving scene description language input by a user;

[0041] A script generation module, configured to parse the driving scene description language by using a pre-trained large language model to obtain an execution script; wherein, the execution script includes the scene parameters corresponding to the driving scene description language;

[0042] A file conversion module for structurally mapping the scenario parameters in the execution script to generate a scenario description file, where the scenario description file includes a set of scenario parameters;

[0043] A parameter processing module for determining a loss function for the set of scenario parameters, performing gradient update on the set of scenario parameters according to the loss function to obtain a set of target scenario parameters, and updating the scenario description file according to the set of target scenario parameters;

[0044] A scenario generation module for converting the format of the updated scenario description file to obtain a simulation scenario file in a preset standard format.

[0045] To solve the above problems, the present application also discloses an electronic device, including a processor and a memory, where

[0046] The memory is used to store a computer program;

[0047] The processor is used to execute the program stored on the memory to implement the described simulation scenario generation method.

[0048] To solve the above problems, the present application also discloses a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the described simulation scenario generation method is implemented.

[0049] Of course, it is not necessary for any product implementing the present application to simultaneously achieve all the above-mentioned advantages. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 is a flowchart of the steps of a simulation scenario generation method provided by an embodiment of the present application;

[0051] Figure 2 is a flowchart of the steps of a simulation scenario generation method provided by an embodiment of the present application;

[0052] Figure 3 is a flowchart of the steps of a simulation scenario generation method provided by an embodiment of the present application;

[0053] Figure 4 is a schematic structural diagram of a simulation scenario generation device provided by an embodiment of the present application;

[0054] Figure 5 is a schematic structural diagram of the electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0055] In order to make the technical problems, technical solutions and beneficial effects solved by this application more clear and understandable, the following further details this application in combination with embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not used to limit this application.

[0056] In the related art, on the one hand, an autonomous driving simulation scenario is generated based on a real vehicle driving video. Specifically, static road scene information is determined according to the video data generated by vehicle driving and the vehicle's own attitude data; traffic participants are identified from the video data; according to the video data and the vehicle's own attitude data, the driving speeds, motion trajectories and position information of the vehicle and traffic participants are determined through a preset video ranging algorithm; the speed, motion trajectory and position information of the vehicle and traffic participants are integrated with the static road scene information to form an autonomous driving simulation scenario. On the other hand, an autonomous driving simulation scenario is generated based on a preset scenario database. Specifically, a target functional scenario is determined according to the scenario requirements in the test requirements, and the scenario variable characteristics of the target functional scenario are determined. According to the scenario variable characteristics, a target scenario variable sample is selected from the scenario variable samples in the preset scenario database. Based on the data distribution characteristics of the target scenario variable sample, sampling is performed on the target scenario variable sample to obtain a scenario variable sampling value, and a target simulation scenario is generated based on the scenario variable sampling value for simulating and testing the to-be-tested driving system using the target simulation scenario.

[0057] There are the following problems in these two simulation scenario generation methods based on real vehicle driving videos and based on preset scenario databases: For the simulation scenario generation method based on real vehicle driving videos, it depends on a large amount of real driving data, resulting in insufficient generalization ability and being unable to generate diverse and complex scenarios. For the simulation scenario generation method based on a preset database, the authenticity and accuracy of scenario generation are relatively low. Therefore, it is difficult to balance the current scenario generalization and scenario accuracy and unable to meet the requirements of autonomous driving scenarios.

[0058] Based on this, an embodiment of the present application proposes a simulation scenario generation method. By obtaining the driving scenario description language input by the user, using a pre-trained large language model to parse the driving scenario description language to obtain an execution script, performing a structured mapping on the scenario parameters in the execution script to generate a scenario description file, determining the loss function of the scenario parameter set, performing gradient update on the scenario parameter set according to the loss function to obtain a target scenario parameter set, updating the scenario description file according to the target scenario parameter set, and converting the format of the updated scenario description file to obtain a simulation scenario file in a preset standard format. The embodiment of the present application uses a large language model to automatically convert the driving scenario description language into an execution script, thereby obtaining a structured scenario description file, supporting various scenario descriptions and parameter generalization, and adjusting the scenario parameters through the loss function and gradient update, so as to convert the optimized scenario description file format to obtain an accurate and effective simulation scenario file, achieving a balance between the generalization and accuracy of scenario generation, and further meeting the requirements of the autonomous driving simulation scenario.

[0059] Embodiment 1

[0060] An embodiment of the present application provides a simulation scenario generation method. Please refer to Figure 1 , including the following steps:

[0061] S110: Obtain the driving scenario description language input by the user.

[0062] In the embodiment of the present application, since the simulation scenario generation method based on real vehicle driving videos relies on a large amount of real driving data, resulting in insufficient generalization ability and unable to generate diverse and complex scenarios, and the simulation scenario generation method based on a preset database has low authenticity and accuracy of scenario generation. To solve the problem that it is difficult to balance the current scenario generalization and scenario accuracy and cannot meet the requirements of the autonomous driving scenario, this embodiment uses a large language model to automatically convert the driving scenario description language into an execution script, thereby obtaining a structured scenario description file, supporting various scenario descriptions and parameter generalization, and adjusting the scenario parameters through the loss function and gradient update, so as to convert the optimized scenario description file format to obtain an accurate and effective simulation scenario file, achieving a balance between the generalization and accuracy of scenario generation.

[0063] Specifically, the simulation scenario generation system of this embodiment receives the natural language input by the user and obtains the driving scenario description language input by the user. Among them, to ensure the accuracy of scenario generation, the driving scenario description language input by the user preferably includes scenario content and scenario keywords. The scenario content includes the location, environmental characteristics, vehicle characteristics, and vehicle driving parameters of the driving scenario. The keywords may include vehicles, roads, weather, traffic, etc., which will not be elaborated here one by one.

[0064] It should be noted that the natural language processing involved in the embodiments of this application is completed by a large model. Generally speaking, the input driving scenario description language includes scenario content and keywords, and the output effect of the model will be better. If the driving scenario description language does not include scenario content and keywords, the large model needs to understand the user's intention before outputting. Therefore, to ensure the accuracy of the model output content, in this embodiment, the user can directly input a standardized driving scenario description language, or preprocess the natural language input by the user to extract the driving scenario description language from a large amount of redundant natural language to obtain a more accurate description of the scenario content, further improving the accuracy of the simulation scenario generation.

[0065] S120: Parse the driving scenario description language using a pre-trained large language model to obtain an execution script; wherein, the execution script includes scenario parameters corresponding to the driving scenario description language.

[0066] In the embodiments of this application, to obtain a driving simulation scenario file that takes into account both generalization and accuracy, a parameter-structured Excel file can be generated based on the driving scenario description language input by the user, and then the Excel file can be format-converted. However, since the Excel file is not a mainstream modality such as images or code, the current large model does not have the ability to directly generate an Excel file in this modality. Therefore, in this embodiment, a pre-trained large language model is used to parse the driving scenario description language to first generate an execution script in code modality (Python script). The scenario parameter structure in the execution script is clearer and is conducive to automatic collation into an Excel file. Excel not only inherits the clear code structure of Python but is also more intuitive.

[0067] Specifically, input the driving scenario description language into the pre-trained large language model, use the large language model to parse the driving scenario description language, identify the scenario parameters included in the driving scenario description language, convert the scenario parameters into structured data, and output an execution script according to the structured data. Among them, the scenario parameters included in the driving scenario description language can be road layout parameters, traffic flow parameters, weather condition parameters, etc. In this embodiment, the execution script output by the large language model is a Python script.

[0068] It should be noted that in this embodiment, the pre-trained large language model can be a large large language model (LLM). The large large language model is a model used in the field of natural language processing to understand the structure and rules of language and achieve text understanding and generation. The pre-trained large language model needs to be provided with a large amount of text data, and the model uses this data to learn the structure, grammar, and semantics of human language. This process is usually completed through unsupervised learning. In self-supervised learning, the model generates labels for the input data by predicting the next word or token in the sequence and gives the previous words. The training process includes two main steps: pre-training and fine-tuning. In the pre-training stage, the model learns from a huge and diverse dataset, usually containing billions of words from different sources. In the fine-tuning stage, the model is further trained on a more specific and smaller dataset of simulation scenarios related to the field of autonomous driving simulation. The training process of the large language model in this embodiment is not specifically limited.

[0069] S130: Structurally map the scenario parameters in the execution script to generate a scenario description file; wherein, the scenario description file includes a set of scenario parameters.

[0070] In the embodiment of the present application, the scenario parameters in the execution script are structurally mapped to generate a scenario description file. Specifically, the data structure of the scenario parameters in the execution script is determined, the scenario parameters are converted into a structured table to obtain a set of structurally processed scenario parameters, and the set of scenario parameters is mapped to a preset format file, i.e., an Excel file, to generate a scenario description file in Excel format, realizing the conversion of the Python script generated by the large language model into a structured Excel file, which is convenient for converting the simulation scenario file according to the Excel file.

[0071] S140: Determine the loss function of the set of scenario parameters, perform gradient update on the set of scenario parameters according to the loss function to obtain a set of target scenario parameters, and update the scenario description file according to the set of target scenario parameters.

[0072] In the embodiment of the present application, after obtaining the structured scenario description file, the simulation scenario file can be obtained by format conversion according to the scenario description file, i.e., the Excel file. To further ensure the balance between the generalization and accuracy of the generated simulation scenarios, this embodiment uses a scenario balancer to optimize and adjust the generation of simulation scenarios. Through the optimization problem and gradient update algorithm, the balance between the generalization and accuracy of scenario generation is achieved, and while generating a large number of diverse scenarios, the high accuracy of the generated scenarios and the degree of fit with the actual application environment can be ensured.

[0073] Specifically, the scenario balancer in this embodiment includes a loss function and a gradient update algorithm. During the scenario conversion process, the scenario balancer is used to perform gradient update on the scenario parameter set through an optimization algorithm and the gradient update algorithm to obtain an optimized target scenario parameter set, and update the scenario description file according to the optimized target scenario parameter set. In this embodiment, first, the loss function of the scenario parameter set is determined, and the scenario parameters in the scenario parameter set are gradient-updated according to the loss function. The scenario parameters are gradually adjusted through the gradient descent method to gradually reduce the loss function. The target scenario parameter set includes the optimized and adjusted scenario parameters. Thus, the scenario parameters in the original scenario description file are replaced with the target scenario parameter set obtained after optimization to obtain an updated scenario description file.

[0074] S150: Convert the format of the updated scenario description file to obtain a simulation scenario file in a preset standard format.

[0075] In the embodiment of the present application, the format of the updated scenario description file is converted to obtain a simulation scenario file in a preset standard format. The preset standard format is the XOSC format that can be integrated into the simulation platform. Specifically, the updated scenario description file is mapped to an XML file in the XOSC format for format conversion. The pandas library is used to read the scenario parameters in the Excel file, and the scenario parameters in the Excel are mapped to the XML elements in the XOSC format to generate a simulation scenario file containing complete simulation scenario information, which conforms to the OpenSCENARIO standard and can be integrated into the simulation platform for autonomous driving simulation testing.

[0076] The embodiment of the present application proposes a simulation scenario generation method. By obtaining the driving scenario description language input by the user, a pre-trained large language model is used to parse the driving scenario description language to obtain an execution script. The scenario parameters in the execution script are structurally mapped to generate a scenario description file. The loss function of the scenario parameter set is determined, and the scenario parameter set is gradient-updated according to the loss function to obtain a target scenario parameter set. The scenario description file is updated according to the target scenario parameter set, and the format of the updated scenario description file is converted to obtain a simulation scenario file in a preset standard format. The embodiment of the present application uses the large language model to automatically convert the driving scenario description language into an execution script, thereby obtaining a structured scenario description file, supporting various scenario descriptions and parameter generalization, and adjusting the scenario parameters through the loss function and gradient update. Thus, the optimized scenario description file is format-converted to obtain an accurate and effective simulation scenario file, achieving a balance between the generalization and accuracy of scenario generation and further meeting the requirements of autonomous driving simulation scenarios.

[0077] Step S120 includes sub-step S1201 and sub-step S1202.

[0078] Sub-step S1201: Input the driving scenario description language into a pre-trained large language model, and use the large language model to parse the driving scenario description language to identify the scenario parameters included in the driving scenario description language.

[0079] Sub-step S1202: Convert the scenario parameters into structured data, and output an execution script according to the structured data.

[0080] It should be noted that in the embodiment of the present application, the driving scenario description language (natural language) input by the user is used as the input and input into a pre-trained large language model. Among them, the pre-trained large language model is, for example, a large language model (such as GPT-4, etc.), which is not specifically limited here. The large language model is used to parse the driving scenario description language, and the model identifies the scenario parameters included in the driving scenario description language. The scenario parameters parsed by the large language model are converted into structured data in Python (such as dictionaries, lists), and a Python script is generated according to the structured data for the construction and testing of the simulation scenario. The generated Python script can be saved as a file or directly returned to the user.

[0081] For example, the driving scenario description language input by the user can be "In the simulation of urban traffic roads, there are two vehicles in the scenario. A car is driving at a speed of 30 km / h, and another truck is driving at a speed of 20 km / h. The two vehicles are on the same ordinary urban road and are 100 meters apart." The large language model LLM extracts key scenario parameters from the driving scenario description language, including: vehicle information, namely type, color, speed, location, and road information, namely road length, number of lanes, etc. Other information can also be generalized, such as weather, time, traffic rules, etc. The scenario parameters parsed by the LLM are converted into structured data in Python (such as dictionaries, lists), and a Python script is generated according to the structured data. It should be noted that if the driving scenario description language input by the user is incomplete, the LLM can generalize more scenario parameters according to the context. For example, if the user does not specify the road length, the LLM can supplement the default value (such as 1000 meters), and if the user does not specify the weather, the LLM can supplement the default weather (such as sunny). Details are not elaborated here one by one.

[0082] The embodiment of the present application uses a large language model to process the driving scenario description language, which can quickly and accurately extract effective scenario parameters from the natural language description, reduce the workload of manual parsing, and the large language model can supplement missing parameters according to the context, improving the integrity and usability of the scenario description. The automatically generated Python script can be used as the basis for the simulation scenario, supporting various scenario descriptions and parameter generalization, and meeting different driving simulation requirements.

[0083] Step S130 includes sub - steps S1301, S1302, and S1303.

[0084] Sub - step S1301: Determine the data structure of the scenario parameters in the execution script.

[0085] Sub - step S1302: According to the preset mapping rules and the data structure of the scenario parameters, convert the scenario parameters into a structured table to obtain a set of scenario parameters.

[0086] Sub - step S1303: Map the set of scenario parameters to a preset format file to generate a scenario description file.

[0087] It should be noted that in the embodiments of the present application, the generated Python script is parsed into a structured Excel file. Specifically, read the Python script file, extract the scenario parameters therein, determine the data structure of the scenario parameters. The data structure includes data types. For example, the scenario parameters are vehicle information or road information. According to the preset mapping rules and the data structure of the scenario parameters, convert the scenario parameters into structured data (such as dictionaries, lists) for subsequent processing. Among them, the preset mapping rules are the mapping rules between the predefined scenario parameters and the table fields. The pandas library can be used to convert the scenario parameters into a DataFrame, and the converted DataFrame is saved as a set of scenario parameters. Define the preset format of the Excel file, including the worksheet name, column names, etc. Use pandas.ExcelWriter to write the set of scenario parameters into the Excel file to generate a scenario description file.

[0088] In the embodiments of the present application, by automatically converting the execution script into a structured table, manual operations are reduced. Through structured data processing, it is ensured that the generated Excel file is accurate. It supports custom mapping rules and Excel formats, and displays the scenario parameters in tabular form, facilitating subsequent scenario file conversion and adapting to different simulation requirements.

[0089] Step S150 includes sub - steps S1501 and S1502.

[0090] Sub - step S1501: Create a text file in a preset standard format.

[0091] Sub - step S1502: Map the set of target scenario parameters in the updated scenario description file to the text file for format conversion to obtain a simulation scenario file.

[0092] It should be noted that in the embodiments of the present application, a text file in the preset standard format XOSC is created. Among them, XOSC (OpenSCENARIO) is an XML-based simulation scenario description format used to describe scenario elements (such as vehicles, pedestrians, roads, etc.) and their behaviors in autonomous driving simulations. The structure of the XOSC file includes: basic information of the file (such as date), entities in the scenario (such as vehicles, pedestrians), and behaviors of the entities (such as speed, position change). In this embodiment, the xml.etree.ElementTree library of Python can be used to create an XML file in XOSC format, map the set of target scenario parameters in the updated scenario description file to the XML file in XOSC format for format conversion, use the pandas library to read the scenario parameters in the Excel file, map the scenario parameters in Excel to the XML elements in XOSC format, run HTML to generate an XOSC file, and use a scenario conversion script (such as in python format) to write the mapped scenario parameters into the XOSC file to generate a simulation scenario file containing complete simulation scenario information. The generated XOSC file conforms to the OpenSCENARIO standard and is convenient for integration into the simulation platform.

[0093] In the embodiments of the present application, by automatically converting an Excel file into a simulation scenario file in XOSC format containing complete simulation scenario information, it can meet different simulation requirements, conform to the simulation standard, and is convenient for integration into the simulation platform. Users can quickly generate a new XOSC file by modifying the Excel file, supporting rapid iteration and simulation testing.

[0094] Embodiment 2

[0095] Reference Figure 2 , which shows a simulation scenario generation method provided by the embodiments of the present application, including the following steps:

[0096] S210: In response to the generation of the scenario description file, call a preset scenario balancer; among them, the preset scenario balancer includes a loss function and a gradient update algorithm.

[0097] S220: Determine the loss function of the set of scenario parameters in the preset scenario balancer, and perform gradient update on the set of scenario parameters according to the loss function to obtain a set of target scenario parameters.

[0098] S230: Replace the set of scenario parameters in the scenario description file with the set of target scenario parameters to obtain an updated scenario description file.

[0099] Step S220 includes sub-steps S2201, sub-steps S2202, sub-steps S2203, and sub-steps S2204.

[0100] Sub-step S2201: Determine the scene parameters to be optimized in the set of scene parameters, and determine the loss function of the scene parameters to be optimized in the preset scene balancer.

[0101] Sub-step S2202: Generate a target according to the predefined simulation scenario, and determine the target value of the loss function of the scene parameters to be optimized.

[0102] Sub-step S2203: Use the gradient update algorithm to adjust the scene parameters to be optimized, and monitor the loss function value of the scene parameters to be optimized.

[0103] Sub-step S2204: When it is monitored that the loss function value of the scene parameters to be optimized is reduced to the target value, update the adjusted scene parameters to the target scene parameter set.

[0104] In the embodiment of the present application, a target is generated according to the predefined simulation scenario. For example, if it is necessary to optimize the road curvature in the simulation scenario, then determine the scene parameters related to the road in the set of scene parameters as the scene parameters to be optimized, and determine the loss function of the scene parameters to be optimized in the preset scene balancer, so as to adjust the parameters by the gradient descent method to minimize the loss function and finally achieve the purpose of optimizing the road curvature. Therefore, a target is generated according to the predefined simulation scenario, and the target value of the loss function of the scene parameters to be optimized is determined. For example, if the target generated by the predefined simulation scenario includes a road curvature of 0.1, then based on the difference between the current road curvature and the ideal road curvature, determine the target value of the corresponding road layout loss function, and thus use the gradient update algorithm to adjust the scene parameters to be optimized until the loss function value of the scene parameters to be optimized is reduced to the target value. At this time, the adjusted scene parameters meet the simulation scenario generation target, and update the adjusted scene parameters to the target scene parameter set for further simulation scenario generation processing.

[0105] It should be noted that by means of optimization problems and gradient updates, the balance between the diversity and accuracy of the simulation scenario is achieved. Assuming that the set of scene parameters is set as θ and the predefined simulation scenario generation target is to generate a simulation scenario that meets certain conditions (such as the layout of roads, vehicles, pedestrians, etc.), the optimization problem formula is as follows:

[0106]

[0107] Among them, is the loss function of the i-th scene parameter, which is used to represent the weighted sum of the loss functions of each scene parameter, and θ is the set of scene parameters.

[0108] Based on the above optimization problem formula, the scene parameters are gradually adjusted by the gradient descent method to gradually reduce the loss function. The gradient update formula is:

[0109]

[0110] Among them, θt is the scenario parameter of the t-th iteration, and η is the learning efficiency, which is used to control the step size of the scenario parameter adjustment. is the gradient of the loss function with respect to θt.

[0111] In this embodiment, taking the scenario parameter set including road layout parameters, traffic flow parameters, and weather condition parameters as an example for illustration, the loss function corresponding to the scenario parameter set is:

[0112]

[0113] Among them, is the loss function of the i-th scenario parameter, which is used to evaluate whether the generated simulation scenario meets the expectations. α1, a2, and a3 are the weight coefficients of the loss function of the scenario parameter, which are used to adjust the influence of the loss of each scenario parameter on the total scenario loss. θroad, θtrafic, and θweather are the scenario parameter vectors of road layout, traffic flow, and weather condition respectively.

[0114] Specifically, the specific calculation formula of the loss function corresponding to the scenario parameter set is:

[0115]

[0116] In order to reduce the loss function, according to the gradient update formula proposed above, the gradient update formulas obtained for each specific scenario parameter are:

[0117] 1) Gradient update of road layout parameters:

[0118]

[0119] Among them, θ road is the road layout parameter, η is the learning efficiency, α1 is the weight coefficient of the loss function of the scenario parameter, k road is the road curvature, k desired is the ideal road curvature. is the gradient of the road layout loss function with respect to the road layout parameter.

[0120] 2) Gradient update of traffic flow parameters:

[0121]

[0122] 3) Gradient update of weather condition parameters:

[0123]

[0124] Exemplarily, optimize and balance specific scenario parameters in the autonomous driving simulation scenario: Assume that the predefined simulation scenario target has requirements for road curvature, and the desired generated road curvature k road should not be too large or too small, and k desired is the ideal road curvature, then the optimization problem formula can be defined as:

[0125]

[0126] Adjust the parameter θ through the gradient descent method to minimize the loss function then the road layout parameter θ needs to be updated road , and the gradient update formula can be specified as:

[0127]

[0128] where is the gradient of the road layout loss function with respect to the road layout parameter, is the derivative of the road curvature with respect to the layout parameter, reflecting the impact of changes in the road layout parameter on the road curvature.

[0129] In a specific generated simulation scenario, the curvature k of the current road road = 0.2, and the target curvature k desired = 0.1, then the loss function of the road layout parameter is:

[0130]

[0131] If the initial value of the road layout parameter is θ road,t = 1.0, then the gradient of the road layout loss function with respect to the road layout parameter is:

[0132]

[0133] Assume then based on the above gradient update formula, the calculated gradient of the road layout loss function with respect to the road layout parameter is 0.1. If the learning rate η is set to 0.01, then the road curvature in the updated road layout parameter is:

[0134] θ road,t+1 = 1.0 - 0.01×0.1 = 0.999

[0135] Through gradient update, the road layout parameter is updated from 1.0 to 0.999, thereby reducing the difference between the road curvature and the target curvature.

[0136] Example Three

[0137] Reference Figure 3, a simulation scenario generation method provided by an embodiment of the present application further includes: step S240 and step S250.

[0138] S240: Collect historical simulation scenarios in advance and obtain scenario parameters in the historical simulation scenarios;

[0139] S250: Construct a scenario balancer according to the scenario parameters in the historical simulation scenarios; wherein, the scenario balancer includes a loss function and a gradient update algorithm.

[0140] In an embodiment of the present application, historical simulation scenarios are collected from existing simulation platforms or simulation databases, such as publicly available autonomous driving simulation datasets (such as the CARLA Challenge dataset). Key scenario parameters are extracted from the historical simulation scenarios. The scenario parameters include vehicle information, pedestrian information, road information, environmental information, etc. The extracted scenario parameters are stored as structured data for subsequent processing. By collecting historical simulation scenarios, diverse scenario parameters are obtained, providing data support for the construction of the scenario balancer. The scenario balancer is used to optimize the distribution of simulation scenarios, ensuring that the generated scenarios are both diverse and can cover key test requirements. The main objectives include: generating diverse scenarios, and the generated scenarios should be as close as possible to the real traffic environment.

[0141] Specifically, the scenario balancer includes a loss function and a gradient update algorithm. The loss function is used to measure the optimization objective of the scenario distribution. The gradient update algorithm can use the gradient descent algorithm to optimize the parameters of the scenario balancer and minimize the loss function. Through the scenario balancer, optimized scenario parameters can be output, which are used to generate simulation scenarios that take into account both generalization and accuracy.

[0142] S210: In response to the generation of a scenario description file, call a preset scenario balancer; wherein, the preset scenario balancer includes a loss function and a gradient update algorithm.

[0143] S220: Determine the loss function of the scenario parameter set in the preset scenario balancer, and perform gradient update on the scenario parameter set according to the loss function to obtain a target scenario parameter set.

[0144] S230: Replace the scenario parameter set in the scenario description file with the target scenario parameter set to obtain an updated scenario description file.

[0145] Steps 210 to 230 are as described in the previous embodiment and will not be elaborated here.

[0146] In the embodiments of the present application, a scenario balancer is used to optimize the distribution of simulation scenarios, ensuring that the generated scenarios are both diverse and accurately balanced. The generated scenarios are rich and diverse and closer to the real traffic environment, meeting the requirements of the autonomous driving simulation test scenarios. By optimizing the scenario generation process with the scenario balancer, the generation of invalid scenarios is reduced, and the generation efficiency of simulation scenarios is further improved.

[0147] The embodiments of the present application also provide a simulation scenario generation device 40. Please refer to Figure 4 , and the device includes:

[0148] An information acquisition module 410, configured to acquire the driving scenario description language input by the user.

[0149] A script generation module 420, configured to parse the driving scenario description language by using a pre-trained large language model to obtain an execution script; wherein, the execution script includes scenario parameters corresponding to the driving scenario description language.

[0150] A file conversion module 430, configured to perform a structured mapping on the scenario parameters in the execution script to generate a scenario description file; wherein, the scenario description file includes a set of scenario parameters.

[0151] A parameter processing module 440, configured to determine a loss function for the set of scenario parameters, perform gradient update on the set of scenario parameters according to the loss function to obtain a set of target scenario parameters, and update the scenario description file according to the set of target scenario parameters.

[0152] A scenario generation module 450, configured to perform format conversion on the updated scenario description file to obtain a simulation scenario file in a preset standard format.

[0153] Further, the script generation module 420 includes:

[0154] A parsing sub-module, configured to input the driving scenario description language into a pre-trained large language model, parse the driving scenario description language by using the large language model, and identify the scenario parameters included in the driving scenario description language;

[0155] A first conversion sub-module, configured to convert the scenario parameters into structured data and output an execution script according to the structured data.

[0156] Further, the file conversion module 430 includes:

[0157] A parameter determination sub-module, configured to determine the data structure of the scenario parameters in the execution script;

[0158] A second conversion sub-module, configured to convert the scenario parameters into a structured table according to a preset mapping rule and the data structure of the scenario parameters, so as to obtain a set of scenario parameters;

[0159] A first mapping sub-module, configured to map the set of scenario parameters to a preset format file to generate a scenario description file.

[0160] Further, the parameter processing module 440 includes:

[0161] A call sub-module, configured to call a preset scenario balancer in response to the generation of the scenario description file; wherein, the preset scenario balancer includes a loss function and a gradient update algorithm;

[0162] A gradient update sub-module, configured to determine the loss function of the set of scenario parameters in the preset scenario balancer, and perform gradient update on the set of scenario parameters according to the loss function to obtain a set of target scenario parameters;

[0163] A parameter update sub-module, configured to replace the set of scenario parameters in the scenario description file with the set of target scenario parameters to obtain an updated scenario description file.

[0164] Further, the gradient update sub-module includes:

[0165] A determination parameter unit, configured to determine the scenario parameters to be optimized in the set of scenario parameters, and determine the loss function of the scenario parameters to be optimized in the preset scenario balancer;

[0166] A determination target unit, configured to generate a target according to a predefined simulation scenario, and determine the target value of the loss function of the scenario parameters to be optimized;

[0167] A parameter update unit, configured to adjust the scenario parameters to be optimized by using the gradient update algorithm, and monitor the loss function value of the scenario parameters to be optimized;

[0168] A target unit, configured to update the adjusted scenario parameters to the set of target scenario parameters when it is monitored that the loss function value of the scenario parameters to be optimized is reduced to the target value.

[0169] Further, the parameter processing module 440 further includes:

[0170] A parameter acquisition sub-module, configured to pre-collect historical simulation scenarios and obtain the scenario parameters in the historical simulation scenarios;

[0171] A parameter preprocessing sub-module, configured to construct a scenario balancer according to the scenario parameters in the historical simulation scenarios; wherein, the scenario balancer includes a loss function and a gradient update algorithm.

[0172] Furthermore, the scenario generation module 450 includes:

[0173] A text creation sub-module for creating a text file in a preset standard format;

[0174] A third conversion sub-module for mapping the set of target scenario parameters in the updated scenario description file to the text file for format conversion to obtain a simulation scenario file.

[0175] An embodiment of the present application provides a simulation scenario generation device. By obtaining the driving scenario description language input by the user, using a pre-trained large language model to parse the driving scenario description language to obtain an execution script, structuring and mapping the scenario parameters in the execution script to generate a scenario description file, determining the loss function of the set of scenario parameters, updating the set of scenario parameters according to the loss function to obtain a set of target scenario parameters, updating the scenario description file according to the set of target scenario parameters, and performing format conversion on the updated scenario description file to obtain a simulation scenario file in a preset standard format. The embodiment of the present application uses a large language model to automatically convert the driving scenario description language into an execution script, thereby obtaining a structured scenario description file, supporting various scenario descriptions and parameter generalization, and adjusting the scenario parameters through the loss function and gradient update, so as to convert the optimized scenario description file format to obtain an accurate and effective simulation scenario file, achieving a balance between the generalization and accuracy of scenario generation, and further meeting the requirements of autonomous driving simulation scenarios.

[0176] An embodiment of the present application also provides an electronic device 50. Please refer to Figure 5 , which includes a processor 510 and a memory 520. Among them, the memory 510 is used to store a computer program; the processor 520 is used to execute the program stored on the memory 510 to implement a simulation scenario generation method introduced in any embodiment of the present application.

[0177] An embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements a simulation scenario generation method introduced in any embodiment of the present application.

[0178] In the present application, "multiple" refers to two or more.

[0179] Terms such as "first", "second", "third", "fourth", etc. in the present application are used to distinguish similar objects and do not have to be used to describe a specific order or sequence.

[0180] In this application, the term "and / or" is merely a description of the relationship between associated objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. Additionally, in this application, the character "" generally indicates that the associated objects before and after are in an "or" relationship.

[0181] If there is no special indication, all steps of this application can be carried out sequentially or randomly. For example, the method includes steps A and B, which means that the method can include steps A and B carried out sequentially, or it can include steps B and A carried out sequentially. For example, when it is mentioned that the method may further include step C, it means that step C can be added to the method in any order. For example, the method can include steps A, B, and C, or it can include steps A, C, and B, or it can include steps C, A, and B, etc.

[0182] The above are only the preferred embodiments of this application and are not intended to limit this application. Any modifications, equivalent replacements, and improvements made within the spirit and principles of this application shall be included within the protection scope of this application.

Claims

1. A method for generating a simulation scenario, characterized in that, The method includes: Obtaining a driving scenario description language input by a user; Parsing the driving scenario description language using a pre-trained large language model to obtain an execution script; wherein, the execution script includes scenario parameters corresponding to the driving scenario description language; Structurally mapping the scenario parameters in the execution script to generate a scenario description file; wherein, the scenario description file includes a set of scenario parameters; Determining a loss function for the set of scenario parameters, performing gradient update on the set of scenario parameters according to the loss function to obtain a target set of scenario parameters, and updating the scenario description file according to the target set of scenario parameters; Converting the format of the updated scenario description file to obtain a simulation scenario file in a preset standard format.

2. The method according to claim 1, wherein The parsing the driving scenario description language using a pre-trained large language model to obtain an execution script includes: Inputting the driving scenario description language into a pre-trained large language model, and parsing the driving scenario description language using the large language model to identify scenario parameters included in the driving scenario description language; Converting the scenario parameters into structured data and outputting an execution script according to the structured data.

3. The method according to claim 1, characterized in that, The structurally mapping the scenario parameters in the execution script to generate a scenario description file; wherein, the scenario description file includes a set of scenario parameters, includes: Determining the data structure of the scenario parameters in the execution script; According to a preset mapping rule and the data structure of the scenario parameters, converting the scenario parameters into a structured table to obtain a set of scenario parameters; Mapping the set of scenario parameters to a preset format file to generate a scenario description file.

4. The method according to claim 1, characterized in that, The determining a loss function for the set of scenario parameters, performing gradient update on the set of scenario parameters according to the loss function to obtain a target set of scenario parameters, and updating the scenario description file according to the target set of scenario parameters includes: In response to the generation of the scenario description file, invoking a preset scenario balancer; wherein, the preset scenario balancer includes a loss function and a gradient update algorithm; Determining a loss function for the set of scenario parameters in the preset scenario balancer, and performing gradient update on the set of scenario parameters according to the loss function to obtain a target set of scenario parameters; Replacing the set of scenario parameters in the scenario description file with the target set of scenario parameters to obtain an updated scenario description file.

5. The method according to claim 4, characterized in that, The determining a loss function for the set of scenario parameters in the preset scenario balancer, and performing gradient update on the set of scenario parameters according to the loss function to obtain a target set of scenario parameters includes: Determining scenario parameters to be optimized in the set of scenario parameters, and determining a loss function for the scenario parameters to be optimized in the preset scenario balancer; Determining a target value of the loss function for the scenario parameters to be optimized according to a predefined simulation scenario generation target; Adjusting the scenario parameters to be optimized using the gradient update algorithm and monitoring the value of the loss function of the scenario parameters to be optimized; When it is detected that the loss function value of the to-be-optimized scenario parameters is reduced to the target value, update the adjusted scenario parameters to the target scenario parameter set.

6. The method according to claim 4, wherein Before invoking the preset scenario balancer in response to the generation of the scenario description file, the method further includes: Pre-collect historical simulation scenarios and obtain the scenario parameters in the historical simulation scenarios; Construct a scenario balancer according to the scenario parameters in the historical simulation scenarios; wherein, the scenario balancer includes a loss function and a gradient update algorithm.

7. The method according to claim 1, wherein The format conversion of the updated scenario description file to obtain a simulation scenario file in a preset standard format includes: Create a text file in a preset standard format; Map the target scenario parameter set in the updated scenario description file to the text file for format conversion to obtain a simulation scenario file.

8. A simulation scenario generation device, characterized in that, The device includes: An information acquisition module, configured to acquire a driving scenario description language input by a user; A script generation module, configured to parse the driving scenario description language by using a pre-trained large language model to obtain an execution script; wherein, the execution script includes scenario parameters corresponding to the driving scenario description language; A file conversion module, configured to perform a structured mapping on the scenario parameters in the execution script to generate a scenario description file; wherein, the scenario description file includes a scenario parameter set; A parameter processing module, configured to determine a loss function of the scenario parameter set, perform gradient update on the scenario parameter set according to the loss function to obtain a target scenario parameter set, and update the scenario description file according to the target scenario parameter set; A scenario generation module, configured to perform format conversion on the updated scenario description file to obtain a simulation scenario file in a preset standard format.

9. An electronic device, characterized in that, Comprising a processor and a memory, wherein The memory is used for storing a computer program; The processor is configured to execute the program stored on the memory to implement the simulation scenario generation method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the simulation scenario generation method according to any one of claims 1-7 is implemented.

Citation Information

Cited By

  • Automatic driving simulation cut-in scene generation method and system based on driving data

    CN121434068A

  • Signal integrity simulation method and system, computer equipment and storage medium

    CN121580690A

  • A signal integrity simulation method, system, computer device and storage medium

    CN121580690B

  • Spacecraft intelligent software virtual simulation test scene intelligent generation method

    CN122111869A

  • A method for intelligently generating virtual simulation test scenarios for spacecraft intelligent software

    CN122111869B