# Grid Anchor Lane Detection Based on Attribute Correlation
## 3 Methods
### Attribute Correlation Loss Function
\(L_{so}^{ed}\) and \(L_{so}^{ok}\) are accumulated from the loss values \(L_{i,j}^{ed}\) and \(L_{i,j}^{ok}\) of all anchors. \[L_{so}^{ed}=\sum_{i=0}^{H_{s}-1}\sum_{j=0}^{W_{s}-1}L_{i,j}^{ed},\ L_{so}^{ ok}=\sum_{i=0}^{H_{s}-1}\sum_{j=0}^{W_{s}-1}L_{i,j}^{ok} \tag{16}\]  
According to the meaning of the direction attribute, the values of \(T_{n+1,i,j}^{s}\) and \(T_{n+2,i,j}^{s}\) indicate the next anchor that the anchor \((i,j)\) points to, and the pointed-to anchor should be classified as a lane line. When \(T_{n+1,i,j}^{s}=1,T_{n+2,i,j}^{s}=0,i\geq 1\), anchor \((i,j)\) points to its leftward anchor \((i-1,j)\). \(L_{i,j}^{ed}\) and \(L_{i,j}^{ok}\) computation formulas are as follows:  
\[L_{i,j}^{ed}=L_{1}\left(\frac{A_{0,i-1,j}^{s}+A_{n+1,i,j}^{s}}{2},1\right)+L _{1}\Big{(}A_{0,i-1,j}^{s}-A_{n+2,i,j}^{s},1\Big{)}, \tag{17}\]  
\[L_{i,j}^{ok}=L_{1}\left(A_{n+3,i,j}^{s}+\frac{W}{W_{s}}-A_{n+3,i-1,j^{\prime} }^{s}\left(A_{n+4,i,j}^{s}-A_{n+4,i-1,j}^{s}\right)\frac{A_{n+5,i,j}^{s}+A_{n +5,i-1,j}^{s}}{2}\right), \tag{18}\]  
where \(L_{i,j}^{ed}\) correlates the directional attributes \((A_{n+1,i,j^{\prime}}^{s}A_{n+2,i,j}^{s})\) of the current anchor \((i,j)\) with the existence attribute \((A_{0,i-1,j}^{s})\) of the pointed anchor \((i-1,j)\). During parameter updates, the values \(A_{n+1,i,j}^{s}\) and \(A_{0,i-1,j}^{s}\) move towards 1, so the combination method of \(\frac{A_{0,i-1,j}^{s}+A_{n+1,i,j}^{s}}{2}\) is adopted. On the other hand, the value \(A_{n+2,i,j}^{s}\) moves towards 0, so the combination method of \(A_{0,i-1,j}^{s}-A_{n+2,i,j}^{s}\) is used. \(L_{i,j}^{ok}\) correlates the offset and slope attributes of the current anchor and the pointed anchor. Assuming that the slope of the lane line changes uniformly (as shown in Figure 8a), the reciprocal of the slope of the straight line (yellow slanted line) formed by the lane line points predicted by the two anchors can be calculated from the offset attribute value and the anchor boundary length and is equal to the average of the slope attribute values of the two anchors, as shown in Equation (19). \[\frac{A_{n+3,j,j}^{s}+\frac{W}{W_{s}}-A_{n+3,j-1,j}^{s}}{A_{n+4,j,j}^{s}-A_{n+4, j-1,j}^{s}}=\frac{A_{n+5,ij}^{s}+A_{n+5,j-1,j}^{s}}{2} \tag{19}\]  
In the calculation of \(L_{i,j}^{\alpha k}\), to avoid the case of 0 as a divisor, the divisor \(A_{n+4,i,j}^{s}-A_{n+4,i-1,j}^{s}\) is moved to the other side to convert it to multiplication. Similarly, when \(T_{n+1,i,j}^{s}=1,\ T_{n+2,i,j}^{s}=1,\ j\leq H_{s}-2\), anchor \((i,j)\) points to its downward anchor \((i,j+1)\) (as shown in Figure 8b), and the formulas for \(L_{i,j}^{cd}\) and \(L_{i,j}^{\alpha k}\) are as follows:  
\[L_{i,j}^{\alpha k}=L_{1}\bigg{(}\frac{A_{0,i,j+1}^{s}+A_{n+1,j}^{s}}{2},1 \bigg{)}+L_{1}\bigg{(}\frac{A_{0,i,j+1}^{s}+A_{n+2,i,j}^{s}}{2},1\bigg{)} \tag{20}\]  
\[L_{i,j}^{\alpha k}=L_{1}\bigg{(}A_{n+3,j,j}^{s}-A_{n+3,i,j+1}^{s},\ \bigg{(}A_{n+4,i,j}^{s}+\frac{H}{H_{s}}-A_{n+4,i,j+1}^{s}\bigg{)}\frac{A_{n+5, i,j}^{s}+A_{n+5,i,j+1}^{s}}{2}\bigg{)} \tag{21}\]  
When \(T_{n+1,i,j}^{s}=0,T_{n+2,i,j}^{s}=1,i\leq W_{s}-2\), the anchor \((i,j)\) points to its rightward anchor \((i+1,j)\) (as shown in Figure 8c), and the formulas for \(L_{i,j}^{ad}\) and \(L_{i,j}^{\alpha k}\) are as follows:  
\[L_{i,j}^{\alpha k}=L_{1}\bigg{(}A_{0,i+1,j}^{s}-A_{n+1,i,j}^{s},1\bigg{)}+L_{ 1}\bigg{(}\frac{A_{0,i+1,j}^{s}+A_{n+2,i,j}^{s}}{2},1\bigg{)} \tag{22}\]  
\[L_{i,j}^{\alpha k}=L_{1}\bigg{(}A_{n+3,i,j}^{s}-\frac{W}{W_{s}}-A_{n+3,i+1,i^{ \prime}}^{s}\bigg{(}A_{n+4,i,j}^{s}-A_{n+4,i+1,j}^{s}\bigg{)}\frac{A_{n+5,i,j} ^{s}+A_{n+5,i+1,j}^{s}}{2}\bigg{)} \tag{23}\]  
In other cases, anchors are classified as background, with direction attribute values equal to 0, or the pointed anchor is beyond the range of \(H_{s}\times W_{s}\), and then \(L_{i,j}^{\alpha d}=0,\ L_{i,j}^{\alpha k}=0\). Figure 8: Illustration shows the three different cases for the computation of the loss function \(L_{i,j}^{\alpha k}\).