# On-the-Fly Machine Learning for Improving Image Resolution in Tomography
## 3 Method
### Machine Learning  
At this point in the process, the tomographic reconstruction method yields a low-resolution voxel grid \(\widetilde{\mathbf{x}}^{\text{low}}\) and a high-resolution voxel grid \(\widetilde{\mathbf{x}}^{\text{high}}\). For the neural network to match the low-resolution input to the high-resolution target, it is necessary that both input and target relate to the same physical space, and have the same voxel size. In this section, we outline how \(\widetilde{\mathbf{x}}^{\text{low}}\) and \(\widetilde{\mathbf{x}}^{\text{high}}\) are processed to match in physical space and voxel size. We also describe the training procedure, and motivate the choice of neural network architecture. The voxel grid \(\widetilde{\mathbf{x}}^{\text{low}}\) corresponds to the physical space \(\Omega_{\text{low}}\) and \(\widetilde{\mathbf{x}}^{\text{high}}\) corresponds to \(\Omega_{\text{high}}\). To serve as input data for neural network training, we use the voxels from \(\widetilde{\mathbf{x}}^{\text{low}}\) that are contained in \(\Omega_{\text{high}}\). We denote this restriction operation by \(\mathbf{R}:\mathbb{R}^{N_{\text{low}}^{3}}\to\mathbb{R}^{N_{\text{high}}^{3} /3}\). The resulting voxel grid  
\[\widetilde{\mathbf{x}}^{\text{low}}_{\text{ROI}}=\mathbf{R}\left(\widetilde{ \mathbf{x}}^{\text{low}}\right)\in\mathbb{R}^{N_{\text{high}}^{3}/3} \tag{13}\]  
corresponds to the physical volume \(\Omega_{\text{high}}\), and each of its voxels can thus be matched with voxels from \(\widetilde{\mathbf{x}}^{\text{high}}\). The voxel sizes of \(\widetilde{\mathbf{x}}^{\text{low}}_{\text{ROI}}\) and \(\widetilde{\mathbf{x}}^{\text{high}}\) can be equalized by either up-sampling the input data \(\widetilde{\mathbf{x}}^{\text{low}}_{\text{ROI}}\) or down-sampling the target data \(\widetilde{\mathbf{x}}^{\text{high}}\). We present both options, which we designate as method A and method B, respectively. By up-sampling the input data by a factor \(k\) with an interpolation method \(\mathbf{U}_{k}:\mathbb{R}^{N_{\text{high}}^{3}/3}\to\mathbb{R}^{N^{3}}\) with \(N=N_{\text{high}}\), we obtain training data on a fine grid  
\[\widetilde{\mathbf{x}}^{\text{input}} =\mathbf{U}_{k}\left(\widetilde{\mathbf{x}}^{\text{low}}_{\text{ ROI}}\right)\in\mathbb{R}^{N^{3}},\] (method A) \[\widetilde{\mathbf{x}}^{\text{target}} =\widetilde{\mathbf{x}}^{\text{high}}\in\mathbb{R}^{N^{3}}. \tag{15}\]  
By down-sampling the target data by a factor \(k\) with an interpolation method \(\mathbf{D}_{k}:\mathbb{R}^{N_{\text{high}}^{3}}\to\mathbb{R}^{N^{3}}\) with \(N=N_{\text{high}}/k\), we obtain training data on a coarse grid \[\widetilde{\mathbf{x}}^{\text{input}} =\widetilde{\mathbf{x}}^{\text{low}}_{\text{ROI}}\in\mathbb{R}^{N^{3}},\] (method B) (16) \[\widetilde{\mathbf{x}}^{\text{target}} =\mathbf{D}_{k}\left(\widehat{\mathbf{x}}^{\text{high}}\right) \in\mathbb{R}^{N^{3}}. \tag{17}\]  
The interpolation methods \(\mathbf{U}_{k}\) and \(\mathbf{D}_{k}\) are open to choice. Various methods can be used, including, for instance, cubic interpolation. The up- and down-sampling operations are illustrated in Figure 4.  
The properties of the acquired projection data can be used to inform the choice whether to up-sample the input (method A), or down-sample the target (method B). When optical blurring on the detector is negligible, the small-scale features that can be seen in \(\widehat{\mathbf{x}}^{\text{high}}\) will be hard to visualize on the coarse grid of \(\widetilde{\mathbf{x}}^{\text{low}}_{\text{ROI}}\). Therefore, it is recommended to use method A where \(\widetilde{\mathbf{x}}^{\text{target}}\) is defined on a fine grid. If, on the other hand, optical blurring limits the effective resolution of \(\widetilde{\mathbf{x}}^{\text{low}}_{\text{ROI}}\) and its resolution can be improved without reducing the voxel size, then it is recommended to use method B, where the grid size is smaller, and training and applying the network is thus computationally faster.