In-situ real-time detection method, system and device for soil nitrogen content and storage medium

CN122545774APending Publication Date: 2026-08-11CHINA AGRI UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-13
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0003]本发明提供一种土壤氮含量原位实时检测方法、系统、电子设备及存储介质,用以解决传统土壤氮含量原位检测方法实时性不足,并且忽视了土壤水分与氮素之间的非线性耦合干扰,导致在实际田间动态水分条件下检测精度低、可靠性差的缺陷

Benefits of technology

[0013] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the in-situ real-time detection method for soil nitrogen content as described in any of the above claims.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122545774A_ABST
    Figure CN122545774A_ABST
Patent Text Reader

Abstract

This invention provides a method, system, electronic device, and storage medium for in-situ real-time detection of soil nitrogen content. It collects multi-parameter soil data in real time using an array of IoT sensors deployed at different depths in the soil. This multi-parameter data is input into a soil nitrogen content estimation model, which dynamically quantifies the interference weight of soil moisture on electrical conductivity based on a feature attention mechanism, generating decoupled feature data. Based on this decoupled feature data, the invention outputs the in-situ real-time detection result of soil nitrogen content. This approach shifts from "avoiding coupling" to "facing and decoupling," fundamentally improving the robustness and accuracy of detection under changing environments (such as irrigation and rainfall). Simultaneously, by combining conventional IoT sensors with a deep learning model, it significantly reduces system cost and deployment difficulty, deeply explores the potential value of multi-parameter data, and has broad prospects for large-scale industrial application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of soil testing technology, and in particular to a method, system, electronic device, and storage medium for in-situ real-time detection of soil nitrogen content. Background Technology

[0002] Soil nitrogen content is a key parameter for evaluating soil fertility, guiding precision fertilization, and ensuring crop yield. Real-time and accurate acquisition of dynamic changes in soil nitrogen content is crucial for achieving on-demand fertilization and reducing non-point source pollution caused by excessive fertilizer application. Traditional laboratory analysis methods require soil sample collection and testing, a cumbersome and time-consuming process with significant time lag, failing to meet the needs of in-situ real-time monitoring in the field. To address the real-time issue, spectroscopic detection technology has been proposed. This technology attempts to establish predictive models using the sensitive spectral bands of water and nitrogen, avoiding interference from water in nitrogen content detection by selecting specific spectral bands that are insensitive to water. However, while this technology achieves rapid detection to some extent, it suffers from high costs of spectroscopic instruments, difficulty in large-scale deployment in the field, and serious challenges to the stability and long-term reliability of optical probes in the complex environment of actual fields. Furthermore, the "avoidance" strategy of spectroscopic technology does not fundamentally solve the coupling mechanism between water and nitrogen; when soil moisture conditions change drastically, the model prediction accuracy often decreases significantly. Furthermore, although various commercial soil sensors are available that can independently measure parameters such as temperature, moisture, electrical conductivity (EC), and pH, single-parameter or multi-parameter simple correlation detection techniques generally treat each parameter as an independent variable, ignoring the strong nonlinear coupling between parameters within soil as a complex multiphase system. In particular, changes in soil moisture significantly affect the measurement results of electrical conductivity (EC). This coupling interference effect between parameters reduces the accuracy and reliability of nitrogen content inversion models based on simple correlations of single-parameter or multi-parameter values ​​such as EC under actual field moisture dynamics. Summary of the Invention

[0003] This invention provides a method, system, electronic device, and storage medium for in-situ real-time detection of soil nitrogen content, which addresses the shortcomings of traditional in-situ soil nitrogen content detection methods, such as insufficient real-time performance and neglect of nonlinear coupling interference between soil moisture and nitrogen, resulting in low detection accuracy and poor reliability under actual field dynamic moisture conditions.

[0004] This invention provides a method for in-situ real-time detection of soil nitrogen content, comprising: Multi-parameter data of the soil are collected in real time by an array of IoT sensors deployed at different depths in the soil. The multi-parameter data is input into the soil nitrogen content estimation model. The soil nitrogen content estimation model dynamically quantifies the interference weight of soil moisture on electrical conductivity based on the feature attention mechanism, generates decoupled feature data, and outputs the in-situ real-time detection result of soil nitrogen content based on the decoupled feature data.

[0005] According to the in-situ real-time detection method for soil nitrogen content provided by the present invention, the soil nitrogen content estimation model includes: The feature attention layer is used to dynamically weight the input feature vector; A Transformer encoding layer is used to extract long-range temporal dependence features of soil nitrogen transport based on the dynamic weighting results using a multi-head self-attention mechanism. A bidirectional LSTM layer is used to capture the local evolution trend of the long-distance temporal dependence characteristics of soil nitrogen transport and perform regression prediction.

[0006] According to the in-situ real-time detection method for soil nitrogen content provided by the present invention, the feature attention layer is configured as follows: Based on the real-time collected multi-parameter data, construct the input feature vector for the current moment; Calculate in real time the cross-correlation matrix between moisture features and electrical conductivity features in the input feature vector at the current moment; Based on the cross-correlation matrix, attention weights corresponding to each input feature are dynamically generated, wherein the attention weights corresponding to the moisture feature are negatively correlated with the moisture fluctuation at the current moment. The input feature vector is weighted using the attention weights to obtain the decoupled feature data at the current time.

[0007] According to the in-situ real-time soil nitrogen content detection method provided by the present invention, the Transformer encoding layer is configured as follows: The weighted feature vector output by the feature attention layer is positionally encoded to generate an input sequence carrying temporal position information; The input sequence is linearly projected into a query matrix, a key matrix, and a value matrix; The query matrix, key matrix, and value matrix are divided into multiple heads, and the attention score is calculated independently within each head. The attention outputs of multiple heads are concatenated and linearly transformed to obtain the output of the multi-head self-attention mechanism; The output of the multi-head self-attention mechanism is nonlinearly transformed using a feedforward neural network; By adding residual connections and layer normalization operations after the multi-head self-attention mechanism and the feedforward neural network respectively, the long-range temporal dependence features of soil nitrogen transport are output.

[0008] According to the in-situ real-time detection method for soil nitrogen content provided by the present invention, the bidirectional LSTM layer is configured to include: The forward LSTM unit is used to read the long-distance temporal dependence features of soil nitrogen transport in the forward chronological direction and capture the influence of past information on soil nitrogen transport on the current moment. The backward LSTM unit is used to read the long-distance temporal dependence features of soil nitrogen transport in reverse chronological order, and to capture the constraint of future time information of soil nitrogen transport on the current time. The hidden state concatenation layer is used to concatenate the hidden states of the forward LSTM unit and the backward LSTM unit at the same time to generate a comprehensive feature vector that integrates forward and backward temporal information. A fully connected output layer is used to map the integrated feature vector into a predicted curve of soil nitrogen content.

[0009] According to the in-situ real-time detection method for soil nitrogen content provided by the present invention, the soil nitrogen content estimation model further includes: The physical guidance loss function includes a prediction error term and a physical constraint regularization term. The prediction error term is used to calculate the difference between the predicted and actual values ​​of soil nitrogen content in the prediction curve; The physical constraint regularization term is used to constrain the temporal smoothness of the prediction curve.

[0010] According to the in-situ real-time detection method for soil nitrogen content provided by the present invention, before inputting the multi-parameter data into the soil nitrogen content estimation model, the method further includes: The raw multi-parameter data collected in real time by the IoT sensor array is cleaned to remove outliers and missing data. Time alignment is performed on the cleaned multi-parameter data so that data collected by different sensors at the same time form a complete time profile. Standardize the time-aligned multi-parameter data to map parameter data with different dimensions to the same numerical scale.

[0011] This invention also provides an in-situ real-time detection system for soil nitrogen content, comprising: An IoT sensor array is deployed at different depths in the soil to collect multi-parameter data of the soil in real time. The data processing center is used to receive the multi-parameter data and run the soil nitrogen content estimation model. The soil nitrogen content estimation model dynamically quantifies the interference weight of soil moisture on electrical conductivity based on the feature attention mechanism, generates decoupled feature data, and outputs the in-situ real-time detection results of soil nitrogen content based on the decoupled feature data.

[0012] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the in-situ real-time detection method for soil nitrogen content as described in any of the preceding claims.

[0013] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the in-situ real-time detection method for soil nitrogen content as described in any of the above claims.

[0014] The present invention provides a method, system, electronic device, and storage medium for in-situ real-time detection of soil nitrogen content. This method collects multi-parameter data of the soil in real time using an array of IoT sensors deployed at different depths. The multi-parameter data is input into a soil nitrogen content estimation model, which dynamically quantifies the interference weight of soil moisture on electrical conductivity based on a feature attention mechanism, generating decoupled feature data. Based on this decoupled feature data, the method outputs the in-situ real-time detection result of soil nitrogen content. This shifts from "avoiding coupling" to "facing and decoupling," fundamentally improving the robustness and accuracy of detection under changing environments (such as irrigation and rainfall). Simultaneously, by combining conventional IoT sensors with a deep learning model, the method significantly reduces system cost and deployment difficulty, deeply explores the potential value of multi-parameter data, and has broad prospects for large-scale industrial application. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0016] Figure 1 This is a flowchart of the in-situ real-time detection method for soil nitrogen content provided in this embodiment of the invention; Figure 2 This is a schematic diagram of the deployment of the multi-depth sensor array in a soil profile provided in an embodiment of the present invention; Figure 3 This is an architecture diagram of the in-situ real-time soil nitrogen content detection system provided in this embodiment of the invention; Figure 4 This is a flowchart of the in-situ real-time soil nitrogen content detection system provided in this embodiment of the invention; Figure 5 This is a functional structure diagram of the electronic device provided in the embodiments of the present invention. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0018] Figure 1 The flowchart of the in-situ real-time detection method for soil nitrogen content provided in the embodiments of the present invention is as follows: Figure 1 As shown, the in-situ real-time detection method for soil nitrogen content provided in this embodiment of the invention includes: Step 101: Collect multi-parameter data of the soil in real time by deploying an array of IoT sensors at different depths in the soil; In this embodiment of the invention, a multi-depth sensor array is deployed to simultaneously acquire a set of highly correlated and complementary parameters, including temperature, moisture, EC value, and pH value. These parameters together constitute an "information fingerprint" reflecting the soil nitrogen status.

[0019] Step 102: Input the multi-parameter data into the soil nitrogen content estimation model. The soil nitrogen content estimation model dynamically quantifies the interference weight of soil moisture on electrical conductivity based on the feature attention mechanism, generates decoupled feature data, and outputs the in-situ real-time detection result of soil nitrogen content based on the decoupled feature data.

[0020] Traditional soil nitrogen content detection technologies cannot achieve in-situ real-time measurement and cannot effectively solve the problem of mutual coupling interference of multiple parameters (especially water and nutrients) within the soil, leading to distorted detection results.

[0021] The in-situ real-time soil nitrogen content detection method provided in this invention collects multi-parameter soil data in real time using an array of IoT sensors deployed at different depths in the soil. This multi-parameter data is then input into a soil nitrogen content estimation model. This model dynamically quantifies the interference weight of soil moisture on electrical conductivity based on a feature attention mechanism, generating decoupled feature data. Based on this decoupled feature data, the method outputs the in-situ real-time soil nitrogen content detection result. This shifts from "avoiding coupling" to "facing and decoupling," fundamentally improving the robustness and accuracy of detection under changing environments (such as irrigation and rainfall). Simultaneously, by combining conventional IoT sensors with a deep learning model, the method significantly reduces system costs and deployment difficulty, deeply explores the potential value of multi-parameter data, and has broad prospects for large-scale industrial applications.

[0022] Based on any of the above embodiments, before inputting the multi-parameter data into the soil nitrogen content estimation model, the method further includes: Step 201: Clean the raw multi-parameter data collected in real time by the IoT sensor array, and remove outliers and missing data; Step 202: Time-align the cleaned multi-parameter data so that the data collected by different sensors at the same time form a complete time profile; Step 203: Standardize the time-aligned multi-parameter data to map parameter data of different dimensions to the same numerical scale.

[0023] In this embodiment of the invention, the received multi-parameter raw data is cleaned, aligned, and standardized to construct a standard multi-parameter temporal tensor that meets the requirements of the model input.

[0024] Based on any of the above embodiments, the soil nitrogen content estimation model includes: The feature attention layer is used to dynamically weight the input feature vector; A Transformer encoding layer is used to extract long-range temporal dependence features of soil nitrogen transport based on the dynamic weighting results using a multi-head self-attention mechanism. A bidirectional LSTM layer is used to capture the local evolution trend of the long-distance temporal dependence characteristics of soil nitrogen transport and perform regression prediction.

[0025] In this embodiment of the invention, the soil nitrogen content estimation model is a Transformer-LSTM hybrid neural network estimation model. Addressing the problems of severe coupling interference between soil moisture and salinity and strong lag in nitrogen transport, this model constructs a deep learning architecture integrating a feature attention mechanism, a Transformer encoder, and a bidirectional LSTM. First, the feature attention mechanism is used to calculate the cross-correlation between input features and dynamically assign weights. When drastic fluctuations in moisture are detected, its nonlinear interference on the conductivity signal is automatically suppressed, thereby achieving implicit dynamic decoupling of water and nitrogen signals in the feature dimension. Subsequently, combining the global temporal awareness capability of the Transformer with the local memory capability of the LSTM, the model deeply mines and accurately captures the temporal lag features of soil nitrogen transport and transformation in porous media, thereby establishing a nonlinear mapping relationship between multi-source sensor data and soil nitrogen content, achieving in-situ, real-time, and high-precision prediction of soil nitrogen content.

[0026] This invention abandons the traditional independent decoupling sub-model and instead adopts a stage-IFeature attention mechanism. The model automatically calculates the cross-correlation matrix of features such as conductivity, moisture, and temperature at the input, dynamically generating feature weights. For example, when a sharp change in moisture due to irrigation is detected, the model automatically reduces the weight of the moisture feature, implicitly removing its nonlinear interference on nitrogen content prediction from the feature dimension, thus achieving dynamic decoupling of the signal. A Transformer-LSTM hybrid neural network is employed. Using the preprocessed and decoupled analysis-processed multi-parameter time-series tensor as input, a Transformer encoder captures the long-distance temporal dependence of nitrogen transport, and a bidirectional long short-term memory network mines local evolution trends, deeply analyzing the temporal lag characteristics of soil nitrogen transport. Through end-to-end mapping calculations, real-time sensor data is directly converted into high-precision nitrogen content predictions.

[0027] In this embodiment of the invention, the feature attention layer is configured as follows: Step 301: Construct the input feature vector at the current moment based on the real-time collected multi-parameter data; Step 302: Calculate the cross-correlation matrix between moisture features and electrical conductivity features in the input feature vector at the current moment in real time; Step 303: Based on the cross-correlation matrix, dynamically generate the attention weights corresponding to each input feature, wherein the attention weights corresponding to the moisture feature are negatively correlated with the moisture fluctuation at the current moment. Step 304: Use the attention weights to weight the input feature vector to obtain the decoupled feature data at the current time.

[0028] In this embodiment of the invention, the Transformer coding layer is configured as follows: Step 401: Perform position encoding on the weighted feature vector output by the feature attention layer to generate an input sequence carrying temporal position information; Step 402: Linearly project the input sequence into a query matrix, a key matrix, and a value matrix; Step 403: Divide the query matrix, key matrix, and value matrix into multiple heads, and calculate the attention score independently within each head; Step 404: Concatenate and linearly transform the attention outputs of multiple heads to obtain the output of the multi-head self-attention mechanism; Step 405: Perform a nonlinear transformation on the output of the multi-head self-attention mechanism using a feedforward neural network; Step 406: Add residual connections and layer normalization operations after the multi-head self-attention mechanism and the feedforward neural network respectively to output the long-range temporal dependence features of soil nitrogen transport.

[0029] In this embodiment of the invention, the bidirectional LSTM layer is configured to include: The forward LSTM unit is used to read the long-distance temporal dependence features of soil nitrogen transport in the forward chronological direction and capture the influence of past information on soil nitrogen transport on the current moment. The backward LSTM unit is used to read the long-distance temporal dependence features of soil nitrogen transport in reverse chronological order, and to capture the constraint of future time information of soil nitrogen transport on the current time. The hidden state concatenation layer is used to concatenate the hidden states of the forward LSTM unit and the backward LSTM unit at the same time to generate a comprehensive feature vector that integrates forward and backward temporal information. A fully connected output layer is used to map the integrated feature vector into a predicted curve of soil nitrogen content.

[0030] Based on any of the above embodiments, the soil nitrogen content estimation model further includes: The physical guidance loss function includes a prediction error term and a physical constraint regularization term. The prediction error term is used to calculate the difference between the predicted and actual values ​​of soil nitrogen content in the prediction curve; The physical constraint regularization term is used to constrain the temporal smoothness of the prediction curve.

[0031] For example, the system of this invention was deployed in a farmland experimental area and monitored continuously for one month. During this period, one fertilization and two irrigations were carried out. The system successfully captured the upward trend of nitrogen content after fertilization and the dynamic process of the relative decrease in nitrogen content due to water dilution after irrigation. The nitrogen content predicted by this embodiment of the invention was compared with the laboratory analysis results of soil samples collected during the same period, and its prediction accuracy (R0) was [not specified]. 2 The root mean square error (RMSE) reached over 0.89, which is much lower than that of the traditional single conductivity value estimation model, fully verifying the effectiveness and accuracy of this method.

[0032] The in-situ real-time soil nitrogen content detection method provided in this invention can accurately reflect complex field conditions, achieve long-term in-situ real-time monitoring of soil nitrogen content, solve the influence of the coupling effect of soil moisture and nutrients on sensor output, and achieve accurate estimation of soil nitrogen content through multi-parameter fusion and decoupling analysis.

[0033] The in-situ real-time soil nitrogen content detection system provided by the present invention is described below. The in-situ real-time soil nitrogen content detection system described below can be referred to in correspondence with the in-situ real-time soil nitrogen content detection method described above.

[0034] The in-situ real-time soil nitrogen content detection system provided in this embodiment of the invention includes: An IoT sensor array is deployed at different depths in the soil to collect multi-parameter data of the soil in real time. In this embodiment of the invention, the multi-depth sensor array is deployed in the soil profile as follows: Figure 2 As shown, for example, at depths of 10cm, 30cm, and 50cm, the sensor node collects data every 15 minutes. It should be noted that the collection frequency of the sensor node can be set according to requirements, and this invention does not impose any restrictions.

[0035] The data processing center is used to receive the multi-parameter data and run the soil nitrogen content estimation model. The soil nitrogen content estimation model dynamically quantifies the interference weight of soil moisture on electrical conductivity based on the feature attention mechanism, generates decoupled feature data, and outputs the in-situ real-time detection results of soil nitrogen content based on the decoupled feature data.

[0036] The system hardware provided in the embodiments of the present invention is as follows: Figure 3 As shown, the system includes: multi-parameter sensor nodes deployed in the soil profile in the field, a gateway for data collection, a server deployed in the cloud, and user terminals. Data collected by the sensor nodes is transmitted to the gateway via LoRa wireless technology, including temperature, volumetric water content, EC value, and pH value. The gateway then transmits the data to the cloud server via a 4G / 5G network. Prediction results, along with the raw sensor data, are displayed on a web interface or mobile app, allowing users to view real-time nitrogen dynamics in different soil layers and set early warning thresholds.

[0037] The specific workflow of the in-situ real-time soil nitrogen content detection system provided in this embodiment of the invention is as follows: Figure 4 As shown, the invention specifically includes: First, by deploying an array of IoT sensors at different depths, the invention directly acquires multi-depth, multi-parameter raw data of the soil profile; second, in the data preprocessing stage, the collected multi-parameter data is organized into a time-series tensor containing three dimensions: time, depth, and parameter type, completely preserving all original information; finally, the user interaction module retrieves the stored raw data and model prediction results from the database, displaying the real-time values ​​and historical trends of each depth and parameter to the user in the form of visual charts, thus forming a comprehensive soil health diagnostic platform to provide farmers with more comprehensive decision support. This invention not only outputs nitrogen content but also simultaneously provides profile information on soil moisture, salinity (EC value), and pH, forming a comprehensive soil health diagnostic platform to provide farmers with more comprehensive decision support.

[0038] This invention, combined with solar power, enables the system to operate for extended periods in unattended outdoor environments, achieving true in-situ, online, and real-time monitoring and meeting the data continuity requirements of smart agriculture.

[0039] The soil nitrogen content in-situ real-time detection system provided in this invention collects multi-parameter data of the soil in real time through an array of IoT sensors deployed at different depths in the soil. This multi-parameter data is input into a soil nitrogen content estimation model, which dynamically quantifies the interference weight of soil moisture on electrical conductivity based on a feature attention mechanism, generating decoupled feature data. Based on this decoupled feature data, the system outputs the in-situ real-time detection result of soil nitrogen content. This shifts from "avoiding coupling" to "facing and decoupling," fundamentally improving the robustness and accuracy of detection under changing environments (such as irrigation and rainfall). Simultaneously, by combining conventional IoT sensors with a deep learning model, the system significantly reduces system cost and deployment difficulty, deeply explores the potential value of multi-parameter data, and has broad prospects for large-scale industrial application.

[0040] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5 As shown, the electronic device may include a processor 510, a communication interface 520, a memory 530, and a communication bus 540. The processor 510, communication interface 520, and memory 530 communicate with each other via the communication bus 540. The memory 530 includes computer programs, an operating system, and acquired data. The processor 510 can call logical instructions in the memory 530 to execute a method for in-situ real-time detection of soil nitrogen content. This method includes: real-time acquisition of multi-parameter data of the soil using an IoT sensor array deployed at different depths in the soil; inputting the multi-parameter data into a soil nitrogen content estimation model, whereby the soil nitrogen content estimation model dynamically quantifies the interference weight of soil moisture on electrical conductivity based on a feature attention mechanism to generate decoupled feature data; and outputting the in-situ real-time detection result of soil nitrogen content based on the decoupled feature data.

[0041] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to related technologies, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0042] On the other hand, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a method for in-situ real-time detection of soil nitrogen content provided by the above methods. The method includes: collecting multi-parameter data of soil in real time through an Internet of Things sensor array deployed at different depths in the soil; inputting the multi-parameter data into a soil nitrogen content estimation model, wherein the soil nitrogen content estimation model dynamically quantifies the interference weight of soil moisture on electrical conductivity based on a feature attention mechanism to generate decoupled feature data; and outputting in-situ real-time detection results of soil nitrogen content based on the decoupled feature data.

[0043] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0044] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of software products. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0045] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for in-situ real-time detection of soil nitrogen content, characterized in that, include: Multi-parameter data of the soil are collected in real time by an array of IoT sensors deployed at different depths in the soil. The multi-parameter data is input into the soil nitrogen content estimation model. The soil nitrogen content estimation model dynamically quantifies the interference weight of soil moisture on electrical conductivity based on the feature attention mechanism, generates decoupled feature data, and outputs the in-situ real-time detection result of soil nitrogen content based on the decoupled feature data.

2. The method for in-situ real-time detection of soil nitrogen content according to claim 1, characterized in that, The soil nitrogen content estimation model includes: The feature attention layer is used to dynamically weight the input feature vector; A Transformer encoding layer is used to extract long-range temporal dependence features of soil nitrogen transport based on the dynamic weighting results using a multi-head self-attention mechanism. A bidirectional LSTM layer is used to capture the local evolution trend of the long-distance temporal dependence characteristics of soil nitrogen transport and perform regression prediction.

3. The method for in-situ real-time detection of soil nitrogen content according to claim 2, characterized in that, The feature attention layer is configured as follows: Based on the real-time collected multi-parameter data, construct the input feature vector for the current moment; Calculate in real time the cross-correlation matrix between moisture features and electrical conductivity features in the input feature vector at the current moment; Based on the cross-correlation matrix, attention weights corresponding to each input feature are dynamically generated, wherein the attention weights corresponding to the moisture feature are negatively correlated with the moisture fluctuation at the current moment. The input feature vector is weighted using the attention weights to obtain the decoupled feature data at the current time.

4. The method for in-situ real-time detection of soil nitrogen content according to claim 2, characterized in that, The Transformer encoding layer is configured as follows: The weighted feature vector output by the feature attention layer is positionally encoded to generate an input sequence carrying temporal position information; The input sequence is linearly projected into a query matrix, a key matrix, and a value matrix; The query matrix, key matrix, and value matrix are divided into multiple heads, and the attention score is calculated independently within each head. The attention outputs of multiple heads are concatenated and linearly transformed to obtain the output of the multi-head self-attention mechanism; The output of the multi-head self-attention mechanism is nonlinearly transformed using a feedforward neural network; By adding residual connections and layer normalization operations after the multi-head self-attention mechanism and the feedforward neural network respectively, the long-range temporal dependence features of soil nitrogen transport are output.

5. The method for in-situ real-time detection of soil nitrogen content according to claim 4, characterized in that, The bidirectional LSTM layer is configured to include: The forward LSTM unit is used to read the long-distance temporal dependence features of soil nitrogen transport in the forward chronological direction and capture the influence of past information on soil nitrogen transport on the current moment. The backward LSTM unit is used to read the long-distance temporal dependence features of soil nitrogen transport in reverse chronological order, and to capture the constraint of future time information of soil nitrogen transport on the current time. The hidden state concatenation layer is used to concatenate the hidden states of the forward LSTM unit and the backward LSTM unit at the same time to generate a comprehensive feature vector that integrates forward and backward temporal information. A fully connected output layer is used to map the integrated feature vector into a predicted curve of soil nitrogen content.

6. The method for in-situ real-time detection of soil nitrogen content according to claim 5, characterized in that, The soil nitrogen content estimation model also includes: The physical guidance loss function includes a prediction error term and a physical constraint regularization term. The prediction error term is used to calculate the difference between the predicted and actual values ​​of soil nitrogen content in the prediction curve; The physical constraint regularization term is used to constrain the temporal smoothness of the prediction curve.

7. The method according to any one of claims 1 to 6, wherein Before inputting the multi-parameter data into the soil nitrogen content estimation model, the method further includes: The multi-parameter data collected in real time by the IoT sensor array is cleaned to remove outliers and missing data. Time alignment is performed on the cleaned multi-parameter data so that data collected by different sensors at the same time form a complete time profile. Standardize the time-aligned multi-parameter data to map parameter data with different dimensions to the same numerical scale.

8. A system for in-situ real-time detection of soil nitrogen content, characterized in that, include: An IoT sensor array is deployed at different depths in the soil to collect multi-parameter data of the soil in real time. The data processing center is used to receive the multi-parameter data and run the soil nitrogen content estimation model. The soil nitrogen content estimation model dynamically quantifies the interference weight of soil moisture on electrical conductivity based on the feature attention mechanism, generates decoupled feature data, and outputs the in-situ real-time detection results of soil nitrogen content based on the decoupled feature data.

9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the in-situ real-time detection method for soil nitrogen content as described in any one of claims 1 to 7.

10. A non-transitory computer readable storage medium having stored thereon a computer program, characterized in that, When executed by a processor, the computer program implements the in-situ real-time detection method for soil nitrogen content as described in any one of claims 1 to 7.