# A Deep Learning Approach to Estimate Soil Organic Carbon from Remote Sensing
## 3 Materials and Methods
### Stage 1--Segmentation DNN for LC Estimation  
The focus of our study is the creation of an approach able to generate a map of SOC estimates of the same resolution as that provided by Sentinel-2 imagery, restricted to agricultural applications. However, the amount of training data available for this task is limited, which can hinder the performance of state-of-the-art machine learning models. In addition, the available data sources such as the LUCAS and CHLSOC datasets are sparse, making it impossible to use them for direct end-to-end training of machine learning models for segmentation tasks, which are the basic technology that needs to be used to efficiently address the problem of continuous SOC estimation. To overcome these limitations, we propose to use transfer learning. We first trained a segmentation network, in our case a U-Net, to accurately predict the LC of a certain geographical location based on Sentinel-2 imagery. Similar to [PERSON] et al. [38], we then extracted the latent features learned by the network to serve as the input to a second-stage ML model to estimate SOC. Since the segmentation network used in the first stage preserves the spatial relations existing in the image, this allowed us to generate spatially continuous predictions of SOC levels for a given region of interest (ROI), taking these relations into account and improving the accuracy of our estimates. A block diagram of the proposed approach is shown in Figure 3.  
To evaluate the performance of the whole pipeline, we used a combination of the CHLSOC and LUCAS 2015 and 2018 datasets and standard metrics: the Mean Absolute Error (MAE), Mean-Squared Error (MSE), Mean Absolute Percentage Error (MAPE), and the coefficient of determination (R\({}_{2}\)). The latter two provide insight into how large the error is relative to the ground truth value and how much of the variance of the data is explained by the model. U-Net is a convolutional neural network (CNN) architecture that was developed by [PERSON] et al. in 2015 at the University of Freiburg in Germany for biomedical image segmentation [52]. The U-Net architecture is an improvement over the Fully Convolutional Network (FCN) architecture that was developed by [PERSON] et al. in 2014 [53]. The architecture is shown in Figure 4.  
Figure 4: U-Net architecture. Figure 3: Proposed approach. The U-Net architecture is composed of two main parts: an encoder and a decoder. The encoder, also known as the contracting path, reduces the spatial dimensions of the input image and increases the number of filters (feature channels) at each of its blocks. This process extracts increasingly abstract and high-level features from the input image. The decoder network, also known as the expansive path, takes the high-level features from the encoder network and uses them to reconstruct a segmentation map of the same size as the input image. Each encoder block consists of two 3 \(\times\) 3 px convolutional layers. The activation function of these layers is a Rectified Linear Unit (ReLU), introducing nonlinearity. The output of the ReLU activation function is then passed to the corresponding decoder block using skip connections. This allows the network to retain detailed spatial information in the encoder path and use it to produce more-accurate segmentation maps. The decoder consists of a sequence of decoder blocks, each of which starts with a 2 \(\times\) 2 transpose convolutional layer that increases the spatial dimensions of the feature maps. The output of the transpose convolution is then concatenated with the corresponding output of an encoder block passed via the skip connection. This concatenated feature map is then passed through two 3 \(\times\) 3 convolutional layers with ReLU activation. To produce the final segmentation mask, the output of the last decoder block is passed through a 1 \(\times\) 1 convolutional layer with sigmoid activation. To create our LC classifier, we used a U-Net architecture with an input of 64 \(\times\) 64 px.