# Focus on Point: Parallel Multiscale Feature Aggregation for Lane Key Points Detection
## 3 Methodology
### Grouping Key Points with Association Embedding  
The global detection results will be aggregated into the local geometric modeling of lane lines in this section. Specifically, we need to further divide the set of detected key points meticulously in order to determine which lane they belong to. To this end, our approach introduced the association embedding idea for human pose estimation in [31]. They generate feature embedding for all detected human joints and group the joints based on the distance between these embeddings. According to this idea, we noticed that, if key points belong to the same lane, the feature distance between their embeddings should be small; on the contrary, the feature distance between embeddings of key points in different lanes should be long. The other branch of the network will generate embedding vectors for each detected key points. We could complete the grouping task only based on the feature distance between embedding vectors of key points, and did not need to pay attention to the actual values of embedding vectors.  
In order to group the set of key points belong to the same lane together, \(L_{assemble}\) enables the embeddings of these key points to be as close as possible to the cluster center of this lane \(\mu_{l}\). For the key points belong to different lanes, \(L_{separate}\) is used to separate the cluster centers of different lanes, so that embeddings from different lanes are far away from each other, as shown in Figure 6. The loss function for the embedding is constructed as:  
\[\begin{split}&\mu_{l}=\frac{1}{K_{l}}\sum_{i=1}^{K_{l}}x_{l_{i}}\,\\ & L_{assemble}=\frac{1}{N}\sum_{l=1}^{N}\sum_{i=1}^{K_{l}}\left\| x_{l_{i}}-\mu_{l}\right\|_{2}\,\\ & L_{separate}=\frac{1}{N(N-1)}\sum_{l_{1}=1}^{N}\sum_{\begin{subarray} {c}l_{2}=1\\ l_{2}\
eq l_{1}\end{subarray}}^{N}\max\left(0,\Delta-\left\|\mu_{l_{1}}-\mu_{ l_{2}}\right\|_{2}\right)\,\\ & L_{GP}=L_{assemble}+L_{separate}\,\end{split} \tag{7}\]  
where \(x_{l_{i}}\) represents a key point embedding of lane \(l\), \(K_{l}\) is the total number of key point embeddings of lane \(l\), \(N\) is the total number of lanes in the current image, \(\mu_{l}\) is the cluster center of the lane \(l\) (the mean embedding of the lane \(l\)), \(\left\|\cdot\right\|_{2}\) represents the L2 distance and \(\Delta\) is the distance threshold between cluster centers.  
Subsequently, we applied the distance-based embedding clustering method after the model training converged to subdivide the key points of each lane line through the iterative procedure. It specifically includes the following steps:Setting the embedding distance threshold \(\delta_{i}\) (where \(\delta_{i}\leq\Delta\)), which is used to determine whether the embeddings belong to the same lane.
2. Selecting a random embedding \(x_{l_{1}}\) from all key point embeddings, and assigning a lane label \(l\) for it. The value of this embedding \(x_{l_{1}}\) is the initial cluster center \(\mu_{l}\) of the lane \(l\).
3. Selecting another embedding \(x_{l_{2}}\) from remaining embeddings to calculate the feature distance between \(x_{l_{1}}\) (L2 distance). If the feature distance is less than or equal to \(\delta_{i}\), \(x_{l_{2}}\) is assigned to the same label \(l\) and the average value of \(x_{l_{1}}\) and \(x_{l_{2}}\) is taken as the new cluster center \(\mu_{l}\) of the lane \(l\). Otherwise, proceed to screen the next embedding.
4. Repeating step 3 to go through all remaining embeddings and find all embeddings of the lane \(l\).
5. A new round of iteration is performed for remaining key point embeddings without labels, and steps 2, 3 and 4 are repeated until all key point embeddings are assigned a lane label.