# 3D Reconstruction Based on Iterative Optimization of Moving Least-Squares Function
## 3 Methods
### Model Optimization  
In scenarios where the point cloud is evenly distributed within an octant, resulting in a flat and continuous surface, a corresponding division loss function, \(L_{1}\), is proposed to minimize unnecessary divisions. This loss function dynamically adjusts the partitioning strategy based on the local morphology and characteristics of the point cloud, thereby reducing redundant partitioning operations while maintaining accuracy.  
\[L_{1}=\sum_{d=1}^{7}\left[1-\frac{1}{m}\sum_{i=1}^{m}cos(n_{i,d},n_{c,d})\right]. \tag{11}\]  
The paper uses supervised deep-learning techniques to enhance the method's performance. We train on each shape on the ShapeNet dataset and use the result of voxel partitioning of a ground-truth octree with an output depth of \(d\), \(O_{d}\), to supervise shape partitioning. By introducing a loss constraint between the results of the network-generated octree partition and the ground-truth partition results, the learned partition results are infinitely close to the true partitions. Define the loss function as the structural loss, \(L_{2}\):  
\[L_{2}=\frac{1}{|O_{d}|}{\sum_{o\in O_{d}}E(o,o_{gt})}. \tag{12}\]  
In the paper, we use the binary cross-entropy function (denoted as \(E(\cdot)\)) to measure the difference between the predicted octree structure (denoted as \(o\)) and the real octree structure (denoted as \(o_{gt}\)). Moreover, we use the SDF loss \(L_{sdf}\), point repulsion loss \(L_{rep}\), projection-smoothing loss \(L_{proj}\), and radius-smoothing loss \(L_{rnd}\), which are performed using the same computational method as described in DeepMLS [4].  
The optimized feature \(f\) after GRU iteration can generate an MLS point cloud (denoted as \(x_{i}\in S_{1}\)), and the real point cloud extracted from the shape surface (denoted as \(y_{i}\in S_{2}\)) needs to be highly approximate in position. Therefore, using the chamfer distance (CD1) between the two as a loss function, \(L_{3}\). constrains the accuracy of the generated MLS point cloud:  
\[L_{3}=\frac{1}{|S_{1}|}{\sum_{x_{i}\in S_{1}}min_{y_{i}\in S_{2}}\|x_{i}-y_{i} \|}+\frac{1}{|S_{2}|}{\sum_{y_{i}\in S_{2}}min_{x_{i}\in S_{1}}\|y_{i}-x_{i}\|}. \tag{13}\]  
In the paper, the surface generated during the reconstruction process is denoted as \(S_{Q}\), while the GT surface is denoted as \(S_{T}\). Point clouds are randomly sampled from two surfaces to obtain \(N=10k\) points. And \(S_{1}=\{x_{i}\}_{i=1}^{N}\) represents the point cloud extracted from \(S_{Q}\), while \(S_{2}=\{y_{i}\}_{i=1}^{N}\) is the point cloud extracted from the GT surface \(S_{T}\). \(|S_{1}|\) and \(|S_{2}|\) mean the number of point clouds in \(S_{1}\) and \(S_{2}\), respectively. In Formula (13), the first term represents the sum of the smallest distances of any point \(x_{i}\) in \(S_{1}\) to \(S_{2}\), and the second term represents the sum of the smallest distances of any point \(y_{i}\) in \(S_{2}\) and \(S_{1}\). Combining these two terms ensures that the point cloud extracted from the reconstructed surface is closer to the point cloud extracted from the ground truth surface.  
In summary, the total loss is defined as L:  
\[L=L_{1}+L_{2}+L_{3}+L_{sdf}+L_{rep}+L_{proj}+L_{rad}. \tag{14}\]  
We train our model in an end-to-end fashion by using gradient descent. This involves back-propagating through the sum of all these loss functions to update the model parameters iteratively.