# Prototype Network for Few-Shot Hazard Assessment of Vehicle Lane Changes in Risk Field
## 4 A Prototype Network-Based Risk Level Identification Model for Lane Change
### Experimental and Results  
This study proposes a method combining a prototype network with risk field intensity. The prototype network is mainly composed of a distance metric model and a feature-embedding model. In metric learning, the feature-embedding model transforms the input into a high-dimensional feature space. In the high-dimensional space, instances from the same class are as close together as feasible, while samples from different classes are as separated as possible. The embedding model is intended to map the normalized vehicle feature parameters to a high-dimensional feature space, and it creates more features for each feature parameter, which is conducive to a data response. Five feature parameters characterizing vehicle risk are mapped to the two-dimensional polynomial term of \(v\_vel,v\_Acc,Space\_Hdavy,Time\_Hdavy,TTC\) and \(1/TTC\). In addition, the feature vector changes from a 5-dimensional vector to a 21-dimensional vector, and the principle is shown in Equation (17). \[ \begin{bmatrix}v\_vel,v\_Acc_{1},Space\_Hdavy_{1},Time\_Hdavy_{1},1/TTC_{1}\\ v\_vel,v\_Acc_{2},Space\_Hdavy_{2},Time\_Hdavy_{2},1/TTC_{2}\\ \ldots\\ v\_vel,v\_Acc_{n},Space\_Hdavy_{n},Time\_Hdavy_{n},1/TTC_{n}\end{bmatrix}  \xrightarrow{\mathcal{F}_{\phi}(x)} \tag{17}\] \[ \begin{bmatrix}1&1&\ldots&1\\ v\_vel_{1}&v\_vel_{2}&\ldots&v\_vel_{n}\\ v\_Acc_{1}&v\_Acc_{2}&\ldots&v\_Acc_{n}\\ \ldots\\ v\_Acc_{1}^{2}&v\_Acc_{2}^{2}&\ldots&v\_Acc_{n}^{2}\\ v\_vel_{1}*v\_Acc_{1}&v\_vel_{2}*v\_Acc_{2}&\ldots&v\_vel_{n}*v\_Acc_{n}\\ \ldots\\ Time\_Hdavy_{1}^{2}&Time\_Hdavy_{2}^{2}&\ldots&Time\_Hdavy_{n}^{2}\\ 1/TTC_{1}^{2}&1/TTC_{2}^{2}&\ldots&1/TTC_{n}^{2}\end{bmatrix} \]  
where \(n\) is the total number of samples. Through high-dimensional feature mapping, the vector of \(n*5\) dimensions is mapped to the vector of \(n*21\) dimensions, which is imported into the model as the input of the prototype network for processing and training. Among them, the distance between the center of each type of prototype and the feature vector of the sample to be tested in the feature-embedding model is the basis for classification in the recognition process. Combined with the above risk field model, the proposed prototype network architecture for identifying vehicle lane changes is illustrated in Figure 7.  
In this paper, six categories of input data are applied to the specific cases, with 5, 10, and 20 input samples for each test. The class prototype center of the example is calculated. The six categories in the data include three risk level categories and the distraction data category based on physiological data as an additional three categories, which together constitute the required dataset for the experiment. Samples with marks or some unmarked ones are equipped with query sets, which should remain the same in testing and training. For instance, N-way M-shot in training means N-way M-shot in testing. The sample is substituted with \(\mathbb{P}_{w}(y=m_{i}\mid x)=\frac{exp(-\mathcal{D}(\mathcal{F}_{\phi}),c_{m_{ i}})}{\sum_{j}exp(-\mathcal{D}(\mathcal{F}_{\phi}),c_{j})}\) to calculate its distance from  
Figure 7: Prototype network model based on vehicle lane change risk field. each category. Moreover, the probability is obtained through homogenization, meaning \(x\) has fallen into the probability of category \(x\). In the process, the distance function adopts a Euclidean function, and the objective function adopts the gradient descent method to find the minimum value. First, the test results are analyzed via different learning rates and iterations in the prototype network. Then, the original characteristic mapping insert network is optimized by maximizing the chance of correctly classifying cases and minimizing the loss function. The highest classification accuracy is obtained with the 6-way 5-shot, the 6-way 10-shot, and the 6-way 20-shot. Table 3 shows the details of the test results.