Research on Abnormal Behavior Recognition of Buses Based on Improved Support Vector Machine

.e abnormal driving behavior of buses brings about greater security threat. How to effectively identify the abnormal driving behavior of buses has become one of the problems of cracking public transportation safety. .is paper constructs an abnormal behavior recognition model of buses based on improved support vector machine. .rough the verification, the model has a high recognition rate, which provides an important means for further improving the safety of public transportation operations.


Introduction
e abnormal driving behavior of buses not only seriously affects the comfort and safety of passengers in the vehicle but also brings about great security risks to the surrounding vehicles. erefore, through the research of abnormal driving behavior of buses, analyzing the temporal and spatial distribution characteristics of various behaviors, and establishing an effective mathematical model according to the characteristics of the corresponding driving data analysis, in this paper, through the training and identification of driving data, it can effectively identify the abnormal driving behavior of the bus and promptly remind the drivers of the bus and surrounding vehicles, so as to reduce the occurrence of traffic accidents and ensure the safety of road traffic. e sudden acceleration and sudden braking behaviors of buses are the most common abnormal driving behavior [1]. In the relevant laws and regulations of the transportation industry, sudden acceleration and sudden braking behaviors are not clearly illegal. erefore, the existing literature has less research on the sudden acceleration and sudden braking behavior. Literature [2,3] proposed that the sudden acceleration and sudden braking behaviors of the vehicle belong to the abnormal longitudinal driving behavior, and its main data features are shown in the sudden change of instantaneous longitudinal velocity and acceleration. Literature [4] studies the abnormal left-turning and rightturning behavior of buses, which is mainly reflected in the turning action at a relatively high speed when the vehicle is running, which results in the vehicle's posture to tilt to the left or right. Literature [5] investigates the abnormal left and right lateral driving behavior of buses, which is mainly reflected in the transformation of the vehicle's acceleration and roll angle. Literature [6,7] extract features of vehicle speed information, including vehicle speed, GPS information, and triaxial acceleration information, so as to describe changes in vehicle position and driving status during operation.
is paper first introduces support vector machine algorithm; second, it builds an abnormal behavior recognition model of buses based on the improved support vector machine on this basis; finally, the model is verified, analyzed, and summarized by an example.

Support Vector Machine
SVM (support vector machine) is a machine learning algorithm for classification proposed by Corinna Cortes and Vapnik in 1995. Because it has shown many unique advantages in solving small sample and nonlinear problems, it has been popular for more than ten years, and its classification ability can even surpass neural networks on some problems, and it is widely used in the classification and recognition of data samples. e principle of SVM is to find a hyperplane, in which as many data points as possible are correctly distributed on both sides of the hyperplane [8,9]. According to the complexity of samples and the difficulty of classification, SVM can be considered as three types: linear separable SVM, approximately linear SVM, and nonlinear SVM. Figure 1, a simple sample set (x 1 , y 1 ), (x 2 , y 2 ) . . . (x n , y n ) is constructed, and two kinds of sample data sets that need to be classified are represented by two kinds of graphs. e classified plane is set as H, and the selected hyperplanes are set as H1 and H2. In addition, H1 and H2 must be parallel to H and have the closest distance to the two types of sample data sets. When the classified plane H can allow the maximum distance between H1 and H2, the best classification hyperplane H is calculated at this time.

Linear Separable Support Vector Machine. As shown in
e purpose of the calculation of SVM is to make the value of all sample points from the classification hyperplane greater than or equal to a value, which means that all sample points are located at their own type of support vector. is principle can be expressed by the following formula: (1) In general, simplify the operation and set c' as 1, so that the optimization function can be defined as (2) e meaning of formula (2) is to make the objective function 1/‖w‖ 2 get the maximum value within the specified target of y i (w T x i + b) ≥ 1, (i � 1, 2, . . . m). In addition, because the maximum value of objective function 1/‖w‖ 2 is equal to the minimum value of (1/2)‖w‖ 2 2 , the optimization function of SVM is equivalent to Because the shape of the objective function (1/2)‖w‖ 2 2 is a convex function and its specification requires an accurate representation to be an affine function, it can be obtained from the principle of convex optimization that the optimization requirement can be changed into an unspecified optimization function according to Lagrange function. To be precise, the optimization function is transformed into Due to the introduction of Lagrange multiplier, the optimization goal of SVM has become It can be found from formula (5) that if we want to solve the optimization objective, we can first find the minimum value of the optimization function for W and B and then continue to find the maximum value of Lagrange multiplier α. For the minimum value of W and B, namely, min √ √ w,b L(w, b, α), this extreme value can be obtained by spherical partial derivatives of W and B, respectively: From formula (6), the relationship between w and α can be obtained, so the parameters can be substituted into L(w, b, α) to eliminate w, and ψ(α) is defined as a function of α: rough the definition of norm and the operation of vector, W can be eliminated and the functional relationship between ψ(α) and α can be obtained:  Journal of Advanced Transportation It can be seen from formula (8) that the optimization function ψ(α) only has α vectors as parameters, so as long as we can maximize ψ(α), we can find the corresponding α at this time, and then w, b can be obtained. e mathematical expression for maximizing ψ(α) is as follows: Formula (9) is the problem of the extreme value of the quadratic function under the requirements of the inequality, and its optimal solution is set as α * � (α * 1 , . . . , α * n ). e initial optimal solution of the problem is w * and b * , and w * � n i�1 α * i y i x i is required at the same time. In addition, because α * is a Lagrange multiplier under the original optimization requirement, according to Kuhn-Tucker's requirement, Because most of samples α * i are equal to 0 and the only condition that makes it not equal to 0 is to make the samples (support vectors) on both sides of the optimal classification surface equal to each other, the mathematical expression of maximizing ψ(α) is brought into Kuhn-Tucker condition to get erefore, the optimal hyperplane of the linear discriminant function in the two-dimensional space can be obtained by the following formula: Because the value of the nonsupport vector is 0, formula (12) requires the calculation of the support vector.

Approximate Linear Support Vector
Machine. As shown in Figure 2, there are some complex sample points that make the former linearly separable problem change into an approximate linearly separable problem. erefore, the complex sample points can be regarded as noise points, which are similar to the behavior of turning left and changing lanes in the process of identifying abnormal driving behaviors of buses, and the degree of similarity is relatively high, which will lead to little difference between data samples when reflected in the data. e existence of noise points will give rise to the data not to be completely linearly separable, so it is necessary to transform the problem to be approximately linearly separable. e relaxation variable β should be added to make the classification interval less than 1; then the optimal hyperplane problem can be transformed into (13) e constraint condition of adding β can be transformed into If the difference between the representative nonlinear sample point and the set of the same categories is set as relaxation variable β, the distance will become larger and larger as the difference increases; and the missing difference between the outlier sample points and the objective function will increase with the increase of the penalty factor C. Among them, the penalty factor C will be obtained in the program of continuous optimization of all parameters. e first step is to specify a value to match the classifier, and then the test sample will be experimented. If the result is poor, change C and repeat the above process. is problem still belongs to the optimization problem, and its handle is the same as the previous optimization problems.

Linear Indivisible Support Vector Machine.
In the above linear separable support vector machines and approximate linear separable support vector machines, their data dimensions are not high, so the data set can be classified by using a low-dimensional hyperplane. However, the abnormal bus driving behavior data set contains a variety of collected data and statistically calculated moral data, and the dimension of the data is significantly higher than that of the two-dimensional. ere may not be a good hyperplane to separate the data set, so it is necessary to map the original data space to a high-dimensional space. If there is a hyperplane that can classify data in a high-dimensional space, it can solve the problem of identifying and confirming abnormal bus driving behavior. e process of transforming the initial space R d into the high-dimensional space H is set as x ⟶ Φ(x); then the data set ( x 1 , y 1 ), . . . , (x n , y n ) in the initial space will be transformed into (Φ(x 1 ), y 1 ), . . . , (Φ(x n ), y n ) , so the problem of obtaining hyperplane is equivalent to e equivalent classification function is converted into Suppose that ϕ is an Η mapping from low-dimensional input space χ (a subset or discrete set of Euclidean spaces) to the high-dimensional Hilbert space.
en if there is a function K(x, z), for any x, z ∈ χ, there is en, K(x, z) is called kernel function. e advantage of this function is that it can transform features from low dimension to high dimension, and this kind of function can be calculated by relying on low dimensionality, and then the real classification results (after the inner product process) are displayed in high dimensionality. is approach can eliminate the difficulty of calculation in high-dimensional space and completely eliminate the difficulty of inseparable linearity of support vector machine. e commonly used kernel functions are shown in Table 1.

Abnormal Behavior Recognition Model of Buses Based on Improved Support Vector Machine Algorithm
Different abnormal driving behaviors of buses have different levels of complexity. As an example, changes in data characteristics of bus rapid acceleration behavior are mainly reflected in changes in vehicle speed and acceleration, and the duration of the change is short, mostly completed in two seconds. However, the abnormal lane-changing behavior of buses may be embodied as continuous lane-changing, and data feature changes are embodied in multidimensional data such as speed, X-axis acceleration, and Y-axis acceleration roll angle, which lasts for a long time, up to more than ten seconds. is leads to the inconsistency of the complexity and quantity of different types of samples when collecting samples of abnormal bus driving behaviors. When the SVM algorithm classifies data with a large number of samples, the classification error is small; and when classifying data with fewer data samples, the error will be larger. Moreover, if there is a large amount of the same sample data, it will be regarded as new sample data to be calculated again, and the difficulty of calculation will increase greatly, which will lead to a significant increase in the time consumption of the algorithm. erefore, this research adopts an improved support vector machine algorithm, weighted support vector machine algorithm. Compared with the traditional support vector machine algorithm, this algorithm increases the weight of data samples, reduces the impact of category differences, and speeds up the speed and accuracy of algorithm training.
e optimization problem of weighted support vector machine algorithm is described as In formula (18), s i represents the weight added to each sample, and d i represents the repetition factor of data points, so the term s i d i ξ i is the error loss of the misclassification of the data. e coefficient s i is a constant between 0 and 1, which can be assigned different values according to the importance of the data samples. e coefficient s i tends to 1 for the more important samples, and the coefficient s i tends to 0 for the samples that need to be discarded, so as to overcome the impact of the algorithm on the imbalance of the number of samples in different categories.
Similar to the general support vector machine algorithm, the weighted support vector machine algorithm also applies the Lagrange multiplier method to obtain the best optimization plane: e corresponding decision function is rough the comparison of the process of solving the optimal hyperplane of the support vector machine algorithm, it is found that although the results of the two calculation methods are similar, the limitation of weighted support vector machine algorithm requires that the maximum value of α i be changed to the multiplier of C and s i d i .
Since the support vector machine algorithm is essentially a two-category algorithm but the problem of abnormal driving behavior recognition of bus is a multicategory problem, in this research, the support vector machine algorithm and binary tree algorithm are combined to convert the multicategory problem into a series of two-category problems, so as to realize the recognition of various abnormal driving behaviors. As shown in Figure 3, in the binary tree algorithm, firstly, the vehicle motion is divided into longitudinal motion and lateral motion according to the direction of the change of the vehicle operating state. In the longitudinal motion, the vehicle motion is divided into reverse and forward according to the forward direction of the vehicle; in the forward motion, the vehicle motion is divided into constant speed and variable speed according to the change of the vehicle speed; in variable speed motion, it is divided into acceleration motion and braking according to the change of acceleration. In the lateral movement, it is divided into leftward movement and rightward movement according to the lateral movement direction of the vehicle and divided into left turn and left tilt and right turn and right tilt according to the change of vehicle posture.

Model Validation
In the experimental verification, the data acquisition device integration module (composed of GPS, gyroscope, threeaxis accelerometer, magnetometer, and other sensors) is fixed at the center of mass of the bus, and the measurement coordinate system of the sensor is matched with the running direction of the vehicle, so that the positive direction of the accelerometer and gyroscope is consistent with the heading direction of the vehicle. After the module is installed, the parameters of each sensor need to be calibrated to reduce the impact of data error.
In the data collection link, the bus is driven to continuously perform operations such as starting, going straight, turning, changing lanes, and braking, as well as collecting the various sensors' data for the vehicle's acceleration, deceleration, left turn, right turn, left lane change, and right lane change. rough the collection of data, a large number of data samples of various abnormal driving behaviors were obtained. In this research, 200 sets of various abnormal driving behavior data were intercepted as the training data set, and each data segment was marked as a certain kind of abnormal driving in the training data set. For the label of the behavior, 100 groups are used as verification data, the verification data does not need to be labeled, and it is a data fragment directly intercepted from the collected raw data.
After using LIBSVM, the computing power of support vector calculation method is increased. LIBSVM is a flexible and efficient support vector machine software package developed by National Taiwan University. It provides executable files and source code, which can solve various support vector machine algorithms and algorithm expansion problem. 200 sets of training data are used to train the built support vector machine algorithm to stabilize the various parameters of the algorithm, and then 100 sets of verification data are used to verify the improved support vector machine algorithm to test the recognition rate of the algorithm. During the verification process, the receiver operating characteristic (ROC) curve was drawn as shown in Figure 4.
By analyzing the ROC curve graphs of nine different behaviors, it can be found that each curve can reach the top quickly, and the area under the curve is much higher than the area under the diagonal. It shows that the improved support vector machine algorithm has a better ability to discriminate abnormal bus driving behavior. Among them, the real experimental results are presented in Table 2.
rough the analysis of the experimental results, it can be concluded that the improved support vector machine algorithm has high recognition rate for driving behaviors with long duration and large data variation (such as reversing, acceleration, uniform speed, and deceleration) and poor recognition rate for driving behaviors with short duration and no obvious data variation (such as left leaning and right leaning).

Summary
is paper selects the data that best reflects the abnormal driving behavior as the research data and then studies the support vector machine algorithm in the machine learning algorithm, analyzes the structure of the algorithm, and improves the support vector machine algorithm according to the characteristics of the abnormal driving behavior of public transportation vehicles. Finally, a bus abnormal driving behavior data set containing 200 sets of training data    and 100 sets of verification data was established, and the improved support vector machine algorithm was used to train and recognize the data set. e experimental verification results prove that the improved support vector machine algorithm has high recognition rate for driving behaviors with long duration and large data variation (such as reversing, acceleration, uniform speed, and deceleration), which will help to enhance the safety supervision of bus drivers and improve the safety management level of public transport.
Data Availability e data are available upon request to the corresponding author.

Conflicts of Interest
e authors declare that they have no conflicts of interest.