## 4 Proposed Work
### Cluster-Based Vehicle Motion Detection  
In IoCV, vehicles are connected to each other through V2V communication. To differentiate each vehicle, each has a unique vehicle ID. Similarly, the E-RSU for each road segment have their own unique ID. Roads are considered as road segments to extract the geographical information accurately. The vehicles in an environment are represented as \(V=\{V1,\,V2,\,V3\dots\,Vn\}\). Vehicles travel on the road for a particular time period, and E-RSUs that the vehicle passes are R= [R1, R2, R3... R\(n\)]. This information, along with factors such as velocity, speed, latitude and longitude, and the moving direction of the vehicle, are used to form non-overlapping clusters of vehicles from which vehicles will be classified on the basis of mobility. The clustering is performed by E-RSU using MCB-HCC in which the correlation between two vehicles is determined by the distance of correlation. This distance is computed on the basis of the dimensionality of correlation of each vehicle. The covariance matrix \(\,\mathrm{H}_{V}\) of vehicle \(V1\) can be formulated as follows. \[\mathrm{H}_{V1}=\frac{1}{\big{|}NN_{j}(V1)\big{|}}\cdot\,\sum_{Q\in NN_{j}(V1) }\big{(}Q-\overline{Q}\big{)}\cdot\big{(}Q-\overline{Q}\big{)}^{T} \tag{1}\]  
Here, \(j\) belongs to a set of vehicles, and \(\,\mathrm{H}_{V1}\) of vehicle \(V1\) with respect to \(j\) is created by the \(j\) nearest neighbor of \(V1\)\(\big{(}NN_{j}(V1)\big{)}\). \(\overline{Q}\) Is the centroid of \(\,NN_{j}(V1)\). The dimensionality of correlation \(\mu_{V1}\) of vehicle \(V1\) can be computed as follows. \[\frac{\sum_{i=1}^{u}eg_{i}}{\sum_{i=1}^{d}eg_{i}}\geq\gamma \tag{2}\]  
Here, \(u\) is the lowest number of eigenvalues \(eg_{i}\), and \(\gamma\) refers to the percentage of the total variance. The matrix of correlation similarity is represented as follows. \[\hat{S}_{V1}=E_{V1}\hat{B}_{V1}E_{V1}^{T} \tag{3}\]In Equation (3), \(E_{V1}\) denotes the eigenvector matrix of vehicle \(V1\) and \(\hat{B}_{V1}\) is the eigenvalue matrix formed by the following  
\[\hat{\mathcal{S}}_{i}=\left\{ \begin{array}{ll}0,\ if\ i\leq\mu_{V1}\\ 1,\ otherwise\end{array} \right. \tag{4}\]  
The local distance of correlation of vehicle \(V1\) to vehicle \(V2\) can be formulated as follows. \[locD_{V1}(V1,V2)=\sqrt{\left(V1-V2\right)^{T}\cdot\hat{\mathcal{S}}_{V1}\cdot \left(V1-V2\right)} \tag{5}\]  
Here, \(locD_{V1}(V1,V2)\) is the Euclidean distance between \(V1\) and \(V2\), in which \(\hat{\mathcal{S}}_{V1}\) is taken as weight. However, \(locD_{V1}(V1,V2)\) is equal to the distance between vehicle \(V2\) and  
Figure 1: Three Tier Architecture. the correlation hyperplane of the neighbors of \(V1\). If \(V2\) is present in the hyperplane of \(V1\), then we have the following. \[locD_{V1}(V1,V2)=0 \tag{6}\]  
The dimensionality of correlation between two vehicles \(V1\) and \(V2\) is indicated as \(\mu(V1,V2)\), and the distance of correlation between two points, \(V1\) and \(V2\), is denoted as follows. \[CD(V1,V2)=(\mu(V1,V2),\ D(V1,V2)) \tag{7}\]  
```
Initialize Vehicles \((V)\) Determine Covariance matrix \(\mathrm{H}_{V}\) Compute dimensionality correlation of \(V1\) and \(V2\) Calculate \(\hat{B}_{V1}\) from \(\hat{\mathcal{G}}_{V2}\); Eigenvector matrix of \(V1\) be \(E_{V1}\); The dimensionality of correlation of \(V1\) is \(\mu_{V1z}\) Calculate \(\hat{B}_{V2}\) from \(\hat{\mathcal{G}}_{V2}\); Eigenvector matrix of \(V2\) be \(E_{V2}\);



The information obtained from the clusters of vehicles is used to train AttResNet. These features are represented as \((f_{1};\ldots;\)\(f_{z})\) which can be formulated as follows. \[f_{whole}=[f_{1};\ldots;\)\(f_{z}] \tag{11}\]

The equations can be computed as follows. \[\epsilon=\rho(Bf_{whole}+w) \tag{12}\]

\[\dot{\theta}=\epsilon\otimes f_{whole} \tag{13}\]

\[=[at_{1}*f_{1};\ldots;\;at_{z}*f_{z}] \tag{14}\]

Here, \(B\) and \(w\) are weights, \(\rho\) indicates a sigmoid function, and \(\otimes\) denotes feature-wise multiplication.