Pedestrian crossing tolerance time prediction method under signal control condition

Pedestrian patience type grouping is carried out through the random survival forest model and the K-means clustering algorithm, and a Stacking ensemble model is constructed, which solves the problem of lack of patience type classification and microscopic individual feature prediction in the existing technology, and improves pedestrian patience time when crossing the street Prediction accuracy and performance.

CN119152233APending Publication Date: 2024-12-17CHONGQING JIAOTONG UNIV
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411197731.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

The prior art lacks patience type classification and micro-individual feature prediction in pedestrian crossing patience time prediction, and the single model cannot comprehensively analyze complex influencing factors, resulting in insufficient prediction accuracy and performance.

Method used

The random survival forest model is used to calculate the risk score of pedestrian crossing data, combine the K-means clustering algorithm to group the tolerance type, and build a Stacking integrated model, including multiple primary models and meta models, and tune it through Bayesian hyperparameter optimization algorithm. Optimize hyperparameters to improve prediction accuracy and stability.

Benefits of technology

Through patience type grouping, noise interference is reduced, prediction accuracy and generalization ability is improved, and comprehensive analysis is combined with multiple models to enhance the processing ability of complex data, and improve the accuracy and performance of pedestrian patience time prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119152233A_ABST
    Figure CN119152233A_ABST
Patent Text Reader

Abstract

The invention discloses a pedestrian crossing tolerance time prediction method under a signal control condition. The method comprises the following steps: calculating a risk score of each pedestrian sample in a pedestrian crossing data set through a random survival forest model; carrying out tolerance grouping on the pedestrian samples by using a K-means clustering algorithm in combination with the risk score, and generating a data set of a plurality of tolerance; dividing the data set of each tolerance into a training set and a test set; a Stacking integration model is constructed; performing hyper-parameter tuning on each primary model through a Bayesian hyper-parameter optimization algorithm; inputting the training set into each primary model for training according to five-fold cross validation, and outputting a prediction result of each primary model; integrating the prediction result of each primary model and the true value of the tolerance time into a new training set and a new test set, inputting the new training set and the new test set into the meta-model, and outputting a corresponding tolerance time prediction value; and realizing tolerance time prediction of a single pedestrian through the trained Stacking integrated model. According to the invention, the accuracy of pedestrian crossing tolerance time prediction can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of pedestrian crossing management, and in particular to a method for predicting pedestrian crossing tolerance time under signal control conditions. Background Art

[0002] With the increasing emphasis on environmental protection and concerns about carbon emissions, the necessity to reduce the use of fossil fuels and lower air pollution has become apparent. Therefore, promoting low-carbon modes of transportation, such as walking, has become widely accepted in society. Walking is not only the main green mode of transportation, but also plays a key role in connecting urban public transportation systems.

[0003] However, under the guidance of the development model dominated by motorized traffic, cities generally have problems such as poor walking environment and improper pedestrian facilities. In particular, the control parameters of traffic signal for crossing the street are usually based on the aggregated pedestrian walking speed, lacking refinement and flexibility, because they rarely consider the personalized quantitative characteristics of pedestrians, such as the tolerance of pedestrians to the length of time waiting for red lights. This has led to pedestrians in many cities having red light signals that are too long and exceed their tolerance time, and some pedestrians have violated the rules to cross the street during red lights, which has seriously affected pedestrians' crossing safety and experience. Studies have shown that pedestrians who ignore red lights are more likely to be injured. Therefore, studying pedestrians' tolerance time for red lights and its influencing factors is of great significance for promoting low-carbon travel and pedestrian safety.

[0004] The applicant found that by calculating the waiting tolerance of each pedestrian who arrives at the waiting area for crossing the street in each time period, the probability distribution function, expected value, variance, etc. of the waiting crowd tolerance time at each moment can be obtained, and then the upper limit of the waiting time of the current overall crowd can be calculated at a certain significance level (such as 5%), which can be used as the basis for determining the maximum red light duration of the current signal. Especially in the Internet of Vehicles environment, the roadside network facilities can provide real-time feedback to the networked vehicles on the time distribution of pedestrians waiting to cross the street, so as to remind the networked vehicles to accelerate or decelerate in advance. The setting of the red light duration can also solve the problem that it is currently based on fixed parameters and is difficult to adapt to the composition of people in different time periods. It can be set flexibly in real time according to the composition of the crowd, reduce the probability of pedestrians crossing the street illegally, and coordinate the traffic efficiency of pedestrians and motor vehicles. At the same time, according to the calculation results of the waiting time for each person arriving at the waiting area for crossing the street, the traffic management personnel can be warned. Especially when pedestrians cannot cross within the maximum tolerance time due to reasons such as excessive motor vehicle traffic flow, traffic management personnel can provide necessary attention or proactive emotional comfort to people with low tolerance, extend the tolerance time of such pedestrians through external intervention, and reduce the probability of pedestrians crossing the street illegally.

[0005] At present, the research on pedestrian red light tolerance time can be roughly divided into three aspects: factors affecting pedestrian red light tolerance time, numerical research on pedestrian red light tolerance time, and model selection and establishment of pedestrian tolerance time.

[0006] In terms of model building, many solutions use deterministic models such as logistic regression. Although these models are easy to implement and interpret, their accuracy depends on data quality, and they do not consider the impact of missing data on pedestrian crossing data. In order to address the impact of data missing, some solutions choose traditional survival analysis models, which were originally used in the medical field to study the survival time of patients and can handle missing data. However, these non-parametric duration models cannot quantify the impact of influencing factors on red light running behavior, nor can they consider the impact of covariates on tolerance time. Further research combined traditional survival analysis and Weibull distribution to create fully parametric models for analysis, but these models require that the distribution of survival time follows Weibull distribution, which is not always the case for pedestrian tolerance time. Another solution introduced the DeepWait deep learning framework, which uses data simulated by virtual reality technology to predict the tolerance time of pedestrians under non-signal control conditions, but this lacks consideration of many factors that affect pedestrian tolerance time in reality.

[0007] Since the waiting tolerance time of pedestrians crossing the street cannot be measured directly, the current research mainly focuses on prediction by establishing regression models. The existing research in this field still has the following shortcomings: 1) There is a lack of tolerance type classification before predicting pedestrian tolerance. Since different types of pedestrians may be affected by the same factors and the effects and degrees of their influence may be different, it is necessary to classify pedestrians according to their tolerance-related characteristics (i.e. types). 2) Most studies focus on the macro level of factors affecting pedestrian tolerance time and the distribution of tolerance time for groups, and lack tolerance time prediction for micro pedestrian individual characteristics. 3) Current studies generally use a single model for prediction, while the factors affecting pedestrian tolerance time are complex and diverse, and a comprehensive analysis should be conducted from different angles. Summary of the invention

[0008] In view of the deficiencies of the above-mentioned prior art, the technical problem to be solved by the present invention is: how to provide a method for predicting the tolerance time of pedestrians crossing the street under signal control conditions, grouping the pedestrian samples into tolerance types through the random survival forest model and the K-means clustering algorithm, so as to solve the problem of lack of tolerance type classification before prediction; realizing the tolerance time prediction of micro-individual pedestrian characteristics by constructing a Stacking integrated model of individual pedestrians, and at the same time using multiple models to comprehensively analyze the tolerance time of people crossing the street from different angles, so as to improve the accuracy and performance of the prediction of the tolerance time of pedestrians crossing the street.

[0009] In order to solve the above technical problems, the present invention adopts the following technical solutions:

[0010] A method for predicting pedestrian crossing tolerance time under signal control conditions, comprising:

[0011] S1: Get the pedestrian crossing data set;

[0012] S2: Calculate the risk score of each pedestrian sample in the pedestrian crossing data set through the random survival forest model; Use the K-means clustering algorithm combined with the risk score to group the pedestrian samples into tolerance types and generate several tolerance type data sets; Divide each tolerance type data set into a training set and a test set;

[0013] S3: Build a Stacking integration model; the first layer of the Stacking integration model includes several primary models, and the second layer includes a meta-model;

[0014] S4: Tune the hyperparameters of each primary model using the Bayesian hyperparameter optimization algorithm; input the training set into each primary model for training according to five-fold cross-validation, and output the prediction results of each primary model;

[0015] S5: Integrate the prediction results of each primary model and the corresponding true value into a new training set and a new test set, input them into the meta-model, and output the corresponding tolerance time prediction value;

[0016] S6: Output the corresponding patience time prediction value based on the characteristic data of a pedestrian through the trained Stacking ensemble model.

[0017] Preferably, in step S2, the processing steps of the random survival forest model are as follows:

[0018] S201: Define the death event of the random survival forest model as the red light running behavior of pedestrians when crossing the street within a signal cycle;

[0019] S202: Generate N survival trees with all pedestrian samples in the pedestrian crossing data set as root nodes;

[0020] For a single survival tree, the cumulative risk function of the i-th pedestrian sample at the leaf node h of the survival tree is calculated by the following formula:

[0021]

[0022] Where: X i (i=1,2,3...) represents the selected characteristic covariate affecting pedestrian sample i; t represents the time when the pedestrian sample has been observed; t i,h represents the time point experienced by the i-th pedestrian sample in the leaf node h; d i,h Indicates that at t i,h The number of pedestrian samples that died at any given moment;i,h Indicates that at t i,h The number of pedestrian samples that survive at any time;

[0023] S203: randomly extracting pedestrian samples from the pedestrian crossing data set in a form of replacement to establish a sample subset; dividing the sample subset into out-of-bag data and in-bag data;

[0024] S204: For the i-th pedestrian sample from the out-of-bag data, calculate its integrated cumulative risk function in all survival trees by the following formula

[0025]

[0026] Where: n represents the nth survival tree in the random survival forest; represents the cumulative risk function of the nth survival tree of out-of-bag data; when the pedestrian sample is out-of-bag data, define I i,n =1, otherwise I i,n =0;

[0027] S205: For the i-th pedestrian sample from the in-bag data, calculate its integrated cumulative risk function in all survival trees by the following formula

[0028]

[0029] Where: H * n (t|X i ) represents the cumulative risk function of the nth survival tree of the in-bag data;

[0030] S206: For the i-th pedestrian sample from the out-of-bag data, its integrated mortality rate, i.e., risk score, is calculated by the following formula:

[0031]

[0032] Where: represents the integrated cumulative risk function of the i-th pedestrian sample from the out-of-bag data in all survival trees; J represents the total number of pedestrian samples in the data without bootstrap sampling; T j represents the survival time of the jth pedestrian sample in the data without self-sampling;

[0033] S207: For the i-th pedestrian sample from the in-bag data, its integrated mortality rate, i.e., risk score, is calculated by the following formula:

[0034]

[0035] Where: represents the integrated cumulative risk function of the ith pedestrian from the in-bag data in all survival trees.

[0036] Preferably, in step S2, the processing steps of the K-means clustering algorithm are as follows:

[0037] S211: Determine the K value of the K-means clustering algorithm;

[0038] S212: Randomly select K pedestrian samples from the pedestrian crossing data set as initial cluster centers;

[0039] S213: For each pedestrian sample in the pedestrian crossing data set, the distance between the pedestrian sample and each cluster center is calculated by the risk score, and the pedestrian sample is assigned to the category to which the nearest cluster center belongs;

[0040] S214: for each category, recalculate its cluster center;

[0041] S215: Repeat steps S213 to S214, reallocate pedestrian samples to the category to which the nearest cluster center belongs and update the cluster center of the category until the preset iteration stop condition is reached, and generate K tolerance type data sets.

[0042] Preferably, in step S211, the optimal K value of the K-means clustering algorithm is determined by the silhouette coefficient method;

[0043] The specific steps are as follows:

[0044] S2111: Determine the value range of K value;

[0045] S2112: For each K value within the range, use the K-means algorithm to cluster the pedestrian crossing data set to generate K categories;

[0046] S2113: Calculate the silhouette coefficient using the following formula;

[0047]

[0048] Where: S represents the similarity between pedestrian samples, i.e., the silhouette coefficient; D a represents the average Euclidean distance between the pedestrian sample and all other pedestrian samples in the same cluster, that is, the similarity between the pedestrian sample and other pedestrian samples in the same cluster; D b represents the average Euclidean distance between the pedestrian sample and all pedestrian samples in the next nearest cluster, that is, the similarity between the pedestrian sample and other pedestrian samples in the next nearest cluster;

[0049] S2114: Select the K value whose silhouette coefficient S is closest to 1 as the optimal K value of the K-means clustering algorithm.

[0050] Preferably, in step S3, the primary model of the first layer of the Stacking integrated model includes a neural network multilayer perceptron model, a support vector machine regression model, a random forest model and / or an XGBoost model.

[0051] Preferably, the features in the pedestrian crossing data set are divided from different angles, including:

[0052] Pedestrian characteristics: gender, age, distraction status and / or walking speed;

[0053] A set of environmental characteristics: presence of violators ahead, weather conditions, volume of people, and / or group size;

[0054] The feature set selected by the random forest model: age, distraction status, presence of traffic violators ahead, weather color, traffic flow and / or walking speed;

[0055] The feature sets selected by the neural network multilayer perceptron model, the support vector machine regression model, and the XGBoost model are: age, distraction status, presence of traffic violators ahead, weather color, crowd flow, group size, and / or pace.

[0056] Preferably, in step S3, the meta-model of the second layer of the Stacking integrated model includes using a multivariate linear regression model.

[0057] Preferably, in step S4, the processing steps of the Bayesian hyperparameter optimization algorithm are as follows:

[0058] S401: Define the objective function and hyperparameter range of the primary model;

[0059] S402: Selecting a proxy model to approximate the objective function of the primary model;

[0060] S403: randomly selecting a set of hyperparameter configurations to train the primary model, and evaluating the performance of the primary model on the validation set; using these hyperparameter configurations and corresponding performance indicators as initial data points for training the proxy model;

[0061] S404: The proxy model predicts the performance in the entire hyperparameter space based on the existing data set; uses the acquisition function to balance exploration and exploitation, and selects the next hyperparameter configuration to be evaluated;

[0062] S405: Train the primary model using the selected hyperparameter configuration and evaluate its performance on the validation set;

[0063] S406: adding the new evaluation result to the data set of the proxy model and updating the proxy model;

[0064] S407: Repeat steps S404 to S406 until the iteration stop condition is met.

[0065] Preferably, in step S4, the processing steps of five-fold cross validation training of the primary model are as follows:

[0066] S401: Divide a data set of a certain tolerance type into a training set and a test set according to an 8:2 ratio;

[0067] S402: Divide the training set into 5 folds; select 4 folds as training sets in each training, and the remaining 1 fold as a validation set;

[0068] S403: According to the division results in step S402, different training sets are combined to train model Model_i; Model_i is used to predict the verification set of the corresponding group to obtain a 1-fold one-dimensional prediction sequence to verify the prediction result i; at the same time, Model_i is used to predict the test set to obtain a one-dimensional prediction sequence to test the prediction result i; this cycle is repeated until all combinations are traversed, and finally 5 verification prediction results i and 5 test prediction results i are obtained;

[0069] S404: merging the five validation prediction results i in sequence vertically into a one-dimensional prediction sequence new training feature j, and averaging the five test prediction results i to obtain a prediction sequence new test feature j based on the test set;

[0070] S405: Repeat the operations from S403 to S404 for each primary model, and finally obtain 4 new training features j and 4 new test features j.

[0071] Preferably, in step S5, the processing steps of training the meta-model are as follows:

[0072] S501: merging the four new training features j and the true values ​​of the endurance time corresponding to the training set horizontally in sequence to obtain a new 5-dimensional new training set;

[0073] S502: Horizontally merge the four new test sets j and the true values ​​of the endurance time corresponding to the test sets in turn to obtain a new 5-dimensional new test set;

[0074] S503: Use the meta-model to perform training according to the new training set and the new test set and output a predicted value of the endurance time.

[0075] Compared with the prior art, the pedestrian crossing tolerance time prediction method under signal control conditions in the present invention has the following beneficial effects:

[0076] The present invention aims at the problem of lack of tolerance type classification before pedestrian tolerance prediction. The risk score of each pedestrian sample in the pedestrian crossing data set is calculated by the random survival forest model, and then the pedestrian samples are grouped by tolerance type in combination with the risk score to generate multiple tolerance type data sets. First, the random survival forest model can handle problems containing time-to-event data, such as the prediction of pedestrian crossing tolerance time. The risk score calculated by the random survival forest model can accurately quantify the urgency or tendency of the waiting time before each pedestrian sample crosses the street. Secondly, combined with the K-means clustering algorithm, the pedestrian samples are divided into different tolerance types (such as high tolerance, medium tolerance, and low tolerance) according to the risk score, which is helpful to discover the differences in crossing behaviors of different groups of people, thereby providing a more detailed and targeted data set for the training of subsequent models. Finally, through tolerance type grouping, the data set of each tolerance type is made purer, and the noise interference of the model during the training process is reduced, thereby improving the prediction accuracy and generalization ability of the model for different types of pedestrians.

[0077] The present invention aims at the problem of lack of tolerance time prediction of micro-pedestrian individual characteristics and single model, and constructs a quantitative pedestrian tolerance classification standard and classification model, namely Stacking integrated model, wherein the Stacking integrated model is a special prediction model designed for different types of pedestrians. First, the first layer of the Stacking integrated model includes a neural network multi-layer perceptron (MLP) model, a support vector machine regression (SVR) model, a random forest (RF) model and an XGBoost (XGB) model), and the second layer is a meta-model (MLR model. These models have different learning mechanisms and advantages and disadvantages. Multiple models can be used to conduct a comprehensive analysis of the tolerance time of pedestrians crossing the street from different angles, thereby improving the accuracy and performance of pedestrian crossing tolerance time prediction. Secondly, the Stacking integrated model re-learns the prediction results of the first layer primary model through the multivariate linear regression model of the second layer, which helps to reduce the overfitting problem that may be caused by a single model, thereby improving the stability and generalization ability of the model. Finally, due to the combination of the prediction results of multiple primary models, the Stacking integrated model can provide more accurate prediction results, especially when processing complex, nonlinear or high-dimensional data.

[0078] The present invention aims at the problem that the manually set hyperparameters in the machine learning model usually cannot reach the global optimum, and performs hyperparameter tuning on each primary model through the Bayesian hyperparameter optimization algorithm. First, the Bayesian optimization algorithm can automatically search for the optimal hyperparameter combination, avoiding the tediousness and subjectivity of manual parameter adjustment, thereby improving the efficiency and accuracy of parameter adjustment. Secondly, the Bayesian optimization algorithm approximates the real objective function by constructing a proxy model, and uses the Bayesian hyperparameter optimization algorithm to update the proxy model, gradually narrowing the search space, so that the optimal or near-optimal hyperparameter combination can be found efficiently. Finally, by optimizing the hyperparameters, each primary model can be made more adaptable to the data characteristics during the training process, thereby improving the prediction performance of the Stacking integrated model.

[0079] The present invention inputs the training set into each primary model for training according to five-fold cross validation, outputs the prediction results of each primary model, and then integrates the prediction results of each primary model with the corresponding true value into a new training set and a new test set, which are input into the meta-model to output the corresponding tolerance time prediction value. First, the five-fold cross validation divides the data set into five parts, which are used as the test set and the training set for multiple training and testing in turn, so as to evaluate the performance differences of each model on different data sets, thereby judging the stability of the primary model. Secondly, cross validation can reduce the model's dependence on specific training data and reduce the risk of overfitting through multiple training and testing, thereby improving the generalization ability of the model. Finally, since cross validation provides a comprehensive evaluation of model performance, the best model selected based on the evaluation result will be able to provide more reliable and stable prediction results, thereby improving the performance of pedestrian crossing tolerance time prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] In order to make the purpose, technical solution and advantages of the invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings, in which:

[0081] Figure 1 A schematic diagram of pedestrian crossing types;

[0082] Figure 2 The logical block diagram of the pedestrian crossing patience time prediction method;

[0083] Figure 3 A schematic diagram of pedestrian tolerance classification;

[0084] Figure 4 This is the prediction flowchart of the Stacking ensemble model;

[0085] Figure 5 is a schematic diagram of the SVR model;

[0086] Figure 6 This is the framework diagram of the Stacking integrated model algorithm;

[0087] Figure 7 is the risk score distribution;

[0088] Figure 8 is the result of the silhouette coefficient method;

[0089] Fig. 9 Group the results for tolerance;

[0090] Fig.10 , Fig.11 , Fig.12 , Fig.13 They represent the predicted values ​​of the low tolerance M1, M2, M3, and M4 feature groups, respectively;

[0091] Fig.14 , Fig.15 , Fig.16 , Fig.17 They represent the predicted values ​​of the medium tolerance M1, M2, M3, and M4 feature groups, respectively;

[0092] Fig.18 , Fig.19 , Fig. 20 , Fig.21 They represent the predicted values ​​of the high tolerance feature groups M1, M2, M3, and M4 respectively. DETAILED DESCRIPTION

[0093] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but only represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work belong to the scope of protection of the present invention.

[0094] The following is a further detailed description through specific implementation methods:

[0095] Example:

[0096] This embodiment discloses a method for predicting pedestrian crossing tolerance time under signal control conditions.

[0097] In this embodiment, the observation start point is the red light within the signal cycle, and the observation end point is the green light. This is an observation cycle, and the above cycle is repeated multiple times and the results are statistically summarized. Figure 1As shown, the states of pedestrians are divided into k1, k2, and k3. K1 indicates that the pedestrian arrives at the intersection during the green light period and starts to pass normally during the green light period. K2 indicates that the pedestrian arrives at the intersection during the red light period and waits until the green light comes on to start passing normally. K3 indicates that the pedestrian arrives at the intersection during the red light period and starts to pass illegally during the red light period.

[0098] Figure 1 In the figure, pedestrians in situations k1 and k2 are considered to be passing normally when the green light is on. In situation k1, pedestrians do not have to wait, which is not within the main research scope of this implementation, so we will not discuss it in detail. In situation k2, we only observe the starting point of pedestrians' patience when they start to wait, but not the end point of pedestrians' patience when they lose patience. Because pedestrians end their waiting in advance due to the green light before reaching the upper limit of their patience, we cannot know how long pedestrians can continue to endure when the green light is on, and this "exceeding" patience time cannot be observed or measured. We can only know that the patience time of this group of people is not less than the remaining red light time when they arrive, but we cannot fully know their true patience time (this type of data is also called "missing" data). This part of pedestrian data is only meaningful for the division of pedestrian tolerance due to its lack of completeness, but cannot support the prediction of specific pedestrian tolerance time. Therefore, in this embodiment, only k2 type of normal pedestrians crossing the street are included in the tolerance grouping analysis without making specific time predictions. In the k3 case, pedestrians cross the road while the red light is on, which is considered illegal. In this case, within one observation period, we observe both the starting point of the pedestrian's tolerance to wait and the end point of the pedestrian's tolerance to reach the upper limit of tolerance and then illegally pass (run a red light). Based on these two time points, we can calculate the pedestrian's complete tolerance time. This embodiment will mainly predict this type of pedestrian. This implementation aims to calculate the dynamic tolerance waiting time of each group waiting to cross the street by finely predicting the red light tolerance time of each individual pedestrian, so as to help reasonable signal timing so that more k3 illegal pedestrians can be transformed into k2 normal pedestrians.

[0099] like Figure 2 As shown in FIG. 1 , the pedestrian crossing tolerance time prediction method under signal control conditions includes:

[0100] S1: Get the pedestrian crossing data set;

[0101] In this embodiment, it is necessary to pre-process the collected pedestrian crossing data set to remove abnormal values ​​and noise values ​​in the data set.

[0102] S2: Calculate the risk score of each pedestrian sample in the pedestrian crossing data set through the random survival forest model; Use the K-means clustering algorithm combined with the risk score to group the pedestrian samples into tolerance types and generate several tolerance type data sets; Divide each tolerance type data set into a training set and a test set;

[0103] In this embodiment, three tolerance types of data sets are included: low tolerance, medium tolerance, and high tolerance.

[0104] S3: Build a Stacking integration model; the first layer of the Stacking integration model includes several primary models, and the second layer includes a meta-model;

[0105] S4: Tune the hyperparameters of each primary model using the Bayesian hyperparameter optimization algorithm; input the training set into each primary model for training according to five-fold cross-validation, and output the prediction results of each primary model;

[0106] S5: Integrate the prediction results of each primary model and the corresponding true value into a new training set and a new test set, input them into the meta-model, and output the corresponding tolerance time prediction value;

[0107] S6: Output the corresponding tolerance time prediction value based on the characteristic data of a pedestrian through the trained Stacking ensemble model. The characteristic data of the pedestrian includes various characteristic variables in Table 4.

[0108] The present invention aims at the problem of lack of tolerance type classification before pedestrian tolerance prediction. The risk score of each pedestrian sample in the pedestrian crossing data set is calculated by the random survival forest model, and then the pedestrian samples are grouped by tolerance type in combination with the risk score to generate multiple tolerance type data sets. First, the random survival forest model can handle problems containing time-to-event data, such as the prediction of pedestrian crossing tolerance time. The risk score calculated by the random survival forest model can accurately quantify the urgency or tendency of the waiting time before each pedestrian sample crosses the street. Secondly, combined with the K-means clustering algorithm, the pedestrian samples are divided into different tolerance types (such as high tolerance, medium tolerance, and low tolerance) according to the risk score, which is helpful to discover the differences in crossing behaviors of different groups of people, thereby providing a more detailed and targeted data set for the training of subsequent models. Finally, through tolerance type grouping, the data set of each tolerance type is made purer, and the noise interference of the model during the training process is reduced, thereby improving the prediction accuracy and generalization ability of the model for different types of pedestrians.

[0109] The present invention aims at the problem of lack of tolerance time prediction of micro-pedestrian individual characteristics and single model, and constructs a quantitative pedestrian tolerance classification standard and classification model, namely Stacking integrated model, wherein the Stacking integrated model is a special prediction model designed for different types of pedestrians. First, the first layer of the Stacking integrated model includes a neural network multi-layer perceptron (MLP) model, a support vector machine regression (SVR) model, a random forest (RF) model and an XGBoost (XGB) model), and the second layer is a meta-model (MLR model. These models have different learning mechanisms and advantages and disadvantages. Multiple models can be used to conduct a comprehensive analysis of the tolerance time of pedestrians crossing the street from different angles, thereby improving the accuracy and performance of pedestrian crossing tolerance time prediction. Secondly, the Stacking integrated model re-learns the prediction results of the first layer primary model through the multivariate linear regression model of the second layer, which helps to reduce the overfitting problem that may be caused by a single model, thereby improving the stability and generalization ability of the model. Finally, due to the combination of the prediction results of multiple primary models, the Stacking integrated model can provide more accurate prediction results, especially when processing complex, nonlinear or high-dimensional data.

[0110] The present invention aims at the problem that the manually set hyperparameters in the machine learning model usually cannot reach the global optimum, and performs hyperparameter tuning on each primary model through the Bayesian hyperparameter optimization algorithm. First, the Bayesian optimization algorithm can automatically search for the optimal hyperparameter combination, avoiding the tediousness and subjectivity of manual parameter adjustment, thereby improving the efficiency and accuracy of parameter adjustment. Secondly, the Bayesian optimization algorithm approximates the real objective function by constructing a proxy model, and uses the Bayesian hyperparameter optimization algorithm to update the proxy model, gradually narrowing the search space, so that the optimal or near-optimal hyperparameter combination can be found efficiently. Finally, by optimizing the hyperparameters, each primary model can be made more adaptable to the data characteristics during the training process, thereby improving the prediction performance of the Stacking integrated model.

[0111] The present invention inputs the training set into each primary model for training according to five-fold cross validation, outputs the prediction results of each primary model, and then integrates the prediction results of each primary model with the corresponding true value into a new training set and a new test set, which are input into the meta-model to output the corresponding tolerance time prediction value. First, the five-fold cross validation divides the data set into five parts, which are used as the test set and the training set for multiple training and testing in turn, so as to evaluate the performance differences of each model on different data sets, thereby judging the stability of the primary model. Secondly, cross validation can reduce the model's dependence on specific training data and reduce the risk of overfitting through multiple training and testing, thereby improving the generalization ability of the model. Finally, since cross validation provides a comprehensive evaluation of model performance, the best model selected based on the evaluation result will be able to provide more reliable and stable prediction results, thereby improving the performance of pedestrian crossing tolerance time prediction.

[0112] In order to better introduce the technical solution of the present invention, this embodiment is described through the following parts.

[0113] 1. Random Survival Forest (RSF) Model

[0114] Combination Figure 3 As shown in the figure, the pedestrian red light tolerance type classification process is as follows: first, the pedestrian samples are divided into normal crossing k2 category and illegal crossing k3 category and marked. Then the data is input into the random survival forest to obtain the risk scores of different pedestrians, and further clustered according to the risk scores to divide the pedestrian samples into different types. The random survival forest model is used to calculate the tolerance score of pedestrians crossing tolerance time under signal conditions, and the clustering method is further used to group the tolerance. The random survival forest uses the ensemble tree method to study the censored survival data. Compared with the traditional model, the random survival forest method is a non-parametric model. Its advantage in predicting pedestrian crossing tolerance time under signal control conditions is that it can effectively handle complex survival data and does not require too many assumptions. Its randomness and ensemble method give it strong generalization ability.

[0115] In this embodiment, the processing steps of the random survival forest model are as follows:

[0116] S201: Define the death event of the random survival forest model as the red light running behavior of pedestrians when crossing the street within a signal cycle;

[0117] There are two important concepts in the random survival forest model: survival time and death events. The survival time refers to the time from the beginning of observation to the occurrence of a death event or the exit from observation in an observation period. A death event refers to an event defined in advance by the observer. Once the event occurs, the sample changes from the survival state to the death state. The "red light running" behavior of pedestrians crossing the street in a signal cycle is defined as the death event of the model. Therefore, the k2 type pedestrian samples that did not have this event are marked as "survival" samples, and the k3 type pedestrians who crossed the street illegally are marked as "death" samples. The time from the pedestrian arriving at the intersection and waiting to the pedestrian starting to cross the street is defined as the survival time by the model.

[0118] S202: Generate N survival trees with all pedestrian samples in the pedestrian crossing data set as root nodes;

[0119] The central elements of the random survival forest model are the generation of survival trees and the construction of an integrated cumulative hazard function (CHF). A survival tree is a binary tree generated by recursively splitting tree nodes. A tree is grown starting from the root node, which is the top of the tree containing all pedestrian crossing data. Using a predetermined survival criterion, the root node is divided into two child nodes: a left child node and a right child node, and the pedestrian data is divided into these two nodes. In turn, each child node is split, and each split will produce two left and right child nodes, and the pedestrian data is also divided successively. By maximizing the survival difference, the tree separates different situations. Eventually, the survival tree reaches a saturation point, at which time no new child nodes can be formed. The terminal node in a saturated tree is called a leaf node, denoted by H. For a single survival tree, the cumulative hazard function of the i-th pedestrian sample at the leaf node h of the survival tree is calculated by the following formula:

[0120]

[0121] Where: X i (i=1, 2, 3...) represents the selected characteristic covariate that affects pedestrian sample i (the independent variable used to predict individual survival time or survival status); t represents the time the pedestrian sample has been observed; t i,h represents the time point experienced by the i-th pedestrian sample in the leaf node h; d i ,h means at t i,h The number of pedestrian samples that died at any given moment; i,h Indicates that at t i,h The number of pedestrian samples that survive at any time;

[0122] S203: randomly extract samples (bootstrapped) from the pedestrian crossing data set with replacement to establish sample subsets; exclude 37% of the data in each sample subset as out-of-bag data (OOB), and the remaining data as in-bag data (IB);

[0123] S204: For the i-th pedestrian sample from the out-of-bag data, calculate its integrated cumulative risk function in all survival trees by the following formula The cumulative hazard function is derived from only one single tree, while the random survival forest model needs to calculate the integrated cumulative hazard function based on the average of multiple survival trees.

[0124]

[0125] Where: n represents the nth survival tree in the random survival forest; represents the cumulative risk function of the nth survival tree of out-of-bag data; when the pedestrian sample is out-of-bag data, define I i,n =1, otherwise I i,n =0;

[0126] S205: For the i-th pedestrian sample from the in-bag data, calculate its integrated cumulative risk function in all survival trees by the following formula

[0127]

[0128] Where: H * n (t|X i ) represents the cumulative risk function of the nth survival tree of the in-bag data;

[0129] S206: For the i-th pedestrian sample from the out-of-bag data, its integrated mortality rate, i.e., risk score, is calculated by the following formula:

[0130]

[0131] Where: represents the integrated cumulative risk function of the i-th pedestrian sample from the out-of-bag data in all survival trees; J represents the total number of pedestrian samples in the data without bootstrap sampling (bootstrap sampling is a random sampling method with replacement, which is used to generate multiple training sets from the original data set); T j represents the survival time of the jth pedestrian sample in the data without self-sampling;

[0132] S207: For the i-th pedestrian sample from the in-bag data, its integrated mortality rate, i.e., risk score, is calculated by the following formula:

[0133]

[0134] Where: represents the integrated cumulative risk function of the ith pedestrian from the in-bag data in all survival trees.

[0135] 2. K-means clustering algorithm

[0136] For clustering, there are usually classic algorithms such as K-Means, mean shift, DBSCAN, maximum expectation (EM) clustering using Gaussian mixture model (GMM), etc. In this embodiment, the K-means algorithm is used as the tolerance grouping method because it is fast, simple to calculate, and easy to manually determine the number of groups.

[0137] In this embodiment, the processing steps of the K-means clustering algorithm are as follows:

[0138] S211: Determine the K value of the K-means clustering algorithm;

[0139] S212: Randomly select K pedestrian samples from the pedestrian crossing data set as initial cluster centers;

[0140] S213: For each pedestrian sample in the pedestrian crossing data set, the distance between it and each cluster center is calculated by the risk score (usually using the Euclidean distance), and it is assigned to the category to which the nearest cluster center belongs;

[0141] S214: for each category, recalculate its cluster center;

[0142] In this embodiment, the cluster center is the mean (or median) of all data points in the category, which represents the center position of the category.

[0143] S215: Repeat steps S213 to S214, reallocate pedestrian samples to the category to which the nearest cluster center belongs and update the cluster center of the category until the preset iteration stop condition is reached, and generate K tolerance type data sets, including data sets of three tolerance types: low tolerance, medium tolerance, and high tolerance.

[0144] In this embodiment, the stopping condition may be that the change of the cluster center is less than a certain threshold, or that a preset maximum number of iterations is reached.

[0145] In this embodiment, the optimal K value of the K-means clustering algorithm is determined by the silhouette coefficient method. Compared with the "elbow method" which requires subjectively determining the optimal number of clusters by observing the slope change, the silhouette coefficient is more accurate and clear in expressing its meaning.

[0146] The specific steps are as follows:

[0147] S2111: Determine the value range of K value;

[0148] S2112: For each K value within the range, use the K-means algorithm to cluster the pedestrian crossing data set to generate K categories;

[0149] S2113: Calculate the silhouette coefficient using the following formula;

[0150]

[0151] Where: S represents the similarity between pedestrian samples, i.e., the silhouette coefficient; D a represents the average Euclidean distance between the pedestrian sample and all other pedestrian samples in the same cluster, that is, the similarity between the pedestrian sample and other pedestrian samples in the same cluster; D b represents the average Euclidean distance between the pedestrian sample and all pedestrian samples in the next nearest cluster, that is, the similarity between the pedestrian sample and other pedestrian samples in the next nearest cluster;

[0152] S2114: Select the K value whose silhouette coefficient S is closest to 1 as the optimal K value of the K-means clustering algorithm.

[0153] In this embodiment, the core indicator of the silhouette coefficient method is the silhouette coefficient. The basic assumption of this embodiment is that the similarity between samples can be measured by the distance, and the closeness of the sample within the cluster and the separation from other clusters can be evaluated based on the distance between the samples. The S value is between [-1, 1]. The closer the value is to 1, the smaller the distance between the sample point and the samples in the same cluster is, the larger the distance between the sample point and the samples in other clusters is, and the better the clustering effect is. On the contrary, when the silhouette coefficient is close to -1, it means that the distance between the sample and the samples in the same cluster is large, and the distance between the sample point and the samples in other clusters is small, and the clustering effect is poor.

[0154] 3. Stacking Integration Model

[0155] In this embodiment, the overall structure of the Stacking integration model is as follows: Figure 4 As shown in the figure, the stacking ensemble model has two layers. The primary model of the first layer includes a neural network multilayer perceptron (MLP) model, a support vector machine regression (SVR) model, a random forest (RF) model and / or an XGBoost (XGB) model. The meta-model of the second layer includes a multiple linear regression (MLR) model.

[0156] Here are four basic model principles:

[0157] 1) Random Forest Model

[0158] Random forest is one of the ensemble learning algorithms. This algorithm combines multiple regression trees. The construction process of a single regression tree is as follows:

[0159] Step 1: Randomly select a subset from all features as candidate features.

[0160] Step 2: Using the selected candidate features, select the best split point based on the residual sum of squares (RSS).

[0161] RSS is an indicator used to measure the consistency of pedestrian sample values ​​within a node. The goal is to select a split point that makes the node after splitting have the smallest RSS. For a given node G, it can be expressed as:

[0162]

[0163] where |G| is the number of pedestrian samples in node G; y i is the true value of the endurance time of pedestrian sample i; is the mean endurance time of all pedestrians in node G.

[0164] For node G, consider all possible split points (features and their values) and calculate the two child nodes G generated after the split L and G R The RSS(G) of , and select the split point that minimizes the overall RSS after splitting. The overall RSS is defined as:

[0165]

[0166] Where |G L | and |G R | respectively the left child node G L and right child node G R The number of samples in .

[0167] Step 3: Repeat the above process until the number of samples in each node is less than the preset threshold or all samples belong to the same category.

[0168] Further, multiple regression trees are repeatedly constructed according to the above process to form a random forest. The core idea of ​​the random forest model is to use the voting mechanism of multiple regression trees to average the pedestrian tolerance time predictions of multiple trees to obtain the final result. The prediction result of random forest regression can be expressed as:

[0169]

[0170] in represents the predicted value of the endurance time of pedestrian sample i; M is the number of regression trees in the random forest; t i,m is the prediction result of the mth regression tree on the patience time of the i-th pedestrian.

[0171] 2) XGBoost Model

[0172] The core principle of using the XGBoost model to predict pedestrians' patience time is based on the gradient boosting technique, which improves the overall performance by training multiple regression tree models in series and combining their prediction results of pedestrians' patience time. This iterative process enables the model to gradually approach the true value of pedestrians' patience time and minimize the loss function. Assuming that the model has K regression trees, its core formula can be expressed as:

[0173]

[0174]

[0175] Where L Obj is the objective function of the XGB model; B is the number of input pedestrian samples; f k,i represents the result of the regression equation established by the kth tree for the i-th pedestrian sample; Ω(f k ) contains the regularization term; is the model loss function, and the mean square error (MSE) calculation formula is:

[0176]

[0177] This embodiment uses both L1 and L2 regularization terms, and the specific expression is:

[0178]

[0179] Where NT is the number of leaf nodes in the tree, γ is the penalty coefficient for this item; the parameter of the L1 regularization item is α; the parameter of the L2 regularization item is λ; ω j is the weight of the jth leaf node. During the training process, the XGBoost model uses the gradient descent method to optimize the objective function and continuously adjusts the model parameters to minimize the loss function.

[0180] 3) Neural Network Multilayer Perceptron Model

[0181] The main algorithm flow of the neural network multilayer perceptron model is as follows:

[0182] Step 1: Forward Propagation. The network receives the input pedestrian sample data and processes it through the weighted sum of nodes and activation function of each layer, passing it from the input layer to the hidden layer and finally to the output layer. In this embodiment, the hidden layer uses the ReLU activation function, which is a nonlinear function. The ReLU function directly outputs the value when the input is greater than 0, and outputs 0 when the input is less than or equal to 0. When the input is negative, the derivative of the ReLU function is 0, and when the input is positive, the derivative of the ReLU function is 1. When the input value is equal to 0, the ReLU function is not differentiable.

[0183] Step 2: Loss Calculation. Calculate the error between the predicted result and the actual result at the output layer. The loss function is MSE.

[0184] Step 3: Backward Propagation of Errors. Starting from the output layer, calculate the gradient of the loss with respect to each weight backward.

[0185] Step 4: WeightsUpdate. Update all weights and biases in the model based on the calculated gradient and the set learning rate, and use the stochastic gradient descent method to update and reduce the value of the loss function.

[0186] The above steps are repeated in a loop, with each iteration aiming to reduce the value of the loss function until the specified number of iterations is reached or the loss value no longer decreases significantly, and predictions are made based on the final weight combination.

[0187] 4) Support vector machine regression model

[0188] Support vector machine regression (SVR) is a branch of support vector machine (SVM). The goal of SVR is to find a prediction function f(X). A certain width area is selected on both sides of the function. No loss is calculated for all pedestrian samples falling into the area. Only samples outside the area are included in the loss function. Then the model is optimized by minimizing the width of the interval band and the total loss. The SVR model is as follows: Figure 5 The specific process is as follows:

[0189] First, the regression formula for the pedestrian tolerance time prediction value can be expressed as:

[0190]

[0191] Where X is the input feature vector. ω is the weight vector and b is the bias term.

[0192] Secondly, an insensitive loss function ε is introduced to ignore the part where the error is less than ε. The loss function is expressed as:

[0193]

[0194] Finally, slack variables ξi and ξi* are introduced into the model, and the model weights are optimized by minimizing the objective function. The specific formula is as follows:

[0195]

[0196]

[0197] Where C is the regularization penalty coefficient, and S represents the number of pedestrian samples in the training data set.

[0198] 5) Multiple Linear Regression Model

[0199] The stacking sub-metamodel for predicting the red light tolerance time of pedestrians should select a relatively simple mechanism model to prevent the final prediction result of the integrated model from being overfitted. Multiple linear regression is the simplest regression algorithm in machine learning. Multiple linear regression is essentially a linear regression problem in which a sample has multiple features. In this embodiment, the prediction results of the four primary models for the red light tolerance time of pedestrians will be used as four input feature vectors (x1, x2, x3, x4) respectively. The predicted value can be expressed as:

[0200]

[0201] Where w0 is the intercept of the model, and w1 to w4 are called regression coefficients. i1 ~x i4 is the predicted value of different primary models belonging to the i-th pedestrian sample. Assuming that there are q samples in the subset of the pedestrian dataset, this equation can be expressed using a matrix. The input feature structure is a (q, 4) matrix, then:

[0202]

[0203] The multivariate linear regression model of this embodiment uses MSE as the loss function. According to the above expression, the optimal regression coefficient is finally obtained by using the gradient descent method.

[0204] 4. Training of Stacking Ensemble Model

[0205] In this example, the divided pedestrian data set is input into the primary model according to 5-fold cross validation to deal with the data leakage risk that may occur in the Stacking integrated model. The four primary models will make predictions independently and the prediction results of the models will be integrated and recorded as The prediction results of the primary model are further integrated as feature groups denoted as The actual pedestrian red light tolerance time is y. and y are concatenated into a complete data set as the input data of the secondary model. Finally, the second-layer MLR model outputs the prediction result of the pedestrian's endurance time. This method can avoid overfitting, learn the information of the combination of features, and improve the accuracy of prediction.

[0206] Combination Figure 6 As shown in the figure, the processing steps for training the primary model with five-fold cross validation are as follows:

[0207] S401: Divide a data set of a certain tolerance type into a training set and a test set according to an 8:2 ratio;

[0208] S402: Divide the training set into 5 folds (training i sub-dataset, i=1, 2, 3, 4, 5); select 4 folds as training sets in each training, and the remaining 1 fold as a validation set;

[0209] S403: According to the division results in step S402, different training sets are combined to train the model Model_i (i=1, 2, 3, 4, 5); the verification set of the corresponding group is predicted by Model_i to obtain a 1-fold one-dimensional prediction sequence to verify the prediction result i; at the same time, Model_i is used to predict the test set to obtain a one-dimensional prediction sequence to test the prediction result i (which is a column vector, i=1, 2, 3, 4, 5); this cycle is repeated until all combinations are traversed, and finally 5 verification prediction results i and 5 test prediction results i are obtained;

[0210] S404: merging the five validation prediction results i in sequence vertically into a one-dimensional prediction sequence new training feature j (the length is consistent with the length of the training set, j=1, 2, 3, 4), and averaging the five test prediction results i to obtain a prediction sequence new test feature j based on the test set (the length is consistent with the length of the test set, j=1, 2, 3, 4);

[0211] S405: Repeat the operations from S403 to S404 for each primary model, and finally obtain 4 new training features j and 4 new test features j.

[0212] Next, the processing steps for training the meta-model are as follows:

[0213] S501: 4 new training features j and the true value of the endurance time (Train y) corresponding to the training set are horizontally merged in sequence to obtain a new 5-dimensional new training set;

[0214] S502: Horizontally merge the four new test sets j and the true values ​​of the endurance time corresponding to the test sets (Test y) in sequence to obtain a new 5-dimensional new test set;

[0215] S503: Use the meta-model (MLR model) to perform training based on the new training set and the new test set and output the final tolerance time prediction value.

[0216] 5. Bayesian Hyperparameter Optimization (BOA) Algorithm

[0217] This embodiment uses the Bayesian hyperparameter optimization algorithm to tune the hyperparameters of the four primary models. The BOA global optimization algorithm is applied to accelerate the process of model iteration. In each iteration, the BOA optimizer selects candidate points from the hyperparameter space according to the current probability model and sampling method. These candidate points are regarded as hyperparameters of MLP, XGB, SVR and RF, which are used to build models and train them on the training set. This embodiment evaluates the effect of the model by calculating the performance index of the model on the validation set, which is used as the target output function to update the probability model and sampling method. This process is repeated until the predetermined number of iterations is reached or the target performance index is met. At the end of each iteration, the hyperparameters of the model with the best performance are selected. The selected hyperparameters are used to build the MLP, SVR, XGB and RF models and train them on the entire training set. Finally, the performance of the model is evaluated using the test set, and the best classification results and predicted trajectory data are obtained. The advantage of the BOA algorithm is that it can obtain a solution close to the global optimal solution regardless of the data size, and the optimal solution can be found in only a few iterations.

[0218] In this embodiment, the processing steps of the Bayesian hyperparameter optimization algorithm are as follows:

[0219] S401: Define the objective function and hyperparameter range of the primary model;

[0220] In this embodiment, the objective function may be selected from accuracy, mean square error (MSE), F1 score, etc. The range of the hyperparameter range is shown in Table 1.

[0221] Table 1 Hyperparameter optimization range

[0222]

[0223]

[0224] S402: Select a surrogate model (such as Gaussian process, random forest regression, Bayesian neural network, etc.) to approximate the objective function of the primary model;

[0225] S403: randomly selecting a set of hyperparameter configurations to train the primary model, and evaluating the performance of the primary model on the validation set; using these hyperparameter configurations and corresponding performance indicators as initial data points for training the proxy model;

[0226] S404: The proxy model predicts the performance in the entire hyperparameter space based on the existing data set; uses acquisition functions (such as expected improvement EI, probability improvement PI, upper confidence bound UCB, etc.) to balance exploration (sampling in areas with high uncertainty) and exploitation (sampling in known high-performance areas) to select the next hyperparameter configuration to be evaluated;

[0227] S405: Train the primary model using the selected hyperparameter configuration and evaluate its performance on the validation set;

[0228] S406: adding the new evaluation result to the data set of the proxy model and updating the proxy model;

[0229] S407: Repeat steps S404 to S406 until the iteration stop condition is met.

[0230] In this embodiment, the iteration stopping condition may be selected as reaching a predetermined number of iterations, exhaustion of computing resources, performance improvement being less than a certain threshold, or prediction uncertainty of the proxy model being lower than a certain level.

[0231] VI. Experimental description and results analysis

[0232] 1. Pedestrian crossing data

[0233] The experimental data was collected at three signal-controlled crosswalks in Chongqing, China. Location 1 is located at the crossroads of the MixC business district in Jiulongpo District, Location 2 is located inside the Longhu Times Tianjie business district in Yuzhong District, and Location 3 is located at No. 122 Shixiao Road in Shapingba District. The selected sites are all located in the city center and have high pedestrian density. The data was collected from September 10 to 29, 2023. In order to eliminate the interference of weather conditions, it was uniformly collected on sunny days. The appropriate time period was selected from 7:00 to 20:00 every day for video shooting and collection, and the video was recorded at a frame rate of 60 frames per second.

[0234] The timing of pedestrian crossing signals at various locations is shown in Table 2.

[0235] Table 2 Pedestrian crossing signal timing

[0236]

[0237]

[0238] The collected data include pedestrian waiting time, individual characteristics of pedestrians, environmental factors, etc. The timing starts when the pedestrian arrives at the intersection, and ends when the pedestrian starts crossing the street. The pedestrian's patience time is calculated through the two time points. Individual characteristics include the pedestrian's gender, age, distraction state, and walking speed. The distraction state refers to whether the pedestrian has distracting behaviors such as communicating with others, looking at mobile phones, taking care of children, etc. while waiting. In addition, the group size indicates whether the pedestrian is waiting alone or walking with others. The time attribute indicates whether it is daytime or nighttime. Whether there are violators ahead refers to whether there are other pedestrians observing the pedestrian crossing the street in front of the red light. Pedestrian flow indicates the congestion level of the intersection at this time.

[0239] Data preprocessing is performed on the collected data. Duplicate or missing data in the data set is detected and deleted. The pedestrian tolerance time value range is set to 5s-105s, and outliers outside this range are deleted. The isolation forest method is used to detect outliers in the tolerance time and further determine whether to retain them.

[0240] Through the above preprocessing, 27 data items were deleted, and a total of 1023 normal crossing data items and 1527 illegal crossing data items were obtained. The data slices are shown in Table 3, where columns 1-8 are features. Column 9 is the measured value of pedestrian crossing tolerance time. The last column is the event state variable. When the value is 0, it means that the pedestrian did not "run a red light", and when the value is 1, it means that the pedestrian ran a red light and crossed the street.

[0241] Table 3 Pedestrian dataset segmentation

[0242]

[0243] The descriptive statistics of the analyzed pedestrian behavior variables are shown in Table 4, where 59.5% of the pedestrians are male. During the observation period, the age of pedestrians was mainly middle-aged, accounting for 59.2%, while children and the elderly accounted for 15.3% and 25.5% of the data set, respectively. Most of the pedestrians observed were distracted by looking at their phones or chatting, accounting for 60.4%. Pedestrians traveled alone, accounting for 55.7%. The pedestrian flow states accounted for 35.4% loose, 30.3% medium, and 34.3% crowded. Most of the observation records came from daytime, accounting for 71.1%. Pedestrians walked at low speeds, accounting for 29.3%, medium speeds, accounting for 38.6%, and fast speeds, accounting for 32.1%. The situation of violators appearing in front of pedestrians accounted for 37.5%. The above features are recorded as i1, i2, ..., i8.

[0244] Table 4 Descriptive statistics of characteristic variables

[0245]

[0246]

[0247] 2. Pedestrian crossing tolerance grouping

[0248] The pedestrian risk score reflects the probability that each pedestrian sample will lose patience and cross the street during a red light. Specifically, pedestrians with higher risk scores have lower tolerance and are more likely to run a red light in a shorter period of time. Pedestrians with lower risk scores have higher tolerance and can tolerate for a longer period of time. The risk score frequency chart obtained by the random survival forest model is shown in Figure 2. Figure 7 As shown. Further, the obtained risk scores of each pedestrian are used as the input of the K-means algorithm. According to the results of the "Silhouette Coefficient Method", the number of clusters is determined to be 3, as shown Figure 8 As shown. That is, output 3 types of pedestrian red light tolerance types and the corresponding digital labels from 1 to 3 are low tolerance, medium tolerance, and high tolerance. Fig. 9 As shown in the figure, the original illegal pedestrian data is divided into three sub-datasets based on this result and the models are trained for prediction respectively. There are 553 data in the low tolerance group, 452 in the medium tolerance group and 522 in the high tolerance group.

[0249] 3. Feature Grouping

[0250] The purpose of this embodiment to divide the features from different angles is to explore the lowest dimensional main feature combination under the premise of ensuring accuracy, rather than simply inputting all the features to reduce the workload of data collection and processing. First, according to the meaning of each feature, gender, age, distraction state and pace are summarized as pedestrian characteristics, so i1, i2, i3, i8 are added to the pedestrian's own feature subset and recorded as M1. On the other hand, the presence or absence of violators ahead, weather, pedestrian flow, and group size are summarized as external environmental characteristics, so i4, i5, i6, i7 are added to the environmental feature set and recorded as M2. According to the importance results of the single RF model, the feature set is selected as M3. Combining the three models of RF, SVR, and XGB models, vote to select a feature set that is significantly significant to the model results and record it as M4. As shown in Table 5.

[0251] Table 5 Feature groups

[0252]

[0253] Specific:

[0254] Pedestrian characteristics: gender, age, distraction status and / or walking speed;

[0255] A set of environmental characteristics: presence of violators ahead, weather conditions, volume of people, and / or group size;

[0256] The feature set selected by random forest (RF): age, distraction status, presence of traffic violators ahead, weather color, traffic flow and / or walking speed;

[0257] The feature sets selected by the neural network multi-layer perceptron (MLP), support vector machine regression (SVR) and XGBoost (XGB) models are: age, distraction status, presence of traffic violators ahead, weather color, crowd flow, group size and / or walking speed.

[0258] 4. Evaluation indicators

[0259] Since this embodiment is aimed at predicting pedestrian endurance time, it belongs to numerical regression prediction. Therefore, MSE, mean absolute error (MAE), and mean absolute percentage error (MAPE) are used as model evaluation indicators. The smaller the values ​​of MSE, MAE, and MAPE, the smaller the difference between the predicted value and the true value of the model, and the better the performance of the model.

[0260] The calculation formulas for MAE and MAPE are as follows:

[0261]

[0262]

[0263] 5. Analysis of prediction results of pedestrians' tolerance time for crossing red lights

[0264] 5.1 Analysis of the low tolerance group

[0265] The average tolerance time of pedestrians in the low tolerance group is 11s. The tolerance time values ​​of this type of pedestrians are generally small, so MAPE is sensitive to errors. The results of the model using four different feature combinations are shown in Table 6 and Fig.10 , Fig.11 , Fig.12 and Fig.13 As shown in Table 6, the best input is M4, at which the model MSE and MAE are 6.58 and 1.91 respectively, and the MAPE is 19.78%. This shows that the average prediction error of the model for the tolerance time of pedestrians in the low tolerance group is within 2s, and the overall error is less than 20%. Overall, the model's prediction results for the low tolerance group have a small error in absolute values ​​and can truly reflect the specific tolerance of pedestrians. Although the error percentage is affected by the characteristics of the data itself, it is still within an acceptable range.

[0266] Table 6 Optimization comparison

[0267]

[0268] 5.2 Analysis of the Medium Tolerance Group

[0269] The average value of the medium tolerance group is 22s. The results of using four different feature combinations in the medium tolerance group are shown in Table 7 and Fig.14 , Fig.15 , Fig.16 and Fig.17 As shown. From Table 7, we can see that the best input is the M4 group, and the M3 group is similar to it. The MSE and MAE of the best input model are 4.82 and 1.53 respectively, and the MAPE of the model is 7.63%. This shows that the average numerical error of the model for the medium tolerance group is small, which is consistent with the low tolerance group and is more accurate. At the same time, the MAPE of the model has dropped significantly, which also shows that the MAPE in the low tolerance group is greatly affected by the size of the value itself. Except for the poor performance of the M2 input, the average error value of the model in predicting the pedestrian tolerance time under other input conditions is less than 10%. This shows that the integrated model also has good accuracy in predicting the tolerance time of pedestrians with medium tolerance.

[0270] Table 7 Optimization comparison

[0271]

[0272] 5.3 Analysis of the high tolerance group

[0273] The average endurance time of the high-tolerance group is 45s. The results of using four different feature combinations in the high-tolerance group are shown in Table 8 and Fig.18 , Fig.19 , Fig. 20 and Fig.21 As shown in the chart, the prediction results of the M4 group are still the best. At this time, the MSE and MAE of the model are 33.32 and 3.89 respectively, and the MAPE is 10.14%. Although the MSE and MAE have increased, the MAPE is 10.14%, which is not significantly higher than that of the medium tolerance group. When the numerical value is significantly improved, the accuracy of the model remains stable.

[0274] Table 8 Optimization comparison

[0275]

[0276] 6. Model comparison

[0277] In order to further verify the effectiveness of the model of the present invention, separate XGB, RF, MLP and SVR models were established for comparative analysis on the test set. Table 9 shows the model evaluation indicators. According to the indicator data, the prediction error indicators of the Stacking ensemble model after tolerance grouping are the best among multiple models. The MSE of the Stacking model without tolerance division is 34.98, and the MAE is 3.97. The MSE of the single MLP, XGB, RF, and SVR models for prediction are 39.86, 37.29, 41.74, and 81.23, respectively, and the MAE are 4.90, 4.12, 5.00, and 7.19, respectively. The overall prediction accuracy is weaker than that of the grouped Stacking ensemble model. Under the condition of using the M4 feature group, after the prediction values ​​of each primary model are input into the secondary model as feature variables, the feature importance scores obtained by the MLR model are shown in Table 10.

[0278] Table 9 Model comparison

[0279]

[0280] Table 10 MLR model feature importance scores

[0281]

[0282] 7. Conclusion

[0283] The M4 input group selected by multiple learners performs best in the three tolerance groups. In the low tolerance group, MSE, MAE, and MAPE are 6.58, 1.91, and 19.78%, respectively; in the medium tolerance group, MSE, MAE, and MAPE are 4.82, 1.53, and 7.63%, respectively; in the high tolerance group, MSE, MAE, and MAPE are 33.32, 3.89, and 10.14%, respectively. A separate XGBoost model, a random forest regression model, an MLP model, an SVR model, and an ungrouped Stacking model are further established for comparative analysis with the grouped Stacking model of this embodiment. The results show that the model proposed by the present invention performs best.

[0284] In general, the Stacking model for dividing tolerance groups integrates the advantages of machine learning and deep learning. Through feature selection and hyperparameter optimization strategies, it can effectively predict the individual pedestrian crossing tolerance time under signal control. Compared with existing methods that focus on large time granularity and the problem that the tolerance time of pedestrian groups cannot reflect individual characteristics, this model can dynamically calculate the tolerance time of individual pedestrians that evolves over time. The calculation results can calculate the probability distribution of tolerance time and key parameters for different personnel composition at each moment, which serves as the basis for the elastic timing of pedestrian crossing signals. At the same time, the calculation results of the length of each pedestrian's tolerance time can remind traffic management personnel to pay special attention, and if necessary, take active intervention to reduce the probability of pedestrians crossing the street illegally. This model provides a necessary means for building a pedestrian-friendly city and coordinating the benefits of pedestrian and motor vehicle traffic.

[0285] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit the technical solution. Those skilled in the art should understand that those modifications or equivalent substitutions of the technical solution of the present invention that do not depart from the purpose and scope of the technical solution should be included in the scope of the claims of the present invention.

Claims

1. A method for predicting pedestrian crossing tolerance time under signal control conditions, characterized in that: include: S1: Get the pedestrian crossing data set; S2: Calculate the risk score of each pedestrian sample in the pedestrian crossing dataset using the random survival forest model; The K-means clustering algorithm is used in combination with the risk score to group the pedestrian samples into tolerance types, and several tolerance type data sets are generated; each tolerance type data set is divided into a training set and a test set; S3: Build a Stacking integration model; the first layer of the Stacking integration model includes several primary models, and the second layer includes a meta-model; S4: Tune the hyperparameters of each primary model using the Bayesian hyperparameter optimization algorithm; input the training set into each primary model for training according to five-fold cross-validation, and output the prediction results of each primary model; S5: Integrate the prediction results of each primary model and the corresponding true value into a new training set and a new test set, input them into the meta-model, and output the corresponding tolerance time prediction value; S6: Output the corresponding patience time prediction value based on the characteristic data of a pedestrian through the trained Stacking ensemble model.

2. The method for predicting pedestrian crossing tolerance time under signal control conditions as claimed in claim 1, characterized in that: In step S2, the processing steps of the random survival forest model are as follows: S201: Define the death event of the random survival forest model as the red light running behavior of pedestrians when crossing the street within a signal cycle; S202: Generate N survival trees with all pedestrian samples in the pedestrian crossing data set as root nodes; For a single survival tree, the cumulative risk function of the i-th pedestrian sample at the leaf node h of the survival tree is calculated by the following formula: Where: X i (i=1,2,3…) represents the selected characteristic covariate that affects pedestrian sample i; t represents the time that the pedestrian sample has been observed; t i,h represents the time point experienced by the i-th pedestrian sample in the leaf node h; d i,h Indicates that at t i,h The number of pedestrian samples that died at any given moment; i,h Indicates that at t i,h The number of pedestrian samples that survive at any time; S203: randomly extracting pedestrian samples from the pedestrian crossing data set in a form of replacement to establish a sample subset; dividing the sample subset into out-of-bag data and in-bag data; S204: For the i-th pedestrian sample from the out-of-bag data, calculate its integrated cumulative risk function in all survival trees by the following formula Where: n represents the nth survival tree in the random survival forest; represents the cumulative risk function of the nth survival tree of out-of-bag data; When the pedestrian sample is out-of-bag data, define I i,n =1, otherwise I i,n =0; S205: For the i-th pedestrian sample from the in-bag data, calculate its integrated cumulative risk function in all survival trees by the following formula Where: H * n (t|X i ) represents the cumulative risk function of the nth survival tree of the in-bag data; S206: For the i-th pedestrian sample from the out-of-bag data, its integrated mortality rate, i.e., risk score, is calculated by the following formula: Where: represents the integrated cumulative risk function of the i-th pedestrian sample from the out-of-bag data in all survival trees; J represents the total number of pedestrian samples in the data without bootstrap sampling; T j represents the survival time of the jth pedestrian sample in the data without self-sampling; S207: For the i-th pedestrian sample from the in-bag data, its integrated mortality rate, i.e., risk score, is calculated by the following formula: Where: represents the integrated cumulative risk function of the ith pedestrian from the in-bag data in all survival trees.

3. The method for predicting pedestrian crossing tolerance time under signal control conditions as claimed in claim 2, characterized in that: In step S2, the processing steps of the K-means clustering algorithm are as follows: S211: Determine the K value of the K-means clustering algorithm; S212: Randomly select K pedestrian samples from the pedestrian crossing data set as initial cluster centers; S213: For each pedestrian sample in the pedestrian crossing data set, the distance between the pedestrian sample and each cluster center is calculated by the risk score, and the pedestrian sample is assigned to the category to which the nearest cluster center belongs; S214: for each category, recalculate its cluster center; S215: Repeat steps S213 to S214, reallocate pedestrian samples to the category to which the nearest cluster center belongs and update the cluster center of the category until the preset iteration stop condition is reached, and generate K tolerance type data sets.

4. The method for predicting pedestrian crossing tolerance time under signal control conditions as claimed in claim 3, characterized in that: In step S211, the optimal K value of the K-means clustering algorithm is determined by the silhouette coefficient method; The specific steps are as follows: S2111: Determine the value range of K value; S2112: For each K value within the range, use the K-means algorithm to cluster the pedestrian crossing data set to generate K categories; S2113: Calculate the silhouette coefficient using the following formula; Where: S represents the similarity between pedestrian samples, i.e., the silhouette coefficient; D a represents the average Euclidean distance between the pedestrian sample and all other pedestrian samples in the same cluster, that is, the similarity between the pedestrian sample and other pedestrian samples in the same cluster; D b represents the average Euclidean distance between the pedestrian sample and all pedestrian samples in the next nearest cluster, that is, the similarity between the pedestrian sample and other pedestrian samples in the next nearest cluster; S2114: Select the K value whose silhouette coefficient S is closest to 1 as the optimal K value of the K-means clustering algorithm.

5. The method for predicting pedestrian crossing tolerance time under signal control conditions as claimed in claim 1, characterized in that: In step S3, the primary model of the first layer of the Stacking ensemble model includes a neural network multilayer perceptron model, a support vector machine regression model, a random forest model and / or an XGBoost model.

6. The method for predicting pedestrian crossing tolerance time under signal control conditions as claimed in claim 5, characterized in that: The features in the pedestrian crossing dataset are divided from different angles, including: Pedestrian characteristics: gender, age, distraction status and / or walking speed; A set of environmental characteristics: presence of violators ahead, weather conditions, volume of people, and / or group size; The feature set selected by the random forest model: age, distraction status, presence of traffic violators ahead, weather color, traffic flow and / or walking speed; The feature sets selected by the neural network multilayer perceptron model, the support vector machine regression model, and the XGBoost model are: age, distraction status, presence of traffic violators ahead, weather color, crowd flow, group size, and / or pace.

7. The method for predicting pedestrian crossing tolerance time under signal control conditions as claimed in claim 1, characterized in that: In step S3, the meta-model of the second layer of the Stacking ensemble model includes using a multivariate linear regression model.

8. The method for predicting pedestrian crossing tolerance time under signal control conditions as claimed in claim 1, characterized in that: In step S4, the processing steps of the Bayesian hyperparameter optimization algorithm are as follows: S401: Define the objective function and hyperparameter range of the primary model; S402: Selecting a proxy model to approximate the objective function of the primary model; S403: randomly selecting a set of hyperparameter configurations to train the primary model, and evaluating the performance of the primary model on the validation set; using these hyperparameter configurations and corresponding performance indicators as initial data points for training the proxy model; S404: The proxy model predicts the performance in the entire hyperparameter space based on the existing data set; uses the acquisition function to balance exploration and exploitation, and selects the next hyperparameter configuration to be evaluated; S405: Train the primary model using the selected hyperparameter configuration and evaluate its performance on the validation set; S406: adding the new evaluation result to the data set of the proxy model and updating the proxy model; S407: Repeat steps S404 to S406 until the iteration stop condition is met.

9. The method for predicting pedestrian crossing tolerance time under signal control conditions as claimed in claim 1, characterized in that: In step S4, the processing steps of five-fold cross-validation training of the primary model are as follows: S401: Divide a data set of a certain tolerance type into a training set and a test set; S402: Divide the training set into 5 folds; select 4 folds as training sets in each training, and the remaining 1 fold as a validation set; S403: According to the division results in step S402, different training sets are combined to train the model Model_i; the validation set of the corresponding group is predicted by Model_i to obtain a 1-fold one-dimensional prediction sequence to verify the prediction result i; at the same time, a one-dimensional prediction sequence is used to predict the test set using Model_i to test the prediction result i; This cycle is repeated until all combinations are traversed, and finally 5 verification prediction results i and 5 test prediction results i are obtained; S404: merging the five validation prediction results i in sequence vertically into a one-dimensional prediction sequence new training feature j, and averaging the five test prediction results i to obtain a prediction sequence new test feature j based on the test set; S405: Repeat the operations from S403 to S404 for each primary model, and finally obtain 4 new training features j and 4 new test features j.

10. The method for predicting pedestrian crossing tolerance time under signal control conditions as claimed in claim 9, characterized in that: In step S5, the processing steps of training the meta-model are as follows: S501: merging the four new training features j and the true values ​​of the endurance time corresponding to the training set horizontally in sequence to obtain a new 5-dimensional new training set; S502: Horizontally merge the four new test sets j and the true values ​​of the endurance time corresponding to the test sets in turn to obtain a new 5-dimensional new test set; S503: Use the meta-model to perform training according to the new training set and the new test set and output a predicted value of the endurance time.

Citation Information

Cited By

  • Taste classification method based on electroencephalogram data

    CN120105212A

  • A taste classification method based on electroencephalogram data

    CN120105212B

  • Ship trajectory clustering method

    CN120670883A