# Low-Photon Counts Coherent Modulation Imaging via Generalized Alternating Projection Algorithm
## 2 Methods  
Generally, phase retrieval is a non-convex optimization problem, due to the intensity measurement of wavefields. Unlike convex situations, non-convex optimization problems are at risk of stagnation at local minima and saddle points [43]. Current phase retrieval algorithms usually introduce additional regularizing priors to the optimization function to reduce the scope of the solution space. In the following, we briefly sketch the basics of the proposed CMI-GAP algorithm. As is common in machine learning [44], dictionary learning [45], compressive sensing [46], as well as sparse coding [47], the phase retrieval problem in CDI can be represented as an objective function  
\[\min_{x}\frac{1}{2}\||Ax|-y\|_{2}^{2}+R(x). \tag{1}\]  
Here, \(x\) is the complex object wavefield to be recovered. \(y\) is the measured diffraction data. \(A\) stands for the free space propagation operator. In the near-field, forward propagation is defined as  
\[P_{near}=As\{M\{As(x\cdot s)\}\}. \tag{2}\]\(M\) is the transmission function of the modulator and \(s\) is the support function. _As_ denotes the angular spectrum propagation method. Additionally, in far-field, forward propagation is defined as  
\[P_{far}=F\{M\{As(x\cdot s)\}\}, \tag{3}\]  
where \(F\) denotes the Fourier transform. In Equation (1), \(\||Ax|-y\|_{2}^{2}\) is a smooth fidelity term, which can be minimized under a standard gradient descent method, while \(R(x)\) is a non-differentiable regularization term. The proximal gradient algorithm can be adopted for such optimization problems; the so-called proximal operator is defined as  
\[prox_{g}(x,\lambda)=\underset{x}{\operatorname{argmin}}\frac{1}{2}\||Ax|-y\|_ {2}^{2}+\lambda g(x). \tag{4}\]  
The phase solution \(x\) is calculated by minimizing the combination of the fidelity term \(\||Ax|-y\|_{2}^{2}\) and regularization term \(g(x)\). Constant \(\lambda\) adjusts the weighting of the regularization term relative to the fidelity term. Iterative phase retrieval algorithms for CDI involve projections between two spaces and imposition of constraints, which can generate satisfying results under certain limitations [48]. For CMI, the propagation operator \(A\) also includes wavefront modulation. We observed that a forward operator \(A\) with a complex matrix structure could enhance the encoding effectiveness of the sample phase and accelerate the retrieval process greatly. CMI shows good performance in X-ray and optical experiments when the measured data are not subject to heavy noise [38; 39]. The GAP framework is one popular method that can retrieve high fidelity images from contaminated data by incorporating sample priors. Compared with other algorithms, such as ADMM [49] and TwIST [50], the GAP algorithm uses only Euclidean projection in updating the unknown \(x\). PnP-GAP exhibits global convergence for data recorded in the scheme of snapshot compressive imaging [51; 52]. In this work, we adopt the GAP strategy to suppress the noise and enhance the performance of CMI in a low lighting scenario. According to the GAP framework, Equation (4) can be reformulated as  
\[(x,z)=\operatorname{argmin}\frac{1}{2}\|y-|Ax|\|_{2}^{2}+\lambda g(z).\,s.t.x=z. \tag{5}\]  
Here, a new variable \(z\) is introduced into the objective function. The conditional constraint term \(x=z\) is then replaced with a penalty term, given by  
\[(x,z)=\operatorname{argmin}\frac{1}{2}\|y-|Ax|\|_{2}^{2}+\|x-z\|_{2}^{2}+ \lambda g(z) \tag{6}\]  
where \(x\) and \(z\) are the variables that need to be optimized. The optimum may be effectively reached by updating \(x\) and \(z\) in an alternating fashion. In updating \(x\), we are inclined to get more information from the diffraction pattern \(y\) to form the wavefront; while in updating \(z\), the resultant \(x\) is conditioned to fit more accurately with the real samples.