Knowledge graph enhancement-based automatic driving test script generation method and device

CN122925232APending Publication Date: 2026-10-16WUHAN JIANGXIA CHUNENG AUTOMOBILE TECHNOLOGY R&D CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611127958.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0004]然而,LLM在构造场景时缺乏对交通法规的结构化理解,其生成的脚本可能隐含“实线变道”“逆向行驶”或“红灯不停”等违法指令;其次,物理失真问题同样严峻,车辆运动受轮胎附着极限、制动系统响应延迟、底盘动力学等物理定律的刚性约束,但LLM输出的加速度、制动距离等运动参数常违背这些工程极限

Benefits of technology

本申请所提供的基于知识图谱增强的自动驾驶测试脚本生成方法及装置、电子设备及自动驾驶测试系统中,预先构建包括多个结构化节点和与各个结构化节点连接的节点限制条件的多维知识图谱,在获取自然测试语句后,先对自然测试语句进行关键字提取得到多个测试关键字,然后获取多个结构化节点中与测试关键字匹配的目标节点,获取目标节点连接的节点限制条件作为目标限制条件,最后将目标限制条件和自然测试语句输入大语言模型,获取大语言模型生成的自动驾驶测试脚本,由于大语言模型中一并输入了各个关键字对应的目标限制条件,大语言模型在生成自动驾驶测试脚本时可以基于目标限制条件对生成的自动驾驶测试脚本进行限制,通过多维知识图谱构建自动驾驶测试脚本的先验限制,基于先验限制生成的自动驾驶测试脚本符合先验限制的目标限制条件,减少了大语言模型生成的自动驾驶测试脚本中逻辑失真问题,使得生成的汽车自动驾驶测试脚本更有效、更安全,进一步的使用更有效、更安全的汽车自动驾驶测试脚本进行汽车自动驾驶测试,可以提升汽车自动驾驶测试过程可靠性和测试效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122925232A_ABST
    Figure CN122925232A_ABST
Patent Text Reader

Abstract

The application relates to the field of automobile function testing, in particular to an automatic driving test script generation method and device based on knowledge graph enhancement, an electronic device and an automatic driving test system. The method comprises the following steps: providing a multi-dimensional knowledge graph, the multi-dimensional knowledge graph comprising a plurality of structured nodes and node restriction conditions connected with each structured node; obtaining a natural test sentence, and extracting a plurality of test keywords from the natural test sentence; obtaining target nodes matched with the test keywords in the plurality of structured nodes, and obtaining the node restriction conditions connected with the target nodes as target restriction conditions; inputting the target restriction conditions and the natural test sentence into a large language model, and obtaining an automatic driving test script generated by the large language model. The application realizes the technical effect of generating more effective and safer automobile automatic driving test scripts, and improves the reliability and test efficiency of automobile automatic driving test results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of automotive functional testing, specifically to a method and apparatus for generating autonomous driving test scripts based on knowledge graph enhancement, an electronic device, and an autonomous driving test system. Background Technology

[0002] As intelligent driving technology evolves towards advanced autonomous driving, testing and verification have become a key bottleneck restricting industrialization. Traditional road testing, limited by cost, safety, and scenario coverage, struggles to encompass all the long-tail scenarios a vehicle might encounter throughout its entire lifecycle. Therefore, the industry has generally shifted towards virtual simulation testing, constructing high-fidelity digital twin environments to achieve large-scale, high-efficiency verification of autonomous driving systems.

[0003] In recent years, with the development of Large Language Models (LLMs), the powerful semantic understanding and code generation capabilities of LLMs have led the industry to explore their application in the field of automated testing. This involves testers inputting natural language test case descriptions, and LLMs directly generating corresponding autonomous driving test scripts, significantly improving the efficiency and scale of autonomous driving test script generation, thereby enhancing the efficiency of intelligent driving simulation testing.

[0004] However, LLMs lack a structured understanding of traffic regulations when constructing scenarios, and the scripts they generate may implicitly contain illegal instructions such as "changing lanes over solid lines," "driving in the wrong direction," or "not stopping at red lights." Secondly, the problem of physical distortion is equally serious. Vehicle motion is rigidly constrained by physical laws such as tire adhesion limits, braking system response delays, and chassis dynamics, but the motion parameters such as acceleration and braking distance output by LLMs often violate these engineering limits. Such autonomous driving test scripts have low reliability and safety, and not only cannot serve as effective test cases, but if used in intelligent driving tests, they will also pollute the credibility of intelligent driving test results, reducing the reliability and efficiency of autonomous driving test results. Summary of the Invention

[0005] In view of this, it is necessary to provide a knowledge graph-based method and device for generating autonomous driving test scripts, an electronic device, and an autonomous driving test system, so as to achieve the technical effect of generating more effective and safer autonomous driving test scripts and improving the reliability and efficiency of autonomous driving test results.

[0006] To achieve the aforementioned technical effects, firstly, this application provides a method for generating autonomous driving test scripts based on knowledge graph enhancement, comprising: A multidimensional knowledge graph is provided, which includes multiple structured nodes and node constraints connected to each of the structured nodes; Obtain natural test statements, and extract keywords from the natural test statements to obtain multiple test keywords; Obtain the target node that matches the test keyword from the plurality of structured nodes, and obtain the node constraint conditions connected to the target node as the target constraint conditions; Input the target constraints and the natural test statement into the large language model to obtain the autonomous driving test script generated by the large language model.

[0007] In one possible embodiment, the autonomous driving test script includes a test vehicle and an environmental background vehicle, and the knowledge graph-based autonomous driving test script generation method further includes: The test vehicle's driving trajectory and the background vehicle's driving trajectory are obtained based on the autonomous driving test script. Based on the driving trajectory of the test vehicle and the driving trajectory of the background vehicle, it is determined whether there is a risk of collision between the test vehicle and the background vehicle. If there is a risk of collision between the test vehicle and the vehicles in the environmental background, the autonomous driving test script will be adjusted.

[0008] In one possible embodiment, determining whether there is a collision risk between the test vehicle and the background vehicles based on the test vehicle's trajectory and the background vehicle's trajectory includes: Based on the set bounding box parameters, construct a test vehicle bounding box corresponding to the test vehicle and a background vehicle bounding box corresponding to the environmental background vehicles; Based on the set sampling time point, the driving trajectory of the test vehicle is sampled to obtain multiple test vehicle sampling positions. Based on the set sampling time point, the driving trajectory of the background vehicle is sampled to obtain multiple background vehicle sampling positions. For each of the set sampling time points, calculate the minimum distance between the test vehicle and each of the environmental background vehicles; If the minimum distance is less than the set safe distance, it is determined that there is a risk of collision between the test vehicle and the vehicles in the background environment.

[0009] In one possible embodiment, adjusting the autonomous driving test script includes: If the minimum distance is less than the set safe distance, the set sampling time point corresponding to the minimum distance is obtained as the risk time point, and the vehicle operation of the test vehicle at the risk time point is determined as the risk operation based on the autonomous driving test script. Based on the risky operation and the risky time point, locate the violation script and adjust the violation script.

[0010] In one possible embodiment, the step of locating the violation script based on the risky operation and the risky time point includes: The autonomous driving test script is compiled into an abstract syntax tree, which includes multiple action nodes and parameter nodes connected to the action nodes. Based on the risky operation and the risky time point, the violation action node is located in the abstract syntax tree, and the parameter node connected to the violation action node is obtained as the violation parameter node. The violation script is determined based on the violation action node and the violation parameter node.

[0011] In one possible embodiment, adjusting the violating script includes: Based on the violation script, an incremental guidance instruction that meets the set constraints is constructed; The incremental guidance instruction is input into the large language model to obtain the adjusted autonomous driving test script output by the large language model.

[0012] In one possible embodiment, constructing the multidimensional knowledge graph includes: Obtain regulatory and / or physical constraints, which include multiple vehicle operations and vehicle operation constraints corresponding to each of the vehicle operations. The structured nodes are constructed based on the vehicle operations, the node constraints are constructed based on the vehicle operation constraints, and the connection relationship between the structured nodes and the node constraints is constructed based on the vehicle operations and their correspondence with the vehicle operation constraints.

[0013] Secondly, this application provides a knowledge graph-based autonomous driving test script generation device, comprising: A multidimensional knowledge graph module is used to provide a multidimensional knowledge graph, which includes multiple structured nodes and node constraints connected to each of the structured nodes. The statement analysis module is used to obtain natural test statements and extract multiple test keywords from the natural test statements. The constraint matching module is used to obtain the target node that matches the test keyword among the plurality of structured nodes, and to obtain the node constraint conditions connected to the target node as the target constraint conditions; A test script generation module is used to input the target constraints and the natural test statements into a large language model to obtain an autonomous driving test script generated by the large language model.

[0014] Thirdly, this application provides an electronic device, including: an input serial bus, an output serial bus, a memory, and a processor, wherein... The input serial bus is used to input natural test statements; The memory is used to store the program, the natural test statement, and the multidimensional knowledge graph; The processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the above-described knowledge graph-based autonomous driving test script generation method, thereby obtaining an autonomous driving test script. The output serial bus is used to output the autonomous driving test script to the autonomous driving test equipment.

[0015] Fourthly, this application provides an autonomous driving testing system, comprising: The aforementioned knowledge graph-based autonomous driving test script generation device and the autonomous driving test equipment connected to the knowledge graph-based autonomous driving test script generation device. The knowledge graph-based autonomous driving test script generation device is used to execute the steps in the knowledge graph-based autonomous driving test script generation method described above, so as to generate an autonomous driving test script and input the autonomous driving test script into the autonomous driving test equipment. The autonomous driving test equipment runs the autonomous driving test script to perform autonomous driving simulation tests.

[0016] The beneficial effects of this application are: The knowledge graph-based autonomous driving test script generation method, apparatus, electronic device, and autonomous driving test system provided in this application pre-construct a multi-dimensional knowledge graph including multiple structured nodes and node constraints connected to each structured node. After obtaining a natural test statement, keywords are extracted from the natural test statement to obtain multiple test keywords. Then, target nodes matching the test keywords are obtained from the multiple structured nodes. The node constraints connected to the target nodes are obtained as target constraints. Finally, the target constraints and the natural test statement are input into a large language model to obtain the autonomous driving test script generated by the large language model. Since the target constraints corresponding to each keyword are input into the large language model, the large language model can restrict the generated autonomous driving test script based on the target constraints. By constructing prior constraints for the autonomous driving test script through the multi-dimensional knowledge graph, the autonomous driving test script generated based on the prior constraints conforms to the target constraints of the prior constraints, reducing the logical distortion problem in the autonomous driving test script generated by the large language model. This makes the generated autonomous driving test script more effective and safer. Further using more effective and safer autonomous driving test scripts for autonomous driving testing can improve the reliability and efficiency of the autonomous driving testing process. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a flowchart illustrating the knowledge graph-based autonomous driving test script generation method provided in an embodiment of this application. Figure 2 A flowchart illustrating a knowledge graph-based autonomous driving test script generation method provided in another embodiment of this application; Figure 3 This is a schematic diagram illustrating the process of determining whether there is a collision risk between the test vehicle and background vehicles based on the test vehicle's driving trajectory and the background vehicle's driving trajectory in another embodiment of the knowledge graph-based autonomous driving test script generation method provided in this application. Figure 4 This is a flowchart illustrating the process of locating violation scripts based on risky operations and risky time points in a knowledge graph-based autonomous driving test script generation method provided in another embodiment of this application. Figure 5A schematic diagram of the structure of the knowledge graph-based autonomous driving test script generation device provided in this application embodiment; Figure 6 A schematic diagram of an electronic device provided in one embodiment of this application; Figure 7 This is a schematic diagram of an autonomous driving test system provided in one embodiment of this application. Detailed Implementation

[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0020] In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related 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.

[0021] The terms "first," "second," etc., used in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a technical feature defined with "first" or "second" may explicitly or implicitly include at least one of those features.

[0022] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0023] This application provides a knowledge graph-based method and apparatus for generating autonomous driving test scripts, an electronic device, and an autonomous driving test system, which are described below.

[0024] Please refer to Figure 1 The knowledge graph-based autonomous driving test script generation method provided in this application includes: Step S101: Provide a multidimensional knowledge graph.

[0025] In this step, the multidimensional knowledge graph is a structured form of knowledge representation that uses nodes and edges to represent entities and the relationships between them. In this embodiment, the multidimensional knowledge graph is used to store information related to autonomous driving testing, such as regulatory constraints, physical constraints, scene elements, and vehicle behaviors. Based on this information, multiple structured nodes and node constraints connected to each structured node are constructed. It is understood that node constraints can also be considered nodes in a multidimensional knowledge graph. Structured nodes are the basic information units in the multidimensional knowledge graph, representing entities, operations, environments, and other related objects in the intelligent driving process. Examples include weather, temperature, overtaking, and vehicles. Node constraints are the rules, attributes, or constraint information associated with structured nodes. They define the legal behavior range or characteristics of the corresponding structured node. For example, node constraints connected to the "overtaking" node may include traffic regulations such as "do not cross solid lines" and "maintain a safe distance," as well as physical requirements such as "overtaking speed" and "overtaking time."

[0026] In the embodiments of this application, a multidimensional knowledge graph can be pre-built and stored in the cloud or local memory. During the execution of the knowledge graph-enhanced autonomous driving test script generation method provided in this embodiment, the pre-built multidimensional knowledge graph can be read from the local memory or received from the cloud for direct use. Alternatively, in some other embodiments of this application, the multidimensional knowledge graph can be built and used in real time during the execution of the knowledge graph-enhanced autonomous driving test script generation method.

[0027] Furthermore, a multi-dimensional knowledge graph is constructed, specifically including: obtaining regulatory constraints and / or physical constraints, which include multiple vehicle operations and vehicle operation constraints corresponding to each vehicle operation; constructing structured nodes based on vehicle operations; constructing node restrictions based on vehicle operation constraints; and constructing connection relationships between structured nodes and node restrictions based on the correspondence between vehicle operations and vehicle operation constraints.

[0028] Specifically, acquiring regulatory and / or physical constraints refers to collecting and organizing various restrictions that autonomous vehicles must comply with in actual operation. Regulatory constraints may include, but are not limited to, traffic regulations, industry standards, and safety specifications, such as speed limits, traffic light rules, lane keeping requirements, and overtaking rules. Physical constraints may include the vehicle's own performance limitations, such as maximum acceleration, maximum deceleration, maximum turning radius, tire grip, and sensor detection range, as well as environmental factors such as road friction coefficient and weather conditions.

[0029] After obtaining the regulatory and / or physical constraints, extract the multiple vehicle operations included in the regulatory and / or physical constraints and the corresponding vehicle operation constraints for each vehicle operation. Vehicle operations refer to various behaviors or actions that an autonomous vehicle may perform during operation, such as "acceleration," "left turn," "deceleration," "lane change," and "obstacle avoidance." These operations are the basic units for decision-making and control in the autonomous driving system. Vehicle operation constraints are restrictions or requirements on specific vehicle operations. For example, for the "acceleration" operation, the constraint could be "maximum acceleration not exceeding 5 m / s²"; for the "left turn" operation, the constraint could be "when turning left at an intersection, wait for oncoming straight-ahead vehicles to pass" or "the speed when turning left must not exceed 15 km / h."

[0030] Finally, structured nodes are constructed based on vehicle operations, and node constraints are constructed based on vehicle operation constraints. For example, "acceleration" is set as a structured node, and "left turn" is set as a structured node; the node connected to the structured node "acceleration" is constrained by "acceleration value range [0, 5] m / s²"; the node connected to the structured node "left turn" is constrained by "no oncoming straight-ahead vehicles" and "current vehicle speed less than or equal to 20 km / h", etc. Based on these specific connection relationships, node connection relationships are constructed to form a multi-dimensional knowledge graph.

[0031] Step S102: Obtain the natural test statement and extract multiple test keywords from the natural test statement.

[0032] In this step, the natural test statement is a natural statement entered by the tester to generate the autonomous driving test script, such as "following another vehicle on the highway in rainy weather, the vehicle in front cuts in".

[0033] In this embodiment, keyword extraction is specifically based on a pre-set intelligent driving-specific scenario ontology layer. Specifically, the intelligent driving-specific scenario ontology layer includes multiple part-of-speech classifications unique to intelligent driving, including keywords corresponding to parameters such as actions, objects, and environments specific to intelligent driving. Based on this, the natural test sentence is first segmented, and then the segmentation results are matched with the part-of-speech classifications. For example, the segmentation of "following another car on a rainy highway, the car in front cuts in" yields "rainy day," "highway," "following another car," "the car in front," and "cuts in," further corresponding to the environmental keyword "rainy day." Key operating condition: "high speed" The key action word is "entry". wait.

[0034] Step S103: Obtain the target node that matches the test keyword from multiple structured nodes, and obtain the node constraints connected to the target node as the target constraints.

[0035] In this step, each keyword is matched with a structured node in the multidimensional knowledge graph. Structured nodes include environment nodes and action nodes; for example, environment nodes can be matched with the environment keyword "rainy day". The matched target node or action node can then be used as a "cut-in" point to the action keyword. Matching target nodes. After determining the target nodes for each test keyword, obtain the node constraints connected to the target nodes as target constraints.

[0036] Furthermore, when acquiring node constraints connected to the target node as target constraints, the node correlation between each node constraint and the target node can also be acquired. Node constraints with a correlation greater than a set correlation threshold are then used as target constraints. By setting a correlation threshold to filter node constraints connected to the target node, the correlation between target constraints and the target node can be increased, improving the reliability of the target constraints and, consequently, the reliability of the autonomous driving test script.

[0037] For example, if the test keyword is "overtaking", then the structured node named "overtaking" is searched in the knowledge graph as the target node. Then, all the edges connected to the target node are traversed, and the constraints associated with these edges are extracted. For example, node constraints such as "do not cross solid lines when overtaking", "maintain a safe distance when overtaking", "overtaking speed", and "overtaking time" are obtained as target constraints.

[0038] Step S104: Input the target constraints and natural test statements into the large language model to obtain the autonomous driving test script generated by the large language model.

[0039] In this step, the target constraints and natural test statements are input into the large language model. The target constraints provide clear and structured rule guidance in the process of generating autonomous driving test scripts based on natural test statements in the large language model.

[0040] It should be noted that the large language model mentioned in the embodiments of this application is a natural language processing model based on deep learning, which learns from massive amounts of text data and has the ability to understand language, generate text, and generate code. Examples include Generative Pre-trained Transformer 4 (GPT-4) and Meta AI Large Language Model 3 (Llama 3).

[0041] For example, in the process of generating standard autonomous driving test scripts, large language models, lacking common sense about vehicle dynamics, tend to directly provide statements such as "on a rainy, flooded road surface, with..." The distorted parameter of "emergency braking within 15 meters" violates the physical limits. This application pre-searches and transforms this into a target constraint condition (i.e., the maximum braking deceleration on a wet road surface during rain). Because this objective constraint, as a hard boundary rule, forcibly limits the range of parameter selection for the large language model, the values ​​of the large language model are locked when filling in the script motion parameters. Within the legal dynamic range, by imposing logical prior constraints, the possibility of large language models generating acceleration and deceleration that do not conform to the physical limits of real vehicles is eliminated at the source of data input, thus reducing the problem of parameter logic distortion.

[0042] Compared with related technologies, the knowledge graph-based autonomous driving test script generation method provided in this embodiment pre-constructs a multi-dimensional knowledge graph including multiple structured nodes and node constraints connected to each structured node. After obtaining the natural test statement, keywords are extracted from the natural test statement to obtain multiple test keywords. Then, target nodes matching the test keywords are obtained from the multiple structured nodes, and the node constraints connected to the target nodes are obtained as target constraints. Finally, the target constraints and the natural test statement are input into a large language model to obtain the autonomous driving test script generated by the large language model. Since the target constraints corresponding to each keyword are input into the large language model, the large language model can restrict the generated autonomous driving test script based on the target constraints. By constructing prior constraints for the autonomous driving test script through the multi-dimensional knowledge graph, the autonomous driving test script generated based on the prior constraints conforms to the target constraints of the prior constraints, reducing the logical distortion problem in the autonomous driving test script generated by the large language model. This makes the generated autonomous driving test script more effective and safer. Further using more effective and safer autonomous driving test scripts for autonomous driving testing can improve the reliability and efficiency of the autonomous driving testing process.

[0043] Please refer to Figure 2 Another embodiment of this application also provides a method for generating autonomous driving test scripts based on knowledge graph enhancement, specifically including the following steps: Step S201: Provide a multidimensional knowledge graph.

[0044] Step S202: Obtain the natural test statement and extract keywords from the natural test statement to obtain multiple test keywords.

[0045] Step S203: Obtain the target node that matches the test keyword from multiple structured nodes, and obtain the node constraints connected to the target node as the target constraints.

[0046] Step S204: Input the target constraints and natural test statements into the large language model to obtain the autonomous driving test script generated by the large language model.

[0047] It is understood that steps S201 to S204 in the knowledge graph-based autonomous driving test script generation method provided in this embodiment are largely the same as steps S101 to S104 in the aforementioned embodiments. For details, please refer to the specific descriptions in the aforementioned embodiments, which will not be repeated here.

[0048] Step S205: Obtain the test vehicle's driving trajectory and the background vehicle's driving trajectory based on the autonomous driving test script.

[0049] In this step, the autonomous driving test script includes a test vehicle and an environmental background vehicle. The test vehicle refers to the main vehicle equipped with an autonomous driving system and undergoing testing; the environmental background vehicle refers to other vehicles that interact with the test vehicle in the test scenario to simulate a real traffic environment.

[0050] For the vehicle's driving trajectory, the initial coordinates, acceleration-time curves, steering angular velocity, and other physical quantities of the test vehicle and the background vehicle in the autonomous driving test script are extracted. The test vehicle's driving trajectory and the background vehicle's driving trajectory are then reconstructed using classical kinematic equations.

[0051] Step S206: Determine whether there is a collision risk between the test vehicle and the background vehicles based on the test vehicle's driving trajectory and the background vehicle's driving trajectory.

[0052] In this step, please refer to Figure 3 Specifically, it includes: Step S301: Based on the set bounding box parameters, construct the test vehicle bounding box corresponding to the test vehicle and the background vehicle bounding box corresponding to the environmental background vehicles.

[0053] In this step, the bounding box is specifically a geometry that completely encloses the vehicle, typically represented by a simplified geometry to reduce the computational complexity of collision detection. In this embodiment, the bounding box parameters can be configured according to the actual size and type of the vehicle, as well as the detection accuracy requirements. For example, a bounding box in the form of a minimum bounding sphere or a discrete-direction polyhedron can be selected. Based on the set bounding box parameters, a test vehicle bounding box surrounding the test vehicle and a background vehicle bounding box surrounding the environmental background vehicles are constructed respectively.

[0054] Step S302: Based on the set sampling time point, the driving trajectory of the test vehicle is sampled to obtain multiple test vehicle sampling positions. Based on the set sampling time point, the driving trajectory of the background vehicle is sampled to obtain multiple background vehicle sampling positions.

[0055] In this step, the positions of the test vehicle's trajectory and the background vehicle's trajectory are sampled by setting sampling time points. This discretizes the continuous vehicle trajectories, transforming them into a series of discrete test vehicle and background vehicle sampling positions. This transforms the continuous collision detection problem into a series of discrete time-point collision detection problems, significantly reducing computational complexity. The sampling time points can be set using equal time intervals, such as 10ms, 20ms, etc.; or adaptive sampling can be used, adjusting the sampling time interval based on dynamic parameters such as vehicle speed, acceleration, or trajectory curvature.

[0056] Step S303: For each set sampling time point, calculate the minimum distance between the test vehicle and each background vehicle in the environment.

[0057] In this step, for each set sampling time point, there is a background vehicle sampling position and a test vehicle sampling position respectively. Based on the background vehicle sampling position and the test vehicle sampling position, the minimum distance between the bounding box of the test vehicle and the bounding box of the background vehicle is calculated.

[0058] Specifically, the minimum distance can be calculated based on geometric algorithms, such as by comparing the shortest distance between the projection intervals of the test vehicle bounding box and the background vehicle bounding box on each axis; or by using convex body collision detection algorithms such as the GJK (Gilbert-Johnson-Keerthi) algorithm or the EPA (Expanding Polytope Algorithm) to calculate the minimum distance between the test vehicle bounding box and the background vehicle bounding box.

[0059] Step S304: If the minimum distance is less than the set safe distance, it is determined that there is a risk of collision between the test vehicle and the background vehicles.

[0060] In this step, the calculated minimum distance is compared with a preset safe distance to define the safe boundary between vehicles. When the minimum distance between two vehicles is lower than this preset safe distance, a collision risk is considered to exist. The preset safe distance can be a fixed empirical value, such as 2 meters or 5 meters; or it can be dynamically adjusted to be related to factors such as vehicle speed, acceleration, and road type, for example, setting a larger safe distance when traveling at high speeds.

[0061] Step S207: If there is a risk of collision between the test vehicle and vehicles in the background environment, adjust the autonomous driving test script.

[0062] In this step, adjusting the autonomous driving test script specifically includes: if the minimum distance is less than the set safe distance, obtaining the set sampling time point corresponding to the minimum distance as the risk time point, determining the vehicle operation of the test vehicle at the risk time point based on the autonomous driving test script as the risk operation; locating the violation script based on the risk operation and the risk time point, and adjusting the violation script.

[0063] Specifically, if the minimum distance sampled at a certain set sampling time point is less than a set safe distance, then that set sampling time point is designated as a risk time point. The corresponding vehicle operations in the autonomous driving test script at that risk time point are then identified as risky operations. For example, if the risk time point is 5.2 seconds, vehicle operations such as "acceleration," "lane change," and "steering" that take effect around 5.2 seconds in the autonomous driving test script are identified as risky operations.

[0064] For further details, please refer to Figure 4 Based on risky operations and risky timing, the scripts that violate regulations are located, specifically including: Step S401: Compile the autonomous driving test script into an abstract syntax tree.

[0065] In this step, the original autonomous driving test script is specifically converted into a tree-like data structure, namely an Abstract Syntax Tree (AST), using a parser. The AST represents the syntactic structure of the autonomous driving test script in a hierarchical manner. It includes multiple action nodes and parameter nodes connected to these action nodes. Action nodes represent specific operations or behaviors in the autonomous driving test script, such as vehicle acceleration, steering, and braking. Parameter nodes represent specific values ​​or conditions related to these actions, such as acceleration speed, steering angle, and braking intensity. This node structure allows each operation and its details in the script to be clearly represented and accessed. For example, a "vehicle acceleration" action node can be connected to a "speed" parameter node and a "duration" parameter node. Similarly, a "lane keeping" action node can be connected to a "target lane" parameter node.

[0066] Step S402: Based on the risky operation and risky time point, locate the violation action node in the abstract syntax tree, and obtain the parameter node connected to the violation action node as the violation parameter node.

[0067] Specifically, the system performs reverse path addressing in the AST tree topology based on risky operations and risky time points to accurately locate the corresponding nodes of violations. Then obtain the node of the violation. The corresponding parameter node is considered a violation, for example, locking the violation action node. Further, identify the corresponding illegal parameter nodes. .

[0068] Step S403: Determine the illegal script based on the illegal action node and illegal parameter node.

[0069] In this step, the node of the violation is... Using the root node, data dependency analysis is employed to trace upwards to its source variable and downwards to its controlled child nodes. This allows the smallest complete subtree of the violating action to be pruned and separated from the global AST as the violating script, while maintaining the latched state of other normal behavior tree nodes and normal scripts. This process identifies the violating action node. By combining the relevant violation parameter nodes, the original instructions or code snippets in the autonomous driving test script that cause collision risks can be accurately reconstructed. This reconstructed snippet is the violation script that needs to be adjusted. For example, if the violation action node is "steering" and the violation parameter nodes are "angle = 45 degrees" and "duration = 2 seconds", then the violation script is determined to be "vehicle turns 45 degrees, lasting 2 seconds".

[0070] Furthermore, adjusting the violating scripts includes: constructing incremental guidance instructions that conform to set constraints based on the violating scripts; inputting the incremental guidance instructions into the large language model to obtain the adjusted autonomous driving test script output by the large language model. Specifically, the system maintains a preset binary error mapping matrix, whose input is the compiler's technical error code (e.g., ...). The mapping output is a "semantic description of engineering improvement" for large models. Specifically, the system automatically translates and assembles the tedious syntax errors of the violation script into incremental guidance instructions containing physical / legal constraint suggestions through an error mapping matrix. For example: "The current vehicle deceleration cannot meet the RSS safe distance; please adjust the node..." The braking trigger time is advanced by 1.2 seconds, or the initial vehicle speed is reduced to below 100km / h. This information is then input into a large language model to partially rewrite the non-compliant scripts in the autonomous driving test script.

[0071] Compared with related technologies, the knowledge graph-based autonomous driving test script generation method provided in this embodiment retains the technical effects of the aforementioned embodiments. Through a collision risk judgment mechanism, after obtaining the driving trajectories of the test vehicle and the background vehicles, it first constructs corresponding bounding boxes for the test vehicle and background vehicles, respectively. These bounding boxes, as simplified geometric representations of the vehicles, significantly reduce the computational complexity of subsequent collision detection. Then, it compares the calculated minimum distance with a set safe distance. If the minimum distance is found to be less than the set safe distance, the system can clearly determine that there is a collision risk between the test vehicle and the background vehicles. This concretizes the abstract "collision risk" into a quantifiable geometric distance comparison, providing clear triggering conditions and basis for subsequent test script adjustments. This significantly reduces the existence of autonomous driving test scripts with collision risks, further improving the reliability and safety of autonomous driving test scripts. Furthermore, traditional large models must regenerate the entire long-chain test script when faced with error messages. This not only leads to the repeated calculation of a large number of non-violation script nodes (causing high token computing power overhead), but also, due to the randomness of the output of the large model, the redrawn script is very likely to lose the contextual causal logic before and after, causing the script compilation to crash. In this embodiment, the violation action node and violation parameter node are located by risk operation and risk time point, and the entire violation script is further located. Only the violation script is modified and replaced. The syntax structure and variable naming declaration of other non-violation nodes and non-violation scripts are forcibly locked in memory and do not participate in the redrawing. This greatly reduces the calculation scope of the script correction process, and the token consumption decreases rigidly exponentially (the decrease exceeds 60%). Moreover, because the non-violation variable names and context nodes are in a hard-locked state, the newly generated local subtree is seamlessly stitched with the original system trunk, fundamentally eliminating the logical breaks and variable naming conflicts that inevitably occur when redrawing long chain scripts.

[0072] To better implement the knowledge graph-based autonomous driving test script generation method in the embodiments of this application, based on the knowledge graph-based autonomous driving test script generation method, the corresponding method is as follows: Figure 5 As shown in the figure, this application embodiment also provides an autonomous driving test script generation device based on knowledge graph enhancement. The autonomous driving test script generation device based on knowledge graph enhancement includes: The multidimensional knowledge graph module 501 is used to provide a multidimensional knowledge graph, which includes multiple structured nodes and node constraints connected to each structured node. The statement analysis module 502 is used to obtain natural test statements and extract multiple test keywords from the natural test statements. The constraint matching module 503 is used to obtain the target node that matches the test keyword from multiple structured nodes, and to obtain the node constraint conditions connected to the target node as the target constraint conditions; The test script generation module 504 is used to input the target constraints and natural test statements into the large language model and obtain the autonomous driving test script generated by the large language model.

[0073] The knowledge graph-based autonomous driving test script generation device provided in the above embodiments can realize the technical solutions described in the above knowledge graph-based autonomous driving test script generation method embodiments. The specific implementation principles of each module or unit can be found in the corresponding content in the above knowledge graph-based autonomous driving test script generation method embodiments, which will not be repeated here.

[0074] Please refer to Figure 6 This application also provides an electronic device 400. The electronic device 400 includes: an input serial bus 601, an output serial bus 602, a memory 603, and a processor 604.

[0075] The serial input interface 601 is used to connect to human-computer interaction devices, such as host computers, PCs, etc., to receive natural test statements input by users. The memory 602 is used to store the knowledge graph-based autonomous driving test script generation program and the natural test statements input from the self-serial input interface; The processor 603, coupled to the memory 602, is used to execute the knowledge graph-based autonomous driving test script generation program stored in the memory 602, so as to implement the steps in the knowledge graph-based autonomous driving test script generation method provided in the foregoing embodiments and generate an autonomous driving test script. The output serial bus 604 is used to connect with external autonomous driving test equipment, and output the autonomous driving test script generated by the processor 603 to the autonomous driving test equipment so that the autonomous driving test equipment can execute the autonomous driving test script to complete the autonomous driving simulation test process of the vehicle.

[0076] Please refer to Figure 7 This application also provides an autonomous driving testing system, including: The knowledge graph-based autonomous driving test script generation device 701 and the autonomous driving test equipment 702 connected to the knowledge graph-based autonomous driving test script generation device are provided in the foregoing embodiments. The knowledge graph-based autonomous driving test script generation device 701 is used to execute the steps in the knowledge graph-based autonomous driving test script generation method provided in the foregoing embodiments to generate an autonomous driving test script and input the autonomous driving test script into the autonomous driving test device 702. The autonomous driving test equipment 702 runs an autonomous driving test script to perform autonomous driving simulation tests.

[0077] In all specific embodiments of this application, whenever processing is required based on user information, user behavior data, user historical data, and user location information—data related to user identity or characteristics—user permission or consent is obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards. Additionally, when embodiments of this application require access to sensitive user personal information, separate permission or consent from the user is obtained via pop-ups or redirection to a confirmation page. Only after obtaining the user's separate permission or consent is the necessary user-related data required for the proper functioning of these embodiments acquired.

[0078] The above provides a detailed description of the knowledge graph-based autonomous driving test script generation method, apparatus, electronic device, and vehicle provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for generating autonomous driving test scripts based on knowledge graph enhancement, characterized in that, include: A multidimensional knowledge graph is provided, which includes multiple structured nodes and node constraints connected to each of the structured nodes; Obtain natural test statements, and extract keywords from the natural test statements to obtain multiple test keywords; Obtain the target node that matches the test keyword from the plurality of structured nodes, and use the node constraints connected to the target node as the target constraints; Input the target constraints and the natural test statement into the large language model to obtain the autonomous driving test script generated by the large language model.

2. The method for generating autonomous driving test scripts based on knowledge graph enhancement according to claim 1, characterized in that, The autonomous driving test script includes the test vehicle and the environmental background vehicle; The knowledge graph-based autonomous driving test script generation method further includes: The test vehicle's driving trajectory and the background vehicle's driving trajectory are obtained based on the autonomous driving test script. Based on the driving trajectory of the test vehicle and the driving trajectory of the background vehicle, it is determined whether there is a risk of collision between the test vehicle and the background vehicle. If there is a risk of collision between the test vehicle and the vehicles in the environmental background, the autonomous driving test script will be adjusted.

3. The method for generating autonomous driving test scripts based on knowledge graph enhancement according to claim 2, characterized in that, The step of determining whether there is a collision risk between the test vehicle and the background vehicles based on the test vehicle's trajectory and the background vehicle's trajectory includes: Based on the set bounding box parameters, construct a test vehicle bounding box corresponding to the test vehicle and a background vehicle bounding box corresponding to the environmental background vehicles; Based on the set sampling time point, the driving trajectory of the test vehicle is sampled to obtain multiple test vehicle sampling positions. Based on the set sampling time point, the driving trajectory of the background vehicle is sampled to obtain multiple background vehicle sampling positions. For each of the set sampling time points, calculate the minimum distance between the test vehicle and each of the environmental background vehicles; If the minimum distance is less than the set safe distance, it is determined that there is a risk of collision between the test vehicle and the vehicles in the background environment.

4. The method for generating autonomous driving test scripts based on knowledge graph enhancement according to claim 3, characterized in that, The adjustment of the autonomous driving test script includes: If the minimum distance is less than the set safe distance, the set sampling time point corresponding to the minimum distance is obtained as the risk time point, and the vehicle operation of the test vehicle at the risk time point is determined as the risk operation based on the autonomous driving test script. Based on the risky operation and the risky time point, locate the violation script and adjust the violation script.

5. The method for generating autonomous driving test scripts based on knowledge graph enhancement according to claim 4, characterized in that, The script for locating violations based on the risky operation and the risky time point includes: The autonomous driving test script is compiled into an abstract syntax tree, which includes multiple action nodes and parameter nodes connected to the action nodes. Based on the risky operation and the risky time point, the violation action node is located in the abstract syntax tree, and the parameter node connected to the violation action node is obtained as the violation parameter node. The violation script is determined based on the violation action node and the violation parameter node.

6. The method for generating autonomous driving test scripts based on knowledge graph enhancement according to claim 4, characterized in that, The adjustment of the violating script includes: Based on the violation script, an incremental guidance instruction that meets the set constraints is constructed; The incremental guidance instruction is input into the large language model to obtain the adjusted autonomous driving test script output by the large language model.

7. The method for generating autonomous driving test scripts based on knowledge graph enhancement according to claim 1, characterized in that, Constructing the multidimensional knowledge graph includes: Obtain regulatory and / or physical constraints, which include multiple vehicle operations and vehicle operation constraints corresponding to each of the vehicle operations. The structured nodes are constructed based on the vehicle operations, the node constraints are constructed based on the vehicle operation constraints, and the connection relationship between the structured nodes and the node constraints is constructed based on the vehicle operations and their correspondence with the vehicle operation constraints.

8. A knowledge graph-based autonomous driving test script generation device, characterized in that, include: A multidimensional knowledge graph module is used to provide a multidimensional knowledge graph, which includes multiple structured nodes and node constraints connected to each of the structured nodes. The statement analysis module is used to obtain natural test statements and extract multiple test keywords from the natural test statements. The constraint matching module is used to obtain the target node that matches the test keyword among the plurality of structured nodes, and to obtain the node constraint conditions connected to the target node as the target constraint conditions; A test script generation module is used to input the target constraints and the natural test statements into a large language model to obtain an autonomous driving test script generated by the large language model.

9. An electronic device, characterized in that, include: The system consists of an input serial bus, an output serial bus, a memory, and a processor. The input serial bus is used to input natural test statements; The memory is used to store the program, the natural test statement, and the multidimensional knowledge graph; The processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the knowledge graph-based autonomous driving test script generation method according to any one of claims 1 to 7, and to obtain an autonomous driving test script. The output serial bus is used to output the autonomous driving test script to the autonomous driving test equipment.

10. An autonomous driving testing system, characterized in that, include: The knowledge graph-based autonomous driving test script generation device as described in claim 8 and the autonomous driving test equipment connected to the knowledge graph-based autonomous driving test script generation device; The knowledge graph-based autonomous driving test script generation device is used to execute the steps in the knowledge graph-based autonomous driving test script generation method according to any one of claims 1 to 7, so as to generate an autonomous driving test script and input the autonomous driving test script into the autonomous driving test equipment. The autonomous driving test equipment runs the autonomous driving test script to perform autonomous driving simulation tests.