# A Deep Learning-Based Approach for Extraction of Positioning Feature Points in Lifting Holes
## 2 Methods
### The Point Extraction Method Based on Line Features
#### 2.4.2 Clustering Method for Boundary Points
The purpose of the GMM is to estimate unknown parameters \(\Theta=\{w_{1},\cdots,w_{C};\mathbf{\mu}_{1},\cdots,\mathbf{\mu}_{C};\mathbf{\Sigma}_{1}, \cdots,\mathbf{\Sigma}_{C}\}\) based on the observed dataset \(\mathbf{X}=\{\mathbf{x}_{1},\cdots,\mathbf{x}_{N}\}\). For any observed value \(\mathbf{x}_{i}\), let the set of parameters for the \(j\)th cluster be denoted as \(\theta_{j}\in\Theta\), where \((1\leq j\leq C)\). The probability of \(\mathbf{x}_{i}\) belonging to the \(j\)th cluster can be modeled as \(w_{j}(\sum w_{j}=1)\), and the probability distribution of \(\mathbf{x}_{i}\) can be expressed using the following equation:  
\[p(\mathbf{x}_{i}|\Theta)=\sum_{j=1}^{C}w_{j}p(\mathbf{x}_{i}|\theta_{j}) \tag{10}\]  
The logarithm of the maximum likelihood function \(\mathrm{L}(\Theta)\) can be used to evaluate the unknown parameters \(\Theta\), which can be expressed as:  
\[\mathrm{L}(\Theta)=\log\ p(\mathbf{X}|\Theta)=\sum_{i=1}^{N}\log p(\mathbf{x}_{i}| \Theta)=\sum_{i=1}^{N}\log\!\!\sum_{j=1}^{C}w_{j}p(\mathbf{x}_{i}|\theta_{j})= \sum_{i=1}^{N}\log\!\!\sum_{j=1}^{C}w_{j}p(\mathbf{x}_{i}|\mathbf{\mu}_{j},\mathbf{\Sigma} _{j}) \tag{11}\]  
\(L(\Theta)\) can be solved using the Expectation-Maximization (EM) algorithm [33], with the initialization of parameters \(w_{j}^{(0)},\mathbf{\mu}_{j}^{(0)},\mathbf{\Sigma}_{j}^{(0)}\). The recursive formulas for these parameters are as follows:  
\[w_{j}^{(s+1)}=\frac{1}{N}\sum_{i=1}^{N}\gamma_{ij}^{(s)},j=1,\cdots,\mathrm{C} \tag{12}\]\[\mu_{j}^{(s+1)}=\frac{\sum\limits_{i=1}^{N}\gamma_{ij}^{(s)}x_{i}}{\sum\limits_{i= 1}^{N}\gamma_{ij}^{(s)}},j=1,\cdots,\text{C} \tag{13}\]  
\[\Sigma_{j}^{(s+1)}=\frac{\sum\limits_{i=1}^{N}\gamma_{ij}^{(s)}(\textbf{x}_{i}- \textbf{\mu}_{j}^{(s)})(\textbf{x}_{i}-\textbf{\mu}_{j}^{(s)})^{\text{T}}}{ \sum\limits_{i=1}^{N}\gamma_{ij}^{(s)}},j=1,\cdots,\text{C} \tag{14}\]  
The posterior probability \(\gamma_{ij}^{(s)}\) of given \(\Theta^{(s)}\) can be represented as:  
\[\gamma_{ij}^{(s)}=\frac{w_{j}^{(s)}\mathcal{N}(\textbf{x}_{i}\mid\textbf{\mu }_{j}^{(s)},\Sigma_{j}^{(s)})}{\sum\limits_{j=1}^{\text{C}}w_{j}^{(s)} \mathcal{N}(\textbf{x}_{i}\mid\textbf{\mu}_{j}^{(s)},\Sigma_{j}^{(s)})},i=1, \cdots,\text{N;}j=1,\cdots,\text{C} \tag{15}\]  
According to the assumption of independence, the next values of \(x,\mu,\Sigma\) need to be maximized by the expectation function, which is defined as:  
\[\text{Y}\Big{(}\Theta^{(s)}\Big{)}=\sum\limits_{i=1}^{N}\sum\limits_{j=1}^{C }\gamma_{ij}^{(s)}\text{log}w_{j}\mathcal{N}(\textbf{x}_{i}|\textbf{\mu}_{j}, \Sigma_{j}) \tag{16}\]  
Update the parameters in above equations sequentially until \(\text{L}(\Theta)\) is below a certain threshold. The performance of GMM heavily relies on the density of sample points. If the points are too sparse or too dense, it can lead to clustering errors. To address this, the distance between any two adjacent points was evaluated, and if the distance exceeded 12 pixels, an additional point will be inserted at the midpoint of those two points. This method effectively controlled the density of points. The resulting clustering outcome, as depicted in Figure 8c, clearly demonstrates the performance of this clustering approach.