1. Introduction
The phase retrieval technique plays a crucial part in image recording and reconstruction. Due to the nature of the high oscillation frequency of light, optoelectronic detector arrays cannot follow and record only the magnitude of the light field, i.e., average light intensity over time. In this process, phase, being an essential parameter of the light field and providing significant information of the object, is lost during the measurements. Therefore, efforts have been made for decades to explore different methods for phase retrieval in applications such as holographic imaging [
1,
2,
3], astronomical imaging [
4,
5,
6], and X-ray crystallography [
7].
Classic approaches to phase retrieval rely on iterations between Fourier and object domains. The Gerchberg–Saxton (GS) algorithm [
8], being one of the earliest successful attempts, performs an iterative procedure to obtain an estimation of the phase. Fienup modified the Gerchberg–Saxton algorithm with a new set of object constraints and an error function, and named the algorithm the hybrid input-output (HIO) algorithm [
9]. The HIO method improves converging speed significantly but yields varying results depending on different initials, most of which lead to local minima of the optimization. Therefore, multiple runs need to be performed in HIO parallelly and the operation of getting the average results of those with small errors is essential. To increase the consistency of the results, the geometric average was introduced to the iterations of the HIO algorithm, creating the guided hybrid input-output (GHIO) algorithm [
10]. The GHIO method manages to jump out of local minima by running multiple initials parallelly and making good use of a better one between all intermediate results during iterations to guide the direction. However, the success of GHIO depends strongly on multiple runs just like HIO, which come at the cost of more computation. Another multiple initials algorithm utilized particle swarm optimization (PSO) in HIO, which makes random initial particles learn and renew each other, and therefore increases the possibility of reaching the global minimum [
11,
12]. However, the random nature of stochastic perturbations jeopardized the efficiency of the algorithm.
In the past decade, there have been some new attempts on phase retrieval. Inspired by the idea of compressed sensing [
13], Moravec et al. put forward compressive phase retrieval, in which the signal’s sparsity was used as additional prior information to help phase recovery [
14]. Different measuring methods, such as tilt illumination [
15,
16] and optical gratings [
17], were introduced to acquire more information for phase retrieval [
18].
The emergence of novel methods has significant impacts on the development of phase retrieval, and in the meantime there is still room for improvements of classic algorithms, especially when being combined with modern intelligent optimization algorithms. Here in this work, we propose applying the concept of simulated annealing [
19] to HIO to tune the iteration parameter adaptively during the optimization in order to address the problem that many runs need to be performed parallelly in HIO to yield good phase retrieval results. In the process of the algorithm combining HIO and simulated annealing, the present iteration results that own smaller errors in the Fourier domain (ERF) than the previous will be accepted unconditionally; those owning larger errors in the Fourier domain (ERF) than the previous will be accepted according to a simulated annealing probability. Performances of different phase retrieval algorithms are compared quantitatively by numerical simulations and practical experiments. The comparison demonstrates that the proposed method is superior in the converging speed and degree during iterations.
2. Hybrid Input-Output (HIO) Algorithm
In Fienup’s HIO algorithm, phase retrieval is performed by the following steps:
- (1)
Generate a random distribution
in the object domain as an initial distribution. By performing Fourier transform on
, a complex distribution
is yielded in Fourier domain,
where
is the magnitude, and
is the phase;
- (2)
Replace the modulus
with the measured magnitudes experimentally known as
and keep its original phases to get a combinatorial
, i.e.,
- (3)
Generate an estimation
in the object domain by inverse Fourier transformation as
- (4)
For the
iteration, i.e., the next iteration, the estimation of the object is determined as
where
is a constant and
are the regions at which
breaches the object-domain constraints, i.e., wherever
is negative or it goes beyond the known area of the object [
20]. A brief procedure of the HIO method is shown in
Figure 1a.
In this way, the image is reconstructed iteratively and its quality is judged by the mean-square errors (MSE) [
11], i.e.,
where
and
mean the reconstructed and original images, respectively;
and
represent the two-dimensional size of the image.
The parameter in Equation (4) has a crucial impact on the results of the HIO algorithm. The impact could be embodied as the fact that the same initial distribution with different choices of leads to dramatically different reconstructions, and there is no guarantee that the best can be found to run the HIO algorithm due to the nonconvexity of phase retrieval. Therefore, most of the time, a better result is obtained by performing many runs of HIO with different initial distributions or different and averaging their results, which requires large computational time.
However, HIO does not have to run alone because it can be looked on as a suboptimal version of a more general approach [
20]. This implies that the HIO method could be combined with other methods and be regarded as a part of a more universal method. Therefore, we expect to propose a more general approach, in which the rule of utilizing fixed
in a single run of HIO is changed by introducing other algorithms. In this way, a better result could be brought about with fewer runs and less computational time. In other words, a better reconstruction could be realized by the modified method in a single run.
3. Simulated Annealing Hybrid Input-Output
Inspired by some existing algorithms that apply simulated annealing for phase retrieval [
21,
22,
23], in this work we use the concept of simulated annealing in HIO to address the problem of fixed
during the iterations.
As an effective probabilistic technique, simulated annealing plays an important role in approximating the global optimum of a given function. It derives from the physical process of annealing in metallurgy, to make perfect crystals by heating and controlled cooling. In this way, particles in crystals can be arranged in a state with minimal possible energy, provided that the beginning temperature is sufficiently high and the cooling is sufficiently slow [
24].
There are usually four steps in simulated annealing.
- (1)
Start with an appropriate annealing temperature ;
- (2)
Give a perturbation to get a random state close to the current one and calculate the cost function of the new one corresponding to the energy physically;
- (3)
Accept the new state if
where
, and otherwise accept it on a probabilistic basis under the Metropolis criterion [
25]. The annealing probability is given by
where
is the Boltzmann constant;
- (4)
Decrease the temperature and start the next iteration from (2).
Equation (6) demonstrates that the probability increases with and decreases with , which means that particles still tend to accept the new state if it is a bit worse than before in a high temperature.
The proposed simulated annealing hybrid input-output algorithm hereafter referred to as SAHIO, is divided into five steps:
- (1)
Generate a random initial distribution
in the object domain and give an initial temperature
and a value of
. In our experiment, the initial temperature
could be set as
- (2)
Get the Fourier transformation just like Equation (1). Then substitute the modulus of , namely , with the measured data experimentally referred to as and keep its original phase angles to get integrated . Next, perform inverse Fourier transformation to acquire an estimate in the object domain, which is described in Equation (3);
- (3)
For the
iteration, i.e., the next iteration, calculate
according to Equation (4) and then evaluate the errors of
and
respectively using an error function, i.e.,
Furthermore,
, regarded as an analogy with
, is obtained by
- (4)
Accept
as
at the beginning of the next iteration if
or
but it satisfies
where
is a random number generated by the computer, which satisfies uniform distribution between 0 and 1. In this way, we could simulate the annealing event according to probability
because of
. In other words,
means accepting
as
according to the simulated annealing probability
p. Otherwise, reject
and make
as
to start the next iteration;
- (5)
Change the value of β randomly between 0 and 1 for the next iteration. Moreover, decrease the temperature according to some criteria.
The whole process of the SAHIO method is displayed in
Figure 1b. As for the criteria of cooling, there are two points to be noted:
- (6)
Lowering temperature too often and fast is not advised sometimes; that is to say, it is better to drop during every iteration, where is often greater than 1 and it could be set empirically;
- (7)
The strategy of reducing
is various and in this work, it decreases exponentially, i.e.,
where
γ is a constant between 0 and 1 and in this work it is set as 0.8.
To show the operability of the algorithm, a piece of pseudo-code of SAHIO is given in Algorithm 1: The pseudo-code of SAHIO.
Algorithm 1: SAHIO (Simulated Annealing Hybrid Input-Output) |
1: Generate a random initial distribution and give the constraint regions ; |
2: Set the initial temperature and set ; |
3: Give the number of internal and external iterations, e.g., and ; |
4: Caculate according to Equation (8); |
5: for do |
6: for do |
7: set ; |
8: set , and ; |
9: caculate according to Equation (4); |
10: caculate according to Equation (8) and ; |
11: if then |
12: set ; |
13: else then |
14: generate a random number ; |
15: if then |
16: ; |
17: else then |
18: set and ; |
19: end if |
20: end if |
21: change the value of randomly; |
22: end for |
23: set ; |
24: end for |
In the above algorithm proposed, temperature and simulated annealing probability are both crucial parameters. Due to the fact of the different magnitude of for different objects, an appropriate initial temperature is chosen at the beginning of the algorithm to constrain the ratio of to in Equation (10) to guarantee the probability of not more than 1 during iterations. Changing randomly between 0 and 1 could give a different step or direction for the HIO method to improve the performance while fixed beta is easier to lead to local minima.
Although it is an effective indicator for to judge the quality of the HIO’s current iterative result, greed and myopia are hidden in it meanwhile. A “temporarily worse” intermediate result could lead to a “finally better” result. Therefore, we decrease the temperature according to some criteria such as Equation (11) to increase the probability of accepting the “temporarily worse” results in the later stage of iterations, which helps jump out the local minima and reach the global minimum.
4. Results
To compare the performance of different algorithms, a series of numerical simulations were implemented as follows.
First, a comparison between HIO and SAHIO methods was given. We performed the phase retrieval simulation with the same two original images and an identical initial distribution for different methods to guarantee uniqueness. It is worth mentioning that there exists a best initial temperature for the SAHIO, but how to find it is not in the scope of this work and we used Equation (7) to generate our initial temperature.
Figure 2 shows the two original pictures;
Figure 3 and
Figure 4 demonstrate the reconstructed images and their MSEs after 200 iterations by HIO and SAHIO methods, respectively;
Figure 5 displays the average MSEs during iterations.
From
Figure 3 and
Figure 4, it is obvious that the images reconstructed by the SAHIO method, with smaller MSEs, were clearer than the others. On average, the MSE yielded by the SAHIO methods was 64.42% lower than that of the HIO method for 2 images.
However, it is hard to reflect the advantages of the SAHIO algorithm, generally due to the small sample size (only two original images and one initial distribution). Therefore, to verify the universality of the SAHIO method, a large numerical simulation was carried out with 35 general images, in which 10 generated initial distributions are used to start up 2 algorithms, respectively (i.e., 10 runs are performed parallelly for each image of 35, and their results are averaged at last). The average MSEs during iterations are shown in
Figure 5 as well.
Some observations and deductions could be made from
Figure 5:
- (1)
Overall, the MSEs yielded by two algorithms decreased with increasing numbers of iterations with different speeds and results, which means that both methods have dissimilar degrees of the ability to reconstruct images.
- (2)
Generally speaking, the SAHIO method declined faster than HIO. However, it is worth noting that in the early iterations, SAHIO, at a slight disadvantage for decreasing the MSE, showed a bit greater fluctuation owing to randomly changing. It was the random process of the exploration that delayed the time in the former steps but gave more chances to avoid the local minima in the latter stage.
- (3)
At the end of 200 iterations, for 35 images the average MSE yielded by the SAHIO method converged at the lowest value, i.e., 0.00745, while the HIO method ended up with 0.01493; that is to say, the MSE generated by the SAHIO method was 50.12% smaller than the HIO method, demonstrating its strength of jumping out of the local minima and searching for the global optimum.
We concluded that the SAHIO algorithm is better than the HIO algorithm both on speed and degree of convergence. Furthermore, theoretically, all algorithms based on HIO but replacing HIO with SAHIO are expected to get better results. Therefore, a second simulation was carried out to investigate the effect of the method combining the SAHIO and GHIO algorithms, termed as SAGHIO. The same 35 images with 6 initial distributions were used in this experiment, and GHIO was regarded as a baseline to be compared with SAGHIO. The average MSEs during 200 iterations are shown in
Figure 6, and some inferences can be drawn:
- (1)
The MSEs curve of SAGHIO converged faster than that of GHIO. In the beginning, SAGHIO performed a little worse; SAGHIO caught up quickly, but the speed advantage seemed less obvious with iterations going on;
- (2)
At the end of 200 iterations, the MSEs of SAGHIO converged to a lower number, i.e., 0.00152, while GHIO was 0.00266. Due to the restriction of the axis scale, the difference of final MSEs between SAGHIO and GHIO was inapparent, but SAGHIO’s result was 42.857% better than GHIO’s indeed, which means SAGHIO could reconstruct images clearer in general.
Moreover, the physical experiment for testing the effect of the SAHIO method was designed. A simple imaging system shown in
Figure 7 was set up. The light emitted by the laser (
) passed through the beam expander and got collimated into parallel light by the convex lens group (
,
) and then illuminated the object, i.e., a
triangle aperture. The Fourier magnitude of the triangle aperture was recorded on the focal plane of the third convex lens (
) by a CCD (Daheng Optics, Beijing, China, MER-030-120UM). Phase retrieval was performed by HIO (
) and SAHIO respectively in three runs, and the reconstructed objects, Fourier amplitudes and phases distributions are shown in
Figure 8.
Figure 9 shows their ERFs during 200 iterations, which are used to judge the quality of reconstructed objects.
Similar observations and deductions could be made from
Figure 9. The ERFs of iterative results from SAHIO could get a lower level than those from HIO, which means that the quality of reconstructed images by SAHIO is better than that by HIO. Therefore, it can be concluded that SAHIO is more capable of reaching the global minima than HIO.
5. Discussion
Although the SAHIO method could address the plight of getting trapped in local minima to some extent, there still exists some room for improvement.
First, methods of generating and updating temperature could be explored much more. We introduced temperature to regulate the process of annealing in the hybrid modified algorithm, and the choice of initial temperature and the criteria of decreasing temperature are both of great importance. An appropriate initial temperature could not only ensure the probability is not more than 1 during iterations but also stimulate the potential of searching for the global minimum for the SAHIO algorithm. Proper criteria of cooling could control the process of the whole algorithm to speed it up or deepen it. In the experiments of this article, we used Equations (7) and (11) to generate and update the temperature, but there may be other better methods to do the same job. Therefore, it deserves more effort to explore better methods for all kinds of applications.
Second, not only MSE and ERF but also other ways to judge the quality of reconstructed images should be considered. The features of a reconstructed image could be reflected from many aspects and multiple methods could be integrated to evaluate the quality of the phase retrieval results comprehensively.
Last, changing randomly in the SAHIO algorithm of this article was a bit inefficient sometimes; a more appropriate and directional change is expected to replace the random one. All in all, more efforts on phase retrieval should be made for improvement in the future.
6. Conclusions
In this work, we incorporated simulated annealing into the HIO method to propose a combined phase retrieval scheme, namely the SAHIO algorithm. By the benefit of the SA method, the SAHIO algorithm lessens the possibility of locking into the local minima compared with the HIO method. A series of ideal universal pictures were used as the original images for different algorithms to compare their results and test the feasibility and superiority of the SAHIO scheme. It was concluded in the numerical simulations that the SAHIO method has more potential to deal with the nonconvex optimization, with the MSE 50.12% smaller than the HIO method when 35 original images were used in 10 runs. Although the SAHIO scheme lagged in speed at the beginning, it surpassed HIO gradually. Furthermore, SAHIO was applied in the interaction process like SAGHIO and it still led to better results compared with basic GHIO. Moreover, a physical experiment of retrieving phases of a triangle aperture was carried out to compare SAHIO with HIO, and the similar superiority of SAHIO was exhibited.
Both numerical and physical experiments indicate that SAHIO can be utilized in the Fourier spectrum based on image recovery techniques to reconstruct images better. The problem of introducing additional parameters was analyzed qualitatively, and a direction of improvement was given meanwhile. More efforts on phase retrieval algorithms need to be made in the future.