A Novel SPGD Algorithm for Wavefront Sensorless Adaptive Optics System

Stochastic parallel gradient descent (SPGD) is the most frequently used optimization algorithm for correcting wavefront distortion in the wavefront sensorless adaptive optics(WFS-Less AO)system. However, the convergence speed of the SPGD algorithm becomes slow rapidly as increasing of distortion, and the probability of falling into local optimum is rising owing to the fixed gain coefficient. It cannot meet the requirement of real-time wavefront distortion correction. Therefore, a novel algorithm is proposed in this paper, called as adaptive gain stochastic parallel gradient descent (AGSPGD) based on the AMSGrad optimizer in the deep learning, to improve the convergence speed of the algorithm and to reduce the probability of falling into local optimum. The AGSPGD algorithm adopts the first-order moment and the second-order moment of the performance index, which are combined to dynamically adjust the gain. The numerical simulations are completed in this article. The results of ${\bm{D}}/\ {{\bm{r}}}_0 = \ 2.5$ conditions demonstrate that the AGSPGD can reduce the number of iterations by 25%, and the probability of the algorithm falling into local optimum is reduced from 16% to 4%. In addition, the AGSPGD still outperforms the SPGD as ${\bm{D}}/{{\bm{r}}}_0$ increasing.

WFS-Less AOS mainly depends on the optimization algorithm adopted by the system.
The optimization algorithm for WFS-Less AOS is generally divided into two types: model-free and model-based, or called search based blind optimization algorithms and model-based optimization algorithms. The model-based correction algorithm converges quickly, but it has strict requirements on pupil function, and the formula derivation is very complicated, which limits its application in practical adaptive optics systems. In contrast, the realization principle of model-free algorithm is simpler and less restrictive for optical system, so it is very suitable for WFS-Less AO. Nowadays, the search-based blind optimization (model-free) algorithm mainly includes genetic algorithm (GA), simulated annealing (SA), and stochastic parallel gradient descent (SPGD). The SPGD algorithm was first applied to adaptive optics in 1997 [7], which brought up many aspects of the application [8], [9], [10], [11], [12], [13], [14], [15], [16]. The SPGD algorithm has been the focus of research in recent years owing to its simple implementation and strong comprehensive correction ability [17]. However, the convergence speed of the SPGD algorithm is slow or the result of SPGD algorithm is easy to fall into local optimum, which leads to the low correction performance, when the search space of control variables increases with the increases of the number of correction units or aberration modes [18]. In recent years, researchers have been improving the SPGD algorithm, the decoupled SPGD (DSPGD) algorithm was proposed to improve the coupling efficiency of atmospheric phase aberration compensation for tiled fiber array system [19]. A method that combines pattern recognition and the SPGD algorithm was proposed to avoid the circumstance of the local optimum [20]. Hu et al. proposed an optimization algorithm for ASPGD by combining the Adam optimizer in the field of deep learning with SPGD algorithm, which introduce the momentum to make the gain coefficient be self-adaptive. This algorithm speeds up the convergence speed and reduces the probability of times it falls into local optimum [21]. The momentum SPGD (MSPGD) algorithm was proposed to accelerate the correction process of incoherent beam combination, which not only decreases the iterative times, but also maintains the stability of the combination [22]. The MomSPGD algorithm was proposed, by deriving momentum terms from Newton's equation, to improve the convergence speed and disturbance immunity of coherent beam combinations [23].
To solve the problem that the convergence speed of the SPGD algorithm is slow or the result is easy to fall into local optimum, an optimal optimization algorithm called adaptive This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ gain stochastic parallel gradient descent (AGSPGD) is proposed in this article. The AMSGrad optimizer for deep learning is integrated into the SPGD algorithm, the variation of image performance index is approximated to the gradient. The mean of the gradient is defined as the first momentum term, and the variance of the gradient is considered as the second momentum term. Then the direction and step length of the gradient descent are controlled by first momentum term and second momentum term. In addition, a single loop structure and vector parallel operation is applied to the AGSPGD algorithm, to reduce the sampling times of the far-field camera, and to speed up furtherly the system correction. It is more significant for the real-time and miniaturization, lightweight of the WFS-Less AOS.
This article is organized as follows: Section II provides the model of the WFS-Less AO system and briefly describes the working principles. Then, the existing problems of the SPGD algorithm are introduced and analyzed. A novel hybrid algorithm, AGSPGD is proposed based on the SPGD algorithm and the principle of the AMSGrad optimizer. In Section III, the simulations and the analysis are completed. In Section IV, the simulation results are compared and the comparison results are analyzed through the table. Finally, the conclusion is given in Section V, and the future work is briefly introduced.

II. SYSTEM MODEL AND THEORETICAL ANALYSIS
In this section, the wavefront sensorless adaptive optics system model is presented to facilitate analysis.

A. The WFS-Less AO System Model
The schematic diagram of the WFS-Less AO system is shown in Fig. 1. The WFS-Less AO system consists of the deformable mirror (DM), the imaging lens, the far-field detection CCD camera, the optimal controller, and the high-voltage amplifier. In the propagation of the beam, the wave-front phase of incident light is distorted after passing through inhomogeneous medium. The beam with wave-front distortion is reflected by the DM and is incident by the imaging lens. Then the CCD is used to obtain the far-field spot images of distorted beam. The controller is used to read the far-field spot images and the blind optimization algorithm is adopted to generate control voltage signals according to optimization indexes of far-field spot images, and the control voltage signals are amplified by a high voltage amplifier to compel the deformable mirror. Therefore, the wavefront distortion is corrected. So, the performance of the optimal control algorithm greatly determines whether the wavefront-less sensing adaptive optical system can achieve the desired correction effect.
Generally speaking, the SPGD algorithm's gain coefficient is usually a fixed value. When the wavefront aberration changes rapidly, the result of the SPGD algorithm is easy to fall into local optimum or convergence time increases.

B. Theoretical Analysis of AGSPGD Algorithm
To address the above problems of the SPGD algorithm, this article proposes the SPGD algorithm based on the AMSGrad optimizer called AGSPGD algorithm, which integrates the AMS-Grad optimizer in deep learning and the SPGD algorithm. Then the variation of the performance index of the spot image is approximated as a gradient, the average value of the gradient is defined as the first momentum term, and the variance of the gradient is considered as the second momentum term. The first momentum term is used to control the direction of the gradient descent. When the direction of the gradient descent is positive, a positive excitation is generated, otherwise, a negative excitation is generated. The second momentum term is used to control the step size of the gradient descent method to complete the adaptive gain coefficient when the wavefront aberration changes. On the other hand, the single cycle structure and vector parallel operation are adopted by the AGSPGD algorithm, which reduces the calculation amount of the optimal controller and improves the operation speed, and furthermore, it also reduces the sampling times of the far-field camera greatly. Therefore, the convergence speed of the WFS-Less AO system is accelerated and the probability of falling into local optimum is reduced. The AGSPGD algorithm flowchart is shown in Fig. 2.
The idea of correcting wavefront aberration in the SPGD algorithm is as follows. In the (k-1) iteration, the correction voltage vectors u(k − 1) = {u 1 , u 2 , . . . , u m } are applied to the DM. Before the next iteration, a set of disturbance voltage vectors Δu(k) = {Δu 1 , Δu 2 , . . . , Δu m } are randomly generated, according to the Bernoulli distribution. And the Δu(k) has a fixed amplitude of disturbance, that is, |Δu(k)| = Δu. Then, the forward perturbation voltages u + = u(k − 1) + Δu(k) are applied to DM to obtain the forward performance index J(u + ); and the negative perturbation voltages u − are obtained by a similar method to obtain the negative performance index J(u − ). The formula for calculating the performance index is as follows: where the I is the far-field light intensity. So, the variation of performance index is expressed as Then, the correction voltage vectors applied to the DM after the k th iteration is expressed as where the k is the number of iterations, and the γ is the gain coefficient, the symbol of the γ is determined by the optimization direction of the performance index. When the performance index is optimized to the maximum direction, the γ takes a positive number, otherwise, it takes a negative number. It is precisely because the γ is a fixed value that the SPGD algorithm is easy to fall into local optimum, or convergence time increases. So, the AGSPGD algorithm controls the gain coefficient to adjust automatically to speed up the convergence and to reduce the probability of falling into local optimum. In the AGSPGD algorithm, the gradient is approximated as First, the momentum is introduced into the SPGD algorithm to speed up the convergence [24], [25]. In the AGSPGD algorithm, the first momentum term m(k) is constructed by adding a hyperparameter β 1 , and the average value of the gradient is defined as the first momentum term. Then, by following the article [26], a hyper-parameter β 2 is added to construct the second momentum term v(k), and the variance of the gradient is considered as the v(k). The relevant formulas for m(k) and v(k) are as follows: The control signals are updated by a combination of the first momentum term and the second momentum term to control the gain coefficient to adjust automatically. Therefore, the convergence of the algorithm is speeded and the probability of falling into the local optimal is reduced. However, at the beginning of the iteration, the values of the first and second momentum term are smaller than the real mean and variance, then β 1 and β 2 are close to 1, the error of the algorithm is very large. So, it is necessary to correct the deviation of the first momentum term and the second momentum term [26]. The relevant formulas are expressed asm Then, the maximum value of all gradients is used to update the learning rate to make the learning rate positive all the time, to further speed up the convergence. That iŝ As discussed above, using the AGSPGD algorithm to update the control voltage vectors computation formula is as follows: where the k is the number of iterations, α/(V (k) + ε) is the adaptive gain, α is the learning rate. The ε is a small constant usually set to 10 −8 , that is used to avoid the denominator of 0.
The gain coefficient γ in (3) is a fixed value, which is the main reason why the result of the SPGD algorithm is easy to fall into local optimum or convergence time increases. From the (10), as the gain coefficient of AGSPGD algorithm, the α/(V (k) + ε) can realize automatic adjustment. In addition, Δu(k) 2 avoids the problem of oscillation in the late iterations of the algorithm.
The implementation of the AGSPGD algorithm is comprehensively described in Algorithm 1.
In theory, the AGSPGD algorithm changes the limitation of the SPGD algorithm on fixed gain coefficient. The momentum is used to control the direction and step size of the gradient descent, so that the convergence is speeded up and the probability of falling into local optimum is reduced. The numerical simulations will be carried out next. The results will verify the correction performance of the AGSPGD algorithm.

III. SIMULATIONS AND ANALYSIS
In this section, the numerical simulations are performed to verify the effect of the AGSPGD algorithm on static wavefront aberrations correction. Generally, the DM is used to correct the wavefront aberrations. Therefore, the input wavefront is comprised by the Zernike modes. In the numerical simulations, select the aberrations mode with m = 10.
The wavefront phase distortion is expressed by the weighted sum of the Zernike polynomials and their corresponding coefficients. Therefore, in the following numerical simulations, the Zernike polynomials are used to represent the wavefront phase  5) and (7)) 8. Calculate the bias-corrected second momentum term v(k) (6) and (8)) 9. Take the maximum of the gradientv(k) (9)) 10. Update the control voltage u(k) (see (10)) 11. The SR value reaches the preset condition 12. end for ϕ 0 (ρ, θ). The ϕ 0 (ρ, θ) can be expressed as follows [27]: where Z m (ρ, θ) denotes the m th Zernike polynomial and a k is the corresponding coefficient. In the Zernike polynomials, the 0 th is the translation term, it can be ignored. Z 1 and Z 2 represent the tilt terms along X and Y directions, respectively. The tiptilt mirror (TM) is used to correct these two terms. So, in the simulations, the 3 th to 12 th terms in the Zernike polynomials are modeled as the distorted wavefront, to simulate the atmospheric turbulence.
In the simulations, the Strehl Ratio (SR) is used to measure the correction performance of the two algorithms. The SR is defined as the ratio of the far-field peak intensity of an actual beam to the peak intensity of an ideal beam with the same power and uniform phase. The SR can be expressed as where I denote the far-field peak intensity of the actual beam, and I 0 is the peak intensity of the ideal beam. In order to analyze the feasibility of the AGSPGD algorithm. First, two algorithms are respectively used to correct the same group of randomly generated wavefront aberrations, and then the simulation results are compared. According to Roddier's  method [28], Zernike polynomials with 10 terms of a 3 − a 12 are generated randomly, as shown in Fig. 3(a).
Specifically, the SPGD algorithm and the AGSPGD algorithm are used to correct the same group of random wavefront aberrations in the simulations. When the two algorithms were iterated 800 times, the correction effects of the SPGD algorithm are shown in the Fig. 4.
The correction effects of the AGSPGD algorithm are shown in the Fig. 5.
The SR iteration curves for both algorithms are shown in Fig. 6.
In the simulations, the SR = 0.9 is regarded as the convergence condition of the algorithm. The simulation results show that both the SPGD algorithm and the AGSPGD algorithm can meet the convergence condition. The simulation results of the SPGD algorithm show that when the number of iterations is 800, the SPGD algorithm just reaches the convergence condition in Fig. 6(a). Then, in the AGSPGD algorithm simulation, when the number of iterations is 600, the AGSPGD algorithm reaches  the convergence condition. So, the AGSPGD algorithm reduces the number of iterations by 25% compared with the SPGD algorithm. Besides, when the number of iterations is 630 in Fig. 6(b), the SR value of the AGSPGD algorithm is close to 1, which indicates that the algorithm has fully converged. Moreover, the 3D images show that the corrected energy is more concentrated, and has increased by at least one order of magnitude. So, the above simulation results show that the AGSPGD algorithm has better correction effect than the SPGD algorithm. Therefore, the AGSPGD algorithm is worthy of further research.
In order to avoid the chance and uncertainty caused by a group of random aberrations, the following simulations are carried out. First, 100 groups of wavefront aberrations with aberration intensity D/ r 0 = 2.5 are randomly generated. Then, the SPGD algorithm and the AGSPGD algorithm are used to correct the wavefront aberrations. In the following simulations, the number of iterations is also set to 800, and SR = 0.9 is regarded as algorithm convergence.
The simulation results of 100 groups of wavefront aberrations corrected by the SPGD algorithm are shown in Fig. 7. The red bold line represents the SR average value of 100 groups of wavefront aberrations.
Similarly, the simulation results of 100 groups of wavefront aberrations corrected by the AGSPGD algorithm are shown in Fig. 8. And the red plus bold line also represents the average value of SR.
It can be known from the above 100 groups of simulation results that: first, when the algorithm iteration times is 800, in the Fig. 7, the average value of SR is 0.79. It shows that the result of the SPGD algorithm does not meet the convergence condition. However, in the simulations of the AGSPGD algorithm,  the average value of SR is 0.94 in Fig. 8, which reaches the convergence condition. Therefore, the simulation results of 100 groups of random wavefront aberrations show that the AGSPGD algorithm has better correction effect than the SPGD algorithm when the number of iterations is the same.
In addition, if the SR < 0.3, the result of the algorithm is considered to fall into the local optimum. According to the simulation results, when the SPGD algorithm is used for correction, 16 groups of the 100 wavefront aberrations fall into the local optimum, so the convergence probability is 84%. But only 4 groups fall into local optimum when the AGSPGD algorithm is used to correct, and the convergence probability is 96%. Obviously, the AGSPGD algorithm reduces the probability of falling into the local optimum. The simulation results of 100 groups are consistent with the above results, so the correction effect of the AGSPGD algorithm is better than the SPGD algorithm. By the way, the SPGD algorithm oscillates at the end of iteration, but the AGSPGD algorithm almost does not.
Next, according to the simulation results of the two algorithms, the group of wavefront aberrations with the worst correction effect is found and corrected separately after adjusting  the parameters Δu and α. And the SR = 0.8 is regarded as the convergence condition. The simulation results of separate correction by using the SPGD algorithm are shown in Fig. 9.
The AGSPGD algorithm is adopted to conduct the following simulations, and the simulation results are shown in Fig. 10.
As shown in Fig. 9, when the number of iterations is 800, the SR value increases from 0.03 to 0.75 by adjusting the parameters Δu and αof the SPGD algorithm, but the convergence condition is still not reached. However, after adjusting the parameters of  the AGSPGD algorithm, its SR value increases from 0.02 to 0.83 in Fig. 10. This result achieves the convergence condition. Therefore, the simulation results show that due to the high sensitivity of some parameters of the algorithms, the correction results of partial wavefront aberrations are not ideal. But there is no doubt that the correction performance of AGSPGD algorithm is better than that of SPGD algorithm.
In order to further verify the correction performance of the AGSPGD algorithm, the intensity of wavefront aberrations is increased, and the two algorithms are used to correct wavefront aberrations. Similarly, 100 groups of wavefront aberrations with intensity D/ r 0 = 5 are randomly generated. In the simulations, set the number of iterations to 1000.
The results of correcting 100 groups of wavefront aberrations with the SPGD algorithm are shown in Fig. 11. Consistent with the previous simulations, the red plus bold line represents the average value of SR.
The simulation results of 100 groups of wavefront aberrations corrected by the AGSPGD algorithm are shown in Fig. 12. And the red plus bold line also represents the average value of SR. Compared with the above simulation results, it is obvious that the enhancement of wavefront aberrations will degrade the correction performance of the AGSPGD algorithm, but the effect is significantly less than that of the SPGD algorithm. Specifically, when the intensity of wavefront aberrations is increased, the correction performance of the SPGD algorithm decreases significantly, and the average SR is only 0.45. Although the AGSPGD algorithm is also affected, its correction effect is still better than the SPGD algorithm, and the SR average value is 0.64. In addition, the simulation results in Fig. 11 show that the SPGD algorithm will produce oscillation when it reaches convergence, while the AGSPGD algorithm is relatively stable, as shown in Fig. 12. Therefore, the AGSPGD algorithm is better than the SPGD algorithm in correction performance. For the above two algorithms, the SR average value of both is less than 0.8, which may be because some parameters of the algorithm are too sensitive or the number of iterations is insufficient.
From the above simulation results, it can be seen that the performance of AGSPGD algorithm is still better than SPGD algorithm under the condition of increasing aberrations intensity. In order to verify whether the poor correction effect of the two algorithms is related to too sensitive parameters, the following simulations are carried out.
As in the above simulations, the wavefront aberrations with the worst correction effect in the simulation results of the two algorithms should be found out and corrected after adjusting the parameters Δu and α, respectively. In the following simulations, the number of iterations is set to 1000 and the SR = 0.8 is regarded as algorithm convergence.
The simulation results by using the SPGD algorithm are shown in Fig. 13.
The simulation results by using the AGSPGD algorithm are shown in Fig. 14.  According to the above simulation results, the correction effect of the two algorithms is significantly improved after adjusting parameters Δu and α. Specifically, it can be seen from Fig. 13 that the SPGD algorithm after adjusting parameters is used to correct wavefront aberrations, and the SR value increases from 0.03 to 0.69. Although the convergence condition is not reached, its correction effect has been significantly improved. When the parameters are adjusted, the simulation results show that the SR value increases from 0.028 to 0.86 by using the AGSPGD algorithm, which achieves the convergence condition, as shown in Fig. 14. These two simulation results prove the hypothesis above that the poor correction effect is related to too sensitive parameters. At the same time these results also show that the correction performance of the AGSPGD algorithm is better than the SPGD algorithm.

IV. COMPARATIVE ANALYSIS
To directly compare correction speed and the probability of falling into local optimum of the two algorithms, the above simulation results are compared and analyzed in this section, as follows Tables I and II.  TABLE II  COMPARISON OF THE AVERAGE VALUE OF SR AND THE TIMES OF FALLING  INTO LOCAL OPTIMUM BETWEEN THE TWO ALGORITHMS By comparing the data of the two algorithms in Table I, the correction speed of the AGSPGD algorithm is 25% faster than the SPGD algorithm. And based the Table II, the correction performance of the AGSPGD algorithm is better than that of the SPGD algorithm under different D/r 0 . In this section, the SR < 0.3 is regarded as the result of the algorithm falls into the local optimum. When D/ r 0 = 2.5, the probability of the AGSPGD algorithm falling into local optimum is reduced by 12% compared with the SPGD algorithm. When D/ r 0 = 5, the probability of the AGSPGD algorithm falling into local optimum is reduced by 7% compared with the SPGD algorithm.
Based on the above analysis, the AGSPGD algorithm converges faster and has a smaller probability of falling into the local optimum than the SPGD algorithm. And on the other hand, this article proves that the reason why the convergence condition is not achieved is related to the sensitivity of the parameters, rather than the unreasonable algorithm itself. Similarly, it can be guessed from the SR curve that the number of iterations will limit the convergence effect as the aberration intensity increases. Therefore, some simulation studies on improving aberration intensity and increasing iteration times will be further carried out in the future.

V. CONCLUSION
The results demonstrate that the correction effect of the SPGD algorithm is related to the wavefront aberration intensity and the number of iterations. Moreover, the adaptability of the perturbation voltage amplitude Δu, the gain coefficient γ and other parameters of the algorithm is poor. These reasons lead to slow convergence of the result of the SPGD algorithm and even easy to fall into local optimum. Therefore, an improved SPGD algorithm called the AGSPGD algorithm is proposed in this article to accelerate the convergence of SPGD algorithm and reduce the probability of falling into the local optimum. The AGSPGD algorithm adopts adaptive gain coefficient, and its convergence speed is faster than the SPGD algorithm. Moreover, it is less affected by the change of wavefront aberration intensity. Specifically, the AGSPGD algorithm can reduce the number of iterations by 25% compared with the SPGD algorithm, and the probability of the algorithm falling into local optimum is reduced from 16% to 4%. In addition, the parameter adaptability of the AGSPGD algorithm is stronger than that of the SPGD algorithm.
In general, the AGSPGD algorithm proposed in this article has the characteristics of fast convergence speed and is not easy to fall into the local optimum.
In the future, as an optimized SPGD algorithm, the application of the AGSPGD algorithm in optical problems with higher turbulence intensity and more complex will be further studied.