## 4 Proposed Work
### Cluster-Based Vehicle Motion Detection
However, \(\theta\) indicates a weighted vector that is let into the regression layer for the purpose of mobility prediction. Here, the sigmoid function is utilized to achieve higher performance. Figure 2 depicts the structure of AttResNet, which consists of an attention layer, noise layer, dense layer, residual layer, and drop-out. In the attention module, the attention value (\(at_{v}\)) depicts the importance of a feature (\(f_{v}\)) from the available features (\(f_{whole}\)). The normal distribution of noise in the noise layer is \(\mathbb{N}(0,0.04)\). Over-fitting is eliminated by utilizing the drop-out layer. The dense layer uses SELU activation, which can be expressed as follows. \[SELU(p)=\delta\left\{ \begin{array}{l}p,\;if\;p>0\\ \epsilon e^{p}-\epsilon\;if\;p\leq 0\end{array} \right. \tag{15}\]

The loss function for the purpose of training the model can be formulated as follows:

\[L=\frac{1}{N}\sum_{v=1}^{N}(q_{v}-\hat{q}_{i})^{2}+\gamma\sum_{u=1}^{M}(\theta _{u})^{2} \tag{16}\]

Here, the total number of samples is N. The true classification value is denoted as q, and the predicted value is denoted as \(\hat{q}\). The AttResNet model predicts the motion of a vehicle not only by simply classifying vehicles but by interacting with the features by inferring the complexity. From a deep analysis, E-RSU classifies vehicles on the basis of mobility into three classes: high moving, medium moving, and safe moving. Then, this data are set to Layer 2 for further analysis. ### Driver Behavior Analysis and Prediction

Make a decision regarding alert generation and personalized assistance. The A3C Algorithm takes heterogeneous data of input such as pulse rate, EEG rate, respiratory rate, and heart rate, which are collected from smart wearable sensors. These inputs are normalized to reduce the redundant data and the normalized data are considered for analysis of driver behavior. In addition, considering vehicle information such as speed, longitudinal acceleration, yaw angle rate, position, and moving direction from on-board sensors and surrounding factors such as traffic density, accidents, and weather condition. These factors are taken as state (\(\xi\)) attributes for which the driver's current state, i.e., drowsy, distracted, in an emergency, speeding, bad pedaling, and bad steering, is detected as an action (\(\forall\)). The current state is accurately detected by achieving the optimal policy. The proposed Algorithm consists of two entities, an actor network and critic network. The actor network focuses on achieving the optimal policy, whereas the critic network criticizes the performance of the actor network to increase its efficiency. The actor network is represented as \(\tau_{\theta}(\forall|\xi)\), and the critic network is expressed as \(C_{\phi}^{\pi}(\xi)\), in which \(\phi\) is a parameter of the critic network. The approximated \(Q\) function can be formulated as follows:

\[Q^{\pi}(\xi,\forall)\approx\varrho^{\prime}+\zeta C^{\pi}\big{(}\xi^{\prime} \big{)}\approx\varrho^{\prime}+\zeta C_{\phi}^{\pi}\big{(}\xi^{\prime}\big{)} \tag{16}\]

Here, \(\varrho\) is the reward function for each action taken by the actor network, \(\xi^{\prime}\) indicates the next state, and \(\zeta\) is the discount factor. The advantage function can be formulated as follows. \[AD^{\pi}(\xi,\forall)=Q^{\pi}(\xi,\forall)-C^{\pi}(\xi)\approx\varrho^{\prime} +\zeta C_{\phi}^{\pi}\big{(}\xi^{\prime}\big{)}-C_{\phi}^{\pi}(\xi) \tag{17}\]

Though A3C is a policy gradient approach, the critic network is trained on the basis of the value-based approach, which can be represented as follows. Once the E-RSU classifies vehicle into high moving and normal moving, the fog node triggers the A3C Algorithm to determine the current state of the driver in order to:

\[C^{\pi}(\xi)=\mathds{E}_{\forall\sim\pi(\forall|\xi)}\mathds{E}_{\xi^{\prime }\sim p(\xi^{\prime}|\xi,\forall)}\ \big{[}\varrho^{\prime}+\zeta C^{\pi}\big{(}\xi^{\prime}\big{)}\big{]} \tag{18}\]

Figure 2: AttresNet Model.