# Fast Terahertz Coded-Aperture Imaging Based on Convolutional Neural Network
## 2 Method
### Network Structure and Data Generation  
Recently, convolution neural networks (CNN) have been extended and applied to solve inverse problems. The theoretical motivations for using CNNs as the learning architecture and the design strategies of CNN-based imaging framework have been discussed [33]. Moreover, the relationship between CNN and iterative optimization algorithms has also been surveyed [34]. Motivated by this research, we propose a neural network for fast TCAI which includes the nonlinear part of the encoded information and the linear part of the decoded information. Figure 2 shows the schematic diagram of the network architecture. We suppose that the input of the network is the echo signal with the length of \((H\times W)\times 1\). It is down-sampled by \(\times 1\), \(\times 2\), creating two flow structure, with spatial dimensions of \(H\times W\), \(H/2\times W/2\), respectively. And the output is the expected target with different scales. The number of feature maps in each layer is 16. After the down-sample, the two tensors flow to the residue blocks, which is constructed by two convolutional layers with batch normalization and two rectified linear units (ReLU), that is, \(\text{ReLU}(x)=\max(0,x)\). And a shortcut is utilized between the block's input and output, as indicated by the red arrows, which mitigates the divergent gradient problem and accelerates the convergence of the deep neural network. Following residue block, the spatial dimensions of this feature map from \(H/2\times W/2\) to \(H\times W\) via up-sampling block,each block includes one convolutional layer with batch normalization, a ReLU operation and one up-sampling layer that facilitates super-resolution. Finally, the fusion tensor can be obtained by a connection operation in third-dimension of the output tensor of each flow structure. Here, all nonlinear operations are completed, and the low-level and high-level semantic features are learned from the echo signal. For the linear part, which is made up of convolutional layers, it can transform these extracted features into the output in imaging domain. It is important to note that some tricks are adopted to reduce network parameters and achieve cross-channel information interaction. In testing, to avoid over-fitting, the neurons are randomly ignored. In the developed network, the spatial correlations between convolution layers can be modeled as  
\[v_{i,j}^{x,y}=\sum\limits_{r}\sum\limits_{p=0}^{p-1}\sum\limits_{b=0}^{B-1}w_{ i,j,r}^{p,b}v_{i-1,r}^{x+p,y+b}, \tag{8}\]  
where \(r\) stands for the number of channels in \(i-1\) layer, \(P\) and \(B\) are the size of the weight matrix, that is, convolutional kernels. In \(i\)-th convolutional layer, \(v_{i,j}^{x,y}\) is the value of \(x\), \(y\)-th pixel in the \(j\)-th feature map and \(w_{i,j,r}^{p,b}\) is the weight of \(p\), \(b\)-th position in the \(j\)-th convolutional kernels. These parameters are included in \(\Theta\), and they can be optimized by minimizing the loss function of the predicted target and the original target  
\[L=\frac{\sum\limits_{d=1}^{D^{*}}\left\|g_{\theta}(\mathbf{S}_{b}^{d})-\mathbf{\beta}^ {d}\right\|_{2}^{2}}{numel(\mathbf{\beta}^{d})D^{*}}, \tag{9}\]  
where \(\left\|\cdot\right\|_{2}\) refers to \(L_{2}\) Norm, \(numel(\cdot)\) indicates the quantity of pixels in the original target, and \(D^{*}=8\) is the mini-batch size in the stochastic gradient descent (SGD) method [35]. And the Adam optimizer [36] was adopted to optimize imaging parameters. As mentioned above, the training of an imaging network usually requires a large amount of the original target and corresponding echo signal. For the generation of the original target data set, we first randomly generate the number of scattering points and their positions on the \(60\times 60\) imaging plane, which is designed to imitate real-target cases and guarantee the diversity and richness of the target. Then the scattering coefficients are generated randomly.