# 3D Reconstruction Based on Iterative Optimization of Moving Least-Squares Function
## 3 Methods
### Contextual Information Encoding  
To extract local information about the shape, we apply convolutional neural networks on the smallest octant at various depths, which incorporate residual blocks and output-guided skip connections, helping to preserve the details and semantic information in the original input data and avoid information loss. During the processing, each down-sampling generates a shallower octree, while each up-sampling generates a deeper octree. Figure 2: Adaptive octree partition method based on cosine similarity (2D diagram). \(o_{i}\) means the center point of the octant, and \(p_{i}\) means the input point cloud within the octant. When reaching the shallowest octree, each residual block is connected to the GRU module, allowing the reconstruction process within the current octree to be conditional on the previously reconstructed parent octant, thus achieving joint reconstruction and fusion. The GRU module is shown in Figure 3. After data partitioning through adaptive octree and processing with convolutional neural networks, feature representations of different depths were obtained, such as \(\vec{f}_{1}^{j}\), \(\vec{f}_{2}^{j}\), \(\vec{f}_{3}^{j}\), \(\vec{f}_{1}^{j}\) corresponds to the relatively shallow octant, where \(j\) represents all octants at the same octree depth. \(\vec{f}_{2}^{j}\) is a sub octant of \(\vec{f}_{1}^{j}\), and \(\vec{f}_{3}^{j}\) represents the deeper octant. \(\vec{f}_{1}^{j}\) is input into the GRU module and then up-sampled to obtain the deformed feature \(\vec{f}_{2}^{j}\). The purpose of up-sampling is to maintain the same number of channels for \(f_{2}^{j}\) and \(\vec{f}_{2}^{j}\), facilitating concatenation and transfer to the next GRU. \(f_{3}^{j}\) is then obtained through GRU and up-sampling, matching the number of channels of \(\vec{f}_{3}^{j}\). They are then concatenated and passed to the next GRU. This process continues sequentially to achieve the transmission and fusion of features across different octant depths. In Figure 3, information flows from left to right (from shallow octants to deep octants) within the GRU module. This ensures that feature information and contextual information between different scales are fully exchanged and integrated, ultimately enhancing the learning and representation capabilities of the entire network and further optimizing the 3D shape-reconstruction process. The calculation method for feature \(f_{h}^{j}\) after passing through the GRU module is:  
\[f_{h}^{j}=(1-z_{h})f_{h-1}^{j}+z_{h}\vec{f}_{h}^{j}. \tag{4}\]  
Here, \(h\) represents the current octree depth, and \(j\) represents the octant node at \(h\) depth. \(f_{h-1}^{j}\) represents the feature information of \(f_{h}^{j}\) after GRU and up-sampling, while \(\vec{f}_{h}^{j}\) represents the feature information after passing through a convolutional neural network. In the use of GRU [6], the calculation method for the update gate \(z_{h}\) is:  
\[z_{h}=\sigma\Big{(}W_{z}x_{h}+U_{z}f_{h-1}^{j}\Big{)}, \tag{5}\]  
\[\vec{f}_{h}^{j}=tanh\Big{(}W_{c}x_{h}+U_{c}\Big{(}r_{h}\odot f_{h-1}^{j}\Big{)} \Big{)}. \tag{6}\]  
The calculation method for reset gate \(r_{h}\) is:  
\[r_{h}=\sigma\Big{(}W_{r}x_{h}+U_{r}f_{h-1}^{j}\Big{)}, \tag{7}\]  
where \(\sigma\) means the sigmoid activation function, and \(x_{h}\) represents the octant center coordinates at depth \(h\) in the octree. The update gate \(z_{h}\) and reset gate \(r_{h}\) in GRU determine how much information from the previous reconstructions of the octant will be integrated into the geometric features of the current octant node, and how much information from the current octant node will be integrated into the next round of GRU module. In Formulas (5)-(7), W (include \(W_{z}\), \(W_{c}\), \(W_{r}\)) and U (include \(U_{z}\), \(U_{c}\), \(U_{r}\)) are the matrices of the values (also known as the GRU network weights) learned at different stages of the training process.