Soil is an important natural resource. The rapid acquisition of soil property content and spatial distribution is of great value and significance to agriculture and global change. However, the collection of soil samples consumes a large amount of cost, so the prediction of soil nutrient content has become a hot topic in soil research. Visible light near infrared (Vis-NIR) spectroscopy analysis, with its unique advantages such as rapid detection, non-destructive, non-polluting, and real-time detection, has extensive research and application foundations in soil nutrient content prediction [
1,
2,
3]. However, the spectral data is susceptible to interference from stray light, noise, baseline drift and other factors, which affect the modeling effect. Therefore, it is necessary to preprocess the spectral data before modeling to improve the predictive ability and robustness of the model. Due to the complex characteristics of spectral data, although traditional mathematical modeling methods can perform a certain degree of analysis and prediction, its more accurate and more universal prediction process faces technical bottlenecks. With the development of machine learning, many new spectral model regression prediction algorithms have been continuously proposed and applied [
4,
5,
6]. However, compared with traditional mathematical modeling and machine learning methods, neural network models have higher computational efficiency and stronger modeling capabilities, and can independently extract effective feature structures from complex spectral data for learning. The purpose of this paper is to establish a soil nutrient spectrum prediction model with higher efficiency, higher robustness and accuracy, which is of great significance for accelerating the advancement of my country’s agricultural informatization, improving the level of agricultural scientific management and developing my country’s agricultural economy.
Early research found that the soil organic matter can be calculated from the reflectance value of the soil reflectance spectrum, and the response of soil properties can be identified from the spectral characteristics. In 2006, Rossel et al. compared the predictions of various soil concentrations using qualitative analysis values of visible light (VIS) (400 nm–700 nm), near infrared (NIR) (700 nm–2500 nm), and medium infrared (MIR) (2500 nm–5000 nm), demonstrating that soil analysis and soil information can be obtained more effectively using VIS, NIR and MIR [
7]. Later, due to the complexity of vis-NIR spectroscopy, a variety of methods were applied to the pretreatment of soil spectra, such as Savitzky-Golay smoothing, standardization, and normalization methods [
8,
9]. In 2016, Lin et al. used a combined method of S-G smoothing and scattering correction to process soil spectral data to minimize irrelevant and useless information of the spectrum and increase the correlation between the spectrum and the measured value [
10]. By choosing the best combination of preprocessing methods to process soil vis-NIR data, not only can the interference factors be eliminated to the greatest extent, but also the complementary relationship between each preprocessing method can be used to improve the prediction accuracy of the network model. In the existing literature, researchers mostly focus on the preprocessing of spectral data, and there are few proposals and improvements of correlation spectral regression models. A high-performance spectral data modeling method can simplify the preprocessing requirements of spectral data and is also the key to ensuring the accuracy of spectral prediction [
11]. With the development of regression prediction, more and more linear regression methods are applied to soil nutrient prediction, such as the principal component regression (PCR) of Chang [
12] and the partial least square regression (PLSR) method of McCarty [
13]. After that, random forest, genetic algorithm, least squares-support vector machines (LS-SVM) and the Cubist method in machine learning are also used to improve model prediction ability [
14,
15,
16,
17]. Because deep neural networks are good at automatically extracting useful feature representations from large amounts of data, they have obvious advantages over shallow models and linear methods in modeling, and have become a hot spot in machine learning research in recent years. In 2015, Veres et al. applied deep learning technology to soil spectroscopy for the first time, proving the feasibility of the CNN model for evaluating certain characteristics of LUCAS soil data [
18]. In 2017, Ruder proposed that the use of multi-task models can reduce the risk of overfitting while improving the efficiency of model training [
19]. In 2019, Padarian et al. used the convolutional neural network (CNN) model and multi-task CNN network to predict various soil properties based on the LUCAS data set, verifying the effectiveness of multi-task learning in predicting soil properties, but the proposed deep learning method is only suitable for large-scale spectral data set, the prediction result is poor on a small sample [
20]. After that, Ndikumana et al. used the spectral data as time series data and input it into the long and short-term memory network (LSTM) for soil prediction, and finally achieved good results. However, before training the model, the article performs PCA linear dimensionality reduction processing on the data, which may cause the loss of non-linear correlation between samples, resulting in the model not being able to fit the data characteristics well [
21].
Aiming at the problems of low efficiency and low accuracy of current soil prediction models, this paper proposes a new multi-task model based on near-infrared spectroscopy soil data to simultaneously predict multiple attributes of soil. Since the spectral data presents a non-linear trend with the change of the spectral wavelength, this paper takes the spectral wavelength as the time axis, and the spectral data is a non-stationary time series signal. First, the spectrum signal through the three pre-processing methods of SG smoothing, multi-scattering correction, and centralization to construct a stable spectrum sequence. and the original spectral data is windowed and Fourier transform is used to generate a spectrogram, and multiple input channels are used to construct a dual-stream Multi_CNN network that simultaneously inputs a spectrum sequence and a spectrogram, and realizes multiple inputs and multiple outputs of the model by fusing one-dimensional convolution and two-dimensional convolution. In addition, the model has an adaptive input selection function, and independently selects single input and multiple input based on the characteristics of two different scale soil spectral data sets. Due to the small number of samples and short wavelength range of the Small dataset, it only uses a single input to use the one-dimensional convolutional network of the Multi_CNN model for attribute prediction, while LUCAS dataset selects multiple inputs for prediction based on the complete Multi_CNN model. The results show that the evaluation results of single-input network predicting small sample data are better than traditional machine learning algorithms. For large sample data sets, the evaluation results of the Multi_CNN model are better than the existing new models.
The structure of the article in this article is as follows. The second part introduces the two soil sample spectral data and preprocessing methods involved in the article, as well as the multi-input multi-output network Multi_CNN built. The third part compares the two data sets with different scales, and discusses and analyzes the results. The fourth part summarizes the article.