A traffic safety scene text generation method, device, equipment and medium

By acquiring the initial parameter set input by the user, and using a generative artificial intelligence model and a preset semantic constraint template to generate traffic safety scenario files, the problem of insufficient semantic alignment in existing technologies is solved, and scenario data generation with high consistency and interchangeability is achieved, thereby improving user interaction and data stability.

CN122113862APending Publication Date: 2026-05-29CHONGQING JINKANG NEW ENERGY VEHICLE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610200355.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-11
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing technologies suffer from insufficient semantic alignment when generating structured scene data, leading to difficulties in cross-toolchain exchange and reuse.

Method used

By acquiring the initial set of parameters input by the user, input prompts for the generative artificial intelligence model are generated based on a preset semantic constraint template. The generative artificial intelligence model is then used for inference to generate traffic safety scene files. A streaming inference and real-time rendering mechanism is adopted, and persistent storage is achieved by combining timestamp session headers and atomic operations.

Benefits of technology

It improves the semantic consistency and interchangeability of generated text, ensures that the generated scene data conforms to industry standards, and enhances the immediacy of user interaction and the stability of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122113862A_ABST
    Figure CN122113862A_ABST
Patent Text Reader

Abstract

The application discloses a traffic safety scene text generation method, comprising: obtaining an initial parameter set input by a user; generating prompt information based on the initial parameter set and a preset semantic constraint template; the semantic constraint template comprises a plurality of non-numeric mandatory items and their arrangement order; receiving scene description information generated by a generative artificial intelligence model in response to an inference request based on the input prompt information; and generating a traffic safety scene file based on the scene description information. The application generates highly structured input prompt information by receiving an initial parameter set input by a user and combining a preset semantic constraint template. Since the semantic constraint template clearly specifies a plurality of mandatory non-numeric items and their arrangement order, and rigidly stipulates that no numerical parameters are allowed in the prompt information, the generative artificial intelligence model can be strictly limited within the preset semantic framework when receiving instructions to perform inference and creation, thereby improving the semantic consistency of the generated text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of autonomous driving technology, specifically to a method, apparatus, device, and medium for generating text for traffic safety scenarios. Background Technology

[0002] The validation and evaluation of Automated Driving Systems (ADS) and Advanced Driver-Assistance Systems (ADAS) is evolving from a "functional use case" methodology to a "scenario-centric" approach. Currently, international and industry standards have established a relatively clear division of labor: ISO 34503 (International Organization for Standardization) proposes a hierarchical classification method and unified definition format for defining the Operational Design Domain (ODD) of autonomous driving systems to support the construction and exchange of test scenarios. ASAM OpenODD (Open Operational Design Domain) provides a technology-independent (Unified Modeling Language, UML) data model and exchange format for consistent expression of OD / current ODD / target ODD, etc. ASAM OpenSCENARIO DSL (V2.x) is geared towards large-scale V&V (Verification & Validation), emphasizing the ability to abstract, combine, and reuse scenarios, allowing simple scenarios to be combined as components into complex scenarios. UNECE VMAD's NATM (New Assessment / Test Method) framework requires the establishment of a traceable safety evidence chain among multiple pillars, including auditing, simulation, closed-site testing, and open roads. These standards collectively lay the foundation for the methodology of "ODD → logic / specific scenario → verification evidence".

[0003] Based on the aforementioned standards, the industry has developed two main technical approaches: The first is a top-down modeling approach based on standard languages / templates. Engineers utilize the six-layer model and scenario database method proposed by PEGASUS (Project for the Development and Generation of Automated Accident Simulation Scenarios for Unfall-Simulation), to structurally describe road networks and traffic guidance, roadside structures, temporary modifications, dynamic participants, environmental conditions, and digital information, and then manually or semi-automatically generate OpenSCENARIO scenarios and variations. The second is a text / knowledge-driven automated approach, typically using natural language corpora or itemized templates as input. This involves NLP (Natural Language Processing) processes such as rule / dictionary / named entity recognition, or generation using large models, followed by mapping and verification scripts to form structured results that interface with OpenODD / OSCDSL.

[0004] In current practice, information loss or ambiguity often occurs during the conversion between different standards and from text to DSL, affecting the exchange and reuse of scenario data across toolchains. Although OpenODD aims to provide a unified exchange model, the mapping of this model between templates and scripts is still not complete in actual enterprise implementations. Summary of the Invention

[0005] This application provides a method, apparatus, device, and medium for generating text in traffic safety scenarios to address the problem of insufficient semantic alignment when generating structured scenarios.

[0006] This application provides a method for generating text for traffic safety scenarios, including: Obtain the initial set of parameters input by the user; Based on the initial parameter set and the preset semantic constraint template, input prompt information for the generative artificial intelligence model is generated; wherein, the semantic constraint template includes multiple non-numerical required fields and their order; an inference request is initiated to the generative artificial intelligence model, and scene description information generated by the generative artificial intelligence model in response to the inference request based on the input prompt information is received; A traffic safety scenario file is generated based on the scenario description information.

[0007] In one embodiment of this application, the inference request is a streaming inference request, the scene description information includes multiple scene description increments, and the multiple scene description increments are output in the form of a data stream through the association service of the generative artificial intelligence model; the generation of a traffic safety scene file based on the scene description information includes: The incremental information of the multiple scene descriptions is parsed to extract the incremental text of the multiple scene descriptions; The incremental text describing the scenario is updated to the user's graphical interface in real time to generate traffic safety scenario text based on the multiple incremental texts describing the scenario.

[0008] In one embodiment of this application, the traffic safety scene text generation method further includes: Add a session header containing a timestamp to the traffic safety scenario text; The traffic safety scenario text with added session headers is persistently stored using atomic operations.

[0009] In one embodiment of this application, before persistently storing the traffic safety scene text, the method includes: When receiving multiple scene description incremental information returned in the form of a data stream, the receiving status of the data stream is monitored. The receiving status includes the reception status of valid scene description incremental information, the reception status of user stop instructions, and whether any abnormalities occur in the parsing process of the multiple scene description incremental information. When valid scenario description increment information is received, no user stop instruction is received, and no abnormality occurs during the parsing process, it is determined that the traffic safety scenario text has been generated successfully; the persistent storage operation of the traffic safety scenario text is triggered when the traffic safety scenario text is completed.

[0010] In one embodiment of this application, the traffic safety scene text generation method further includes: Perform integrity checks on the initial parameter set; or / and After initiating an inference request to the generative artificial intelligence model, a verification result is obtained from the associated service of the generative artificial intelligence model. If the verification result indicates that the verification has failed, the generation of traffic safety scenario text is terminated. The verification result is generated after the access credentials for accessing the generative artificial intelligence model are validated by the associated service of the generative artificial intelligence model.

[0011] In one embodiment of this application, the required fields in the semantic constraint template include a set of structured semantic fields used to describe basic scenario information, traffic participants, operating environment constraints, behavioral logic sequences, and risk and compliance requirements.

[0012] In one embodiment of this application, generating input prompt information for a generative artificial intelligence model includes: Generate system role messages based on predefined semantic constraint templates; Generate user role messages based on the initial parameter set; The system role message and the user role message are assembled into a structured input prompt message.

[0013] This application provides a traffic safety scene text generation device, comprising: The data acquisition module is used to acquire the initial set of parameters input by the user; The prompt word generation module is used to generate input prompt information for generative artificial intelligence models based on the initial parameter set and the preset semantic constraint template; wherein, the semantic constraint template includes multiple non-numerical required fields and their order. An interaction module is used to initiate a reasoning request to the generative artificial intelligence model and receive scene description information generated by the generative artificial intelligence model in response to the reasoning request, based on the input prompt information. The text generation module is used to generate a traffic safety scenario file based on the scenario description information.

[0014] This application provides a traffic safety scene text generation device, comprising: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, enable the traffic safety scene text generation device to implement a traffic safety scene text generation method.

[0015] This application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer's processor, causes the computer to perform a method for generating text for traffic safety scenarios.

[0016] The beneficial effects of this application are as follows: A traffic safety scene text generation method of this application includes: obtaining an initial parameter set input by a user; generating input prompt information for a generative artificial intelligence model based on the initial parameter set and a preset semantic constraint template; wherein the semantic constraint template includes multiple non-numerical required fields and their order; initiating a reasoning request to the generative artificial intelligence model and receiving scene description information generated by the generative artificial intelligence model in response to the reasoning request based on the input prompt information; and generating a traffic safety scene file based on the scene description information. This application generates highly structured input prompt information by receiving an initial parameter set input by a user and combining it with a preset semantic constraint template. Because the semantic constraint template clearly defines multiple required non-numerical semantic fields and their order, and strictly prohibits the appearance of numerical items in the prompt information, this allows the generative artificial intelligence model to be strictly restricted to reasoning and creation within a preset semantic framework when receiving instructions, thereby improving the semantic consistency of the generated text.

[0017] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings: The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0019] In the attached diagram: Figure 1 This is a flowchart illustrating a traffic safety scenario text generation method according to an embodiment of this application; Figure 2 This is a schematic diagram illustrating the process of generating traffic safety scene text based on input prompt information using a generative artificial intelligence model according to an embodiment of this application; Figure 3 This is a flowchart illustrating a traffic safety scene text generation method according to an embodiment of this application; Figure 4This is a schematic diagram illustrating the process of generating input prompt information for a generative artificial intelligence model according to an embodiment of this application; Figure 5 This is a schematic diagram of a traffic safety scene text generation device according to an embodiment of this application; Figure 6 A schematic diagram of a computer system suitable for implementing the memory of the embodiments of this application is shown. Detailed Implementation

[0020] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0021] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. The drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the shape, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0022] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the present application. However, it will be apparent to those skilled in the art that embodiments of the present application may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the present application.

[0023] Please see Figure 1 , Figure 1 This is a flowchart illustrating a traffic safety scene text generation method according to an embodiment of this application. The traffic safety scene text generation method includes at least steps S110 to S140, which are described in detail below: Step S110: Obtain the initial parameter set input by the user; In this step, the system receives an initial parameter set from the user via a graphical user interface (GUI) or a web-based platform (such as React / Vue). This initial parameter set includes the geographic region, vehicle type, time and weather conditions, and the output requirements of the generative AI model. The GUI, built using Tkinter / ttk, includes an input area, a status area, and "Generate / Export" controls. Upon user submission, the GUI performs an integrity check on the initial parameter set. If any parameter is missing, the traffic safety scenario text generation process is terminated, and the user is notified. Simultaneously, the system loads configurable model access parameters at startup and allows for dynamic adjustments during runtime, thus creating a configurable environment that flexibly adapts to different backend services and generation needs.

[0024] Step S120: Based on the initial parameter set and the preset semantic constraint template, generate input prompt information for the generative artificial intelligence model; wherein, the semantic constraint template includes multiple non-numerical required fields and their order. The semantic constraint template is a predefined structured framework that guides generative AI models to follow specific semantic and formatting requirements when generating text. Specifically, the semantic constraint template includes multiple non-numerical required fields and their order. These non-numerical required fields mean that no specific numerical parameters are allowed; only categorical terms are permitted.

[0025] Generative artificial intelligence models are natural language generation models that can generate continuous text sequences based on structured prompts. They can be implemented using large language models based on the Transformer architecture and have the ability to understand and generate complex semantic instructions.

[0026] In this step, multiple required fields are arranged in a fixed order in the semantic constraint template. Each required field corresponds to a standardized semantic slot, which is filled in according to the input parameters when generating prompt words to form a scene description skeleton. Non-numerical required fields require the model to use only categorical terms (such as "low speed," "medium to long distance," "moderate acceleration," etc.) for qualitative description during generation, and prohibits the inclusion of any specific numerical parameters (such as "speed is 50m / s," "acceleration is 100m / s²"). 2 By constructing input prompts that are "non-numerical parameterized + strong field skeleton", the constraints of semantic consistency and commutativity are placed at the generation end, providing a stable anchor point for the direct mapping of the generated scene text to the industry standard data model.

[0027] Step S130: Initiate an inference request to the generative artificial intelligence model and receive scene description information generated by the generative artificial intelligence model in response to the inference request, based on the input prompt information; Among them, traffic safety scenario text is descriptive scenario content text that meets the requirements of intelligent driving testing.

[0028] In this step, the client sends an inference request to the generative AI model, which includes structured input prompts. Upon receiving the inference request, the generative AI model performs logical reasoning and content generation, outputting a detailed scene description that meets the requirements.

[0029] Step S140: Generate a traffic safety scenario file based on the scenario description information.

[0030] In this step, after receiving the scene description information output by the associated service of the generative artificial intelligence model, the client parses and transforms the scene description information to generate a structured traffic safety scene file.

[0031] This application generates highly structured input prompts by receiving an initial set of parameters from the user and combining them with a preset semantic constraint template. Because the semantic constraint template explicitly defines several required non-numerical semantic fields and their order, and strictly prohibits the appearance of numerical items in the prompts, the generative AI model is strictly confined to reasoning and creation within a preset semantic framework when receiving instructions, thereby improving the semantic consistency of the generated text.

[0032] In one embodiment, the system prompts a minimum of 4 prompts and the user prompts a minimum of 8 prompts, which expands the coverage and reusability.

[0033] In one embodiment, the inference request is a streaming inference request; the scene description information includes multiple scene description increments, which are output as a data stream through the association service of the generative artificial intelligence model.

[0034] Streaming inference requests are a network communication mode that allows clients or servers to begin receiving and processing data streams before the data is fully generated. Specifically, in this embodiment, a streaming inference request refers to a request issued by a generative artificial intelligence model, which allows the model to progressively return partial generated results in the form of a continuous data stream before generating a complete response.

[0035] Among them, associated services refer to proxy services or gateway interfaces that interface with generative artificial intelligence models.

[0036] After constructing the input prompts, a background thread is created. The client initiates a streaming request (SSE (Server-SentEvents) / fragmented form) to connect to the generative AI model interface using a streaming protocol for continuous data push communication. Each streaming data packet carries incremental content with the prefix "data:". The generative AI model's associated services gradually output multiple scene description increments (consisting of various text fragments that make up the final complete text) during the inference process, and then return them to the client in the form of a data stream. The scene description increments can be encapsulated in JSON (JavaScript Object Notation) format.

[0037] Please see Figure 2 , Figure 2 This is a schematic diagram illustrating the process of generating a traffic safety scene file based on scene description information, according to an embodiment of this application. Figure 2 In the process of generating a traffic safety scenario file based on scenario description information, steps S210 to S220 are included at least, as detailed below: Step S210: Parse the incremental information of multiple scene descriptions to extract the incremental text of multiple scene descriptions; In this step, the scene description increment information is parsed to extract the valid scene description increment text from the streaming data packet.

[0038] Step S220: Update the incremental text of the scene description to the user's graphical interface in real time to generate traffic safety scene text based on multiple incremental texts of the scene description.

[0039] In this step, after extracting the incremental text of the scene description, the incremental text of the scene description is delivered to the UI thread (User Interface Thread) through a thread-safe message queue. The UI thread then updates the incremental text of the scene description to the user's graphical interface in real time, thereby providing continuous and visible output feedback during the long text generation process.

[0040] This application adopts a streaming processing and real-time rendering mechanism, which allows users to obtain incremental results in real time. Users can gradually see the presentation of text content without waiting for the entire traffic safety scenario text to be generated, which greatly improves the immediacy and smoothness of user interaction.

[0041] In one embodiment, when initiating an inference request to a generative artificial intelligence model, the inference request can be initiated through a bidirectional network communication protocol WebSocket or HTTP (Hypertext Transfer Protocol) chunked transmission method, or data transmission can be achieved through the generative artificial intelligence model service interface.

[0042] In one embodiment, the display of traffic safety scene text can be implemented based on an asynchronous task scheduling and message passing structure composed of the asyncio event loop and asyncio.Queue. The asyncio event loop is the core scheduler in Python's asynchronous programming model, used to coordinate the execution of multiple coroutine tasks and I / O event processing within a single thread. asyncio.Queue is an asynchronous queue based on the event loop, designed for inter-coroutine communication, supporting non-blocking message delivery and retrieval.

[0043] In one embodiment, a unified exception handling mechanism is also provided for various abnormal situations such as non-200 status codes, request timeouts, network connection errors, character decoding failures, and JSON parsing failures. This includes: employing a "parsing exception is only prompted once" mechanism, clearing the stream buffer, and delivering placeholder prompts to avoid repeated pop-ups and output pollution; simultaneously, it supports persistent storage of the original stream fragment to the local disk in debug mode, facilitating problem reproduction and auditing. Furthermore, the aforementioned "streaming incremental decoding + UI (User Interface) thread-safe rendering + single-error alarm" constitutes a concurrency robustness improvement point for the system across the "data acquisition—content processing—result output" chain, reducing initial screen wait time and significantly improving failure location efficiency.

[0044] Please see Figure 3 , Figure 3 This is a flowchart illustrating a traffic safety scene text generation method according to an embodiment of this application. The traffic safety scene text generation method includes at least steps S310 to S320, which are described in detail below: Step S310: Add a session header containing a timestamp to the traffic safety scenario text; The session header refers to a piece of data that is appended to the data body during data transmission or storage.

[0045] In this step, after the traffic safety scenario text is generated, a session header containing a timestamp is added to the traffic safety scenario text.

[0046] Step S320: Persistently store the traffic safety scenario text with added session headers through atomic operations.

[0047] In this step, the system first creates a temporary file in the target storage directory, writes the traffic safety scenario text with a session header into this temporary file, and then calls an atomic operation to rename the temporary file to the final target filename. This process ensures that the original target file is not corrupted in the event of an exception during any write phase. The system also supports two storage modes: "overwrite" and "append". In overwrite mode, the existing file is directly replaced; in append mode, the new file content is inserted at the end of the existing file and the history is retained, meeting the version management needs of different use cases.

[0048] This application adopts a storage strategy of timestamp session header + atomic replacement after temporary file writing and overwrite / append, which makes the exported records naturally have version anchors and no "half-write" risk, making it easy for compliance auditing, backtracking and comparison; compared with manual splicing and ordinary storage methods, it reduces the risk of data corruption.

[0049] In one embodiment, traffic safety scenario text can be stored in structured data formats such as TXT (plain text) files, JSON, or YAML (YAML is not Markup Language).

[0050] In one embodiment, before persistently storing the traffic safety scene text, the method includes: When receiving multiple scene description incremental information returned in the form of data stream, the receiving status of the data stream is monitored. The receiving status includes the reception status of valid scene description incremental information, the reception status of user stop command, and whether any abnormalities occur in the parsing process of multiple scene description incremental information. When valid incremental scenario description information is received, no user termination instruction is received, and no anomalies occur during the parsing process, the traffic safety scenario text generation is considered complete. The persistent storage operation of the traffic safety scenario text is triggered upon completion of the traffic safety scenario text.

[0051] In this step, the receiving status of the data stream is monitored by tracking and recording the entire data stream processing process in real time. This is achieved through a set of status variables (such as `is_running`, `stop_event`, and `parse_error_shown`) and queue messages (such as `status`, `enable_button`, and `auto_save`). `is_running` indicates whether the generation task is in progress; it is set to `True` when the task starts and `False` when generation is complete, the user stops it, or an exception occurs. `stop_event` notifies the background generation thread to stop execution; it calls `stop_event.set()` to set the event when the user clicks the "Stop" button. `parse_error_shown` indicates whether a parsing error message has been displayed to the user. It is set to `True` if an error message is displayed and reset to `False` if the task has finished. `status` is a message field that conveys the current status description of the generation task, notifying the UI thread of the real-time status of the background task (such as "Generating", "Completed", "Stopped", "Exception Occurred", etc.). `enable_button` is used to notify the UI thread to enable or disable specific buttons (such as "Generate Scene", "Stop", "Export", etc.); `auto_save` is used to indicate whether to automatically perform a save operation.

[0052] In this step, status monitoring begins when the data stream request is initiated. The system synchronously updates various status variables in a background thread: `is_running=True` is set whenever a text segment containing valid semantic content is successfully parsed; `stop_event=True` is set when the user clicks the stop button or sends an abort command; and `parse_error_shown=True` is set when any exception is caught during parsing. If `is_running=True`, `stop_event=False`, and `parse_error_shown=True=False`, the process is considered complete normally; otherwise, it is considered an exception or user-initiated abort. The storage trigger mechanism executes immediately upon successful completion. The system automatically calls the persistent storage module, adds a session header to the traffic safety scenario text, and writes it to the storage medium via atomic operations.

[0053] In one embodiment, the traffic safety scene text generation method further includes: Perform integrity checks on the initial parameter set; or / and After initiating an inference request to the generative AI model, the verification result is obtained from the associated service of the generative AI model. If the verification result indicates that the verification has failed, the generation of traffic safety scenario text is terminated. The verification result is generated by verifying the validity of the access credentials for accessing the generative AI model through the associated service of the generative AI model.

[0054] In this step, after the user submits the initial parameter set, the system sequentially checks whether the three parameters—"city location," "initial vehicle type," and "initial time and weather"—are empty, whether they conform to the preset format (e.g., whether the time format is valid and whether the weather options are within the enumeration range), and whether the parameter combination is valid in business logic (e.g., compatibility checks between extreme weather and certain vehicle types). If any check fails, the system terminates the process, locates and prompts the specific missing or erroneous item, and prevents invalid requests from being sent to downstream processing stages.

[0055] After initiating an inference request to the generative AI model, the system retrieves the verification result of the access credentials (security tokens or keys used to authorize access to the generative AI model's associated services, including but not limited to API Key (Application Programming Interface Key) authentication information) returned by the associated services of the generative AI model. If the verification result indicates successful verification, the subsequent process continues; if the verification result indicates verification failure, the system immediately terminates the traffic safety scenario text generation process.

[0056] This application improves ease of operation and operational reliability by setting input item integrity checks (city / vehicle / time and weather are required) and API key checks in "Data Acquisition" and "Execution Process Control".

[0057] In one embodiment, the required fields in the semantic constraint template include a set of structured semantic fields used to describe basic scenario information, traffic participants, operating environment constraints, behavioral logic sequences, and risk and compliance requirements.

[0058] The basic elements of a scene include: road type and environmental conditions; The main elements and interactive elements include: the vehicle / system and the function under test, the interactive objects, and their relative roles; The operational framework elements include: operational design domain boundaries, road configuration, traffic rules, and temporary changes; Dynamic logic elements include: task and intent, sequence of behaviors, and trigger / termination conditions; Safety and compliance elements include: hazard points, minimum risk strategy positioning, and compliance / key performance indicators positioning.

[0059] Road types include highways, urban roads, rural roads, ramps, etc.; environmental conditions refer to external environmental conditions such as lighting, weather, and visibility; vehicle / system and tested function refer to the vehicle and its autonomous driving function modules to be tested, such as perception systems, decision-making and planning modules, and control systems; interaction objects and relative roles refer to other traffic participants who interact with the vehicle and their behavioral roles, such as vehicles cutting in from the front, pedestrians crossing the road, and oncoming vehicles; the operational design domain boundary refers to the limiting conditions of the autonomous driving system's designed operational range, such as speed range, geofencing, and traffic density; road configuration refers to road geometry such as the number of lanes, intersection shape, and curvature. Features; Traffic rules refer to the applicable traffic regulations and sign / marking constraints in the current scenario; Temporary changes refer to dynamic changes such as temporary construction, accident-related lane closures, and traffic control; Tasks and intentions refer to driving goals and behavioral intentions, such as lane changing, following other vehicles, and passing through intersections; Behavioral sequence refers to the orderly behavioral description of each traffic participant on the timeline; Trigger / termination conditions refer to the logical judgment conditions for the start and end of the scenario; Danger points refer to the locations or moments of potential safety risks in the scenario; Minimum risk strategy placeholders refer to the preset marker locations of system degradation or takeover strategies; Compliance / Key Performance Indicator placeholders refer to the indicator anchor points used for subsequent compliance checks and performance evaluations.

[0060] The semantic constraint template of this application is required to include semantic anchors such as the boundary of the operating design domain, trigger / termination, minimum risk strategy placeholder, and compliance / key performance indicator placeholder. It can be directly mapped to the layered semantic and exchange model of ISO 34503 / OpenODD and can be included in the NATM multi-pillar evidence chain, reducing secondary annotation and reorganization in engineering. This provides directly usable structured evidence for compliance auditing and version management.

[0061] Please see Figure 4 , Figure 4 This is a flowchart illustrating the construction of input prompt information for a generative artificial intelligence model according to an embodiment of this application. The construction of input prompt information for a generative artificial intelligence model includes at least steps S410 to S430, which are described in detail below: Step S410: Generate system role messages based on predefined semantic constraint templates; Among them, system role messages have a fixed format, which transmit instructional prompts to generative artificial intelligence models in the name of the system.

[0062] Step S420: Generate user role messages based on the initial parameter set; In this context, user role messages convey request prompts to the generative AI model from the user's perspective, used to inject an initial parameter set. The initial parameter set includes the geographical region, vehicle type, time and weather conditions, as well as the output requirements of the generative AI model, such as the number of traffic safety scene texts to be output.

[0063] Step S430: Assemble the system role message and user role message into a structured input prompt message.

[0064] In this step, system role messages and user role messages are combined in a specific format that generative artificial intelligence models can recognize and parse, ultimately constructing complete request data that conforms to the generative artificial intelligence model API specification.

[0065] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0066] Please see Figure 5 , Figure 5 This is a schematic diagram illustrating the principle of a traffic safety scene text generation device according to an embodiment of this application. Figure 5 The traffic safety scenario text generation device includes: The data acquisition module 510 is used to acquire the initial parameter set input by the user; The prompt word generation module 520 is used to generate input prompt information for generative artificial intelligence models based on the initial parameter set and the preset semantic constraint template; wherein, the semantic constraint template includes multiple non-numerical required items and their order. The interaction module 530 is used to initiate inference requests to the generative artificial intelligence model and receive scene description information generated by the generative artificial intelligence model in response to the inference requests, based on the input prompt information. The text generation module 540 is used to generate traffic safety scenario files based on scenario description information.

[0067] It should be noted that the traffic safety scene text generation device and the traffic safety scene text generation method provided in the above embodiments belong to the same concept. The specific operation methods of each module and unit have been described in detail in the method embodiments and will not be repeated here. In practical applications, the traffic safety scene text generation device provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. This is not a limitation here.

[0068] Embodiments of this application also provide a traffic safety scene text generation device, including: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by one or more processors, the memory implements the traffic safety scene text generation method in the above embodiments.

[0069] Embodiments of this application also provide one or more machine-readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the traffic safety scene text generation method described in the above embodiments.

[0070] Figure 6 A schematic diagram of a computer system suitable for implementing the memory of embodiments of this application is shown. It should be noted that... Figure 6 The computer system with the memory shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0071] like Figure 6 As shown, the computer system 600 includes a Central Processing Unit (CPU) 601, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, based on a program stored in Read-Only Memory (ROM) 602 or a program loaded from storage into Random Access Memory (RAM) 603. The RAM also stores various programs and data required for system operation. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An Input / Output (I / O) interface 605 is also connected to the bus 604.

[0072] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.

[0073] Specifically, according to embodiments of this application, the processes described in the above-described flowchart can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the aforementioned traffic safety scene text generation method. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, it performs various functions defined in the system of this application.

[0074] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM) 603, read-only memory (ROM) 602, erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0075] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in the flowchart or block diagram may represent a module, program segment, or portion of code, which contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block or combination of blocks in the block diagram or flowchart may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0076] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.

[0077] Another aspect of this application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer's processor, causes the computer to perform the traffic safety scene text generation method described above. This computer-readable storage medium may be included in the memory described in the above embodiments, or it may exist independently and not be assembled into that memory.

[0078] Another aspect of this application provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the traffic safety scene text generation method provided in the various embodiments described above.

[0079] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.

Claims

1. A method for generating text for traffic safety scenarios, characterized in that, The traffic safety scenario text generation method includes: Obtain the initial set of parameters input by the user; Based on the initial parameter set and the preset semantic constraint template, input prompt information for generative artificial intelligence models is generated; wherein, the semantic constraint template includes multiple non-numerical required fields and their order. Initiate an inference request to the generative artificial intelligence model and receive scene description information generated by the generative artificial intelligence model in response to the inference request, based on the input prompt information; A traffic safety scenario file is generated based on the scenario description information.

2. The traffic safety scene text generation method according to claim 1, characterized in that, The inference request is a streaming inference request, and the scene description information includes multiple scene description increments, which are output in the form of a data stream through the association service of the generative artificial intelligence model. The process of generating a traffic safety scenario file based on the scenario description information includes: The incremental information of the multiple scene descriptions is parsed to extract the incremental text of the multiple scene descriptions; The incremental text describing the scenario is updated to the user's graphical interface in real time to generate traffic safety scenario text based on the multiple incremental texts describing the scenario.

3. The traffic safety scene text generation method according to claim 1, characterized in that, The traffic safety scenario text generation method also includes: Add a session header containing a timestamp to the traffic safety scenario text; The traffic safety scenario text with added session headers is persistently stored using atomic operations.

4. The traffic safety scene text generation method according to claim 3, characterized in that, Before persistently storing the traffic safety scenario text, the method includes: When receiving multiple scene description incremental information returned in the form of a data stream, the receiving status of the data stream is monitored. The receiving status includes the reception status of valid scene description incremental information, the reception status of user stop instructions, and whether any abnormalities occur in the parsing process of the multiple scene description incremental information. When valid scenario description increment information is received, no user stop instruction is received, and no abnormality occurs during the parsing process, it is determined that the traffic safety scenario text has been generated successfully; the persistent storage operation of the traffic safety scenario text is triggered when the traffic safety scenario text is completed.

5. The method for generating traffic safety scene text according to claim 1, characterized in that, The traffic safety scenario text generation method also includes: Perform integrity checks on the initial parameter set; or / and After initiating an inference request to the generative artificial intelligence model, a verification result is obtained from the associated service of the generative artificial intelligence model. If the verification result indicates that the verification has failed, the generation of traffic safety scenario text is terminated. The verification result is generated after the access credentials for accessing the generative artificial intelligence model are validated by the associated service of the generative artificial intelligence model.

6. The traffic safety scene text generation method according to claim 1, characterized in that, The required fields in the semantic constraint template include a set of structured semantic fields used to describe basic scenario information, traffic participants, operating environment constraints, behavioral logic sequences, and risk and compliance requirements.

7. The traffic safety scene text generation method according to claim 1, characterized in that, The input prompts generated for the generative artificial intelligence model include: Generate system role messages based on predefined semantic constraint templates; Generate user role messages based on the initial parameter set; The system role message and the user role message are assembled into a structured input prompt message.

8. A traffic safety scene text generation device, characterized in that, include: The data acquisition module is used to acquire the initial set of parameters input by the user; The prompt word generation module is used to generate input prompt information for generative artificial intelligence models based on the initial parameter set and the preset semantic constraint template; wherein, the semantic constraint template includes multiple non-numerical required fields and their order. An interaction module is used to initiate a reasoning request to the generative artificial intelligence model and receive scene description information generated by the generative artificial intelligence model in response to the reasoning request, based on the input prompt information. The text generation module is used to generate a traffic safety scenario file based on the scenario description information.

9. A traffic safety scene text generation device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, cause the traffic safety scene text generation device to implement the traffic safety scene text generation method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, It stores a computer program, which, when executed by the computer's processor, causes the computer to perform the traffic safety scene text generation method according to any one of claims 1 to 7.