A method for generating automatic driving test scenarios considering two-wheeled vehicle driver behavior

By analyzing two-wheeled vehicle traffic accident data and using GSDMM and K-Prototypes algorithms to generate autonomous driving test scenarios, the problem of insufficient coverage of two-wheeled vehicle behavior patterns in existing technologies has been solved, achieving efficient and diversified test scenario generation and improving the safety and reliability of autonomous driving systems.

CN120744824BActive Publication Date: 2026-06-23CHANGSHA UNIVERSITY OF SCIENCE AND TECHNOLOGY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHANGSHA UNIVERSITY OF SCIENCE AND TECHNOLOGY
Filing Date
2025-06-25
Publication Date
2026-06-23

Smart Images

  • Figure CN120744824B_ABST
    Figure CN120744824B_ABST
Patent Text Reader

Abstract

The application discloses a kind of automatic driving test scene generation methods considering two-wheel vehicle driver behavior, comprising: obtaining the numerical data and text data of multiple motor vehicle-two-wheel vehicle traffic accident samples;Numerical data constructs classification variable matrix and continuous variable matrix;Traffic accident document set is obtained based on text data;The correlation of classification variable matrix is handled, and the data corresponding to redundant variable is deleted;For traffic accident document set, theme label classification and theme keyword extraction are carried out by GSDMM model, and accident reason classification variable matrix related to two-wheel vehicle driver behavior is generated;The above matrix is integrated to construct accident scene input variable matrix, and its row vector is clustered and analyzed to obtain cluster label matrix and cluster prototype matrix, so as to obtain the scene description corresponding to each traffic accident type, and automatic driving test scene is generated accordingly.The application can automatically generate automatic driving test scene with authenticity and diversity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data processing technology, and in particular to a method for generating autonomous driving test scenarios that takes into account the behavior of two-wheeled vehicle drivers. Background Technology

[0002] In the verification process of autonomous driving technology, the interaction scenarios with two-wheeled vehicles (including electric bicycles and motorcycles) have become the most challenging aspect of testing due to their unique behavioral patterns. These vehicles are highly mobile, exhibit strong randomness in their driving trajectories, and have a low rate of traffic rule compliance. Drivers often display behaviors such as rapid acceleration, driving against traffic, and illegal lane changes, leading to a high accident rate associated with these vehicles. Statistics show that a large number of misjudgments by autonomous driving systems in urban roads are concentrated in interaction scenarios with two-wheeled vehicles, fully exposing the shortcomings of traditional test scenario construction methods in covering complex scenarios.

[0003] Currently, the generation of autonomous driving test scenarios mainly relies on two methods: one is the playback and reconstruction based on actual road data, and the other is the scenario design based on virtual simulation. Although the former can realistically reflect the road environment in which the vehicle is located, it is difficult to cover all complex or dangerous driving situations due to limited data sources; while the latter, although highly flexible and easy to control variables and adjust parameters, relies on a lot of human intervention and is difficult to automatically generate test scenarios with realism and diversity.

[0004] Therefore, it is necessary to design a method for generating autonomous driving test scenarios that takes into account the behavior of two-wheeled vehicle drivers. Summary of the Invention

[0005] The purpose of this application is to provide a method for generating autonomous driving test scenarios that takes into account the behavior of two-wheeled vehicle drivers, which can automatically generate autonomous driving test scenarios with realism and diversity.

[0006] The technical solution provided in this application is as follows:

[0007] Firstly, this application provides a method for generating autonomous driving test scenarios that considers the behavior of two-wheeled vehicle drivers, including:

[0008] Step 1: Obtain numerical and textual data from multiple motor vehicle-two-wheeler traffic accident samples; construct a classification variable matrix H based on the numerical data from multiple accident samples. p and continuous variable matrix H q A traffic accident document set D is obtained based on textual data from multiple accident samples.

[0009] Among them, the categorical variable matrix H p ∈R M×pWhere M is the number of accident samples, p is the number of categorical variables; the continuous variable matrix H q ∈R M×q , where q is the number of continuous variables;

[0010] Step 2: Based on the categorical variable matrix H p Correlation processing is performed on the extracted p categorical variables, and redundant variables are selected from the p categorical variables based on the correlation processing results; the categorical variable matrix H is then deleted. p The data corresponding to the redundant variables are used to obtain a new categorical variable matrix H. p' ∈R M×p' ;

[0011] Step 3: For the traffic accident document set D, use the GSDMM model to classify the topic tags and extract the topic keywords of the traffic accident documents, and generate an accident cause classification variable matrix H related to the behavior of two-wheeled vehicle drivers. z Among them, H z ∈R M×Z Z represents the number of keywords in the topic;

[0012] Step 4: Combine H p' H q and H z Construct the accident scenario input variable matrix H full ∈R M×(p'+Z+q) ;

[0013] Step 5: Input variable matrix H for the accident scenario full Cluster analysis was performed on the row vectors to obtain the cluster label matrix and the cluster prototype matrix; each cluster obtained by clustering corresponds to a type of traffic accident, and the accident samples in the same cluster have similar categorical and continuous variable characteristics.

[0014] Step 6: Based on the cluster label matrix and cluster prototype matrix obtained from clustering, extract and summarize the scene information of each cluster to obtain the scene description corresponding to each type of traffic accident; generate autonomous driving test scenarios based on the scene descriptions.

[0015] In one possible implementation, step 2 includes:

[0016] Step 2.1: Construct a contingency table for categorical variables: For matrix H p Each pair of categorical variables (X) u ,X v Generate the corresponding contingency table;

[0017] Step 2.2, Calculate the chi-square test statistic: For each pair of categorical variables (X... u ,X v), calculate the Pearson chi-square statistic based on the corresponding contingency table:

[0018]

[0019] Among them, F uv For observation frequency, that is, the actual value in the u-th row and v-th column of the contingency table; E uv The desired frequency is calculated using the following formula:

[0020]

[0021] Step 2.3: Calculate Cramér's V value based on the Pearson chi-square statistic:

[0022]

[0023] Where M is the total number of accident samples, and CV is Cramér's V value, which ranges from 0 to 1, where 0 indicates no correlation and 1 indicates complete correlation.

[0024] Step 2.4: Screening redundant variables: First, set the correlation threshold η∈[0,1]; second, form a symmetric matrix with the CV values ​​of each pair of variables to identify the variable pairs that are higher than the correlation threshold; finally, mark the redundant variables, that is, for the variable pairs that are higher than the threshold, retain one of them according to the business meaning and mark the other as a redundant variable.

[0025] Step 2.5: Generate the simplified matrix H p' : Delete H p From all columns marked as redundant variables, retain the columns corresponding to the remaining categorical variables to form a new matrix: H p' ∈R M×p' , where p' is the number of categorical variables retained.

[0026] In one possible implementation, step 3 includes:

[0027] Step 3.1: Input the traffic accident document set D = {d1, d2, ..., d...} M}, where d i The document representing the i-th traffic accident is a sequence of words. Where N d This is the number of words in the word sequence, i.e., the document length;

[0028] Step 3.2: Preprocess D;

[0029] In some embodiments, preprocessing D includes: segmenting D into words to generate a word list; removing spaces and punctuation marks from the words; setting high-frequency words unrelated to the cause of the traffic accident caused by the two-wheeled vehicle driver as a stop word library S; and applying the stop word library to document d to obtain a new word list wlist; each word appears only once in the word list (is a unique word); the size V of the vocabulary list is the number of words in the word list, which is also the number of unique words.

[0030] Step 3.2, Initialization: Randomly assign an initial topic tag z to each document d. d ∈{1,2,…,K}, and count the corresponding numbers, including: the number N of documents with topic tag k. k The frequency of word w in documents with topic tag k. k,w The total number of words n in the document with topic tag k k ;

[0031] Step 3.3: Perform Gibbs sampling iteration, update the topic tags for each document d and update the corresponding count;

[0032] Step 3.4: Determine if the iteration termination condition is met. If yes, end the iteration and proceed to step 3.5; otherwise, repeat the iteration process in step 3.3.

[0033] Step 3.5: Output the results, including the final topic tags z for each document d. d ∈{1,2,...,K} and the accident cause classification variable matrix H z The accident cause classification variable matrix H z Based on the final topic tag z of each document d d ∈{1,2,...,K}, and tag the topic z d In the document, each word w is sorted by frequency from highest to lowest, and the top Z words are selected as the topic tags z. d Corresponding topic keywords, H z The row vector corresponding to document d in Chinese is z. d The corresponding topic keyword codes form the accident cause classification variable matrix H. z ∈R M×Z .

[0034] In one possible implementation, step 3.3 includes: for each iteration, traversing all documents d∈D, performing the following steps:

[0035] Step 3.3.1: Remove the current topic count for document d, including:

[0036] 1) Update document count:

[0037]

[0038] That is, update theme k old The number of documents is the number of topic tags k old The original document count is reduced by 1; where k old This indicates the current topic tag for document d;

[0039] 2) Update word count:

[0040]

[0041] In this context, the updated topic tag is k. old The frequency of word w in the document is [number] times, and the topic tag is k. old The original frequency of word w in the document is reduced by count(w,d), and the topic tag is updated to k. old The total number of words in the document is k, and the number of topic tags is k. old The original total number of words in the document minus N′ d Where count(w,d) is the number of times word w appears in document d, and N′ d It is the total number of words in document d;

[0042] Step 3.3.2: Calculate the probability that document d belongs to each topic k:

[0043]

[0044] Wherein, P(z) d =k|z -d ,w,α,β) denotes the conditional probability that document d is assigned to topic k given the topic assignments of all other documents except document d and specific w, α, and β; ∝ indicates proportionality; α is the Dirichlet prior parameter of the document-topic distribution, and β is the Dirichlet prior parameter of the topic-word distribution; This represents the number of documents assigned to topic k after excluding the current document d. This represents the frequency (number of occurrences) of word w in document k with topic tag d, excluding document d. This represents the total number of words in the document with topic tag k after excluding document d (i.e., );

[0045] α and β can be taken as empirical values;

[0046] Step 3.3.3: Sample new topics and update the counts, including:

[0047] 1) Convert unnormalized probability values ​​into probability distributions:

[0048]

[0049] Where k' is a temporary variable used for summation;

[0050] 2) Sampling new topics: Based on the probability distribution P(z) d =k), k = 1, 2, ..., K, a new topic tag is obtained by sampling from the topic tags {1, 2, ..., K} for document d, denoted as k. new ;

[0051] 3) Update the corresponding counts:

[0052] 3.1) Update document count:

[0053]

[0054] That is, update theme k new The number of documents is the number of topic tags k new Add 1 to the original document count;

[0055] 3.2) Update word count:

[0056]

[0057] That is, update the topic tag to k new The frequency of word w in the document is [number] times, and the topic tag is k. new The original frequency of word w in the document is incremented by count(w,d), and the topic tag is updated to k. new The total number of words in the document is k, and the number of topic tags is k. new The original total word count in the document plus N′ d .

[0058] In one possible implementation, step 3.4 includes the following iteration termination conditions: 1) a stable state where the rate of change r of the document topic tags is less than a threshold; 2) reaching the maximum number of iterations.

[0059] The iteration ends when one of the iteration termination conditions is met.

[0060] In one possible implementation, step 5 includes:

[0061] Step 5.1: Initialize the cluster prototype: Randomly select C accident samples as the initial cluster prototype;

[0062] Step 5.2: Calculate the distance between the accident sample and the cluster prototype:

[0063] Step 5.4: Iteratively update the cluster label and cluster prototype of each accident sample based on distance until the iteration termination condition is met;

[0064] Step 5.5: Output the results, including the final cluster label matrix and cluster prototype matrix;

[0065] The final cluster label matrix is ​​denoted as: Y = [y1, y2, ..., y M ] T ∈R M×1 Each element represents a cluster label for an accident variable;

[0066] The final cluster prototype matrix is ​​denoted as: Each row represents the mode of the categorical variable and the mean of the continuous variable in a cluster prototype.

[0067] In one possible implementation, step 5.2 employs a hybrid distance function;

[0068] For the i-th accident sample H i =[A i B i ] and the c-th cluster prototype ε c =[m c ,μ c ], Define distance:

[0069]

[0070] Among them, Dist(H i ,ε c ) represents H i With ε c The distance between them, A i For H i In the categorical variable part, A i,j For A i The value of the j-th dimension, B i For H i The continuous variable part, B i,j For B i The value of the j-th dimension; m c ∈R p'+Z The mode of a categorical variable is represented by the prototype ε of the c-th cluster. c The most common combination of values ​​for categorical variables, μ c ∈R q This represents the mean of a continuous variable, specifically the prototype ε of the c-th cluster. c The average value of a continuous variable; m c,j For m c The value of the j-th dimension; μ c,j For μ c The value of the j-th dimension is given by γ, which is a hyperparameter balancing the weights of categorical and continuous variables.

[0071] In a second aspect, this application provides an electronic device, including: a memory and a processor;

[0072] The memory is used to store computer programs;

[0073] The processor is used to invoke the computer program to execute the method described above.

[0074] Thirdly, this application provides a computer-readable storage medium storing a computer program that, when run on an electronic device, causes the electronic device to perform the method described above.

[0075] Fourthly, this application provides a computer program product, including a computer program that, when run on an electronic device, causes the electronic device to perform the method described above.

[0076] The specific implementation methods of the second to fourth aspects of this application can refer to the implementation methods of the first aspect, and will not be elaborated here.

[0077] Beneficial effects:

[0078] This application utilizes numerical data and textual data of accident classification to automatically generate representative and complex test scenarios through multimodal data fusion and intelligent algorithms. This method not only improves testing efficiency and reduces testing costs, but also ensures that the generated test scenarios meet the requirements of real-world road testing for autonomous driving systems in terms of realism and diversity, thus providing strong technical support for system safety and reliability verification.

[0079] This application employs advanced data processing technologies, including but not limited to data preprocessing, text extraction, feature extraction, data clustering, and scene generation. By fusing multiple data sources, this application can generate more realistic and complex test scenarios. Furthermore, by combining machine learning and artificial intelligence technologies, this application can automatically identify and construct potential dangerous interaction scenarios, effectively improving the autonomous driving system's ability to cope with complex road environments and its overall safety. Attached Figure Description

[0080] Figure 1 This is a flowchart illustrating an embodiment of this application. Detailed Implementation

[0081] To enable those skilled in the art to better understand the present application, the technical solution of the present application will be further described below in conjunction with the embodiments and accompanying drawings.

[0082] This application discloses a method for generating autonomous driving test scenarios that considers the behavior of two-wheeled vehicle drivers, aiming to improve the effectiveness and coverage of autonomous driving tests, and belongs to the field of data processing technology. This method generates representative and diverse test scenarios through in-depth analysis and processing of real traffic accident data to more comprehensively verify the safety and reliability of autonomous driving systems. Specifically, it includes: obtaining accident data through in-depth analysis of typical traffic accident cases involving two-wheeled vehicles; reconstructing the obtained accident data; extracting high-risk driving behavior feature parameters from the accident documents, including two-wheeled vehicle-specific behavior indicators such as illegal lane changes, emergency avoidance, speeding, and running red lights; constructing a multi-dimensional scene feature matrix by combining the trajectory features of motor vehicles and two-wheeled vehicles with mixed traffic environment parameters; using algorithms such as K-Prototypes clustering to perform multimodal data fusion analysis of accident features; and generating a set of virtual test scenarios containing characteristics such as two-wheeled vehicle driver behavior and driving environment based on group behavior pattern mining technology. The method disclosed in this application increases the implantability and adaptability of typical scenarios.

[0083] The following will refer to Figure 1 A specific implementation method according to this application is described.

[0084] Example 1:

[0085] This application discloses a method for generating autonomous driving test scenarios that considers the behavior of two-wheeled vehicle drivers, including:

[0086] Step 1: Obtain numerical and textual data from multiple motor vehicle-two-wheeler traffic accident samples; construct a classification variable matrix H based on the numerical data from multiple accident samples. p and continuous variable matrix H q A traffic accident document set D is obtained based on textual data from multiple accident samples.

[0087] In this step, we analyze real motor vehicle-two-wheeler traffic accidents to obtain numerical and textual data from multiple motor vehicle-two-wheeler traffic accident samples.

[0088] Among them, the categorical variable matrix H p ∈R M×p H p The dimension is M×p, where M is the number of accident samples and p is the number of categorical variables; the continuous variable matrix H q ∈R M×q H q The dimension is M×q, where q is the number of continuous variables;

[0089] In some embodiments, the numerical data includes categorical variables and continuous variables; wherein, the categorical variables include: road, environment, two-wheeled vehicle type, motor vehicle type and driver information; and the continuous variables include: two-wheeled vehicle and motor vehicle speeds.

[0090] Among them, text-based data of traffic accidents refers to traffic accident document (text report) data;

[0091] Step 2: Based on the categorical variable matrix H p Correlation processing is performed on the extracted p categorical variables, and redundant variables are selected from the p categorical variables based on the correlation processing results; the categorical variable matrix H is then deleted. p The data corresponding to the redundant variables are used to obtain a new categorical variable matrix H. p' ∈R M×p' .

[0092] In some embodiments, the correlation processing of the extracted p categorical variables includes: evaluating the association between the categorical variables using Cramér's V statistic analysis.

[0093] In this step, important and redundant categorical variables are identified based on the results of correlation processing.

[0094] In some embodiments, step 2 specifically includes:

[0095] Step 2.1: Construct a contingency table for categorical variables: For matrix H p Each pair of categorical variables (X) u ,X v Generate the corresponding contingency table;

[0096] Step 2.2, Calculate the chi-square test statistic: For each pair of categorical variables (X... u ,X v ), calculate the Pearson chi-square statistic based on the corresponding contingency table:

[0097]

[0098] Among them, F uv For observation frequency, that is, the actual value in the u-th row and v-th column of the contingency table; E uv The desired frequency is calculated using the following formula:

[0099]

[0100] Step 2.3: Calculate Cramér's V value based on the Pearson chi-square statistic:

[0101]

[0102] Where M is the total number of accident samples, and CV is Cramér's V value, which ranges from 0 to 1, where 0 indicates no correlation and 1 indicates complete correlation.

[0103] Step 2.4: Screening redundant variables: First, set the correlation threshold η∈[0,1]; second, form a symmetric matrix with the CV values ​​of each pair of variables to identify the variable pairs that are higher than the correlation threshold; finally, mark the redundant variables, that is, for the variable pairs that are higher than the threshold, retain one of them according to the business meaning and mark the other as a redundant variable.

[0104] Among them, retaining one based on business significance means retaining the variable that better reflects the danger of the scenario;

[0105] Step 2.5: Generate the simplified matrix H p' ; Delete H p From all columns marked as redundant variables, retain the columns corresponding to the remaining categorical variables to form a new matrix: H p' ∈R M×p' , where p' is the number of categorical variables retained;

[0106] The remaining p' categorical variables are either independent or have low correlation.

[0107] Step 3: For the traffic accident document set D, use the GSDMM model (GibbsSamplingDirichletMultinomial Mixture, a short text clustering model based on Dirichlet-Multinomial distribution and Gibbs sampling) to classify the topic tags and extract topic keywords from the traffic accident documents, generating an accident cause classification variable matrix H related to the behavior of two-wheeled vehicle drivers. z Among them, H z ∈R M×Z Z represents the number of keywords in the topic.

[0108] Accident causation classification variable matrix H related to two-wheeled vehicle driver behavior z The variables include the topic keywords related to traffic accidents caused by two-wheeled vehicle drivers in each accident sample; each topic label corresponds to a cause of the accident; and the topic keywords are the specific behavioral details of the two-wheeled vehicle drivers under the corresponding topic. Therefore, the accident cause classification variable matrix H is used to classify the variables. z It can reflect the specific role and behavioral characteristics of the two-wheeled vehicle driver in the accident.

[0109] In some embodiments, step 3 specifically includes:

[0110] Step 3.1: Input the traffic accident document set D = {d1, d2, ..., d...} M}, where di The document representing the i-th traffic accident is a sequence of words. Where N d This is the number of words in the word sequence, i.e., the document length;

[0111] Step 3.2: Preprocess D;

[0112] In some embodiments, preprocessing D includes: segmenting D into words to generate a word list; removing spaces and punctuation marks from the words; setting high-frequency words unrelated to the cause of the traffic accident caused by the two-wheeled vehicle driver as a stop word library S; and applying the stop word library to document d to obtain a new word list wlist; each word appears only once in the word list (is a unique word); the size V of the vocabulary list is the number of words in the word list, which is also the number of unique words.

[0113] Step 3.2, Initialization: Randomly assign an initial topic tag z to each document d. d ∈{1,2,…,K}, and count the corresponding numbers, including: the number N of documents with topic tag k. k The frequency of word w in documents with topic tag k. k,w The total number of words n in the document with topic tag k k ; can be expressed by formulas as follows:

[0114]

[0115] n k =∑ w n k,w ;

[0116] in, This is an indicator function; the value is 1 if the condition in parentheses is true, and 0 otherwise; count(w,d) represents counting the frequency of word w in document d; w∈wlist;

[0117] Step 3.3: Perform Gibbs sampling iterations, update the topic tags for each document d and update the corresponding counts:

[0118] For each iteration, traverse all documents d∈D and perform the following steps:

[0119] Step 3.3.1: Remove the current topic count for document d, including:

[0120] 1) Update document count:

[0121]

[0122] That is, update theme k old The number of documents is the number of topic tags k oldThe original document count is reduced by 1; where k old This indicates the current topic tag for document d;

[0123] 2) Update word count:

[0124]

[0125] In this context, the updated topic tag is k. old The frequency of word w in the document is [number] times, and the topic tag is k. old The original frequency of word w in the document is reduced by count(w,d), and the topic tag is updated to k. old The total number of words in the document is k, and the number of topic tags is k. old The original total number of words in the document minus N′ d Where count(w,d) is the number of times word w appears in document d, and N′ d It is the total number of words in document d;

[0126] Step 3.3.2: Calculate the probability that document d belongs to each topic k:

[0127]

[0128] Wherein, P(z) d =k|z -d ,w,α,β) denotes the conditional probability that document d is assigned to topic k given the topic assignments of all other documents except document d and specific w, α, and β; ∝ indicates proportionality; α is the Dirichlet prior parameter of the document-topic distribution, and β is the Dirichlet prior parameter of the topic-word distribution; This represents the number of documents assigned to topic k after excluding the current document d. This represents the frequency (number of occurrences) of word w in document k with topic tag d, excluding document d. This represents the total number of words in the document with topic tag k after excluding document d (i.e., );

[0129] α and β can be taken as empirical values;

[0130] Step 3.3.3: Sample new topics and update the counts, including:

[0131] 1) Convert unnormalized probability values ​​into probability distributions:

[0132]

[0133] Where k' is a temporary variable used for summation;

[0134] 2) Sampling new topics: Based on the probability distribution P(z) d=k), k = 1, 2, ..., K, a new topic tag is obtained by sampling from the topic tags {1, 2, ..., K} for document d, denoted as k. new ;

[0135] The probability distribution of the above topic tags is a multinomial distribution;

[0136] 3) Update the corresponding counts:

[0137] 3.1) Update document count:

[0138]

[0139] That is, update theme k new The number of documents is the number of topic tags k new Add 1 to the original document count;

[0140] 3.2) Update word count:

[0141]

[0142] In this context, the updated topic tag is k. new The frequency of word w in the document is [number] times, and the topic tag is k. new The original frequency of word w in the document is incremented by count(w,d), and the topic tag is updated to k. new The total number of words in the document is k, and the number of topic tags is k. new The original total word count in the document plus N′ d ;

[0143] Step 3.4: Determine if the iteration termination condition is met. If yes, end the iteration and proceed to step 3.5; otherwise, repeat the iteration process in step 3.3.

[0144] In some embodiments, the iteration termination conditions include: 1) a stable state (convergence) where the rate of change r of the document topic tags is less than a threshold; 2) reaching the maximum number of iterations;

[0145] The iteration ends when one of the iteration termination conditions is met.

[0146] The convergence of the model is determined by the rate of change of document topic tags; the rate of change of document topic tags represents the proportion of changes in document topic tags between two adjacent iterations; its calculation method is as follows:

[0147] Let z be the topic tags of all documents after the previous iteration, i.e., the (t-1)th iteration. (t-1) ={z1 (t-1) z2 (t -1) ,...,z M (t-1)};

[0148] The topic tags for all documents after the current iteration (t-1th iteration) are z. (t) ={z1 (t) z2 (t) ,...,z M (t)};

[0149] Compare old and new tags, and count the number of documents (M) whose topic tags have changed. c :

[0150]

[0151] Calculate the rate of change r of topic tags:

[0152] Step 3.5: Output the results, including the final topic tags z for each document d. d ∈{1,2,...,K} and the accident cause classification variable matrix H z The accident cause classification variable matrix H z Based on the final topic tag z of each document d d ∈{1,2,...,K}, and tag the topic z d In the document, each word w is sorted by frequency from highest to lowest, and the top Z words are selected as the topic tags z. d Corresponding topic keywords, H z The row vector corresponding to document d in Chinese is z. d The corresponding topic keyword codes form the accident cause classification variable matrix H. z ∈R M×Z .

[0153] Step 4: Combine H p' H q and H z Construct the accident scenario input variable matrix H full ∈R M×(p'+Z+q) .

[0154] By constructing the accident scenario input variable matrix H full This provides the foundational data for subsequent cluster analysis. full The dimension is M×(p'+Z+q).

[0155] Step 5: Input variable matrix H for the accident scenario full Cluster analysis was performed on the row vectors to obtain the cluster label matrix and the cluster prototype matrix; each cluster obtained by clustering corresponds to a type of traffic accident, and the accident samples in the same cluster have similar categorical and continuous variable characteristics.

[0156] In some embodiments, the K-Prototypes clustering algorithm is used to analyze the input variable matrix H of the accident scenario. full Cluster analysis is performed on the row vectors in the data.

[0157] This step provides a basis for classifying and summarizing accident scenarios.

[0158] In some embodiments, step 5 specifically includes:

[0159] Step 5.1: Initialize the cluster prototype; randomly select C accident samples as the initial cluster prototype;

[0160] The prototype of the c-th cluster is represented as ε c =[m c ,μ c ], where m c ∈R p'+Z The mode of a categorical variable is represented by the prototype ε of the c-th cluster. c The most common combination of values ​​for categorical variables, μ c ∈R q This represents the mean of a continuous variable, specifically the prototype ε of the c-th cluster. c The average value of continuous variables;

[0161] ε c The initial value is

[0162] in, ε c initial value, For m c initial value, For μ c The initial value;

[0163] Step 5.2: Calculate the distance between the accident sample and the cluster prototype:

[0164] In some embodiments, for the i-th accident sample H i =[A i B i ] and the c-th cluster prototype ε c =[m c ,μ c ], Define distance:

[0165]

[0166] Among them, Dist(H i ,ε c ) represents H i With ε c The distance between them, A i For H i In the categorical variable part, Ai,j For A i The value of the j-th dimension, B i For H i The continuous variable part, B i,j For B i The value of the j-th dimension; m c,j For m c The value of the j-th dimension; μ c,j For μ c The value of the j-th dimension; γ is a hyperparameter balancing the weights of categorical and continuous variables;

[0167] This distance function is a hybrid distance function, combining the Hamming distance of categorical variables and the Euclidean distance of continuous variables;

[0168] Step 5.4: Iteratively update the cluster label and cluster prototype of each accident sample based on distance until the iteration termination condition is met;

[0169] Specifically, it includes:

[0170] Step 5.4.1: Assign accident samples to the nearest cluster;

[0171] For each incident sample i, calculate its distance to all cluster prototypes and assign it to the nearest cluster:

[0172]

[0173] Where t represents the current iteration round, and its initial value is 0; This represents the cluster label of accident sample i in the t-th iteration. ε c The value taken in the t-th iteration. This represents the cluster number to which accident sample i is assigned in the t-th iteration;

[0174] Step 5.4.2: Update the prototype based on the current cluster allocation:

[0175] 1) Update the mode of the categorical variable:

[0176]

[0177] Here, mode() represents the mode; m c,j The value taken in the (t+1)th iteration;

[0178] 2) Mean of continuous variables:

[0179]

[0180] in, μ c,j The value taken in the (t+1)th iteration; Let c represent the set of accident samples in the c-th cluster; express The number of accident samples;

[0181] Step 5.4.3: Determine if the iteration termination condition is met:

[0182] Or reach the maximum number of iterations T max ;

[0183] Where λ is the convergence threshold;

[0184] If so, the iteration ends; otherwise, repeat steps 5.4.1 and 5.4.2 until the iteration termination condition is met.

[0185] in This indicates that the cluster allocation result has converged;

[0186] Step 5.5: Output the results, including the final cluster label matrix and cluster prototype matrix;

[0187] The final cluster label matrix is ​​denoted as: Y = [y1, y2, ..., y M ] T ∈R M×1 Each element represents a cluster label for an accident variable;

[0188] The final cluster prototype matrix is ​​denoted as: Each row represents the mode of the categorical variable and the mean of the continuous variable in a cluster prototype.

[0189] Step 6: Based on the cluster label matrix and cluster prototype matrix obtained from clustering, extract and summarize the scene information of each cluster to obtain the scene description corresponding to each type of traffic accident; generate autonomous driving test scenarios based on the scene descriptions.

[0190] These descriptions summarize the common characteristics of various accidents, forming typical accident scenario models.

[0191] This application's embodiments deeply analyze key factors in traffic accident scenarios, with a particular focus on the impact of two-wheeled vehicle driver behavior on accident causes. During the analysis, multi-dimensional data, including road environment, vehicle status, and two-wheeled vehicle driver behavior, are combined to identify the correlation patterns between high-risk behaviors and specific scenarios. By automatically extracting behavioral features and integrating them into a structured model, this method transforms the implicit behavioral logic in the text into quantifiable categorical variables, constructing an accident cause feature matrix. This matrix intuitively presents the contribution of different behavioral patterns to accident outcomes, providing a refined basis for scenario-based modeling and prevention strategy optimization. The processed categorical variables, continuous variables, and text features are fused to construct an accident scenario input matrix. Through hybrid clustering (using the mode for categorical variables and the mean for continuous variables), cluster labels and prototype matrices are generated, summarizing the scenario characteristics of each type of accident, ultimately automatically generating diverse autonomous driving test scenarios. This method improves the realism and coverage of the test scenarios.

[0192] Example 2:

[0193] This embodiment provides an electronic device, including: a memory and a processor;

[0194] The memory is used to store computer programs;

[0195] The processor is configured to invoke the computer program to execute the method as described in Embodiment 1.

[0196] Example 3:

[0197] This embodiment provides a computer-readable storage medium storing a computer program. When the computer program is run on an electronic device, it causes the electronic device to perform the method described in Embodiment 1.

[0198] Example 4:

[0199] This embodiment provides a computer program product, including a computer program that, when run on an electronic device, causes the electronic device to perform the method described in Embodiment 1.

[0200] The specific implementation of the system, electronic device, computer-readable storage medium, and computer program product provided in this application can be referred to the specific embodiments of the above methods, and will not be repeated here.

[0201] Obviously, those skilled in the art should understand that the various units or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device, or fabricating them separately as individual integrated circuit modules, or fabricating multiple modules or steps into a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0202] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method for generating autonomous driving test scenarios considering the behavior of two-wheeled vehicle drivers, characterized in that, include: Step 1: Obtain numerical and textual data from multiple samples of motor vehicle-two-wheeled vehicle traffic accidents; A categorical variable matrix was constructed based on numerical data from multiple accident samples. and continuous variable matrix ; A traffic accident document set was obtained based on textual data from multiple accident samples. ; Among them, the categorical variable matrix ,in The number of accident samples. Number of categorical variables; matrix of continuous variables ,in The number of continuous variables; Step 2: Based on the categorical variable matrix For the extracted Correlation analysis was performed on the categorical variables, and the results of the correlation analysis were used to... Redundant variables were filtered out from the categorical variables; the categorical variable matrix was deleted. The data corresponding to the redundant variables are used to obtain a new categorical variable matrix. ; Step 3: For the traffic accident document set The GSDMM model is used to classify the topic tags and extract the topic keywords of traffic accident documents, generating a matrix of accident cause classification variables related to the behavior of two-wheeled vehicle drivers. ;in, , The number of keywords in the topic; specifically including: Step 3.1: Input the traffic accident document set ,in, Indicates the first The document about the traffic accident is a sequence of words. ,in This refers to the number of words in the word sequence, i.e., the document length. Step 3.2, for Preprocessing includes: Perform word segmentation to generate a word list; remove spaces and punctuation marks from the words, and set high-frequency words unrelated to the causes of traffic accidents caused by two-wheeled vehicle drivers as stop words. And apply the stop thesaurus to the document. In the process, a new word list is obtained. Each word appears only once in the word list, making it a unique word; the size of the vocabulary... That is, the number of words in the word list, which is also the number of unique words; Step 3.2, Initialization: Randomly assign each document... Assign an initial topic tag And count the corresponding number of tags, including: Number of documents Theme tags are Words in the document frequency Theme tags are Total number of words in the document ; Step 3.3: Perform Gibbs sampling iterations and update each document. The topic tags and corresponding counts are updated; Step 3.4: Determine if the iteration termination condition is met. If yes, end the iteration and proceed to step 3.5; otherwise, repeat the iteration process in step 3.

3. Step 3.5: Output the results, including outputting each document. final hashtags Accident cause classification variable matrix The accident cause classification variable matrix Based on each document final hashtags , tag the topic as Each word in the document Sort by frequency from highest to lowest, and select the top results based on the sorting. Each word as a topic tag Corresponding topic keywords Chinese document The corresponding row vector is The corresponding topic keyword codes form the accident cause classification variable matrix. ; Step 4: Combining , as well as Construct the input variable matrix of the accident scenario ; Step 5: Input variable matrix for the accident scenario Cluster analysis was performed on the row vectors to obtain the cluster label matrix and cluster prototype matrix; each cluster obtained by clustering corresponds to a type of traffic accident, and the accident samples in the same cluster have similar categorical and continuous variable characteristics. Step 6: Based on the cluster label matrix and cluster prototype matrix obtained from clustering, extract and summarize the scene information of each cluster to obtain the scene description corresponding to each type of traffic accident; generate autonomous driving test scenarios based on the scene descriptions.

2. The method according to claim 1, characterized in that, Step 2 includes: Step 2.1: Construct a contingency table for categorical variables: [This step involves] processing the matrix... Each pair of categorical variables in Generate the corresponding contingency table; Step 2.2, Calculate the chi-square test statistic: For each pair of categorical variables Calculate the Pearson chi-square statistic based on the corresponding contingency table: ; in, For observation frequency, i.e., the number of observations in the contingency table. Line number The actual value of the column; The desired frequency is calculated using the following formula: ; Step 2.3: Calculate Cramér's V value based on the Pearson chi-square statistic: ; in, The total number of accident samples. This is Cramér's V value, which ranges from 0 to 1, where 0 indicates no correlation and 1 indicates a complete correlation. Step 2.4: Filter redundant variables: First, set a correlation threshold. Secondly, for each pair of variables... The values ​​form a symmetric matrix to identify variable pairs that are above the correlation threshold; finally, redundant variables are marked, that is, for variable pairs that are above the threshold, one is retained according to the business meaning, and the other is marked as a redundant variable; Step 2.5: Generate a simplified matrix :delete From all columns marked as redundant variables, retain the columns corresponding to the remaining categorical variables to form a new matrix: ,in The number of categorical variables that are retained.

3. The method according to claim 1, characterized in that, Step 3.3 includes: for each iteration, traversing all documents. Perform the following steps: Step 3.3.1: Remove the document The current topic count, including: 1) Update document count: ; That is, update the theme The number of documents is based on topic tags. The original document count is reduced by 1; among which, Document Current topic tags; 2) Update word count: , ; Among them, updating the topic tags is Words in the document The frequency of the topic tags is Words in the document original frequency reduction Update the theme tags to The total number of words in the document is [number], and the topic tags are [number]. The original total number of words in the document minus ;in, It is a word In the document The number of times it appears in It is a document Total number of words in; Step 3.3.2, Calculate the document Belonging to each theme The probability of: ; in, Indicates that in the known document All other document topic assignments and specific , and Under the conditions, document Assigned to topic The conditional probability; Indicates proportional to; For the Dirichlet prior parameters of the document-topic distribution, For the Dirichlet prior parameters of the topic-word distribution; Indicates exclusion of the current document Then, assigned to a topic The number of documents, Indicates the exclusion of documents After that, the hashtag is Words in the document The frequency, or the number of times it occurs; Indicates the exclusion of documents After that, the hashtag is The total number of words in the document, i.e. ; Step 3.3.3: Sample new topics and update the counts, including: 1) Convert unnormalized probability values ​​into probability distributions: ; in, This is a temporary variable used for summation; 2) Sampling new topics: based on probability distribution From the hashtags Chinese document A new topic tag is obtained by sampling, denoted as ; 3) Update the corresponding counts: 3.1) Update document count: ; That is, update the theme The number of documents is based on topic tags. Add 1 to the original document count; 3.2) Update word count: , ; That is, update the topic tags to Words in the document The frequency of the topic tags is Words in the document Original frequency plus Update the theme tags to The total number of words in the document is [number], and the topic tags are [number]. The original total word count in the document plus .

4. The method according to claim 3, characterized in that, In step 3.4, the iteration termination condition includes: 1) the rate of change of document topic tags. 1) A stable state with values ​​below the threshold; 2) Reaching the maximum number of iterations; The iteration ends when one of the iteration termination conditions is met.

5. The method according to claim 1, characterized in that, Step 5 includes: Step 5.1, Initialize the cluster prototype: randomly select One accident sample was used as the initial cluster prototype; Step 5.2: Calculate the distance between the accident sample and the cluster prototype: Step 5.4: Iteratively update the cluster label and cluster prototype of each accident sample based on distance until the iteration termination condition is met; Step 5.5: Output the results, including the final cluster label matrix and cluster prototype matrix; The final cluster label matrix is ​​denoted as: Each element represents a cluster label for an accident variable; The final cluster prototype matrix is ​​denoted as: Each row represents the mode of the categorical variable and the mean of the continuous variable in a cluster prototype.

6. The method according to claim 5, characterized in that, In step 5.2, a hybrid distance function is used; For the first One accident sample and the Cluster prototype Define distance: ; in, express and The distance between them for The categorical variable part, for The Middle The value of dimension, for The continuous variable part, for The Middle The value that a dimension can take; The mode of a categorical variable, i.e., the th . Cluster prototype The most common combination of values ​​for categorical variables in the middle. This represents the mean of a continuous variable, i.e., the th... Cluster prototype The average value of continuous variables; for The Middle The value that a dimension can take; for The Middle The value that a dimension can take; Hyperparameters used to balance the weights of categorical and continuous variables.

7. An electronic device, characterized in that, include: Memory and processor; The memory is used to store computer programs; The processor is configured to invoke the computer program to perform the method as described in any one of claims 1 to 6.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed on an electronic device, causes the electronic device to perform the method as described in any one of claims 1 to 6.

9. A computer program product, comprising a computer program, characterized in that, When the computer program is run on an electronic device, it causes the electronic device to perform the method as described in any one of claims 1 to 6.