## 2 Materials and Methods
### Random Forest Semantic Segmentation  
The basic idea of 3D semantic segmentation is to calculate the probability of an object belonging to each classification label and then attribute the label attaining the highest probability value. This can be conducted via a supervised classification based on machine learning concepts, and specific training can be understood as a classifier. For a given feature vector x, the prediction belongs to the category label y with conditional probability p (y \(|\)x). Therefore, our primary objective was to select an appropriate classifier. We opted to use a random forest as a classifier for 3D urban landscapes with large amounts of data, which has the advantages of parallel computation [37], support for high-dimensional features, and strong generalizability. A prior probability distribution of the observational data was created using a random forest. However, random forest classification only provides the category probability of a single discrete object without considering the correlation between spatial objects in its neighborhood. Consequently, some point clouds can be isolated into incorrect categories, and their classification labels are often not optimal solutions. Simultaneously, there are significant contextual prior knowledge constraints in 3D classifications (such as the elevation of the ground being lower than that of the building and roof, the building being adjacent to the ground, and the absence of trees on a roof). Classification results should discern between the boundaries of different categories as clearly as possible and obtain the smoothest possible classification in the local neighborhood. To this end, we employed the [PERSON] random field model [38] to determine optimal classification labels. Let P = {P1, P2,..., Pn} be a set of points, L = {L1, L2,..., Lm} comprise a set of classification labels, and m is the number of classification labels. X = {X1, X2,..., Xn} is a set of random variables in the set P, and each 3D point is associated with a random variable. According to [PERSON] rule:  
\[P(s|d)=\frac{P(d|s)P(s)}{P(d)}, \tag{6}\]  
where \(P(d|s)\) is the conditional probability distribution of the observed value d (also known as the likelihood function); \(P(d)\) is a fixed value; and \(P(s)\) is the prior probability of the initial value generated via random forest classification. Assuming that the optimal state is s\(*\), the solution to the problem can be expressed as  
\[s*=\text{max}P(s)P(d|s),s\in S. \tag{7}\]  
According to the Hammersley-Clifford theorem, the probability distribution of the [PERSON] random field undirected graph must be expressed as the product of non-negative functions on the largest clique that satisfies the Gibbs distribution [39,40]. According to Gibbs measures of the Potts model [41], the solution of Equation (7) can be transformed into the minimum value of the solution of Equation (8):  
\[E(s)=\sum_{i=1..N}D_{i}(s_{i})+\gamma\sum_{i,j\in N(p_{i})}V_{i,j}\big{(}s_{i} s_{j}\big{)}, \tag{8}\]  
where the semantic meaning of \(D_{i}(s_{i})\) can be understood as the loss of the current object, designated under a different classification tag. When this object is labeled with tag X\({}_{i}\), the consistent difference between its observed and expected features is greater; the greater this value, the smaller the matching degree. Furthermore, \(V_{i,j}\big{(}s_{i}s_{j}\big{)}\) describes the degree of proximity between adjacent objects, where \(i\) and \(j\) represent two adjacent points in the neighborhood space; the larger this value, the larger the range of smoothness and the smaller the overall smoothness. \(\sum_{i=1..N}D_{i}(s_{i})\) of the equation sign in Equation (8) expresses the global optimality of the classification results, and \(\gamma\sum_{i,j\in N(p_{i})}V_{i,j}\big{(}s_{i}s_{j}\big{)}\) expresses the local smoothness of the classification results. In the classification problem based on the Markov model, Equation (8) was solved for the minimum value.