State Machine Approach for Lane Changing Driving Behavior Recognition

: Research in understanding human behavior is a growing ﬁeld within the development of Advanced Driving Assistance Systems (ADASs). In this contribution, a state machine approach is proposed to develop a driving behavior recognition model. The state machine approach is a behavior model based on the current state and a given set of inputs. Transitions to different states occur or we remain in the same state producing outputs. The transition between states depends on a set of environmental and driving variables. Based on a heuristic understanding of driving situations modeled as states, as well as one of the related actions modeling the state, using an assumed relation between them as the state machine topology, in this paper, a crisp approach is applied to adapt the model to real behaviors. An important aspect of the contribution is to introduce a trainable state machine-based model to describe drivers’ lane changing behavior. Three driving maneuvers are deﬁned as states. The training of the model is related to the deﬁnition/tuning of transition variables (and state deﬁnitions). Here, driving data are used as the input for training. The non-dominated sorting genetic algorithm II is used to generate the optimized transition threshold. Comparing the data of actual human driving behaviors collected using driving simulator experiments and the calculated driving behaviors, this approach is able to develop a personalized behavior recognition model. The newly established algorithm presents an easy to apply, reliable, and interpretable AI approach.


Introduction
Traffic accidents within Germany have increased over the past few years. In the year 2019 alone, the Department of Statistics in Germany recorded that 74.4 percent of accidents were related to human driving error, such as inappropriate speed, insufficient space, and failure to yield the right of way [1]. Advanced Driving Assistance Systems (ADASs) have played an important role in assisting a human driver on the road to minimize errors while driving in recent years. Thus, developing a driving behavior prediction and recognition model is an important aspect in the development of ADASs. To improve driving predictions, this can be done by understanding individual driving behaviors to predict driving decisions in different environments. This improved ADAS model parameterized to individual driving preferences can inform the driver about suitable moves or how to maneuver accurately in different situations based on individual driving style by taking into account the safety and environmental conditions.
Developing driving prediction and recognition models has been previously tackled in several research works by using different machine learning algorithms such as in Gindele et al. [2], where the Dynamic Bayesian Network (DBN) was used in the context of predicting traffic situations. of the experiment is shown. The results and evaluations are presented in Section 3. In Section 4, a discussion about this research work is presented. Finally, the conclusions, a summary, and the future work are provided in Section 5.

Methodology
To establish a driving behavior model, first the inputs and outputs of the considered system need to be defined. Lane changing, as an example of a driving maneuver, is selected as a representative of driving behaviors in this contribution. Three different driving maneuvers including Lane Keeping (LK), Lane Changing to the Left (LCL), and Lane Changing to the Right (LCR) are modeled as the outputs of the model. The variables affecting driver's decisions are used as the inputs, assuming they are measurable. In general, different states of the ego vehicle (position, speed, acceleration, steering wheel angle, etc.) and information about surrounding vehicles are used as the inputs. The main aim is to establish a suitable recognition performance with respect to the ACC, DR, and FAR.

State Machine Approach
A state machine, in the case of deterministic modeling, models behaviors based on a set of inputs. Based on the inputs, the system dynamics are characterized by a sequence of transitions, whereby the system can either remain in the current state or shift to another state. State machines are well known approaches used for modeling, analysis, and control. In the classical approach, the parameters and variables used for modeling are defined by designers or are related to processes to be modeled or designed. The idea first published in Beganovic et al. [9] was using a state machine approach with parameters defining states and transitions (so, only the topology was given by designers first) as part of an optimization loop to develop models describing wear degradation behaviors. According to the given objectives, these parameters of the optimization variables were to be defined (using the NSGA-II) with the best/optimal parameters, using data from a tribological experiment.

Integration of the State Machine Approach in Driving Behavior Prediction
In this contribution, the state machine approach is assumed as given in Figure 1. Here, a state is defined as a driving behavior like "lane keeping" or "lane changing", whereby it is assumed that the different states are connected by parameterized transitions. The topology shown consists of three states (driving behaviors) transitioning from one state to another based on specific parameter/threshold conditions generated by the NSGA-II. The parameters/thresholds are given in Table 1 Table 1, the first set of thresholds, for each variable, is used to define a transition from State 2 to State 1, while the second set of thresholds is used to define a transition from State 2 to State 3. For a transition from State 2 to State 1, the values of either one of the variables have to be within the first set of thresholds. For a transition from State 2 to State 3 to occur, the values of either one of the variables generated should be within the second set of thresholds. If these threshold conditions are not met, the state machine remains in the same state. In Table 1, T n denotes the threshold values, and the maximum number of thresholds/parameters is 40; hence, n = 40. In Figure 2

Driving Behavior Model Based on the State Machine Approach
The state machine model introduced here has two major components. The first part consists of determining the thresholds (design parameters) through optimization. The second part focuses on determining/recognizing the driving states based on the optimal thresholds. These thresholds of the variables determine whether a state transition can occur. The driving behaviors determined using this model and the actual driving behavior (by a human driver) will be compared to evaluate the accuracy and reliability of this model.

Driving Behavior Prediction Problem
When driving on a highway, the driver's decision is often based on the ego vehicle's relationship with the surrounding vehicles. Decisions rely on an individual perception of environmental variables and their combination, like the velocity of the ego vehicle and the actual angle of the steering wheel. The variables used here are given in Table 1. The states considered here were described in the previous section. In this case, a four lane highway is considered. Since transitions from one state to another are dependent on the optimized thresholds of variables, these thresholds are generated with respect to the maximal DR, maximal ACC, and minimal FAR (or maximal 1-FAR) to evaluate the model. The ACC, DR, and FAR are determined based on True Positive (TP), False Positive (FP), True Negative (TN), as well as False Negative (FN) values. The True Positive (TP) is calculated based on the number of events when an estimated maneuver is positive (right lane change) and the actual maneuver is positive as well. The False Positive (FP) is based on the number of events when an estimated maneuver is positive, but the actual driving behavior is not [12]. This concept is applied to the True Negatives (TNs) and False Negatives (FNs) as well. Thus, this enables the evaluation of the well known metrics [13] Accuracy (ACC), Detection Rate (DR), and False Alarm Rate (FAR), given as: Suitable objective functions are selected to evaluate the optimization process by comparing the real states (the real driving behaviors) and the calculated states at each moment. In the state machine model introduced in this paper, the variables ACC, DR, and FAR are used to describe the objective functions with respect to minimizing the deviation between measured and estimated driving behaviors. The aim is to minimize the deviation between the calculated and real driving behaviors. The termination criteria are based on the maximum generation. The optimal values of the parameters are generated when the conditions are fulfilled, which will then be used to calculate the driving behaviors. The objective functions are defined as: (4) Equations (4)-(6) express the objectives in terms of the DR and FAR for each state.

State Machine-Based Problem Description
Optimal values of the variables and related optimization thresholds are generated using the NSGA-II. The NSGA-II model used in this contribution was proposed by Song et al. [14], which is used for multi-objective optimization consisting of three main features. The model uses an elitist preserving method and a diversity preserving method, which involves crowding distance, and highlights the non-dominated results [12,15,16]. Due to the conflicting objectives, the NSGA-II is used to handle the multi-objective problem presented. In Table 2, the list of arguments/inputs required for the NSGA-II are shown. The design parameters generated by the NSGA-II are used to minimize the objective function.

Application of the New Approach
In this section, the experimental setup, training, and testing of the data are suitably tuned. The optimal design parameters from the NSGA-II to develop the driving recognition model will be discussed.

Design of Experiment
A driving simulator SCANeR TM studio ( Figure 3) was used to perform driving simulations to generate driving data. The simulator is equipped with five monitors, a base-fixed driver seat, a steering wheel, and pedals. The simulator also consists of three rear mirrors, which are essential to decide on a lane change. The mirrors are displayed on the corresponding positions of the monitors. The driving scenario is a highway with four lanes with two directions and a simulated traffic environment. During the driving, the participant can perform an overtaking maneuver when the preceding vehicle drives slowly. After overtaking, the driver can maneuver back to the initial lane. The time points of changing the lane to the left and right were decided by the participant. Following the traffic rules in Germany, it is only allowed to overtake from the left lane. The participants were allowed to make lane changes based on their choice and their assessment of the traffic situation. No further instructions were given such as the maximum number of vehicles they should overtake.
For the proof of concept, three datasets from three driving participants were used for training and testing. Each dataset (training and test) corresponds to a driver performing a driving scenario using the driving simulator. The training dataset is based on a forty minute drive by a participant, while the testing dataset is based on another ten minute drive by the same participant [8]. The training datasets and testing datasets contain different maneuvers. The current lane of the ego vehicle is determined through the vehicle's center point. It is also worth mentioning that the driving and environmental conditions are normal (no fog, no rain, etc.). The driving and traffic conditions, as well as the scenarios  For proof of concept, three data sets from three driving participants are used for training and test. Each data set (training and test) corresponds to a driver performing a drive using the driving simulator. A training data set is based on a forty minute drive by a participant, while the test data set is a based on another ten minute drive by the same participant [8]. Training data sets and test data sets contain different maneuvers. The current lane of the ego vehicle is determined through the vehicle's centre point. It is also worth mentioning that the driving and environmental conditions are normal (no fog, no rain, etc.). The driving and traffic conditions as well as the scenarios are the same for all the drivers. The traffic condition are defined by the existence of different vehicles on the lane, no further problems are generated.

Training and test procedure
Training phase: As mentioned previously, three different data sets are used. Further analysis has to be done to extend the approach to possibly structural different driving behaviors. The data sets contain information about the current lane at each moment. The model is trained in the following manner: 1. The NSGA-II generates transition parameters used in this experiment by using the training data sets 2. Based on the transition parameters, the driving behavior at each time point can be calculated based on the topology. 3. Next, the calculated driving behaviors and the measured driving behavior from the data set will be compared. 4. This can be used to derive ACC, DR, and FAR based on the calculated driving behavior. 5. The values of objective functions is derived. 6. The process (1) to (5) is repeated until convergence and optimal model is obtained.
The training of data sets on a standard office PC (2.6 GHz) takes around 26 -68 seconds approximately. The saved training results are then used for testing. The test process only takes around 3 -5 seconds for the algorithm to predict the driving behavior for different data sets. Based on

Training and Test Procedure
Training phase: As mentioned previously, three different datasets are used. Further analysis has to be done to extend the approach to possibly structurally different driving behaviors. The datasets contain information about the current lane at each moment. The model is trained in the following manner: 1. The NSGA-II generates transition parameters used in this experiment by using the training datasets. 2. Based on the transition parameters, the driving behavior at each time point can be calculated based on the topology. 3. Next, the calculated driving behaviors and the measured driving behaviors from the dataset are compared. 4. This can be used to derive the ACC, DR, and FAR based on the calculated driving behavior. 5. The values of the objective functions are derived. 6. Processes (1) to (5) are repeated until convergence and the optimal model is obtained.
The training of datasets on a standard office PC (2.6 GHz) took around 26-68 s. The saved training results were then used for testing. The test process only took around 3-5 s for the algorithm to predict the driving behavior for different datasets. Based on the exemplary observed time, this is a very fast algorithm to execute. In addition, the training time is not linear to the dataset size, as each data point goes through (50 × 20) (population × generation) iterations in the NSGA-II optimization. In the test data, however, every data point is evaluated with a parameter generated from the training; hence, here, we have a linear relationship between the test time and the size of the data.
Test phase: The corresponding testing datasets are used here. The optimal values of the thresholds calculated from the training phase are used here to determine the driving behavior based on the test driving data. The ACC, DR, and FAR are determined by the calculated and actual driving behaviors.

Results
In this section, the results are presented. The driving behaviors generated using the state machine model will be shown and compared with the measured driving behaviors to check for similarities.

Figures, Tables, and Schemes
Here, results based on three datasets from three participants are shown. The datasets are generated from driving simulator experiments conducted in the driving simulator laboratory at the Chair of Dynamics and Control at University of Duisburg-Essen. As mentioned previously, the training dataset is based on a 40 min drive, while the testing dataset is based on a 10 min drive. The experiments were conducted with driving participants with ages from 25 to 38 years. All participants held a valid Automation 2020, 1 75 driving license. The best results are defined as those results generated from the tuned model showing the closest fit to the actual driving behaviors. The results in Figures 4-6 are based on Testing Datasets 1, 2, and 3 when training their respective training datasets. In the ordinate, the y-axis represents the three different states, while the x-axis represents time, in seconds. The blue line represents the estimated driving behavior (or calculated states), and the red dotted line represents the driving behavior from the driving simulator.
In Figure 4, the estimated and measured driving behavior lines have a close fit with Testing Dataset 1 for most of the behaviors with some inconsistencies.   The results shown in Figure 6, are based on Training Dataset 3 and Testing Dataset 3. A close fit to the measured driving behavior can also be observed.  Table 1 change throughout the driving for each driver.
The ACC, DR, and FAR values for each state when training different datasets and the corresponding test data are shown in Tables 3-5. The ACC, DR, and FAR values given correspond to the datasets tested. In Table 3, Training Dataset 1 it is tested with Testing Dataset 1, Training Dataset 1 (used for the test as well), Dataset 2 (a combination of Training and Testing Dataset 2), and Dataset 3 (a combination of Training and Testing Dataset 3) to show the generalizability and transferability. In Table 4, Training Dataset 2 is tested with Testing Dataset 2, Training Dataset 2 (used for the test as well), Dataset 1 (a combination of Training and Testing Dataset 1), and Dataset 3 (a combination of Training and Testing Dataset 3). In Table 5, Training Dataset 3 is tested with Testing Dataset 3, Training Dataset 3 (used for the test as well), Dataset 1 (a combination of Training and Testing Dataset 1) and Dataset 2 (a combination of Training and Testing Dataset 2).

Discussion
In this section, the validity of the results and the method used will be discussed. The state machine approach is established in this contribution first to recognize/predict driving behaviors. One of the objectives of this research is to develop a suitable driving recognition model by generating the optimal thresholds of variables using the NSGA-II. The other objective is to develop a close fit between the measured driving behaviors and generated behaviors from the model. The driving behavior considered here is lane changing behavior [8,17,18].
The results generally show a good fit between the behaviors for the datasets used. This method produces high ACC and DR and low FAR for most of the states. For an example, in Table 3, the overall accuracy for Testing Dataset 1 is 92.90%, with the highest left maneuver accuracy of 96.66% and low false alarm rates for all maneuvers. The overall accuracy for Testing Dataset 2 is the highest in comparison to the other datasets with an accuracy of 95.77%. A high accuracy of the left maneuver at 98.08% is achieved, which is not only the highest within the Testing Dataset 2, but also the highest value when compared with other testing datasets. However, the false alarm rate for lane keeping in Testing Dataset 2 is higher than the rest of the maneuvers within this dataset. The same can be said regarding the FAR for lane keeping in Testing Datasets 1 and 3. On the other hand, the FAR for the right and left maneuvers for Testing Dataset 2 is low at 1.41% and 1.42%, respectively. The detection rate also seems to perform well for the different maneuvers in all the datasets, with values larger than 73%. The results from this contribution generally show a close resemblance to the results from previous works [7,8]. The newly introduced approach is therefore easier to understand and, from the machine learning perspective, interpretable.
To verify the effectiveness of this method, the results developed in this paper are compared with the results developed using other techniques. In Deng et al. [8], who used the same dataset as this work, the average values of the ACC, DR, and (1-FAR)were higher than 80%. Here, the values of the ACC, DR, and (1-FAR) from the datasets are also generally higher than 80%, with some exceptions; for example, for Training Dataset 2, the DR for the right maneuver in Testing Dataset 2 is 79.31%. In contrast to Deng et al. [8], the main advantage of the approach introduced in this contribution is that the approach is interpretable, which is not the case for all the approaches applied by Deng et al. [8].

Conclusions
In this contribution, a state machine approach is introduced for driving behavior recognition/ prediction. A topology is developed based on the transition of states by applying threshold-based conditions as the model parameters to be trained using the NSGA-II [19,20]. These transition parameters are determined by optimization. This allows the optimization to define those model parameters that fit best to the whole driving behavior sequence. To validate this model, three training and testing datasets are used and combined in the sense of cross-validation. The results show that the dataset trained and the dataset used for testing allow a close fit with acceptable accuracies. The ACC, DR, and FAR of the datasets are also evaluated to validate the efficiency of this model. Due to the fact that only three suitable datasets are used, it can be concluded that this machine learning-based approach may be also a new candidate for situation and driver behavior recognition and prediction in the future. Improvements, especially to the robustness with respect to different individual driving patterns, are required.