Rapid soil nutrient detection method based on Internet of Things
By collecting multimodal data through IoT sensor networks and utilizing a spectral domain deconvolution self-correction model and a Transformer self-attention mechanism, environmental drift is dynamically corrected, solving the problems of long detection time and low accuracy in traditional soil nutrient detection. This enables rapid and accurate soil nutrient detection, supporting real-time monitoring and precision agriculture.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-25
- Publication Date
- 2026-04-03
AI Technical Summary
Traditional methods for soil nutrient testing are time-consuming, cumbersome, and costly. Existing methods based on spectral technology are easily affected by environmental factors, resulting in insufficient reliability and accuracy of test results, and failing to meet the needs for rapid and accurate testing.
Multimodal data is collected using an Internet of Things (IoT) sensor network. Soil nutrient chemical component signals are separated through preprocessing and a spectral domain deconvolution self-correction model. The Transformer self-attention mechanism is combined to capture the correlation of multimodal features, dynamically correct environmental drift, and construct a concentration mapping model to output the detection results.
It enables rapid, accurate, and comprehensive detection of soil nutrients, improves the stability and reliability of the detection, and is suitable for agricultural scenarios such as field crops and greenhouses, supporting real-time monitoring and precision agricultural decision-making.
Smart Images

Figure CN121783870A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of soil nutrient detection, and more specifically, to a rapid soil nutrient detection method based on the Internet of Things. Background Technology
[0002] In agricultural production, soil research, and ecological environmental protection, accurate and rapid acquisition of soil nutrient information is crucial. Soil nutrient content directly affects crop growth, development, and yield; rational fertilization and scientific management of soil resources all depend on a precise understanding of soil nutrients.
[0003] Traditional methods for soil nutrient testing, such as chemical analysis, while providing relatively accurate results, have several limitations. Chemical analysis typically requires soil samples to be collected in a laboratory, undergoing a series of complex pretreatments and chemical experiments. The process is cumbersome and time-consuming, failing to meet the demands for real-time, rapid testing. Furthermore, chemical analysis requires the use of large quantities of chemical reagents, leading to high costs and potential environmental pollution.
[0004] With the development of technology, soil nutrient detection methods based on techniques such as spectral analysis have gradually emerged. However, these methods are often affected by various factors during the detection process. For example, the soil environment is complex and variable; environmental factors such as temperature and humidity can cause shifts in the detection spectral lines, thus affecting the accuracy of the results. There are complex correlations and interactions between different soil types and nutrient components, making it difficult for single-modal data to comprehensively and accurately reflect the true state of soil nutrients. Furthermore, existing detection methods have limited capabilities in data processing and analysis, particularly in the fusion and feature extraction of multimodal data, making it difficult to fully extract useful information from the data, thus requiring improvements in the reliability and accuracy of the detection results.
[0005] Therefore, developing a method that can overcome the above-mentioned shortcomings and achieve rapid, accurate, and comprehensive detection of soil nutrients is of great practical significance. Summary of the Invention
[0006] The purpose of this invention is to provide a rapid soil nutrient detection method based on the Internet of Things, which solves the problems of traditional soil nutrient detection methods, such as long detection time, cumbersome process, high cost and environmental pollution. Existing methods based on spectroscopy and other technologies are also susceptible to environmental interference and have limited multimodal data fusion and feature extraction capabilities, resulting in poor reliability and accuracy of detection results, which cannot meet the needs of use.
[0007] This invention achieves the above objective through the following technical solution: a rapid soil nutrient detection method based on the Internet of Things, the method comprising the following steps:
[0008] S1. Acquire and preprocess raw multimodal soil data collected by the Internet of Things sensor network;
[0009] S2. Input the preprocessed multimodal data into the preset analysis model to separate the soil nutrient chemical component signals and capture the correlation and dependence between multimodal features;
[0010] S3. Based on a preset reference standard, dynamically correct the environmental drift of characteristic peaks and eliminate spectral shift errors caused by environmental factors;
[0011] S4. Through characteristic signal quantification analysis and concentration mapping, output the detection results of the content of target nutrient components in the soil.
[0012] Furthermore, the acquisition of raw multimodal soil data collected by the Internet of Things sensor network in S1 includes:
[0013] Multiple types of sensors deployed through an Internet of Things (IoT) sensor network are used to simultaneously collect multimodal raw data of soil at different depth layers in the soil sampling area.
[0014] The multimodal raw data includes at least spectral data, dielectric response data, and temperature and humidity data. During the acquisition process, the timestamp synchronization error of each sensor is ensured to be within a preset range.
[0015] Furthermore, the preprocessing in S1 includes:
[0016] Noise correction and background drift removal are performed on the spectral data;
[0017] The dielectric response data is normalized in the frequency dimension to eliminate amplitude differences between different frequency channels;
[0018] Outlier identification and correction were performed on the temperature and humidity data, and finally, standardized multimodal input data was obtained by integration.
[0019] Furthermore, the separation of soil nutrient chemical component signals and the capture of correlation dependencies between multimodal features in S2 include:
[0020] A multimodal feature fusion layer is constructed, and a dedicated embedding layer is designed for different types of standardized data. Various types of data are mapped to a high-dimensional feature space with unified dimensions to obtain the embedding features of each modality.
[0021] Spectral domain transformation is performed on the spectral embedding features, and the feature signals of the target nutrient chemical components are separated using the deconvolution algorithm;
[0022] The attention mechanism module processes multimodal embedding features to capture the nonlinear correlations and dependencies between different modalities.
[0023] Furthermore, the deconvolution algorithm is based on sparse coding theory and achieves the separation of overlapping feature peaks by learning an adaptive deconvolution kernel;
[0024] The initial value of the deconvolution kernel is set based on the reference signal of the standard nutrient group and is dynamically optimized during model training through an optimization algorithm.
[0025] Furthermore, the training steps of the preset analysis model include:
[0026] We constructed a dataset covering different soil types, different nutrient concentration gradients, and different environmental conditions, and simultaneously collected multimodal raw data and obtained the actual concentration of the target nutrient components as label data.
[0027] Divide the dataset into training, validation, and test sets, and set the model initialization parameters, training batch size, number of training epochs, and early stopping strategy.
[0028] Define a hybrid loss function that includes feature separation loss, peak position correction loss, and concentration prediction loss;
[0029] Configure the optimizer and learning rate scheduling strategy, train the model using the training set, evaluate the model performance using the validation set and save the optimal model, and perform the final performance evaluation using the test set.
[0030] Furthermore, the environmental drift correction of the characteristic peak based on a preset reference standard in S3 includes:
[0031] A reference benchmark library containing relevant parameters of the characteristic peaks of the target nutrient groups is pre-constructed;
[0032] The relevant parameters include at least the characteristic vibration frequency, the intensity reference value, and the environmental correction coefficient. Each parameter is obtained by fitting standard experimental data.
[0033] Extract the characteristic peak positions of each nutrient group after spectral processing, and calculate the characteristic peak shift by combining the collected environmental data.
[0034] The detected characteristic peak positions are dynamically corrected based on relevant parameters in the reference benchmark library, and the deviation between the corrected characteristic peak and the standard peak position is minimized through an iterative optimization algorithm.
[0035] Furthermore, the environmental correction factor includes:
[0036] Temperature sensitivity coefficient and humidity correction coefficient;
[0037] The temperature sensitivity coefficient was obtained through regression analysis of the peak position shift at different temperatures and temperature changes;
[0038] The humidity correction factor was obtained through fitting analysis of the peak position shift under different humidity levels and humidity changes;
[0039] Supports dynamic invocation based on soil type.
[0040] Furthermore, in step S4, the detection results are output through feature signal quantization analysis and concentration mapping, including:
[0041] The integral of the characteristic signals of each nutrient group after correction is calculated to obtain the integral area of the characteristic peak;
[0042] A concentration mapping model was constructed and trained using a large number of soil samples with known concentrations. The integral area of the characteristic peak was used as input and the corresponding actual concentration value was used as output. The calibration curve was then fitted.
[0043] By combining the multimodal feature weight fusion results, the concentration calculation values are weighted and corrected, and the content detection results of the target nutrient components are obtained.
[0044] Furthermore, S4 also includes:
[0045] Output the confidence level of each detection result, which is obtained based on the statistical analysis of the model prediction error;
[0046] The reliability of the test results is determined based on the range of confidence values. When the confidence level is lower than the preset threshold, the test results are deemed invalid and a prompt is made to recollect the data.
[0047] The beneficial effects of this invention are as follows:
[0048] 1. By collaboratively collecting data from multiple types of sensors, such as spectroscopy, dielectric response, and temperature and humidity sensors, a multimodal soil feature dataset is formed, enabling complementary fusion of different information sources and significantly improving the stability and accuracy of detection.
[0049] 2. The model employs multimodal feature embedding and attention mechanism, which can automatically separate the feature signals of nutrient chemical components in soil and capture the nonlinear correlation between different modes, thereby enhancing the model's expressive and generalization capabilities.
[0050] 3. Construct a reference library containing characteristic peak parameters and temperature and humidity correction coefficients, and combine it with environmental data to perform real-time dynamic correction of spectral line shifts, effectively eliminating detection errors caused by temperature and humidity changes, and ensuring the stability and repeatability of detection results.
[0051] 4. A quantitative relationship is established by mapping the integral area of characteristic peaks to concentration, and a confidence assessment mechanism is introduced to quantify the reliability of the detection results, support result judgment and anomaly alerts, and improve the system's self-correction capability.
[0052] 5. Combining real-time data acquisition from the Internet of Things with intelligent analysis at the model end, it has the advantages of fast response speed, simple operation, and no need for a laboratory environment. It is suitable for various agricultural scenarios such as field crops, greenhouses, and grasslands. By utilizing the Internet of Things sensor network, the detection time is greatly shortened, enabling rapid detection of soil nutrients and providing strong support for real-time soil nutrient monitoring and precision agricultural decision-making. Attached Figure Description
[0053] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0054] Figure 1 This is a flowchart illustrating the overall method of the present invention;
[0055] Figure 2 This is a flowchart of the data acquisition and preprocessing process of the present invention;
[0056] Figure 3 This is a flowchart of the feature analysis model of the present invention;
[0057] Figure 4 This is a flowchart of the dynamic correction process of the present invention;
[0058] Figure 5 This is a flowchart illustrating the output of the results of this invention. Detailed Implementation
[0059] The present application will now be described in further detail with reference to the accompanying drawings. It should be noted that the following specific embodiments are only used to further illustrate the present application and should not be construed as limiting the scope of protection of the present application. Those skilled in the art can make some non-essential improvements and adjustments to the present application based on the above application content.
[0060] Example 1:
[0061] Please see Figure 1-5 This invention provides a technical solution: a rapid soil nutrient detection method based on the Internet of Things, the method comprising:
[0062] S1. Acquire and preprocess raw multimodal soil data collected by the Internet of Things sensor network;
[0063] The Internet of Things (IoT) sensor network is a network composed of a large number of sensor nodes connected wirelessly. These sensor nodes can sense and collect information about the surrounding environment. In the soil nutrient detection scenario, it is used to collect multimodal raw data related to soil, such as different types of data like soil temperature, humidity, electrical conductivity, and spectral data. Multimodal raw data refers to data with multiple different forms or types. This multimodal raw data is the various types of soil data collected through the IoT sensor network. This data is unprocessed and contains various noise and interference information, requiring preprocessing before it can be used for subsequent analysis. Preprocessing involves a series of operations on the collected raw data to remove noise, correct errors, normalize data, etc., improving data quality and usability, and providing a more accurate and reliable data foundation for subsequent model input and feature extraction.
[0064] S2. Input the preprocessed multimodal data into the spectral domain deconvolution self-calibration model, separate the soil nutrient chemical component signals through the Fourier spectral domain deconvolution algorithm, and use the Transformer self-attention mechanism to capture the correlation and dependence between multimodal features.
[0065] Among them, the spectral domain deconvolution self-calibration model is a specially designed model for soil nutrient detection. It combines the Fourier spectral domain deconvolution algorithm and the Transformer self-attention mechanism, aiming to accurately separate soil nutrient chemical component signals from preprocessed multimodal data and capture the correlation and dependence between multimodal features. The Fourier spectral domain deconvolution algorithm uses Fourier transform, a method to convert signals from the time domain to the frequency domain (spectral domain is the frequency domain), and deconvolution, a commonly used technique in signal and image processing, to recover the original signal or image and remove blur and interference. The Fourier spectral domain deconvolution algorithm separates the mixed soil nutrient chemical component signals in the frequency domain through deconvolution operations, so as to more accurately analyze the characteristics of each nutrient component. The Transformer self-attention mechanism is a core component of the Transformer, a deep learning model architecture. It enables the model to automatically pay attention to the correlation and dependence between different positions in the sequence when processing sequential data. In soil nutrient detection, the self-attention mechanism can be used to capture multimodal data, such as different types of data collected by different sensors and the complex correlations between features, so as to better understand and analyze the characteristics of soil nutrients.
[0066] S3. Based on the built-in chemical bond vibration reference matrix of the model, the environmental drift of characteristic peaks is dynamically corrected to eliminate spectral shift errors caused by soil type differences and temperature and humidity changes.
[0067] The chemical bond vibration reference matrix is a pre-constructed matrix containing relevant information on the vibrational characteristics of different chemical bonds. This information serves as a reference standard for identifying and correcting characteristic peaks in soil nutrient chemical component signals. Different chemical bonds produce specific frequency characteristics during vibration; by comparing these peaks with the reference matrix, the chemical bonds and nutrient components corresponding to the characteristic peaks can be determined more accurately. Environmental drift of characteristic peaks occurs in real-world environments. Differences in soil type and variations in temperature and humidity can cause spectral shifts in soil nutrient chemical component signals. This shift alters the originally accurate position of the characteristic peaks, affecting the accurate detection of soil nutrients. Environmental drift describes this spectral shift phenomenon caused by environmental factors. Spectral shift error arises from the environmental drift of characteristic peaks, causing deviations between the detected spectral line position and the theoretical or standard position. This inaccuracy is called spectral shift error. By dynamically correcting the environmental drift of characteristic peaks, this error can be eliminated, improving the accuracy of soil nutrient detection.
[0068] S4. Through characteristic signal quantification analysis and concentration mapping, output the detection results of the content of target nutrient components in the soil;
[0069] Among them, the feature signal quantification analysis is to quantify the feature signals of soil nutrient chemical components obtained after the previous steps. That is, through mathematical methods and statistical means, the feature signals are transformed into specific numerical indicators in order to more accurately describe the characteristics and content information of soil nutrients. Concentration mapping is to establish a relationship model between the feature signal quantification analysis results and the actual concentration of target nutrient components in the soil. Through this model, the numerical values obtained from the quantification analysis are mapped to the specific content of target nutrient components in the soil, thereby outputting the content detection results of target nutrient components in the soil.
[0070] It should be noted that during use, in terms of data acquisition and processing, the Internet of Things sensor network can be used to collect a wide range of raw multimodal soil data, comprehensively reflecting the soil condition. Preprocessing improves data quality and lays the foundation for accurate analysis. In the spectral domain deconvolution self-correction model, the Fourier spectral domain deconvolution algorithm can accurately separate soil nutrient chemical component signals and avoid signal confusion. The Transformer self-attention mechanism can capture the correlation and dependence of multimodal features, mine deep information in the data, and use the chemical bond vibration reference matrix to dynamically correct the environmental drift of feature peaks, effectively eliminating spectral line shift errors caused by soil type differences and temperature and humidity changes, improving detection accuracy. Through feature signal quantification analysis and concentration mapping output results, the content of target nutrient components in the soil can be obtained quickly and accurately, providing a scientific basis for agricultural fertilization, etc., helping the development of precision agriculture, and improving agricultural production efficiency and quality.
[0071] In one embodiment, acquiring and preprocessing raw multimodal soil data collected by an Internet of Things (IoT) sensor network includes:
[0072] High-resolution spectral sensors, broadband microwave dielectric sensors, and high-precision temperature and humidity sensors deployed through an Internet of Things (IoT) sensor network are used to simultaneously collect multimodal raw soil data at different depth layers in the soil sampling area. Specifically, the multimodal raw data includes soil spectral data covering the visible to near-infrared band of 400-2500 nm. Microwave dielectric response data in the 1-10 GHz band And temperature and humidity microenvironment data with an accuracy of ±0.1℃ and ±1%RH. ,in These represent the spatial height, width (in pixels), and number of spectral channels of the spectral data, respectively. The number of equally spaced frequency points in the microwave dielectric response. The time step for continuous data acquisition is set to ensure that the timestamp synchronization error of each sensor does not exceed 10ms during the acquisition process;
[0073] Dark current correction and baseline subtraction were performed sequentially on the spectral data. Dark current correction was used to eliminate electronic noise interference from the sensor itself, and baseline subtraction used a polynomial fitting method to remove spectral background drift. The correction formula is as follows:
[0074]
[0075] in, For different wavelengths The original spectral signal below, To block the dark current signal collected by the sensor's optical path, This is a reference spectrum calibrated with standard reference materials;
[0076] The microwave dielectric response data is normalized along the frequency dimension to eliminate amplitude differences between different frequency channels. The normalization expression is as follows:
[0077]
[0078] in, for Time Frequency The corresponding original dielectric response value includes the real and imaginary parts of the dielectric constant. , These represent the minimum and maximum values of the dielectric response obtained from multiple samplings at this frequency;
[0079] The temperature and humidity data were analyzed using 3 The criteria remove outliers by removing data values that exceed the specified range. The intervals were identified as outliers. For temperature data, the standard deviation calculation excluded periods of sudden environmental changes, such as strong sunlight or data within one hour after rainfall. For humidity data, the standard deviation calculation excluded abrupt changes in soil moisture content. Identified outliers were replaced using adjacent valid data points via linear interpolation. Finally, the standardized multimodal input data was obtained. This ensures the integrity and consistency of the input data.
[0080] This design acquires and preprocesses raw multimodal soil data collected by an IoT sensor network. It simultaneously collects soil data from different depths using multiple high-precision sensors, covering multimodal information such as spectrum, microwave dielectric response, temperature, and humidity. Dark current correction and baseline subtraction are performed on the spectral data to eliminate noise and background drift; frequency normalization is applied to the microwave dielectric response data to eliminate amplitude differences; and temperature and humidity data are processed using 3D modeling. The criteria remove outliers and replace them with linear interpolation. Simultaneous acquisition by multiple sensors can comprehensively obtain soil information, improving data integrity. The preprocessing operation is highly targeted, effectively eliminating interference factors in various types of data and improving data quality. The standardized multimodal input data provides an accurate and consistent data foundation for subsequent model analysis, which helps the model to more accurately capture soil nutrient characteristics and improve the reliability of detection results.
[0081] In one embodiment, preprocessed multimodal data is input into a spectral domain deconvolution self-calibration model. Soil nutrient chemical component signals are separated using a Fourier spectral domain deconvolution algorithm. The Transformer self-attention mechanism is then used to capture the correlation dependencies between multimodal features, including:
[0082] A multimodal feature fusion layer is constructed, and dedicated embedding layers are designed for the modal characteristics of standardized spectral data, microwave dielectric response data, and temperature and humidity data.
[0083] The spectral data embedding layer uses a 1D convolutional kernel to extract local spectral features, with a kernel size of 3×1, a stride of 1, and the same padding method. The microwave dielectric data embedding layer transforms the dielectric response dimension through a fully connected layer with 256 hidden units. The temperature and humidity data embedding layer combines time-series features with sliding window encoding, with a window size of 5 time steps, mapping the three types of data to a high-dimensional feature space of uniformity to obtain modality embedding features. , , ,in , , These represent the lengths of the feature sequences for each modality. The unified feature dimension is determined by the following rules: it is adaptively adjusted according to the sample size of the input data. When the sample size is less than 10,000, the value is 128; when the sample size is between 10,000 and 50,000, the value is 256; and when the sample size is greater than 50,000, the value is 512.
[0084] Spectral embedding features Perform a Fast Fourier Transform to convert the time-domain spectral features into spectral-domain features. The target nutrient chemical components were separated using a spectral domain deconvolution algorithm. The deconvolution algorithm, based on sparse coding theory, learns an adaptive deconvolution kernel to capture the characteristic signal. To separate overlapping feature peaks, the deconvolution kernel size is set to match 1 / 8 of the spectral feature dimension. Initial values are set using Gaussian initialization based on the pure spectral signals from the standard nutrient group, and dynamically optimized during model training using gradient descent with a learning rate of 0.001. The deconvolution formula is:
[0085]
[0086] in, This represents element-wise multiplication;
[0087] Construct a Transformer self-attention module based on a multi-head mechanism to embed multimodal features. , , After adding specific positional codes according to modality type, the sequences are concatenated to obtain the fused feature sequence. The positional encoding adopts a sine-cosine positional encoding method, with encoding dimension and feature dimension. Consistent; Multi-head self-attention computation is used to capture the nonlinear correlation dependencies between different modalities, while layer normalization and residual connections are introduced to improve the model training stability. The ε parameter of layer normalization is set to 1e-5.
[0088] Attention to the number of heads The determination rule is: based on the feature dimension. satisfy It is an integer, and The value range is 4-16, when hour , hour , hour Or 16;
[0089] The specific calculation formula is as follows:
[0090]
[0091]
[0092] in, These are the query, key, and value matrices obtained from the linear transformation of the fused feature sequence, respectively. The weight matrix of the linear transformation is initialized using Xavier. For each attention head's feature dimension, satisfying... , The output projection matrix is used to map the multi-head attention output to the target feature dimension. The dimension is ;
[0093] The training steps for the spectral domain deconvolution self-calibration model include:
[0094] Dataset Construction: At least 5000 sets of data covering different soil types, specifically black soil, red soil, loess, and saline-alkali soil; and different nutrient concentration gradients were collected. - Soil samples under different temperature and humidity conditions (temperature 5-40℃, humidity 10%-60%RH) were collected simultaneously with multimodal raw data. The true concentration of target nutrient components in the samples was determined using standard laboratory methods such as the Kjeldahl method and the molybdenum-antimony colorimetric method, and used as label data.
[0095] The dataset was divided into training, validation, and test sets in a ratio of 7:2:1. Stratified sampling was used in the partitioning process to ensure that the soil type and concentration distribution of each subset were consistent.
[0096] Initialization settings: The model parameters are initialized using the orthogonal initialization method. The weight parameters of the self-attention module are initialized in the range of [-0.01, 0.01], and the fully connected layer parameters are initialized using He. The training batch size is set to 32, the number of training epochs is set to 100, and an early stopping strategy is used to prevent overfitting. The early stopping patience is set to 15, that is, training stops if the loss on the validation set does not decrease for 15 consecutive epochs.
[0097] Loss function definition: A hybrid loss function is used, including feature separation loss. Peak position correction loss and concentration prediction loss The total loss function is:
[0098]
[0099] in, The difference between the characteristics of the separated components and the characteristics of the standard components was calculated using the mean square error. The deviation between the corrected peak position and the reference position is calculated using L2 loss. The difference between the predicted concentration and the actual concentration is calculated using the mean absolute percentage error.
[0100] Optimizer configuration: The AdamW optimizer is used, with an initial learning rate of 0.001 and a weight decay coefficient of 0.0001. The learning rate scheduling strategy uses cosine annealing decay, with a minimum learning rate of 1e-6 and a period of 20 epochs. After each decay, the learning rate is reset to 0.8 times the current value.
[0101] Training process: Input the training set data into the model in batches, and perform forward propagation to calculate the output results and the total loss. The gradient is calculated through backpropagation, and the model parameters are updated using the optimizer. After each epoch of training, the model performance is evaluated using the validation set, and the R², RMSE, and MAPE of the concentration prediction are calculated. The model with the minimum loss on the validation set is saved as the optimal model. After training is completed, the final performance is evaluated using the test set to ensure the model's generalization ability.
[0102] This design inputs preprocessed multimodal data into a spectral domain deconvolutional self-calibration model, constructs a multimodal feature fusion layer, and designs dedicated embedding layers for different modalities, uniformly mapping them to a high-dimensional feature space. After performing Fourier transform on the spectral embedded features, a spectral domain deconvolution algorithm is used to separate nutrient chemical component signals. A Transformer self-attention module is constructed to capture multimodal correlations and dependencies. The model training steps are also introduced, including dataset construction and initialization settings. The dedicated embedding layers can fully explore the characteristics of each modality of data, multimodal fusion can comprehensively utilize multiple types of information, the spectral domain deconvolution algorithm accurately separates overlapping feature peaks, and the Transformer self-attention mechanism captures complex correlations. The detailed training steps ensure model optimization, improve the model's adaptability to different soil types, nutrient concentrations, and temperature and humidity conditions, and enhance the accuracy and generalization ability of detection.
[0103] In one embodiment, based on the model's built-in chemical bond vibration reference matrix, the environmental drift of characteristic peaks is dynamically corrected to eliminate spectral shift errors caused by soil type differences and temperature and humidity variations, including:
[0104] Pre-constructed chemical bond vibration reference matrix ,in for The total number of characteristic peaks for the three target nutrient groups; each component contains 2-5 characteristic vibrational peaks. The chemical bond vibration characteristic dimension includes four dimensions: characteristic vibration frequency, baseline value of absorption intensity, temperature sensitivity coefficient, and humidity correction coefficient. Each baseline parameter in the matrix is obtained by fitting the spectral experimental data of standard concentration nutrient components under different environmental conditions: the characteristic vibration frequency is determined by peak detection of pure component spectra, the baseline value of absorption intensity is the average characteristic peak area of standard concentration samples under 25℃ and 15%RH conditions, the temperature sensitivity coefficient is obtained by linear regression of peak position shift with temperature change at different temperatures, and the humidity correction coefficient is obtained by nonlinear fitting of peak position shift with humidity change under different humidity conditions. All parameters are stored in the model's parameter library and can be dynamically called according to soil type.
[0105] The peak positions of each nutrient group after spectral domain deconvolution are extracted using a peak detection algorithm. The rule for determining the adaptive threshold is: calculate the spectral domain feature signal. mean and standard deviation The threshold is set to And not less than 30% of the maximum signal value, to ensure effective identification of characteristic peaks while avoiding noise interference; combined with the pre-processed soil temperature {T} and humidity The data is used to calculate the feature peak offset using a pre-trained offset prediction model. ,in Under standard environmental conditions, with a temperature of 25℃ and humidity of 15%, the standard position of the feature peak is determined. The offset prediction model is trained using the gradient boosting tree algorithm. The input is the temperature and humidity data, and the output is the corresponding feature peak offset value. The tree depth of the model is set to 6, the learning rate is 0.05, and the number of iterations is 100.
[0106] The detected characteristic peak positions are dynamically corrected based on a chemical bond vibration reference matrix. For characteristic peaks of different nutrient groups, the corresponding temperature sensitivity coefficient and humidity correction coefficient in the reference matrix are called, and a comprehensive correction coefficient is applied. The weighting rules are as follows:
[0107] Temperature sensitivity coefficient weighting Humidity correction factor weight satisfy When soil moisture hour, , ;
[0108] when hour, , ;
[0109] when hour, , ;
[0110] The correction formula is:
[0111]
[0112] The deviation between the corrected characteristic peak and the standard peak position in the reference matrix is minimized using an iterative optimization algorithm. The rule for determining the iteration termination threshold is as follows:
[0113] The threshold is dynamically set according to the detection accuracy requirements. When the soil nutrient detection accuracy requirement is ±0.01mg / g, the threshold is 1e-6.
[0114] When the required accuracy is ±0.05 mg / g, the threshold is taken as 5e-6;
[0115] When the required accuracy is ±0.1 mg / g, the threshold is taken as 1e-5;
[0116] The rule for determining the maximum number of iterations is as follows: initially set to 50 iterations. If the termination threshold is not reached after 50 iterations, and the objective function decreases by less than 10% of the threshold for 10 consecutive iterations, the iteration is forcibly terminated.
[0117] The objective function is:
[0118]
[0119] in, For the reference matrix, the first The standard positions of the characteristic peaks are obtained, and finally the precise positions of the characteristic peaks after eliminating environmental interference are obtained.
[0120] This design, based on the model's built-in chemical bond vibration reference matrix, dynamically corrects for environmental drift of characteristic peaks. A reference matrix containing multiple parameters is pre-constructed, characteristic peak positions are extracted using a peak detection algorithm, and the offset is calculated using an offset prediction model. The weight of the comprehensive correction coefficient is determined based on temperature and humidity, and the deviation is minimized through an iterative optimization algorithm to obtain accurate characteristic peak positions. The chemical bond vibration reference matrix provides a standard basis and can dynamically adjust the correction coefficients according to different environmental conditions, effectively eliminating spectral shift errors caused by soil type differences and temperature and humidity variations. The iterative optimization algorithm ensures correction accuracy, making the detection results more accurately reflect the true state of soil nutrients and improving the reliability and stability of the detection.
[0121] In one embodiment, the content detection results of target nutrient components in the soil are output through feature signal quantification analysis and concentration mapping, including:
[0122] The characteristic signals of each nutrient group after correction are integrated, and the width of the integration window is determined based on the full width at half maximum (FWHM) of the characteristic peaks. The value is taken as 1.5 times the half-width at half-maximum of the characteristic peak. The area of the characteristic peak is calculated using the trapezoidal integral method, and the formula is:
[0123]
[0124] in For the first The integral area of each characteristic peak The corrected spectral domain component signal;
[0125] A concentration mapping model was constructed, which was trained using a large number of soil samples with known concentrations. The model was then used to map the characteristic peak areas under different concentration gradients. Using the actual concentration value as input and the actual concentration value as output, a polynomial calibration curve is obtained by fitting:
[0126]
[0127] in For the first Predicted concentration values of components in the planting and breeding groups. The coefficients are polynomial fitting coefficients, and the degree of the polynomial is... The determination rule is as follows: It is selected based on the principle of minimizing cross-validation error; when the cross-validation error is within... If the minimum time is reached, then take it twice. If the time error decreases by more than 10%, it is taken 3 times; otherwise, it is taken 2 times by default. During the fitting process, the coefficients are optimized by the 5-fold cross-validation method to avoid overfitting. The number of principal components of the PLSR model is determined by minimizing the error of the validation set, and the value range is 5-15.
[0128] Based on the multimodal feature weight fusion results output by the Transformer self-attention mechanism, the calculated concentration values corresponding to each feature peak are weighted and corrected. The rules for determining the modal weights are as follows:
[0129] The contribution of each mode is calculated based on the feature importance scoring algorithm, and the spectral feature weights are calculated. Microwave dielectric characteristic weights Temperature and humidity characteristic weights satisfy:
[0130]
[0131] and constraints , , The specific value is determined by minimizing the cross-validation error of the training set data;
[0132] Ultimately integrated into the soil The content detection results are output in the following format: It also outputs the confidence level of each detection result, with a value ranging from 0 to 1. The rule for determining the confidence level threshold is as follows:
[0133] When the confidence level is ≥0.85, the test result is considered reliable;
[0134] When 0.7 ≤ confidence level < 0.85, the judgment result needs to be further verified in conjunction with soil type;
[0135] When the confidence level is less than 0.7, the test result is deemed invalid and data needs to be collected again.
[0136] The confidence level is obtained from the statistical analysis of the model prediction error. Specifically, based on the deviation distribution between the predicted concentration and the actual concentration in the test set, the deviation probability density corresponding to the current predicted value is calculated. Confidence level = 1 - the cumulative value of the deviation probability density.
[0137] This design utilizes feature signal quantification analysis and concentration mapping to output detection results. The area of the characteristic peak is calculated by integrating the corrected feature signal, and a concentration mapping model based on partial least squares regression is constructed. The concentration calculation value is then weighted and corrected using multimodal feature weight fusion results, outputting the detection results and confidence level. Confidence level determination rules are clearly defined. The integration calculation and concentration mapping model transform the feature signal into an accurate concentration value. Multimodal feature weight fusion comprehensively considers the influence of various factors, improving detection accuracy. The output confidence level assesses the reliability of the results, providing users with a reference and facilitating timely problem detection and intervention, such as re-collecting data, ensuring the quality and application value of the detection results.
[0138] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0139] The above embodiments provide a detailed description of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A rapid soil nutrient detection method based on the Internet of Things, characterized in that, The method includes the following steps: S1. Acquire and preprocess raw multimodal soil data collected by the Internet of Things sensor network; S2. Input the preprocessed multimodal data into the preset analysis model to separate the soil nutrient chemical component signals and capture the correlation and dependence between multimodal features; S3. Based on a preset reference standard, dynamically correct the environmental drift of characteristic peaks and eliminate spectral shift errors caused by environmental factors; S4. Through characteristic signal quantification analysis and concentration mapping, output the detection results of the content of target nutrient components in the soil.
2. The method for rapid detection of soil nutrients based on the Internet of Things according to claim 1, characterized in that, The step S1 involves acquiring raw multimodal soil data collected by the Internet of Things (IoT) sensor network, including: Multiple types of sensors deployed through an Internet of Things (IoT) sensor network are used to simultaneously collect multimodal raw data of soil at different depth layers in the soil sampling area. The multimodal raw data includes at least spectral data, dielectric response data, and temperature and humidity data. During the acquisition process, the timestamp synchronization error of each sensor is ensured to be within a preset range.
3. The method for rapid detection of soil nutrients based on the Internet of Things according to claim 2, characterized in that, The preprocessing in S1 includes: Noise correction and background drift removal are performed on the spectral data; The dielectric response data is normalized in the frequency dimension to eliminate amplitude differences between different frequency channels; Outlier identification and correction were performed on the temperature and humidity data, and finally, standardized multimodal input data was obtained by integration.
4. The method for rapid detection of soil nutrients based on the Internet of Things according to claim 1, characterized in that, The process of separating soil nutrient chemical component signals and capturing the correlation dependencies between multimodal features in S2 includes: A multimodal feature fusion layer is constructed, and a dedicated embedding layer is designed for different types of standardized data. Various types of data are mapped to a high-dimensional feature space with unified dimensions to obtain the embedding features of each modality. Spectral domain transformation is performed on the spectral embedding features, and the feature signals of the target nutrient chemical components are separated using the deconvolution algorithm; The attention mechanism module processes multimodal embedding features to capture the nonlinear correlations and dependencies between different modalities.
5. The method for rapid detection of soil nutrients based on the Internet of Things according to claim 4, characterized in that: The deconvolution algorithm is based on sparse coding theory and achieves the separation of overlapping feature peaks by learning an adaptive deconvolution kernel; The initial value of the deconvolution kernel is set based on the reference signal of the standard nutrient group and is dynamically optimized during model training through an optimization algorithm.
6. The method for rapid detection of soil nutrients based on the Internet of Things according to claim 4, characterized in that, The training steps of the preset analysis model include: We constructed a dataset covering different soil types, different nutrient concentration gradients, and different environmental conditions, and simultaneously collected multimodal raw data and obtained the actual concentration of the target nutrient components as label data. Divide the dataset into training, validation, and test sets, and set the model initialization parameters, training batch size, number of training epochs, and early stopping strategy. Define a hybrid loss function that includes feature separation loss, peak position correction loss, and concentration prediction loss; Configure the optimizer and learning rate scheduling strategy, train the model using the training set, evaluate the model performance using the validation set and save the optimal model, and perform the final performance evaluation using the test set.
7. The method for rapid detection of soil nutrients based on the Internet of Things according to claim 1, characterized in that, The environmental drift correction of the characteristic peak based on a preset reference standard in S3 includes: A reference benchmark library containing relevant parameters of the characteristic peaks of the target nutrient groups is pre-constructed; The relevant parameters include at least the characteristic vibration frequency, the intensity reference value, and the environmental correction coefficient. Each parameter is obtained by fitting standard experimental data. Extract the characteristic peak positions of each nutrient group after spectral processing, and calculate the characteristic peak shift by combining the collected environmental data. The detected characteristic peak positions are dynamically corrected based on relevant parameters in the reference benchmark library, and the deviation between the corrected characteristic peak and the standard peak position is minimized through an iterative optimization algorithm.
8. The method for rapid detection of soil nutrients based on the Internet of Things according to claim 7, characterized in that, The environmental correction factor includes: Temperature sensitivity coefficient and humidity correction coefficient; The temperature sensitivity coefficient was obtained through regression analysis of the peak position shift at different temperatures and temperature changes; The humidity correction factor was obtained through fitting analysis of the peak position shift under different humidity levels and humidity changes; Supports dynamic invocation based on soil type.
9. The method for rapid detection of soil nutrients based on the Internet of Things according to claim 1, characterized in that, The detection results in S4 are output through feature signal quantization analysis and concentration mapping, including: The integral of the characteristic signals of each nutrient group after correction is calculated to obtain the integral area of the characteristic peak; A concentration mapping model was constructed and trained using a large number of soil samples with known concentrations. The integral area of the characteristic peak was used as input and the corresponding actual concentration value was used as output. The calibration curve was then fitted. By combining the multimodal feature weight fusion results, the concentration calculation values are weighted and corrected, and the content detection results of the target nutrient group are obtained.
10. The method for rapid detection of soil nutrients based on the Internet of Things according to claim 9, characterized in that, S4 also includes: Output the confidence level of each detection result, which is obtained based on the statistical analysis of the model prediction error; The reliability of the test results is determined based on the range of confidence values. When the confidence level is lower than the preset threshold, the test results are deemed invalid and a prompt to recollect data is made.