Next Article in Journal
High-Pressure Processing of Reduced Salt Pangasius Catfish (Pangasianodon hypophthalmus) Minced Muscle: The Effects on Selected Quality Properties of Its Gels
Previous Article in Journal
Performance of Fine-Tuning Techniques for Multilabel Classification of Surface Defects in Reinforced Concrete Bridges
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Research on Pedestrian Avoidance Behavior for School Section Based on Improved BP Neural Network and XGboost Algorithm

College of Economics and Management, Shanghai Ocean University, Shanghai 201306, China
*
Author to whom correspondence should be addressed.
Appl. Sci. 2025, 15(9), 4724; https://doi.org/10.3390/app15094724
Submission received: 9 February 2025 / Revised: 29 March 2025 / Accepted: 2 April 2025 / Published: 24 April 2025

Abstract

:
As society evolves and technology advances, increasing transportation demands have heightened safety risks near schools and on mixed-traffic roads. While traditional studies on pedestrian evasive behavior have mainly focused on general traffic environments and used image-based features to predict trajectories, few have specifically addressed the behavior of pedestrians in school zones. This study fills that gap by analyzing pedestrian evasive actions near school zones in Pudong New Area, Shanghai, using real-time video data. In contrast to previous approaches, our research leverages key traffic variables—such as vehicle speed, pedestrian proximity, and traffic density—to predict whether pedestrians will engage in evasive behavior. We independently apply three predictive models: the traditional BP (Backpropagation) neural network, an improved GA-BP(genetic algorithm–backpropagation) neural network, and the XGBoost (Extreme Gradient Boosting) ensemble learning method. Our findings show that the improved GA-BP model outperforms the others, achieving an accuracy of over 79%. Furthermore, this study identifies crucial traffic factors influencing pedestrian behavior, offering valuable insights for road safety decision-making in school zones. This research demonstrates the potential of advanced predictive models for forecasting pedestrian evasive behavior. It enhances safety in school zones by highlighting the key traffic variables affecting pedestrians.

1. Introduction

In today’s increasingly congested traffic environment, pedestrian safety, particularly for children commuting to and from school, has become a critical concern. Ensuring their safety in high-traffic areas is a top priority. When navigating roads with heavy traffic, pedestrians, especially children, must make crucial decisions about whether to avoid oncoming vehicles. This decision-making process intuitively reacts to the surrounding environment and plays a key role in traffic safety. Therefore, an in-depth investigation into pedestrian avoidance behavior is essential for improving road safety and reducing traffic accidents.
Numerous studies have examined the risks associated with children’s school commutes and pedestrian safety. For example, Appleyard (2022) [1] highlighted the importance of safe routes to school, emphasizing the cognitive benefits of livable streets for schoolchildren. Al-Najjar et al. (2022) [2] explored safety issues in specific built environments, underscoring the role of infrastructure in pedestrian safety. Similarly, Appolloni et al. (2020) [3] proposed an ergonomic approach to evaluating walkable urban environments, which is essential for improving pedestrian accessibility and safety.
Moreover, researchers have explored various technological interventions to mitigate these risks. Intelligent transportation systems, bright traffic signals, and community-based interventions have been implemented to enhance pedestrian safety. Advanced methodologies, such as deep learning and machine learning [4], have also been applied to analyze and predict pedestrian behaviors. For instance, Alahi et al. (2016) [5] utilized Social LSTM (Long Short-Term Memory) to predict human trajectories in crowded spaces, which has implications for improving children’s traffic safety. Chen et al. (2020) [6,7] introduced a multi-channel tensor approach to model pedestrian environmental information, employing convolutional operations to capture spatiotemporal interactions. However, these methods predominantly rely on image-based data, which can be sensitive to noise and outliers, limiting their accuracy in dynamic, real-world environments.
Despite the growing body of work in pedestrian safety, few studies have specifically addressed the prediction of pedestrian evasive behavior in school zones, a critical issue given the heightened risks associated with school commutes. Most existing research focuses on generalized traffic environments or utilizes traditional methods that lack consideration for key traffic variables. In contrast, this study offers a novel approach by integrating real-time video data with three predictive models: the traditional BP neural network, an improved GA-BP neural network, and the XGBoost ensemble learning method. While all three models are applied to predict pedestrian avoidance behavior, specifically in school zones, the GA-BP model demonstrates superior predictive accuracy and stability.
Furthermore, this research considers key traffic variables such as vehicle speed, pedestrian proximity, and traffic density, providing a more context-aware and accurate prediction of pedestrian evasive actions. The GA-BP model, which improves learning efficiency and robustness compared to traditional BP neural networks, addresses the limitations of standard machine learning approaches in real-world, dynamic environments. This study improves the accuracy of pedestrian behavior prediction in school zones and provides valuable insights into the key factors influencing pedestrian safety.
The structure of this paper is as follows: Section 2 presents the data collection methods. Section 3 introduces the Materials and Methods used in the study. Section 4 provides a comparison analysis of the prediction models. Finally, Section 5 concludes the study and discusses potential directions for future research.

2. Data Collection

The data used in this paper comes from traffic volume data near several primary and secondary schools in Pudong New Area, Shanghai. The experimental equipment includes DV cameras that capture real-time video data of several road sections near these schools, totaling 4 h:12 m of video. The videos cover traffic conditions and road types at six locations during various dates and times, including school arrival and departure periods. As shown in Figure 1, Figure 1A,B have no pedestrian crossings but include parking spaces; Figure 1C–E feature both pedestrian crossings and parking spaces, and Figure 1F has a pedestrian crossing without parking spaces. In addition, the red lines marked in Figure 1 indicate the positions where the road width and length are measured, providing additional context for the physical dimensions of the road sections. Table 1 records detailed information about the data collection times, locations, and durations, including the number of samples collected at each site. Ultimately, the dataset was organized into 167 samples. The video recordings capture pedestrian positions, speeds, traffic volume, directions, and times. Using the time–distance method, the average speed of vehicles is calculated by measuring the time taken for vehicles to travel between two points with a known distance while also recording vehicle direction, position, and other features. After preprocessing operations, the video data were finally organized into a CSV format dataset.
During preprocessing, the dataset was constructed with 12 features and one label. The features include variables related to vehicle encounters, pedestrian companionship, traffic volume, and speed. The label represents whether pedestrians exhibit avoidance behavior, coded as 1 for avoidance and 0 for non-avoidance. Definitions, data types, and measurement units for each variable are detailed in Table 2.
Pedestrian avoidance behavior was determined by manually observing video footage. Specifically, avoidance was identified when a pedestrian, during interactions with vehicles, suddenly changed their walking route or came to an abrupt stop. These behaviors indicate a deliberate attempt to avoid potential collisions or perceived danger.
To ensure labeling consistency and accuracy, a random subset of the annotated data was independently cross-validated by a second annotator. Any discrepancies between annotators were discussed and resolved to maintain high labeling reliability.
From the preliminary statistical analysis of the dataset, we observed the following: In 42% of the samples, vehicles traveling in the same direction were encountered (S = 0.42), and in 46% of the samples, vehicles traveling in the opposite direction were encountered (O = 0.46). In the remaining 12% of the samples, no vehicles were encountered. This indicates that pedestrians typically face vehicle interactions from both directions.
The average STV (same-direction traffic volume) is 2.4 vehicles per second, while the average OTV (opposite-direction traffic volume) is 3.6.
Regarding pedestrian grouping, only 38% of the samples (p = 0.38) indicate that pedestrians walk together, implying that most pedestrians walk alone.
The average SV (same-direction speed) is 4.32 m/s, and the OV (opposite-direction speed) is 4.50 m/s, showing that vehicles generally travel at relatively low speeds in these areas.
The mean road W (width) is 4.75 m, reflecting a moderate width.
The mean value for pedestrian A (avoidance behavior) is 0.52, indicating that pedestrians avoid vehicles in about half of the cases.
This detailed description clearly defines the variables’ types (binary vs. continuous) and units, providing a comprehensive understanding of the dataset used in our analysis.
These 12 features are selected for training the model because they accurately reflect pedestrian behavior and decision-making in real traffic environments. They include whether pedestrians encounter vehicles in the same or opposite direction, the type of vehicles (cars or electric bicycles), traffic volume, vehicle speed, and the presence of walking companions. Traffic volume and speed are crucial for predicting whether pedestrians need to take evasive actions, while the number of companions influences pedestrian movement and avoidance decisions. These factors comprehensively describe the interaction between pedestrians and vehicles, enabling the model to predict pedestrian behavior in various traffic scenarios better.
Figure 1. The six collection sites.(A,B) Primary school sites without sidewalks; (CF) Middle school sites with sidewalks.
Figure 1. The six collection sites.(A,B) Primary school sites without sidewalks; (CF) Middle school sites with sidewalks.
Applsci 15 04724 g001aApplsci 15 04724 g001b

3. Methods

3.1. BP Neural Network

The backpropagation technique was used to train the BP, a multilayer feedforward neural network [8]. As illustrated in Figure 2, the BP neural network structure consists of an input layer, one or more hidden layers, and an output layer. BP’s main benefit is its capacity to pick up intricate nonlinear input–output mappings.
The gradient-based optimization underpinning the BP learning process involves iteratively adjusting the weights and biases to minimize the cross-entropy loss. In order to update parameters, the gradients [9] of the loss function are transmitted backward through the network using the steepest descent approach. Because it measures the discrepancy between the actual label distribution and the expected probability distribution, cross-entropy loss is very useful for classification problems.
Figure 3 shows the dataset used in this investigation, which has twelve input features and one output label. The BP model captures the link between these features and the desired result [10]. We use an adaptive learning rate technique and batch normalization to improve training stability and convergence speed.
The dataset employed in this study comprises twelve input features and one target label. Table 1 provides a detailed description of each feature and the corresponding label. The BP neural network model, illustrated in Figure 3, is structured with an input layer, three hidden layers, and an output layer designed to effectively capture the relationship between the input features and the target output.
Equation (1) gives the calculation formula of the BP neural network from the input vector X to the output vector Y.
O l = g { k = 1 ν w k l × f [ j = 1 n w j k × f ( i = 1 m x i × w i j + b 1 j ) + b 2 k ] + b 3 l } , l = 1 , 2 , , T
This formula represents a neural network with three hidden layers, where each output O l is computed through a series of weighted sums and activation functions. The input values x i are combined with weights w i j and a bias term b 1 j , then passed through an activation function f , forming the first hidden layer. The results from this layer are further processed by another set of weights w j k and biases b 2 k , again undergoing the activation function to create the second hidden layer. Similarly, these values propagate through the third layer using weights w k l and biases b 3 l , before being transformed by the final activation function g to produce the output O l . The parameters m , n , and v define the number of neurons in each respective layer, while T represents the total number of output neurons.
f ( x ) = 1 1 + e x , x ( 0 , 1 )
Equation (2) represents the activation function. This formula defines the sigmoid activation function, which maps an input x to an output within the range (0, 1). Where e is the base of the natural logarithm. The input variable x determines the function’s output, with larger values pushing the result closer to 1 and smaller values bringing it closer to 0. This nonlinear transformation enables the function to introduce smooth and differentiable behavior, making it widely used in neural networks for binary classification and gradient-based optimization.
L = [ y log ( y ^ ) + ( 1 y ) log ( 1 y ^ ) ]
Equation (3) represents the binary cross-entropy loss function, which measures the discrepancy between the true binary labels and the predicted probabilities. In this equation, L denotes the loss value, y is the ground truth label that takes a value of either 0 or 1, and y ^ represents the predicted probability that the given sample belongs to the positive class. The logarithmic functions [11], log ( y ^ ) and log ( 1 y ^ ) , ensure that the loss escalates significantly when the prediction deviates from the actual label. The first term, y log ( y ^ ) , penalizes the model when the true label is 1 but the predicted probability is low, while the second term, ( 1 y ) log ( 1 y ^ ) , penalizes the model when the true label is 0 but the predicted probability is high. As a result, binary cross-entropy encourages the model to produce confident and accurate predictions, minimizing the loss when the predicted values align with the actual labels.
Δ w i j ( n ) = α E s w i j + Δ w i j ( n 1 ) b i ( n ) = α E s b i + Δ b i ( n 1 )
Equation (4) represents the update rule for the weights and biases in a neural network during the training process, specifically within the context of backpropagation.
In these equations, Δ w i j ( n ) and Δ b i ( n ) denote the changes in the weight w i j and bias b i at the n t h iteration, respectively. The term α represents the learning rate, which controls the step size during parameter updates.
The partial derivatives E s w i j and E s b i represent the gradients of the error function E s with respect to the weights and biases, respectively. These gradients indicate the direction and magnitude of the adjustments needed to minimize the error [12].
Lastly, Δ w i j ( n 1 ) and Δ b i ( n 1 ) represent the changes in the weights and biases from the previous iteration, which are incorporated into the current update to improve convergence by introducing momentum, helping the network avoid overshooting or oscillations during training.
The parameter settings of the BP neural network model, which were obtained through multiple cross-validation runs to determine the optimal values, are shown in Table 3. Cross-validation ensured robust hyperparameter tuning, preventing overfitting and selecting the best-performing configuration. Additionally, to handle class imbalance, an oversampling strategy was employed to increase the representation of underrepresented classes, ensuring fair classification performance across all classes.
The BP neural network training and prediction process follows the steps outlined in Algorithm 1. First, the dataset is loaded from a CSV file, where the features and target labels are separated. The data are then split into training and testing sets, with 60% of the data used for training and 40% for testing. Next, the BP neural network is initialized with specific parameters, including the number of input features, hidden neurons, output neurons, epochs, and learning rate. The training and test data are converted into PyTorch 2.3.1 tensors, and the model is trained using these inputs. After training, the network is used to predict the test set, and the predictions, along with the training loss history, are returned with a message indicating that the training is complete.
Algorithm 1: BP Neural Network Training and Prediction
Input:
- Dataset in CSV format (features `X’ and target labels `y’)
Output:
- BP predictions for the test set (`BP_prediction’)
- Training loss history (`BP_lossList’)
- Message: “BP training completed.”
1Read data from CSV file: `df = pd.read_csv(‘data_path’) `Split the features (`X`) and target labels (`y`)
X ← df.iloc[:, :−1]
y ← df.iloc[:, −1]
2x_train, x_test, y_train, y_test ← train_test_split(X, y, test_size = 0.4, random_state = 42)
3BP_net ← BP_network.ini_BP_net(n_feature, n_hidden, n_output)
4x_train ← torch.tensor(x_train, dtype = torch.float32)
y_train ← torch.tensor(y_train, dtype = torch.float32).reshape(−1, 1)
x_test ← torch.tensor(x_test, dtype = torch.float32)
y_test_ ← torch.tensor(y_test, dtype = torch.float32).reshape(−1, 1)
5BP_lossList ← BP_network.train(BP_net, num_epoch, learn_rate, x_train, y_train)
6BP_prediction ← BP_net(x_test).detach().numpy()

3.2. GA-BP Neural Network

The GA (genetic algorithm) is an evolutionary algorithm inspired by the “survival of the fittest” principle in biological evolution. Proposed by Professor J. Holland of the University of Michigan in 1967, GA works by starting with an initial population representing a potential solution space [13]. Each individual in this population is encoded using genes. The first step of GA [14] involves encoding the individuals and mapping their phenotype to genotype. The algorithm then iterates over multiple generations, selecting the fittest individuals based on their fitness values and generating new solutions through genetic operators like crossover and mutation. This evolutionary process allows the population to adapt to the problem domain over time, with later generations producing better solutions. The optimal individual from the final generation can then be decoded to provide an approximate optimal solution.
In the context of BP neural networks, GA is applied to optimize the network’s initial weights and thresholds [15]. Instead of randomly initialized parameters, GA obtains an optimal set of weights and thresholds, which serve as the starting point for BP network training. These weights are represented as genes in the GA, where each gene corresponds to a specific weight or threshold in the BP network [16]. The number of genes corresponds to the total weights and thresholds in the BP network, forming a chromosome in the GA. A population of chromosomes is created, where each chromosome represents a potential solution, i.e., a different set of weight values for the BP neural network. This population is evaluated by the BP network’s performance [17], where the fitness of each chromosome (i.e., the weight set) is determined by calculating the error between the network’s actual output and the desired output for a given set of inputs. This error serves as the GA’s fitness function [18].
The connection between the GA and the BP neural network is illustrated in Figure 4, where the two components interact via a bidirectional arrow. This interaction represents the continuous exchange of information: the BP network’s performance is evaluated by calculating the error between the predicted and desired outputs [19]. Based on this evaluation, the GA then selects the best-performing chromosomes (the ones with the lowest error). These best-performing chromosomes represent the “best weights” for the BP neural network. After selection, the GA applies genetic operators such as crossover and mutation to create a new generation of chromosomes (potential weight sets). This new population is evaluated, and the process repeats iteratively. The optimal individual, or the best chromosome in the final generation, contains the weights that minimize the error and serve as the initial parameters for the BP neural network.
Once the optimal set of weights is identified through GA optimization, they are passed to the BP neural network. The BP neural network begins its training process, using these weights as the starting point. This helps the network avoid local minima by providing it with better initial weights, allowing it to achieve faster and more stable convergence during training. The continuous feedback loop between the GA and the BP neural network ensures that the weights are optimized over several iterations, improving the network’s performance [20].
In summary, the fitness function of the GA is based on the error between the BP neural network’s actual output and the desired output. The GA helps improve the BP network’s performance by minimizing this error. Through this iterative optimization process, the GA and BP neural networks work together to enhance the overall training process and ensure that the network achieves optimal performance.
The GA parameters for the GA-BP neural network are set based on the original BP neural network parameters, as shown in Table 4. These parameters were optimized through multiple rounds of cross-validation to identify the best-performing values, ensuring robust model performance. The values used for the hyperparameters were not arbitrary but derived from this validation process. Additionally, the algorithm effectively handles class imbalance by using oversampling techniques, which helps to balance the distribution of the classes and improves the model’s ability to generalize across imbalanced data distributions.
Algorithm 2 illustrates the optimization of the BP neural network using the GA algorithm. This code represents the GA part of a GA-BP hybrid model, where the BP part remains unchanged and is used as originally designed. In this approach, the GA is employed to optimize the parameters of the BP neural network. The GA evolves a population of potential solutions (chromosomes) in each iteration, with each individual representing a different configuration of the BP network’s parameters. The GA helps the population find the best possible neural network configuration through selection, crossover, and mutation.
After the GA optimizes the parameters, the BP part, which is responsible for the actual neural network training and learning, remains unchanged and is used to make predictions. Therefore, the GA fine-tunes the BP network’s structure while the BP part performs the learning and prediction tasks.
Algorithm 2: GA-BP Neural Network Training
Input:
- Dataset in CSV format (features `X` and target labels `y`)
Output:
- best_code: The best chromosome encoding obtained by the genetic algorithm
- best_fitness_ls: List of the best fitness values of each generation
- ave_fitness_ls: List of the average fitness values of each generation
1Initialize chrom_len ← n_feature * n_hidden + n_hidden + n_hidden * n_output + n_output
2Set parameters: size ← 16, p_cross ← 0.4, p_mutate ← 0.5, maxgen ← 150
3Initialize population chrom_sum with the size of chromosomes
- Calculate fitness using chrom_fitness.calculate_fitness
- Record the best fitness and average fitness for the generation
While account < maxgen:
- Select chromosomes based on fitness
- Apply crossover and mutation operators
- Recalculate fitness for the new population
- Record the best fitness and average fitness
If iteration reaches maxgen:
- Obtain the chromosome with the best fitness
- Extract parameters (weights and biases)
- Convert parameters to tensor format
- Create BP network with GA parameters
- Train the BP network and obtain the training loss
4- Make predictions on the test set
End Algorithm

3.3. XGBoost Ensemble Learning Method

In addition to deep learning for experiments, the XGBoost ensemble learning algorithm was also used. XGBoost is an ensemble learning method based on GBDT [21] (Gradient Boosting Decision Tree). It improves the model’s prediction accuracy by constructing multiple decision trees and adding their prediction results. XGBoost optimizes the original GBDT, including more precise loss functions (using the second-order Taylor expansion) and regularization terms to avoid overfitting and parallel computing.
The objective function of XGBoost consists of the loss function and the regularization term [22]. The loss function measures the difference between the model’s predicted value and the actual value, while the regularization term controls the complexity of the model to prevent overfitting. XGBoost uses Taylor expansion to approximate the loss function [23] and takes the structural complexity of the tree as the regularization term. Specifically, the Taylor expansion of the objective function [24] can be expressed as:
L ( Θ ) L ( Θ ( t 1 ) ) + g i f t ( x i ) + 1 2 h i f t 2 ( x i )
Equation (5) represents the second-order Taylor expansion of the loss function used in XGBoost to approximate the objective function. In this equation, L ( Θ ) denotes the loss function of the model with parameters Θ , while L ( Θ ( t 1 ) ) represents the loss [25,26] from the previous iteration ( t 1 ). The term g i is the first-order derivative of the loss function [27] concerning the prediction [28,29,30] ( L y ^ i ), known as the gradient [31]. The function f t ( x i ) indicates the prediction made by the current decision tree [32] for the input sample x i . Additionally, h i represents the second-order derivative of the loss function concerning the prediction ( 2 L y ^ i 2 ), commonly referred to as the Hessian [33]. The coefficient 1 2 is used to balance the second-order term, which captures the curvature of the loss function and helps improve the optimization process. This second-order Taylor expansion effectively combines gradient and curvature information to enhance model [34,35,36,37] performance and convergence.
During training, XGBoost iteratively adds trees, and in each iteration, it selects the best split point to split the nodes, thereby minimizing the objective function. This process involves complex mathematical derivations and optimization algorithms, but the core idea is to gradually use the gradient boosting method [38] to build a robust predictive model. The general flowchart of the XGBoost model algorithm for constructing trees is shown in Figure 5.
In this paper, the XGBoost parameter settings are shown in Table 5, with the maximum number of trees generated being 80. These parameter values were obtained through extensive hyperparameter tuning, using cross-validation to determine the optimal configuration. Additionally, to address potential class imbalance, we employed an oversampling method to balance the class distribution in the training data.
Algorithm 3 illustrates the training of an XGBoost binary classification model and the performance of feature importance analysis. The algorithm begins by loading the dataset from a CSV file, separating the features and labels. The dataset is then split into training and testing sets, and the data are converted into the DMatrix format, which is optimized for XGBoost. Model parameters are defined, and then the XGBoost model is used on the training data. The trained model predicts the binary labels for the training and testing sets. Finally, the feature importance is calculated and visualized in a plot to highlight the most significant features for the classification task.
Algorithm 3: XGBoost Model Training
Input:
- CSV file containing feature data and binary labels
Output:
- Trained XGBoost model, prediction results
1df ← read_csv(‘data.csv’)
2feature_names ← df.columns[:−1]
X ← df.iloc[:, :−1]
y ← df.iloc[:, −1]
3X_train, X_test, y_train, y_test ← train_test_split(X, y, test_size ← 0.4, random_state ← 42)
4dtrain ← DMatrix(X_train, label ← y_train, feature_names ← feature_names)
dtest ← DMatrix(X_test, label ← y_test, feature_names ← feature_names)
5params ← {
    ‘max_depth’ ← 7,
    ‘eta’ ← 0.1,
    ‘gamma’ ← 0.3,
    ‘lambda’ ← 0.2,
    ‘alpha’ ← 0.2,
    ‘objective’ ← ’binary:logistic’,
    ‘eval_metric’ ← ’logloss’
}
6num_trees ← 80
bst ← xgb.train(params, dtrain, num_boost_round ← num_trees, evals ← [(dtrain, ‘train’)])
7y_pred_train ← bst.predict(dtrain)
y_pred_train_binary ← (y_pred_train > 0.5)
y_pred_test ← bst.predict(dtest)
y_pred_test_binary ← (y_pred_test > 0.5)
8xgb.plot_importance(bst, importance_type ← ‘weight’, xlabel ← ‘F-Score’, title ← ‘Feature Importance’, max_num_features ← 12)
show_plot()
9End Algorithm

4. Comparison Analysis of Prediction Models

4.1. Prediction Accuracy Comparison

To evaluate the predictive performance of the three models—BP neural network, GA-BP neural network, and XGBoost—a comparative analysis was conducted using the Heatmap of the Confusion Matrix, Receiver Operating Characteristic (ROC) Curves, and key evaluation metrics. The analysis focuses on the models’ ability to distinguish between avoidant and non-avoidant behaviors while ensuring stability and reliability.
Additionally, we assessed each model’s training time and computational efficiency, which are important considerations for real-world implementation. The BP neural network required approximately 6 s for training, while the GA-BP model took around 7 s. In contrast, XGBoost demonstrated faster training, with a time of approximately 3 s. Although BP and GA-BP models required more computational resources, they provided more accurate predictions. Among the three models, GA-BP exhibited the highest efficiency.
The confusion matrices provide insights into the classification performance on both training and test datasets. The training dataset results for the BP neural network model indicated successful predictions of 38 non-avoidances and 44 avoidances, with 28 incorrect classifications. On the test dataset, 22 non-avoidances and 27 avoidances were correctly classified, while 18 instances were misclassified. The GA-BP neural network improved predictive accuracy, with 37 non-avoidances and 45 avoidances correctly identified in the training dataset, and reduced misclassifications to 18. On the test dataset, this model further improved, with 25 non-avoidances and 28 avoidances correctly predicted, while the number of incorrect classifications was reduced to 14. The Heatmap of the Confusion Matrix for BP and GA-BP is shown in Figure 6, while that for XGBoost is presented in Figure 7. The XGBoost model, in contrast, achieved the highest accuracy in the training set, correctly classifying 46 non-avoidances and 50 avoidances, with only four misclassifications. However, its performance on the test set declined, with 21 correct non-avoidance classifications and 27 correct avoidance classifications, accompanied by 19 misclassifications.
Further insights into model performance were obtained through ROC curves, with AUC values reflecting the models’ ability to distinguish between the two classes. The GA-BP neural network exhibited the highest AUC score of 0.84, followed by the BP neural network at 0.80 and XGBoost at 0.74. These results suggest that the GA-BP model offers better discrimination ability in classification tasks than the other two models. The ROC curves for BP, GA-BP, and XGBoost are shown in Figure 8.
A comprehensive evaluation of accuracy, recall, precision, and F1-score further highlights the differences in model performance. The GA-BP neural network demonstrated the highest overall accuracy of 0.791 and an F1-score of 0.8, indicating its superior balance between precision and recall. In contrast, the BP neural network achieved an accuracy of 0.731 and an F1-score of 0.75, while XGBoost recorded the lowest accuracy at 0.720 and an F1-score of 0.74. Additionally, the algorithmic error for XGBoost was significantly lower than the other two models (0.21), whereas BP and GA-BP neural networks exhibited algorithmic errors of 10.753 and 11.038, respectively. The lower algorithmic error in XGBoost suggests that the model optimizes its loss function more effectively, leading to better convergence during training. This discrepancy in algorithmic error values is primarily due to the difference in loss functions used by the models. BP and GA-BP neural networks typically employ Cross-Entropy Loss, which results in larger numerical values due to their cumulative nature. In contrast, XGBoost utilizes a gradient boosting framework with loss functions (Taylor expansion) that inherently normalize error values, leading to a significantly lower reported error. Despite this lower error, XGBoost did not achieve the highest classification performance, indicating that while it minimized its loss effectively, it did not generalize as well as GA-BP in distinguishing between the two classes.
In addition to these conventional performance metrics, a cost-sensitive analysis was conducted to assess the impact of misclassifications in a traffic safety context. By assigning a cost of one unit for a false positive (CFP = 1) and a cost of five units for a false negative (CFN = 5) [39], reflecting the higher risk of missing a hazardous event—the overall misclassification cost was calculated for each model. Based on the estimated distribution of misclassifications in the test set, the BP neural network incurred a total cost of 54 units (9 false positives and 9 false negatives), GA-BP resulted in 46 units (6 false positives and 8 false negatives), and XGBoost accumulated 55 units (10 false positives and 9 false negatives). This cost analysis underscores that despite XGBoost’s lower algorithmic error, its higher misclassification cost indicates a greater likelihood of high-risk errors, particularly false negatives, than the GA-BP model. Overall, the cost-sensitive evaluation further supports the superiority of the GA-BP neural network in minimizing overall misclassification errors and the potential high-impact errors critical in traffic safety applications. The evaluation results for all three models are summarized in Table 6.
Overall, the comparative analysis indicates that while XGBoost performed well on the training set, its generalization ability on the test set was weaker than the BP and GA-BP neural networks. The GA-BP neural network consistently outperformed the other models across multiple evaluation metrics, demonstrating higher classification accuracy and robustness. Importantly, none of the models exhibited overfitting, confirming their stability in handling the given classification task. These findings suggest that incorporating genetic algorithms into BP neural networks enhances predictive capability, making GA-BP the most suitable model for this application.

4.2. Training Convergence and Feature Importance Interpretation Analysis

The error decline curves of the models provide further insights into their convergence behaviors during training. Figure 9 shows that the BP model’s error decreases rapidly between 0 and 200 iterations. It flattens out after 600 iterations, indicating that the model quickly minimizes its error initially but requires more iterations to fine-tune the weights for further performance improvements. Similarly, the GA-BP model’s curve drops quickly because the genetic algorithm optimizes the weights and thresholds, accelerating the network’s convergence speed. This rapid decrease in error indicates that even minor adjustments during the early stages of training can bring significant improvements. As the training progresses, the model gradually fine-tunes the weights, and the improvements become less dramatic as it approaches an optimal solution.
In contrast, the XGBoost model’s error decreases rapidly during the 0–50 iterations, but the curve tends to flatten out after 50 iterations, with an error value of 0.21 at this point. This sharp initial decline is followed by a plateau, indicating that the model quickly converges to a solution. However, further improvements are limited due to its loss function and optimization approach. The Error Decline Curve Chart of XGBoost is presented in Figure 10.
It is worth noting that the error values are not directly comparable due to the difference in loss functions used by BP and GA-BP (Cross-Entropy Loss) and XGBoost (Taylor expansion). However, the number of iterations at which the error values stabilize can be compared. In this regard, XGBoost’s error curve stabilizes at around 50 iterations, whereas BP and GA-BP show noticeable improvements well beyond this point, particularly at around 200 and 160 iterations, respectively. This difference highlights the distinct convergence characteristics of each model and their corresponding optimization strategies.
Figure 11 shows the feature importance analysis for three models: BP neural network, GA-BP neural network, and XGBoost. The feature importance values clearly illustrate how each model prioritizes different features during decision-making. Overall, the BP and GA-BP models show a similar feature importance distribution. STV and OTV are the most influential features, followed by SV and OV, indicating that traffic volume and vehicle speeds are key factors driving the prediction results for these two models.
Specifically, the BP model is highly important to STV and OTV, with values of 85 and 80, respectively. In contrast, the GA-BP model gives even higher importance to these features, with values of 90 and 82. These results confirm that these two features play a dominant role in the decision-making process for both models. In comparison, the XGBoost model assigns importance values of 81 and 76 to STV and OTV, which, while still high, are slightly lower than those of BP and GA-BP. This indicates that XGBoost places less emphasis on traffic volume than the BP and GA-BP models.
SV consistently ranks as an important feature in all three models. The GA-BP model, in particular, assigns SV an importance value of 77, the highest among all features. The BP model values SV at 74, while XGBoost assigns it a value of 67. These values indicate that both BP and GA-BP models rely more heavily on SV than XGBoost, although SV also remains an important factor for XGBoost. Additionally, XGBoost places relatively more importance on OV, with a value of 33, compared to the BP and GA-BP models, which assign lower values to OV.
Despite the differences in feature importance across the models, STV and OTV remain the most significant features for all three models. This highlights that traffic volume in the same and opposite directions plays a central role in the prediction process. Moreover, the models consistently emphasize the importance of vehicle speed, as reflected in the significance of SV and OV across all models.
In addition to STV, OTV, SV, and OV, other features also play a role in the prediction process. For instance, S (whether a vehicle traveling in the same direction is encountered) has an importance value of 45 in the BP model, 42 in the GA-BP model, and 40 in the XGBoost model, indicating that this feature has a relatively smaller but notable influence. SS (whether the encountered same-direction vehicle is a car) has importance values of 35, 32, and 30, respectively, across the models, suggesting that the type of vehicle in the same direction has some effect on the prediction. SM (whether the encountered same-direction vehicle is an electric bicycle) has importance values of 33 for BP and GA-BP and 29 for XGBoost, showing that electric bicycles have a smaller influence than cars.
Conversely, O (whether a vehicle traveling in the opposite direction is encountered) has a lower importance value in all three models. BP at 40, GA-BP at 38, and XGBoost at 36 indicate that, while it influences the prediction, its effect is relatively small. OS (whether the encountered opposite-direction vehicle is a car) has importance values of 35, 33, and 32, suggesting that the type of vehicle in the opposite direction is relevant to the prediction. OM (whether the encountered opposite-direction vehicle is an electric bicycle) has lower importance values, with BP at 30, GA-BP at 28, and XGBoost at 25, reflecting that the impact of electric bicycles in the opposite direction is minimal.
P (whether pedestrians are walking together) shows relatively higher importance in all models, with BP at 60, GA-BP at 65, and XGBoost at 58, indicating that whether pedestrians are walking with others affects the prediction. Finally, W (road width) has lower importance in all models, with BP at 25, GA-BP at 22, and XGBoost at 20, suggesting that while road width can influence pedestrian behavior, its effect on prediction is relatively small.
In conclusion, despite the variations in how each model ranks the importance of different features, STV and OTV remain the most important features for all three models. These findings align with the experimental objectives and reinforce the critical role of traffic volume and vehicle speed in the prediction task. Additionally, vehicle type (car or electric bicycle) and whether pedestrians are walking together influence the prediction, although their impact is smaller than traffic volume and speed.

5. Conclusions and Discussion

5.1. Conclusions

This study comprehensively analyzes pedestrian avoidance behavior on school roads using three predictive models (BP neural network, GA-BP neural network, and XGBoost). The key findings are as follows:
1. Model Performance Comparison
Among the three models, the GA-BP model outperforms the others in terms of both prediction accuracy and stability. Integrating genetic algorithms with the BP neural network enables faster convergence and more accurate predictions for pedestrian avoidance behavior. Although XGBoost demonstrates strong initial performance and lower algorithmic error due to its normalized loss functions, it ultimately shows a higher misclassification cost when evaluated under cost-sensitive criteria. This indicates a greater likelihood of high-risk errors, particularly false negatives, than the GA-BP model. While robust in simpler scenarios, the conventional BP model exhibits limitations under complex conditions. Therefore, considering the conventional performance metrics and the cost-sensitive analysis, the GA-BP model is the most suitable for predicting pedestrian avoidance behavior on school roads.
2. Key Features Analysis
Traffic volume and vehicle speed are the most influential features in predicting pedestrian avoidance behavior. Specifically, STV and OTV are the most significant predictors. These features directly influence pedestrians’ perception of traffic density, impacting their decision-making when crossing the road. The SV and OV also play crucial roles, as higher vehicle speeds tend to lead to more cautious pedestrian behavior.
3. Other Feature Impacts
Other features also influence pedestrian behavior, though to a lesser extent. For example, SS, SM, OS, and OM, representing the types of vehicles encountered in the same and opposite directions, respectively, show some effect. However, it is less significant compared to traffic volume and speed. The vehicle type—a car or an electric bicycle—may also affect pedestrians’ decisions, with electric bicycles generally perceived as less risky. Additionally, features such as O and S reflect the relative movement between pedestrians and vehicles, influencing pedestrians’ avoidance behavior based on the movement and speed of the vehicles. Feature P has a notable impact, as group behavior tends to make pedestrians more cautious and likely to avoid dense traffic areas or wait for changes in traffic signals. However, W has a relatively small impact on avoidance behavior, as wider roads may offer more crossing space but are less significant when traffic flow and speed are high.

5.2. Discussion

The results of this study indicate several important insights into pedestrian avoidance behavior on school roads, which have implications for traffic safety and management.
1. Model Performance Implications
The superior performance of the GA-BP model can be attributed to the genetic algorithm’s ability to optimize the weights and thresholds of the BP neural network, enabling faster convergence and higher accuracy. Despite its traditional success in many applications, the BP model struggled with complex pedestrian behavior prediction, highlighting the importance of incorporating optimization techniques like genetic algorithms. XGBoost, although effective in more straightforward tasks, demonstrated less flexibility in handling the intricate dynamics of pedestrian interactions with traffic. This suggests that for future research and real-world applications, combining neural networks with optimization techniques, such as GA-BP, may provide more reliable predictions in dynamic environments like school roads.
2. The Role of Traffic Volume and Speed
The dominant role of traffic volume and vehicle speed in influencing pedestrian avoidance behavior is evident in this study. Pedestrians are highly sensitive to traffic density; higher traffic volumes result in more cautious behavior. Similarly, the speed of vehicles, especially in the same direction, influences pedestrians’ timing and decision-making process. This observation is crucial for traffic planning and road safety measures, especially during peak hours when pedestrian–vehicle interaction is critical.
3. Vehicle Type and Pedestrian Avoidance
Features related to vehicle types, such as whether the vehicle is a car or an electric bicycle, play a significant role in how pedestrians perceive risk and adjust their behavior. This study shows that pedestrians are more likely to take risks when encountering smaller vehicles like electric bicycles due to their perceived lower danger. This finding suggests that traffic regulations and safety measures should account for the different types of vehicles, as their interaction with pedestrians differs significantly. Furthermore, ensuring that vehicles, including electric bicycles, adhere to safe speed limits is crucial for reducing pedestrian risk.
4. Implications for Pedestrian Safety on School Roads
The findings from this study have important implications for pedestrian safety, particularly in school zones. Measures to control traffic volume, such as restricting vehicle access during peak hours or implementing speed limits, could significantly reduce pedestrian risk. Additionally, the type of vehicles in school zones should be monitored and regulated, with specific measures to ensure that electric bicycles and other small vehicles do not pose an increased risk to pedestrians. Future policies should prioritize improving pedestrian infrastructure and traffic management during school peak hours to enhance safety for school children.
5. Future Research Directions
This study highlights the need for further investigation into the behavioral dynamics of pedestrians in school zones. Future research could explore integrating real-time traffic data and environmental factors, such as weather conditions and pedestrian crowding, to improve model accuracy. Further analysis of less influential features (e.g., SM, OM) could provide deeper insights into pedestrian behavior and lead to more robust safety strategies.
In conclusion, this study provides valuable insights into the factors influencing pedestrian avoidance behavior on school roads and demonstrates the potential of GA-BP models for accurate prediction. By addressing the identified key features, traffic management strategies can be developed to enhance pedestrian safety, especially in high-risk environments such as school zones.

Author Contributions

Writing—original draft, G.L.; Writing—review & editing, M.L.; Funding acquisition, M.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Appleyard, B. Livable streets for schoolchildren: A human-centred understanding of the cognitive benefits of Safe Routes to School. J. Urban Des. 2022, 27, 692–716. [Google Scholar] [CrossRef]
  2. Al-Najjar, E.; Sukor, N.S.; Shbeeb, L.I. Addressing safety issues along the way to school: Qualitative findings from Jerash camp, Jordan. J. Transp. Health 2022, 26, 101370. [Google Scholar] [CrossRef]
  3. Appolloni, L.; Giretti, A.; Corazza, M.V.; D’alessandro, D. Walkable Urban Environments: An Ergonomic Approach of Evaluation. Sustainability 2020, 12, 8347. [Google Scholar] [CrossRef]
  4. Gregoriades, A.; Dimitriou, L.; Pampaka, M.; Michail, H.; Georgiades, M. Machine Learning Analysis of Pedestrians’ Hazard Anticipation from Eye Tracking Data. In CEUR Workshop Proceeding; RWTH Aachen University: Aachen, Germany, 2022; Available online: https://research.manchester.ac.uk/en/publications/machine-learning-analysis-of-pedestrians-hazard-anticipation-from (accessed on 26 August 2024).
  5. Alahi, A.; Goel, K.; Ramanathan, V.; Robicquet, A.; Fei-Fei, L.; Savarese, S. Social LSTM: Human Trajectory Prediction in Crowded Spaces. In Proceedings of the 29th IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 26 June–1 July 2016; pp. 961–971. [Google Scholar] [CrossRef]
  6. Chen, K.; Song, X.; Han, D.; Sun, J.; Cui, Y.; Ren, X. Pedestrian behavior prediction model with a convolutional LSTM encoder–decoder. Phys. A Stat. Mech. Appl. 2020, 560, 125132. [Google Scholar] [CrossRef]
  7. Wang, B. The Research on Traffic Safety Condition Prediction Method Based on Attention CNN and Deep Forest. Master’s Thesis, Jiangsu University, Zhenjiang, China, 2019. [Google Scholar]
  8. Liu, K.; Lin, T.; Zhong, T.; Ge, X.; Jiang, F.; Zhang, X. New methods based on a genetic algorithm back propagation (GABP) neural network and general regression neural network (GRNN) for predicting the occurrence of trihalomethanes in tap water. Sci. Total. Environ. 2023, 870, 161976. [Google Scholar] [CrossRef]
  9. Li, Y.; Fan, W.; Song, L.; Liu, S. Combining emerging hotspots analysis with XGBoost for modeling pedestrian injuries in pedestrian-vehicle crashes: A case study of North Carolina. J. Transp. Saf. Secur. 2023, 15, 1203–1225. [Google Scholar] [CrossRef]
  10. Ding, S.; Su, C.; Yu, J. An optimizing BP neural network algorithm based on genetic algorithm. Artif. Intell. Rev. 2011, 36, 153–162. [Google Scholar] [CrossRef]
  11. Du, Y.; Liu, Y. Optimization of BP neural network for predicting air quality using hybrid genetic ant colony algorithm. Comput. Syst. Appl. 2023, 32, 1–8. [Google Scholar] [CrossRef]
  12. Zhang, L.; Zhang, J.; Ren, P.; Ding, L.; Hao, W.; An, C.; Xu, A. Analysis of energy consumption prediction for office buildings based on GA-BP and BP algorithm. Case Stud. Therm. Eng. 2023, 50, 103445. [Google Scholar] [CrossRef]
  13. Qu, Y.; Lin, Z.; Li, H.; Zhang, X. Feature Recognition of Urban Road Traffic Accidents Based on GA-XGBoost in the Context of Big Data. IEEE J. Mag. 2019, 7, 170106–170115. [Google Scholar] [CrossRef]
  14. Chen, R.; Song, J.; Xu, M.; Wang, X.; Yin, Z.; Liu, T.; Luo, N. Prediction of the corrosion depth of oil well cement corroded by carbon dioxide using GA-BP neural network. Constr. Build. Mater. 2023, 394, 132127. [Google Scholar] [CrossRef]
  15. Wang, L. A hybrid genetic algorithm–neural network strategy for simulation optimization. Appl. Math. Comput. 2005, 170, 1329–1343. [Google Scholar] [CrossRef]
  16. Li, Y.; Zhou, L.; Gao, P.; Yang, B.; Han, Y.; Lian, C. Short-Term Power Generation Forecasting of a Photovoltaic Plant Based on PSO-BP and GA-BP Neural Networks. Front. Energy Res. 2022, 9, 824691. [Google Scholar] [CrossRef]
  17. Wang, S.; Zhang, N.; Wu, L.; Wang, Y. Wind speed forecasting based on the hybrid ensemble empirical mode decomposition and GA-BP neural network method. Renew. Energy 2016, 94, 629–636. [Google Scholar] [CrossRef]
  18. Xu, J.; Zhao, Y. Stability Analysis of Geotechnical Landslide Based on GA-BP Neural Network Model. Comput. Math. Methods Med. 2022, 2022, 3958985. [Google Scholar] [CrossRef] [PubMed]
  19. Yang, R. Enterprise Network Marketing Prediction Using the Optimized GA-BP Neural Network. Complexity 2020, 2020, 6682296. [Google Scholar] [CrossRef]
  20. Yu, F.; Xu, X. A short-term load forecasting model of natural gas based on optimized genetic algorithm and improved BP neural network. Appl. Energy 2014, 134, 102–113. [Google Scholar] [CrossRef]
  21. Ben Jabeur, S.; Stef, N.; Carmona, P. Bankruptcy Prediction using the XGBoost Algorithm and Variable Importance Feature Engineering. Comput. Econ. 2023, 61, 715–741. [Google Scholar] [CrossRef]
  22. Demir, S.; Sahin, E.K. An investigation of feature selection methods for soil liquefaction prediction based on tree-based ensemble algorithms using AdaBoost, gradient boosting, and XGBoost. Neural Comput. Appl. 2023, 35, 3173–3190. [Google Scholar] [CrossRef]
  23. Guo, J.; Yang, L.; Bie, R.; Yu, J.; Gao, Y.; Shen, Y.; Kos, A. An XGBoost-based physical fitness evaluation model using advanced feature selection and Bayesian hyper-parameter optimization for wearable running monitoring. Comput. Networks 2019, 151, 166–180. [Google Scholar] [CrossRef]
  24. Li, H.; Cao, Y.; Li, S.; Zhao, J.; Sun, Y. XGBoost model and its application to personal credit evaluation. IEEE Intell. Syst. 2020, 35, 52–61. [Google Scholar] [CrossRef]
  25. Shi, X.; Wong, Y.D.; Li, M.Z.-F.; Palanisamy, C.; Chai, C. A feature learning approach based on XGBoost for driving assessment and risk prediction. Accid. Anal. Prev. 2019, 129, 170–179. [Google Scholar] [CrossRef] [PubMed]
  26. Takefuji, Y. Beyond XGBoost and SHAP: Unveiling true feature importance. J. Hazard. Mater. 2025, 488, 137382. [Google Scholar] [CrossRef]
  27. Tian, J.; Jiang, Y.; Zhang, J.; Wang, Z.; Rodríguez-Andina, J.J.; Luo, H. High-Performance Fault Classification Based on Feature Importance Ranking-XgBoost Approach with Feature Selection of Redundant Sensor Data. Curr. Chin. Sci. 2022, 2, 243–251. [Google Scholar] [CrossRef]
  28. Wang, Y.; Ni, X.S. A XGBoost risk model via feature selection and Bayesian hyper-parameter optimization. arXiv 2019. [Google Scholar] [CrossRef]
  29. Zhang, B.; Zhang, Y.; Jiang, X. Feature selection for global tropospheric ozone prediction based on the BO-XGBoost-RFE algorithm. Sci. Rep. 2022, 12, 9244. [Google Scholar] [CrossRef]
  30. Zheng, H.; Yuan, J.; Chen, L. Short-term load forecasting using EMD-LSTM neural networks with a Xgboost algorithm for feature importance evaluation. Energies 2017, 10, 1168. [Google Scholar] [CrossRef]
  31. Ma, J.; Ding, Y.; Cheng, J.C.P.; Tan, Y.; Gan, V.J.L.; Zhang, J. Analyzing the Leading Causes of Traffic Fatalities Using XGBoost and Grid-Based Analysis: A City Management Perspective. IEEE Access 2019, 7, 148059–148072. [Google Scholar] [CrossRef]
  32. Geng, X.; Wu, S.; Zhang, Y.; Sun, J.; Cheng, H.; Zhang, Z.; Pu, S. Developing hybrid XGBoost model integrated with entropy weight and Bayesian optimization for predicting tunnel squeezing intensity. Nat. Hazards 2023, 119, 751–771. [Google Scholar] [CrossRef]
  33. Liu, J.; He, X.; Huang, H.; Yang, J.; Dai, J.; Shi, X.; Xue, F.; Rabczuk, T. Predicting gas flow rate in fractured shale reservoirs using discrete fracture model and GA-BP neural network method. Eng. Anal. Bound. Elem. 2024, 159, 315–330. [Google Scholar] [CrossRef]
  34. Li, J.; Yao, L.; Xu, X.; Cheng, B.; Ren, J. Deep reinforcement learning for pedestrian collision avoidance and human-machine cooperative driving. Inf. Sci. 2020, 532, 110–124. [Google Scholar] [CrossRef]
  35. Asaithambi, G.; Kuttan, M.O.; Chandra, S. Pedestrian Road Crossing Behavior Under Mixed Traffic Conditions: A Comparative Study of an Intersection Before and After Implementing Control Measures. Transp. Dev. Econ. 2016, 2, 14. [Google Scholar] [CrossRef]
  36. Botache, D.; Dandan, L.; Bieshaar, M.; Sick, B. Early Pedestrian Movement Detection Using Smart Devices Based on Human Activity Recognition, Gesellschaft für Informatik e.V. 2019. Available online: https://dl.gi.de/handle/20.500.12116/25059 (accessed on 14 June 2024).
  37. Best, G.; Fitch, R. Bayesian intention inference for trajectory prediction with an unknown goal destination. In Proceedings of the 2015 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), Hamburg, Germany, 28 September–2 October 2015; pp. 5817–5823. [Google Scholar] [CrossRef]
  38. Rasouli, A.; Kotseruba, I.; Tsotsos, J.K. Understanding Pedestrian Behavior in Complex Traffic Scenes. IEEE Trans. Intell. Veh. 2017, 3, 61–70. [Google Scholar] [CrossRef]
  39. Wu, M.; Jia, H.; Luo, D.; Luo, H.; Zhao, F.; Li, G. A multi-attention dynamic graph convolution network with cost-sensitive learning approach to road-level and minute-level traffic accident prediction. IET Intell. Transp. Syst. 2022, 17, 270–284. [Google Scholar] [CrossRef]
Figure 2. The Process of BP Neural Network.
Figure 2. The Process of BP Neural Network.
Applsci 15 04724 g002
Figure 3. BP Neural Network Model.
Figure 3. BP Neural Network Model.
Applsci 15 04724 g003
Figure 4. GA-BP Neural Network Flowchart.
Figure 4. GA-BP Neural Network Flowchart.
Applsci 15 04724 g004
Figure 5. The Process of Generating Trees in XGBoost.
Figure 5. The Process of Generating Trees in XGBoost.
Applsci 15 04724 g005
Figure 6. Heatmap of the Confusion Matrix for BP and GA-BP Models.
Figure 6. Heatmap of the Confusion Matrix for BP and GA-BP Models.
Applsci 15 04724 g006
Figure 7. Heatmap of the Confusion Matrix for XGBoost Models.
Figure 7. Heatmap of the Confusion Matrix for XGBoost Models.
Applsci 15 04724 g007
Figure 8. ROC Curves and AUC Performance of BP, GA-BP, and XGBoost Models.
Figure 8. ROC Curves and AUC Performance of BP, GA-BP, and XGBoost Models.
Applsci 15 04724 g008
Figure 9. Error Decline Curve Chart of BP Model and GA-BP Model.
Figure 9. Error Decline Curve Chart of BP Model and GA-BP Model.
Applsci 15 04724 g009
Figure 10. Error Decline Curve Chart of XGBoost Model.
Figure 10. Error Decline Curve Chart of XGBoost Model.
Applsci 15 04724 g010
Figure 11. Feature Importance of BP, GA-BP, and XGBoost models.
Figure 11. Feature Importance of BP, GA-BP, and XGBoost models.
Applsci 15 04724 g011aApplsci 15 04724 g011b
Table 1. Detailed Information of Video Data.
Table 1. Detailed Information of Video Data.
SiteWidthLengthObservation TimeDurationSchoolSidewalkSidewalk ClutterTotal/Avoidance
A7.5 m27.5 m23 October 2023, 7:30–8:0535 minPrimaryN-30/11
B5 m31.5 m24 October 2023, 17:00–17:3030 minPrimaryN-21/13
C5 m31.8 m16 October 2023, 16:30–17:2050 minMiddleY332/17
D4.5 m30.7 m23 October 2023, 17:00–17:1010 minMiddleY137/21
E4.5 m35 m14 April 2023, 17:30–17:5525 minMiddleY122/19
F5 m15 m14 April 2023, 7:50–8:0010 minMiddleY125/15
Table 2. Dataset Variables: Symbol, Explanation, Data Types, and Units.
Table 2. Dataset Variables: Symbol, Explanation, Data Types, and Units.
SymbolExplanationData Type and Units
SWhether a vehicle traveling in the same direction is encountered (0: no, 1: yes)Binary
SSWhether the encountered same-direction vehicle is a car (0: no, 1: yes)Binary
STVSame-direction traffic volumeContinuous
(vehicles per second)
SMWhether the encountered same-direction vehicle is an electric bicycle (0: no, 1: yes)Binary
OWhether a vehicle traveling in the opposite direction is encountered (0: no, 1: yes)Binary
OSWhether the encountered opposite-direction vehicle is a car (0: no, 1: yes)Binary
OTVOpposite-direction traffic volumeContinuous
(vehicles per second)
OMWhether the encountered opposite-direction vehicle is an electric bicycle (0: no, 1: yes)Binary
PWhether pedestrians are walking together (0: no, 1: yes)Binary
SVSame-direction speed (recorded as the maximum speed among vehicles in that direction)Continuous (m/s)
OVOpposite-direction speed (recorded as the maximum speed among vehicles in that direction)Continuous (m/s)
WRoad widthContinuous (meters)
Table 3. Neural network model parameter settings.
Table 3. Neural network model parameter settings.
ParameterValue
Feature12
Hidden15
Output1
Num_epoch1000
Learn_rate0.02
Table 4. GA Parameter Settings.
Table 4. GA Parameter Settings.
ParameterValue
Size16
P_cross0.4
P_mutate0.5
Maxgen150
Table 5. XGBoost Parameter Settings.
Table 5. XGBoost Parameter Settings.
ParameterValue
Max_depth5
Tree80
Eta0.1
Gamma0.3
Lambda0.2
Alpha0.2
Objectivebinary:logistic
Eval_metriLogloss
Table 6. Evaluation Results of BP Model and GA-BP Model.
Table 6. Evaluation Results of BP Model and GA-BP Model.
Model TypeAlgorithmic ErrorAccuracyRecallPrecisionF1Cost
BP Neural Network10.7530.7310.7300.7710.7554
GA-BP Neural Network11.0380.7910.7570.8480.846
XGBoost0.210.7200.7160.7560.7455
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Lu, G.; Liu, M. Research on Pedestrian Avoidance Behavior for School Section Based on Improved BP Neural Network and XGboost Algorithm. Appl. Sci. 2025, 15, 4724. https://doi.org/10.3390/app15094724

AMA Style

Lu G, Liu M. Research on Pedestrian Avoidance Behavior for School Section Based on Improved BP Neural Network and XGboost Algorithm. Applied Sciences. 2025; 15(9):4724. https://doi.org/10.3390/app15094724

Chicago/Turabian Style

Lu, Guiliang, and Mingwei Liu. 2025. "Research on Pedestrian Avoidance Behavior for School Section Based on Improved BP Neural Network and XGboost Algorithm" Applied Sciences 15, no. 9: 4724. https://doi.org/10.3390/app15094724

APA Style

Lu, G., & Liu, M. (2025). Research on Pedestrian Avoidance Behavior for School Section Based on Improved BP Neural Network and XGboost Algorithm. Applied Sciences, 15(9), 4724. https://doi.org/10.3390/app15094724

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop