# Interferometric Wavefront Sensing System Based on Deep Learning
## 2 Method
### Wavefront Analysis Neural Network
#### 2.2.2 Training Data Generated  
The neural network only works well after being trained, and it needs a lot of training data. According to the function of net1, the wrapped phase is needed as the input, and the wrap count corresponds to the output label. We also need the true phase map as the final result reference. Specifically, the true phase map was simulated by performing arithmetic operations (addition or subtraction) on 7-15 two-dimensional Gaussian functions with random mean and variance. Then,  
Figure 3: The smooth process of the output of net1. (**a**) Wrapped phase; (**b**) wrap count estimated by net1; (**c**) unwrapped phase of net1; (**d**) individual points corrected by smooth method; (**e**) regions corrected by smooth method; (**f**) 3D image of the corrected wavefront. wrap the true phase to get the wrapped phase. Finally, according to Equation (7), the wrap count can be calculated. Net2 needs the true phase map as the input and Zernike coefficients as the output label. However, the Zernike coefficients calculated according to the true phase map have errors and cannot be used as the training label of the net2. The method of using random numbers as the Zernike coefficients to reconstruct the wavefront cannot produce the type of the true phase we desire. To ensure that the training data of net1 and net2 are of the same type, we proposed a novel method to generate the training data: First, the covariance matrix method is used to fit the first 36 Zernike coefficients corresponding to the true phase map, as formulated in Equations (11)-(24). For N points on a wavefront, the phase value of each point can be expressed as:  
\[\mathrm{W_{i}}=\mathrm{a_{0}}+\mathrm{a_{1}Z_{1i}}+\mathrm{a_{2}Z_{2i}}+\cdots +\mathrm{a_{j}Z_{ji}}+\cdots+\mathrm{a_{n}Z_{ni}} \tag{11}\]  
where the index \(\mathrm{i}=1,\cdots,\mathrm{N}\), and \(\mathrm{n}=36\). \(Z_{\mathrm{ji}}\) represents the value of the j-th Zernike polynomial at the i-th point. The average value of the N points is expressed as:  
\[\overline{\mathrm{W}}=\mathrm{a_{0}}+\mathrm{a_{1}\overline{Z}_{1}}+\mathrm{ a_{2}\overline{Z}_{2}}+\cdots+\mathrm{a_{j}\overline{Z}_{j}}+\cdots+\mathrm{a_{n} \overline{Z}_{n}}. \tag{12}\]  
Here, \(\overline{Z}_{j}\) is defined as \(\overline{Z}_{j}=\frac{1}{\mathrm{N}}\sum\limits_{i=1}^{\mathrm{N}}Z_{ji}\). Subtracting Equation (12) from Equation (11), the function can be expressed as:  
\[\mathrm{U_{mi}}=\mathrm{a_{1}U_{1i}}+\mathrm{a_{2}U_{2i}}+\cdots+\mathrm{a_{j} U_{ji}}+\cdots+\mathrm{a_{n}U_{ni}} \tag{13}\]  
where \(\mathrm{U_{mi}}=\mathrm{W_{i}}-\overline{\mathrm{W}}\) and \(\mathrm{U_{ji}}=Z_{ji}-\overline{Z}_{j}\). According to the Gram-Schmidt orthogonalization method [18], a linear combination of \(\mathrm{U_{j}}\) can be used to reconstruct a set of orthogonal polynomials \(\mathrm{P_{j}}\) on discrete data points:  
\[\mathrm{U_{m}}=\mathrm{C_{1}P_{1}}+\mathrm{C_{2}P_{2}}+\cdots+\mathrm{C_{j}P_{ j}}+\cdots+\mathrm{C_{n}P_{n}} \tag{14}\]  
where \(\mathrm{P_{k}}\) and \(\mathrm{P_{j  
By analogy, we can get all the values of \(\alpha_{\rm jk}\), which can be expressed as:  
\[\alpha_{\rm jk}=\frac{\sum_{i=1}^{\rm N}U_{\rm ij}P_{\rm ki}}{\sum_{i=1}^{\rm N} P_{\rm ki}P_{\rm ki}}\qquad\qquad(\rm\rm\,j>k). \tag{19}\]  
According to Equation (15), when the index \(\rm\,j<k\), \(\alpha_{\rm jk}\) is equal to zero, when \(\rm\,j=k\), \(\alpha_{\rm jk}\) is equal to one. Thus, we can get the polynomials \(\rm P_{\rm j}\).