## 3 Methodology
### Ground Detection  
Ground detection separates points into ground points and nonground points. The ground is usually represented by a plane model, which may not be robust for different environments. Considering the points with different category information after semantic segmentation, most of the ground points can be extracted correctly with only a small number of false detections. In order to optimize the ground detection performance, a cascaded ground detection method inspired by [10] is proposed, as shown in Figure 6. The method included two stages: semantic segmentation point filtering and rectangular grid map filtering.  
Figure 4: Illustration of false semantic segmentation.  
Figure 5: Pipeline for road region searching. (**a**) Semantic segment point clouds. (**b**) Grid map searching. (**c**) ROI point clouds.  
For the semantic segmentation point-cloud filtering, the obstacle categories were directly classified as nonground point clouds. Since the semantic segmentation algorithm is robust for obstacle points, semantic segmentation points filtering was robust. Since semantic segmentation algorithm precision is low for obstacle edges and small obstacles such as pedestrians, as shown in Figure 4, they may be falsely segmented into the 'ground' or 'other' category.  
For rectangular grid map filtering, the method was applied to improve the accuracy of ground detection, especially for obstacle edges and small obstacles. Because the grid map method was used to filter out the false semantic segmentation to improve segmentation stability and accuracy, wide parameter thresholds were used to decrease false segmentation. The point clouds processed with semantic segmentation filtering were projected onto the grid map with a resolution of 0.2 m, represented as a dataset \(GM=\{cell_{00},\dots,cell_{mn}\}\), where \(m\) and \(n\) denote the vertical and horizontal serial numbers for the grid map, respectively. For each grid map cell, the variance in height \(\delta_{H2}\),  
Figure 6: The pipeline of ground detection.  
and the maximal and minimal heights \(\Delta H\) were calculated. To maintain all point-cloud information, the indices of point clouds projected onto the cell were stored. Therefore, the grid map feature is denoted as \(f=[\delta_{H^{2}},\Delta H,\textit{indexes}]\). The cell in row \(i\) and column \(j\) was computed with  
\[GM[i][j]=\begin{cases}ground,if\quad\delta_{H}^{2}<tr_{\delta}\quad\textit{and} \quad\Delta H<tr_{H}\\ nonground;\textit{otherwise},\end{cases} \tag{2}\]  
where \(tr_{\delta}\) and \(tr_{H}\) denote the threshold of variance and maximal height difference, respectively.  
The nonground point clouds are output integrated by the semantic segmentation point-cloud filter and rectangular grid map filter.  
In summary, the ground detection algorithm is shown in Algorithm 2.  
```
1:Point clouds with semantic segmentation categories in road region, P={p1,p2,...,p2}, grid map size M and N, threshold tr\({}_{\delta}\) and tr\({}_{H}\)
2:Ground point clouds P\({}_{g}\), nonground point clouds P\({}_{ng}\), nonground candidate point clouds P\({}_{candidate}\)
3:for i=1:size(P)do
4:if P\({}_{i}\).label='truck' \(\parallel\) P\({}_{i}\).label=='vehicle' \(\parallel\) P\({}_{i}\).label=='pedestrian' then
5: P\({}_{ng}\).push_back(P\({}_{i}\))
6:else
7: P\({}_{candidate}\).push_back(P\({}_{i}\))
8:endif
9:endfor
10:Project P\({}_{candidate}\) to grid map GM(M,N)
11:for i=1:M do
12:if\(GM(i,j).\delta_{H^{2}}>tr_{\delta}\parallel\) GM(i,j).\(\Delta\) H \(>\) tr\({}_{H}\)then
13:for m=1:GM(i,j).indexs.size do
14:\({}_{ng}\).push_back(Point(GM(i,j).indexs(m)))
15:endfor
16:else
17:for m=1:GM(i,j).indexs.size do
18: P\({}_{g}\).push_back(Point(GM(i,j).indexs(m)))
19:endfor
20:endif
21:endfor
```  
**Algorithm 2** Ground detection.