# Optical Element Surface Defect Size Recognition Based on Decision Regression Tree
## 3 The Principle of Defect Size Recognition
### Defect Size Recognition Based on DRT  
#### 3.2.1 Generation of DRT  
DRT is a machine learning algorithm and is often used to solve classification and regression problems. The defect size recognition according to its far-field simulation light intensity distribution can be regarded as a regression problem. Hence, we employ the DRT to study the relationship between the defect size and its light intensity distribution, and its training data set (i.e., revised light intensity distribution \(I^{\prime}_{\text{far}}(x)\) of different size defects) can be obtained from the simulation model in Section 3.1. The schematic diagram of defect size recognition based on DRT is depicted in Figure 3. The mean value \(v\) of the distance between three groups of feature points, whose intensity is 0.75, 0.5, and 0.25 of the peak value of \(I^{\prime}_{\text{far}}(x)\), is taken as the feature parameter of the light intensity distribution as follows,  
\[v=\frac{1}{3}(v^{(1)}+v^{(2)}+v^{(3)}) \tag{6}\]  
where \(v^{(1)}\), \(v^{(2)}\), and \(v^{(3)}\) are the distance between points whose intensity is 0.75, 0.5, and 0.25 of the peak value of \(I^{\prime}_{\text{far}}(x)\), respectively. Hence, the relationship between the defect size \(w\) and the light intensity distribution feature parameter \(v\) can be depicted by  
\[w=T(v) \tag{7}\]  
where \(T(\ )\) is the function of DRT. For the \(i\)th light intensity distribution curve, its feature parameter \(v\) is marked as \(v_{i}\), and its corresponding width \(w\) is marked as \(w_{i}\). Hence, the training data set of DRT can be expressed as \(\mathbf{R}=\{(v_{1},w_{1}),(v_{2},w_{2}),\ldots,(v_{n},w_{n})\}\), where \(n\) is the total number of the light intensity distribution curves. In Figure 3, DRT splits the training data set \(\mathbf{R}\) into \(m\) subsets, and the mean width in each subset is taken as the prediction width of each subset. For example, if the feature parameter \(v\) of a defect, whose width is unknown, belongs to a subset \(\mathbf{R}_{k}\), then we will obtain its width recognition result \(\overline{w}_{k}\), according to the mapping relationship \(T\) as follows,  
\[T(v)=\overline{w}_{k}\,(v\in\mathbf{R}_{k}) \tag{8}\]  
The specific defect size recognition process is shown in Figure 4. It mainly consists of three parts. The first part is to extract the feature parameter from the defect image. Our MSDI system mentioned in Section 2 is used to acquire the defect image. Considering there is inevitably some dirt and dust on  
Figure 3: Schematic diagram of defect size recognition based on the decision regression tree (DRT). the optical element surface, which will cause the noise to the defect gray distribution, we use image process methods, such as image filtering and outlier removal, to eliminate the noise of the image. Then, the gray distribution of the defect is extracted from the denoising image. After gray normalization, the feature parameter of the defect is obtained from the normalized gray distribution. The second part is about collecting training data for DRT. A simulation model of MDSI mentioned in Section 3.1 is built based on the FDTD method, and the simulation light intensity distribution revised by PSF is taken as the training data of DRT after normalization. The third part is about training DRT to recognize defect size, which is given as follows:  
1. [label=Step 0.] 2. Arrange the training data set \(\mathbf{R}\) in ascending order according to the feature parameter \(v_{i}\), where \(\mathbf{R}=\{(v,w)\}=\{(v_{1},w_{1}),(v_{2},w_{2}),\ldots,(v_{n},w_{n})\}\) and \(v_{1}<v_{2}<,\ldots,<v_{n}\);
3. Go through each \(v_{i}\) in ascending order, and split \(\mathbf{R}\) into two subsets according to \(v_{i}\), which are \(\mathbf{R}_{\text{left}}=\{(v,w)\}[v\leq v_{i}]\) and \(\mathbf{R}_{\text{right}}=\{(v,w)\}[v>v_{i}]\). Then, calculate the mean width \(\overline{w}\) of each subset, and use \(\overline{w}\) as the width estimation value of all \(v_{i}\) in each subset.