# ViT-Based Classification and Self-Supervised 3D Human Mesh Generation from NIR Single-Pixel Imaging
## 3 Single-Pixel Image Reconstruction
### 2D Reconstruction Algorithm  
We initiated the process by acquiring and digitizing the electrical signal \(y_{k}\) through an analog-to-digital conversion mechanism (ADC). This step involved projecting the signal with a Hadamard matrix, resulting in a vector of signals \(y_{k}\) (refer to Equation (1)). We then applied the Orthogonal Matching Pursuit (OMP) algorithm (see Algorithm 1) to derive the image \(x_{k}\) (refer to Equation (2)). Our goal was to satisfy condition \(|y_{k}-\Phi(i,j)x_{k}|<\varepsilon\)[22]. To enhance the computational efficiency of the 2D SPI image reconstruction algorithm, matrix inversion was carried out using the Cholesky decomposition technique, as described in the literature [53; 54]. This approach required us to compute the symmetric and positive Gram matrix, denoted \(G_{k}=\Phi^{T}\Phi\)[55]. Furthermore, an initial projection \(p^{0}=\Phi^{T}y_{k}\) was performed (see Algorithm 1, line 3) to support the implementation of the Cholesky method. \[L_{new}= \begin{bmatrix}L&0\\ w^{T}&\sqrt{1-w^{T}w}\end{bmatrix}  \tag{3}\]  
```
1:procedureOMP-GPU(\(\Phi\),\(y_{k}\)):
2: set: \(L_{1}\)=[1], \(k\)=1,\(p^{0}=\Phi^{T}y_{k}\)
3: set: \(\varepsilon=y_{k}y_{k}^{T}\), \(G_{k}=\Phi^{T}\Phi\), \(p=p^{0}\)
4:while\(\varepsilon_{k-1}>\varepsilon\)do
5:\(M=\arg\max_{K}|p|\)\(\triangleright\) Finding the new atom
6:if\(M>1\)then
7:\(w_{k}=\left\{L_{k-1}w_{k}=G_{k-1,K}\right\}\)\(\triangleright\) Solver \(w_{k}\)
8:\(L_{k}= \begin{bmatrix}L_{k-1}&0\\ w_{k}^{T}&\sqrt{1-w_{k}^{T}w_{k}}\end{bmatrix} \)\(\triangleright\) Update of Cholesky
9:
10:endif
11:\(x_{k}=\left\{L_{k}L_{k}^{T}x_{k}=p^{o}\right\}\)\(\triangleright\) Solver \(x_{k}\)
12:\(\beta=G_{k}x_{k}\)\(\triangleright\) Matrix-sparse-vector product for each path
13:\(p=p^{o}-\beta\)
14:\(\delta^{k}=x_{k}^{T}\beta\)\(\triangleright\) Calculate error
15:\(\varepsilon^{k}=\varepsilon^{k-1}-\delta^{k}+\delta^{k-1}\)\(\triangleright\) Calculate norm \(\varepsilon\)
16:
17:\(k=k+1\)\(\triangleright\) increasing iteration
18:endwhile
19:return\(x_{k}\)
20:endprocedure
```  
**Algorithm 1** OMP-GPU algorithm [55], **Input:** OMP-GPU algorithm input data: Patterns \(\Phi\), input signal \(y_{k}\), **Output:** OMP-GPU algorithm output data: sparse representation \(x_{k}\) that fulfills the relation \(y_{k}\approx\Phi x_{k}\). The matrix \(G\) can be decomposed into two triangular matrices through Cholesky decomposition, expressed as \(L_{k}L_{k}^{T}\) (see Equation (3)). In this expression, \(L_{k}\) denotes the triangular Cholesky factor [56] (refer to Algorithm 1, line 8). To address this matrix, we establish a system \(L_{k}L_{k}^{T}x_{k}=\Phi^{T}y_{k}\). This system is addressed by considering it as a triangular system, formulated as \(L_{k}u=b\) with \(b=\Phi y_{k}\) and \(L_{k}^{T}x_{k}=u\) (see Algorithm 1, line 11). The matrix \(L_{k}\) is determined using the approach described in Equation (3) [55], where \(w_{k}=L_{k}^{-1}G_{k}\) (see Algorithm 1, line 7). For reconstructing the signal \(x_{k}\), which involves transforming a vector image into an NxN matrix through a reshape operation, a stopping criterion is established by comparing the norm of the residual with a threshold \(\varepsilon\) (see Algorithm 1, line 15), thus bypassing the need to compute the residual \(\delta\) (see Algorithm 1, lines 12-14). To improve algorithm efficiency, we suggest that it be deployedin the Compute Unified Device Architecture (CUDA) to facilitate parallel processing in the reconstruction task [57] (see Algorithm 1). To generate the final 2D image, we first obtain the SPI image using the method described in Algorithm 1 and then integrate it with post-processed depth data from a TOF system. This depth data is improved through a normalization technique. The FSRCNN network method, as detailed in [26], fuses the initial input image with data from the TOF system. This fusion process enhances the image to two times its initial resolution, producing a final output image with dimensions of 64 \(\times\) 64 pixels.