# Machine Learning-Based 3D Soil Layer Reconstruction in Foundation Pit Engineering
## 4 Machine Learning Models for Soil Layer Reconstruction
### Prediction Model  
Deep convolution plays an important role in the feature extraction of high-dimensional data. This paper uses a deep convolutional neural network as the basic reconstruction model structure. The specific structure of the model contains three convolutional layers and two fully connected layers. The model can choose to set the hyperparameters used to determine the network architecture, in which the activation function applies Rectified Linear Unit (ReLU), and the pooling method uses maximum pooling. In real-world scenarios, soil layer distributions are highly variable, and the number of soil layers is not constant. However, the trained model can only be modeled for soil layers with a constant number of layers. If a prediction model is designed for each number of layers, this will make the number of models very large and consume a lot of resources. Therefore, we designed a model adaptation algorithm to preprocess the borehole data. The model can be applied to geology modeling with different soil layers. Figure 10 shows the operation steps of this algorithm. The model adaptation algorithm is divided into three steps:  
Step 1. Selection of the trained soil layer reconstruction model. According to the borehole data provided by the user, the number of soil layers \(S_{num}\) to be modeled is determined, and then the model is selected according to the number of soil layers. The selection method is as follows:  
\[M= \begin{cases}M_{1},&0<s_{num}\leq m\\ M_{2},&m<s_{num}\leq 2m\\ \ldots\\ M_{n},&\left[\frac{n}{m}\right]m<s_{num}\leq n\end{cases} , \tag{7}\]  
where \(n\) is the maximum number of soil layers, and \(m\) is the step size. Step 2. Zero-padding treatment of the soil layer. To ensure consistency with the model's input requirements, zero-padding is applied to all borehole data corresponding to  
Figure 10: Flow chart of the model adaptation algorithm. the missing layers. This process standardizes the number of soil layers across all borehole data to match the model's expected input dimensions. Step 3. Prediction of voxel values. The preprocessed borehole data are input into the encoding algorithm, which divides the formation to be modeled into grid points. The feature map for each grid point is generated based on the encoding algorithm. Subsequently, the feature maps are fed into the model for prediction, yielding the corresponding label values. In a typical low-quality environment for foundation pit construction, the number of soil layers is usually no more than 10. Therefore, this paper sets n to 10 and m to 5, then designs and trains two models with the numbers of soil layers corresponding to 5 and 10, named SCNN-5 and SCNN-10, respectively. If the soil layer type in borehole sampling is less than or equal to five, SCNN-5 is used for soil layer prediction. When the number of soil layers is greater than five, SCNN-10 is used. Figure 11 shows the structure of SCNN-10. Our CNN includes three convolutional and two fully connected layers. The distribution of label information is achieved by applying the output of the second fully connected layer to the input of the 10-way softmax layer. Borehole features with dimensions of 20 \(\times\) 23 \(\times\) 1 are applied to the input layer. All convolutional layers consist of four stages in order, namely convolution, ReLU, normalization, and pooling, followed by a 4096-node fully connected layer containing two stages: an inner product and ReLU. Additionally, convolutional layers 1-3 consist, respectively, of 32 feature maps with a filter size of 2 \(\times\) 2, stride of 1, and padding of 1, and padding of 1; 64 feature maps with a filter size of 2 \(\times\) 2, stride of 1, and padding of 1. The first fully connected layer consists of 4096 nodes, while the second one consists of 10 nodes, followed by the softmax classification layer.