# Point-Line-Aware Heterogeneous Graph Attention Network for Visual SLAM System
## 3 Methodology
### Greedy near Iterative Matching Module  
The output \(H_{i}\) of the last layer in the graph neural network is the feature of graph \(I^{\prime}\). \(H_{j}\) is the feature of graph \(I^{\prime}\), and the point-line distance matrix \(G\in\mathbb{R}^{+N_{1}\times N_{2}}\) can be expressed as:  
\[G=f_{aff}(H_{i},H^{\prime}_{j}),i\in v_{1},j\in v_{2} \tag{24}\]  
where \(f_{aff}\) is the weighted bilinear function, defined as:  
\[f_{aff}(H_{i},H^{\prime}_{j})=\text{exp}(\frac{H^{T}_{i}KH^{T}_{j}}{\tau}) \tag{25}\]  
where the feature is an \(n\)-dimensional vector, namely \(\forall i\in v_{1},j\in v_{2}\) and \(H^{T}_{i}\), \(H^{T}_{j}\in\mathbb{R}^{n\times n}\), \(K\in\mathbb{R}^{n\times n}\) is the weight matrix of the affinity function, and \(\tau\) is the regularization parameter. In the matching process, due to the inconsistency of point and line types, a direct fusion may cause a mismatch of point and line types. For this reason, we regarded the unit block diagonal matrix as the initial coupling matrix \(\Gamma^{(1)}\) so that the relationship between point features and line features in the iterative process minimized the matching cost. Then, we had:  
\[\Gamma^{(1)}\leftarrow\left[\begin{array}{cc}11_{p}&0\\ 0&11_{L}\end{array}\right] \tag{26}\]  
where \(P\) is the number of points after completion, and \(L\) is the number of lines after completion. Then, the point-line discrete distribution Sinkhorn distance [34, 35] was defined as:  
\[W_{\in}(u,v)=\min_{\Gamma\in\sum(u,v)}\langle C,\Gamma\rangle+\lambda h(\Gamma) \tag{27}\]  
where \(u\) and \(v\) are probability vectors, \(W_{\in}(u,v)\) is the distance between \(u\) and \(v\), the matrix \(C=\left[c_{ij}\right]\in\mathbb{R}^{+n\times n}\) is the cost matrix, and \(c_{ij}\) is the distance between \(u_{i}\) and \(v_{j}\). The regularization term \(h(\Gamma)=\sum_{i,j}\Gamma_{ij}\ln\Gamma_{ij}\). The proximal point iteration method [35] was used to solve Equation (25). According to the proximal point iteration method, it is defined as the Bregman divergence:  
\[D_{h}(x,y)=\sum_{i=1}^{n}x_{i}\ln\frac{x_{i}}{y_{i}}-\sum_{i=1}^{n}x_{i}-\sum_{ i=1}^{n}y_{i} \tag{28}\]  
After introducing the near-end point iteration, Equation (27) can be rewritten as:  
\[\Gamma^{(t+1)}=\underset{\Gamma\in\sum(u,v)}{\text{argmin}}\langle C,\Gamma \rangle+\beta^{t}D_{h}(\Gamma,\Gamma^{(t)}) \tag{29}\]Substituting the Bregman divergence Equation (28) into Equation (29), it becomes  
\[\Gamma^{(t+1)} =\underset{\Gamma\subset\sum(u,v)}{\operatorname{argmin}}\langle C ^{\prime},\Gamma\rangle+\beta^{t}h(\Gamma) \tag{30}\]  
where \(C^{\prime}=C-\beta^{t}\ln\Gamma^{(t)}\); we used the greedy strategy to update the best row or column and defined the distance matrix  
\[\rho(x,y)=y-x+\log\frac{x}{y} \tag{31}\]  
According to Equations (29) and (30), the affinity matrix was updated to find the best matching relationship, and the specific algorithm flow is shown in Algorithm 1.  
```
Input: Point-line features of graph network output \(H_{i}\) and \(H_{j}\) Output:\(\Gamma^{(t+1)}\)  initialize \(\Gamma^{(1)}\leftarrow\left[\begin{array}{cc}11_{p}&0\\ 0&11_{L}\end{array}\right]\), \(G\gets f_{aff}(H_{i},H^{\prime}_{j})\) begin for\(t=1,2,3\dots\)do \(Q\gets G\odot\Gamma^{(t)}\) \(I\leftarrow\operatorname{argmax}_{i}\rho(u_{i};\mu_{i}(Q))\) \(J\leftarrow\operatorname{argmax}_{i}\rho(u_{j};\mu_{i}(Q))\) \(\Gamma^{(1)}\gets diag(\exp(a))Qdiag(\exp(b))\) if\(\rho(u_{I},u_{I}(Q))>\rho(u_{I},u_{J}(Q))\)then \(a_{I}\gets a_{I}+\log\frac{u_{I}}{u_{I}(Q)}\) else \(a_{I}\leftarrow a_{I}+\log\frac{u_{I}}{u_{I}(Q)}\) end \(\Gamma^{(1)}\gets diag(\exp(a))Qdiag(\exp(b))\)  end for  end for
```  
**Algorithm 1**GIPOT(\(\mu,\
u,G\)).