A partition interval multi-factor calibration method of a soil moisture sensor
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TSINGHUA UNIVERSITY
- Filing Date
- 2026-04-20
- Publication Date
- 2026-08-04
AI Technical Summary
该类方法虽然局部拟合精度较高,但需要为不同样本分别维护独立模型,通用性较差,应用时难以兼顾效率和一致性
[0050]与现有技术相比,本发明至少具有以下有益效果:第一,在保留分区间显式率定公式可解释性的基础上,通过机器学习实现对的连续化,增强了中间干密度条件下的插值能力;第二,通过对候选分段数进行循环搜索,可确定最优分段数,避免固定分段数带来的经验性偏差;第三,所述方法可以直接输出连续化修正参数,系统快速运算。
Smart Images

Figure CN122506136A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of soil moisture monitoring and sensor calibration technology, specifically to a method for calibrating a soil moisture sensor by interval and multiple factors. Background Technology
[0002] The measurement accuracy of soil moisture sensors largely depends on their calibration method. For the same type of sensor, differences in soil texture, filling conditions, and dry density can all cause shifts in the mapping relationship between the output signal and moisture content. Therefore, directly using a single global empirical curve for calibration often only yields good results under local conditions, while systematic errors are easily introduced across soil types and dry density conditions.
[0003] In existing approaches, one type involves establishing dedicated calibration curves for each single sample or soil type. While this method offers high local fitting accuracy, it requires maintaining independent models for different samples, resulting in poor versatility and difficulty in balancing efficiency and consistency during application. Another type of approach uses a unified model to directly fit multiple conditions as a whole, failing to consider the varying impacts of different conditions on the calibration relationship, leading to increased overall dispersion. Summary of the Invention
[0004] The present invention aims to at least partially solve one of the technical problems existing in the prior art.
[0005] Therefore, the purpose of this invention is to provide a multi-factor calibration method for soil moisture sensors in intervals, so as to achieve a soil moisture sensor calibration method that takes into account both local and overall multi-factor accuracy.
[0006] To achieve the above objectives, the present invention adopts the following technical solution:
[0007] The first aspect of this invention provides a method for calibrating a soil moisture sensor by interval and multiple factors, comprising:
[0008] Soil samples with different soil types, dry densities, and temperatures were prepared. The moisture content of each soil sample was measured using a soil moisture sensor. The measured values of the soil moisture sensor were matched one-to-one with the reference moisture content obtained by weighing each soil sample to construct a calibration sample library.
[0009] The soil moisture sensor's measurement range is divided into multiple calibration intervals based on a given number of calibration interval segments. A basic calibration model is constructed for each calibration interval using the calibration sample library. Each basic calibration model is then fitted using a two-stage residual method to obtain the initial calibration parameters for the corresponding group. Let the first... The initial calibration parameters of the group include the calibration interval. The corresponding soil type correction offset, dry density correction factor, and temperature correction factor are as follows:
[0010] The initial calibration parameters are continuously corrected using machine learning methods. The machine learning methods automatically match a set of correction calibration parameters based on the input soil moisture sensor measurements, soil type, dry density, and temperature, thereby obtaining a correction calibration model.
[0011] For the soil to be tested, the measured value of the soil moisture sensor is obtained and input into the basic calibration model corresponding to the calibration interval to which the measured value belongs, so as to obtain the initial moisture content of the soil to be tested. The initial moisture content, soil type, dry density and temperature of the soil to be tested are input into the correction calibration model to obtain the corrected moisture content of the soil to be tested.
[0012] In some embodiments, the basic calibration model is a polynomial model obtained by fitting the measured values of soil moisture sensors as independent variables and reference moisture content as dependent variables; within each calibration interval, only calibration samples falling within that calibration interval are used to construct the corresponding basic calibration model.
[0013] In some embodiments, for calibration intervals Corresponding basic calibration model Perform a two-stage residual fitting to obtain the first... Group initial calibration parameters ,include:
[0014] For constructing the basic calibration model For each calibration sample used, the residuals of the basic calibration model were calculated:
[0015]
[0016] in, For the first The basic calibration model for a calibration sample The residual; For calibration interval Next The reference moisture content of the calibrated sample; Basic calibration model For the first Fitted values of the moisture content of a single calibrated sample;
[0017] Take the construction of basic calibration models respectively The median dry density and median temperature of all calibration samples were used as the calibration interval. Reference dry density below and reference temperature ;
[0018] For calibration interval For each calibration sample within the range, the following linear residual model is fitted:
[0019]
[0020] in, For calibration interval Soil type correction amount For calibration interval The dry density correction factor is below. For calibration interval Temperature correction factor below, and separate calibration intervals Next The dry density and temperature of the calibration sample, For calibration interval Next The second-stage residual term of a calibration sample, parameters , and Solve using the least squares method;
[0021] Construct the first Group initial calibration parameters .
[0022] In some embodiments, the expression of the correction calibration model is:
[0023]
[0024] in, To correct for moisture content; This represents the initial moisture content. To determine the number of segments in the calibration interval The soil type offset correction amount obtained through machine learning methods; To determine the number of segments in the calibration interval The dry density correction coefficient obtained through machine learning methods; For calibration interval The reference dry density is used to construct the basic calibration model. The median of the dry density of all calibration samples used; To determine the number of segments in the calibration interval The temperature correction coefficient was obtained through machine learning methods. For calibration interval The reference temperature is used to construct the basic calibration model. The median temperature of all calibration samples used; by , and The correction calibration parameters constitute the aforementioned parameters;
[0025] The continuous correction of the initial calibration parameter set using machine learning methods includes:
[0026] Constructing learning samples for machine learning ,in, For calibration interval numbering, ; Number the learning samples. , In order to target the The number of learning samples used in each calibration interval; For soil type identification; and Constructing the first The soil type identifier used in the basic calibration model for each calibration interval is: The The dry density and temperature of the calibration sample; for the training sample The goal of machine learning is , , and These are the soil type correction factor, dry density correction factor, and temperature correction factor for the known nodes of the machine learning objective, respectively, satisfying... , and ;
[0027] Based on preprocessed learning samples Supervised training of the machine learning model is performed to establish a mapping relationship from calibration interval numbers, soil type identifiers, dry density, and temperature to continuous correction parameters. The preprocessing of the learning samples includes: one-heat encoding of the calibration interval numbers and soil type identifiers, numerical feature input for dry density and temperature, and standardization before training as follows:
[0028]
[0029] in, To The dry density obtained after standardization processing To The temperature obtained through standardization; and Here, represents the mean and standard deviation of the dry density for all training samples, respectively. and These are the mean and standard deviation of the temperature for all training samples, respectively.
[0030] The machine learning model is trained by learning a loss function that minimizes the following parameters:
[0031]
[0032]
[0033] in, This is the total loss function; In order to target the Loss function for a given calibration interval; These are the weighting coefficients corresponding to soil type, dry density, and temperature, respectively. The predicted value output by the machine learning model corresponds to a set of correction calibration parameters. , and .
[0034] In some embodiments, the machine learning model may be any regression model or a combination of multiple regression models.
[0035] In some embodiments, the interval-based multi-factor calibration method further includes:
[0036] All learning samples constructed based on the calibration sample library are divided into training and test sets according to a set ratio, and candidate intervals with a set number of calibration interval segments are defined. , These are the maximum and minimum values of the number of segments in the calibration interval, respectively. ;
[0037] For candidate intervals The number of each candidate segment within the range is used to obtain a correction calibration model using the training set, and the accuracy of the corrected moisture content calculated by the correction calibration model is evaluated using the test set.
[0038] The number of candidate segments with the highest evaluation result is taken as the number of segments in the optimal calibration interval, and the optimal correction calibration parameter is determined based on the number of segments in the optimal calibration interval.
[0039] The second aspect of this invention provides a multi-factor calibration device for a soil moisture sensor, comprising:
[0040] The calibration sample library construction module is configured to prepare soil samples with different soil types, dry densities, and temperatures, and to measure the moisture content of each soil sample using a soil moisture sensor. The measured values of the soil moisture sensor are then matched one-to-one with the reference moisture content obtained by weighing each soil sample to construct the calibration sample library.
[0041] The initial calibration parameter determination module is configured to divide the range of the soil moisture sensor into multiple calibration intervals according to a given number of calibration interval segments, construct a basic calibration model for each calibration interval using the calibration sample library, and perform a two-stage residual method fitting on each basic calibration model to obtain a corresponding set of initial calibration parameters. Let the first... The initial calibration parameters of the group include the calibration interval. The corresponding soil type's correction offset, dry density correction factor, and temperature correction factor;
[0042] The correction calibration model construction module is configured to continuously correct the initial calibration parameter set using machine learning methods. The machine learning methods automatically match a set of correction calibration parameters based on the input soil moisture sensor measurements, soil type, dry density, and temperature, thereby obtaining the correction calibration model.
[0043] The correction calculation module is configured to acquire the measured value of the soil moisture sensor for the soil to be tested and input it into the basic calibration model corresponding to the calibration interval to which the measured value belongs, so as to obtain the initial moisture content of the soil to be tested. The initial moisture content, soil type, dry density and temperature of the soil to be tested are input into the correction calibration model to obtain the corrected moisture content of the soil to be tested.
[0044] In some embodiments, the interval-based multi-factor calibration device further includes:
[0045] The optimization module is configured to divide all learning samples constructed based on the calibration sample library into training set, validation set, and test set according to a set ratio, and to set candidate intervals for the number of calibration interval segments. , These are the maximum and minimum values of the number of segments in the calibration interval, respectively. For candidate intervals The number of candidate segments within each interval is used to obtain a correction calibration model using the training set, and the accuracy of the corrected moisture content calculated by the correction calibration model is evaluated using the test set. The number of candidate segments with the highest evaluation result is taken as the number of segments in the optimal calibration interval, and the optimal correction calibration parameter is determined based on the number of segments in the optimal calibration interval.
[0046] A third aspect of the present invention provides an electronic device comprising:
[0047] At least one processor; and a memory communicatively connected to said at least one processor;
[0048] The memory stores computer instructions that can be executed by the at least one processor. When the computer instructions are executed by the at least one processor, they implement the interval multi-factor calibration method according to any embodiment of the first aspect of the present invention.
[0049] The fourth aspect of the present invention provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the interval multi-factor calibration method according to any embodiment of the first aspect of the present invention.
[0050] Compared with the prior art, the present invention has at least the following beneficial effects: First, while preserving the interpretability of the explicit calibration formula for interval division, it achieves the understanding of the specific characteristics of the formula through machine learning. First, the continuous segmentation enhances the interpolation capability under intermediate dry density conditions. Second, by iteratively searching the candidate segment number, the optimal segment number can be determined, avoiding empirical bias caused by a fixed segment number. Third, the method can directly output continuous correction parameters, enabling rapid system computation. Attached Figure Description
[0051] Figure 1 This is an overall flowchart of a multi-factor calibration method for a soil moisture sensor based on intervals, provided in the first aspect of this invention.
[0052] Figure 2 This is a schematic diagram of the structure of an electronic device provided in a third aspect embodiment of the present invention. Detailed Implementation
[0053] To make the objectives, technical solutions, and advantages of this application clearer, the application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely for explaining this application and are not intended to limit this application.
[0054] Conversely, this application covers any alternatives, modifications, equivalent methods, and solutions made within the spirit and scope of this application as defined by the claims. Furthermore, to provide the public with a better understanding of this application, certain specific details are described in detail below. However, those skilled in the art will fully understand this application even without these detailed descriptions.
[0055] See Figure 1 The first aspect of the present invention provides a method for calibrating a soil moisture sensor by interval multi-factor method, comprising the following steps:
[0056] Step S1: Prepare soil samples with different soil types, dry densities and temperatures. Use a soil moisture sensor to measure the moisture content of each soil sample. Match the measured values of the soil moisture sensor with the reference moisture content obtained by weighing each soil sample to construct a calibration sample library.
[0057] Step S2: Divide the soil moisture sensor's range into multiple calibration intervals according to the given number of calibration interval segments. Using the calibration sample library constructed in Step S1, build a basic calibration model for each calibration interval. Perform a two-stage residual method fitting on each basic calibration model to obtain a corresponding set of initial calibration parameters. Let the first... The initial calibration parameters of the group include the calibration interval. The corresponding soil type's correction offset, dry density correction factor, and temperature correction factor;
[0058] Step S3: Continuously correct the initial calibration parameters using machine learning methods. This machine learning method automatically matches a set of correction calibration parameters based on the input soil moisture sensor measurements, soil type, dry density, and temperature, thereby obtaining the correction calibration model.
[0059] Step S4: For the soil to be tested, obtain the measured value of the soil moisture sensor and input it into the basic calibration model corresponding to the calibration interval to which the measured value belongs, to obtain the initial moisture content of the soil to be tested. Input the initial moisture content, soil type, dry density and temperature of the soil to be tested into the correction calibration model to obtain the corrected moisture content of the soil to be tested.
[0060] In some embodiments, the soil moisture sensor to be calibrated is a non-contact filter-type soil moisture sensor, which includes a microporous filter housing, a diatomaceous earth conductive core, a central electrode, and an AC excitation readout unit. The output voltage value of the sensor... The characteristic signal output by the AC excitation readout unit.
[0061] In one specific embodiment of this application, the specific structure of the soil moisture sensor to be calibrated is described in Chinese Invention Patent No. 201910954922.9, which discloses a filter-type soil moisture sensor. The sensor is inserted into the soil to be tested. It uses a filter as the soil-probe moisture exchange interface, a diatomaceous earth conductive core as the internal measuring unit, and outputs a voltage signal characterizing changes in conductivity using an AC excitation method. In addition, auxiliary calibration information for the soil to be tested needs to be obtained, including soil type identification. Soil dry density and temperature Among them, soil type identification This information can be derived from previous soil sample classification results, known plot soil information, or on-site grouping information; soil dry density. This information can come from filling records, on-site sampling and measurement results, or existing site parameters; temperature. The data can come from the temperature probe that comes with the sensor or the temperature acquisition channel in the same acquisition terminal.
[0062] It should be noted that, in addition to the aforementioned non-contact filter-type soil moisture sensor, this invention is also applicable to other existing types of soil moisture sensors.
[0063] In some embodiments, each basic calibration model The construction of calibration parameters also relies on the calibration sample library. Three typical soil types, sandy loam, clay and sand, were selected and sampled under multiple dry density gradients and measured using the soil moisture sensor to be calibrated. Under the same conditions, the reference moisture content of each soil sample was obtained by indoor gravity method to form a one-to-one correspondence between the sensor output voltage value and the reference moisture content, and the calibration sample library was constructed accordingly.
[0064] In one specific embodiment of this application, the dry density is set to 1.30, 1.35, 1.40, 1.45, 1.50, and 1.60. The collected sandy loam soil samples were assigned numbers A1 to A6; clay soil samples were assigned numbers B1 to B6; and sandy soil samples were assigned numbers C1 to C6. See Table 1 for detailed sampling information.
[0065] Table 1: Soil Sample Information
[0066] soil sample serial number Sampling location latitude and longitude Sandy loam soil A1~A6 Beijing Daxing 39.3725,116.2551 clay B1~B6 Fangshan District, Beijing 39.3633,116.0031 sand C1~C6 Beijing Daxing 39.5812,116.3154
[0067] The measurement steps include:
[0068] (1) Soil pretreatment: Collect soil samples, remove stones and plant debris, air dry naturally, and sieve for later use;
[0069] (2) Canning preparation: The three types of soil were prepared at concentrations of 1.30, 1.35, 1.40, 1.45, 1.50 and 1.60, respectively. Six dry density gradient layers were placed into an experimental container (the experimental container is cylindrical with an inner diameter of 10 cm and a height of 16 cm), and each layer was uniformly compacted to ensure the target dry density and spatial uniformity.
[0070] (3) Saturation treatment: Place the experimental vessel in a water-filled container and slowly saturate it using a bottom water supply method to reduce the initial error caused by air retention;
[0071] (4) Sensor deployment: Insert the probe of the filter-type soil moisture sensor and the temperature probe into each experimental tank so that the output voltage, temperature and soil quality changes can be recorded synchronously;
[0072] (5) Continuous evaporation monitoring: The test tank was placed on a HYPROP high-precision automatic balance (METER, Germany, range 2200g, accuracy 0.01g) and the changes in mass, voltage and temperature during the natural air drying process were continuously recorded until the soil was close to being air-dried. The test lasted about two weeks per group.
[0073] This provides a calibration sample library covering multiple soil types, dry density conditions, and different temperatures, laying the data foundation for the subsequent establishment of interval-based calibration models and corrected calibration parameters.
[0074] In some embodiments, considering the differences in the response slope and nonlinearity of non-contact filter-type soil moisture sensors in different moisture content ranges, step S2 of the present invention determines the initial moisture content. The process employs a segmented processing mechanism. Step S2 specifically includes:
[0075] Number of segments in a given calibration interval Under these conditions, the measurement range of the soil moisture sensor is divided into: A fixed interval;
[0076] Within each calibration interval, a basic calibration model from the output voltage value to the reference moisture content is established using only calibration samples from the calibration sample library that fall within that interval; for each calibration interval... Constructed basic calibration model for:
[0077]
[0078] in, Basic calibration model Model parameters.
[0079] In some embodiments, in step S2, the basic calibration model is used. The corresponding set of initial calibration parameters Including calibration intervals Soil type correction amount Dry density correction factor and temperature correction factor ,Right now Determine by following these steps :
[0080] For constructing the basic calibration model For each calibration sample used, the residuals of the basic calibration model were calculated:
[0081]
[0082] in, For the first The basic calibration model for a calibration sample The residual; For calibration interval Next The reference moisture content of the calibrated sample; Basic calibration model For the first Fitted values of the moisture content of a single calibrated sample;
[0083] Take the construction of basic calibration models respectively The median dry density and median temperature of all calibration samples were used as the calibration interval. Reference dry density below and reference temperature ;
[0084] For calibration interval For each calibration sample within the range, the following linear residual model is fitted:
[0085]
[0086] in, For calibration interval Soil type correction amount For calibration interval The dry density correction factor is below. For calibration interval Temperature correction factor below, and separate calibration intervals Next The dry density and temperature of the calibration sample, For calibration interval Next The second-stage residual term of a calibration sample, parameters , and Solve using the least squares method;
[0087] Construct the first Group initial calibration parameters .
[0088] In some embodiments, to extend the initial calibration parameters from discrete data to a parameter function that continuously varies with dry density and temperature, step S3 of the present invention continuously corrects the initial calibration parameters using a machine learning method, specifically including:
[0089] Step S31: Construction of learning samples
[0090] Constructing learning samples for machine learning ,in, For calibration interval numbering, ; Number the learning samples. , In order to target the The number of learning samples used in each calibration interval; For soil type identification; and Constructing the first The soil type identifier used in the basic calibration model for each calibration interval is: The The dry density and temperature of the calibration sample; for the training sample The goal of machine learning is , , and These are the soil type correction factor, dry density correction factor, and temperature correction factor for the machine learning nodes, respectively, satisfying... , and ;
[0091] Step S32: Machine Learning Model Construction
[0092] In this embodiment, the K-nearest neighbor regression model is selected to construct the machine learning model. In other embodiments, any one or more combinations of random forest regression model, gradient boosting tree regression model, extreme gradient boosting regression model, support vector regression model, Gaussian process regression model, neural network regression model, linear regression model, and ridge regression model can also be used to construct the machine learning model.
[0093] Step S33: Machine Learning Model Training
[0094] Based on preprocessed learning samples Supervised training of the machine learning model was conducted to establish a mapping relationship from calibration interval numbers, soil type identifiers, dry density, and temperature to continuous correction parameters; training samples were then applied. The preprocessing includes: using unique thermal encoding for calibration interval numbers and soil type identifiers, using numerical feature inputs for dry density and temperature, and performing the following standardization processing before training:
[0095]
[0096] in, To The dry density obtained after standardization processing To The temperature obtained through standardization; Here, represents the mean and standard deviation of the dry density for all training samples, respectively. and These are the mean and standard deviation of the temperature for all training samples, respectively.
[0097] Machine learning models are trained by learning a loss function that minimizes the following parameters:
[0098]
[0099]
[0100] in, This is the total loss function; In order to target the Loss function for a given calibration interval; Weighting coefficients corresponding to soil type, dry density, and temperature; The predicted value output by the machine learning model corresponds to a set of correction calibration parameters. , and .
[0101] Furthermore, in step S3, using the trained machine learning model, a set of correction calibration parameters can be automatically determined based on the input soil moisture sensor measurements, soil type, dry density, and temperature. And construct a correction calibration model using these correction calibration parameters:
[0102]
[0103] in, To correct for moisture content; The initial moisture content is obtained from the basic calibration model corresponding to the calibration interval where the sensor measurement value is located; To determine the number of segments in the calibration interval The soil type offset correction amount obtained through machine learning methods; To determine the number of segments in the calibration interval The dry density correction coefficient obtained through machine learning methods; For calibration interval The reference dry density is used to construct the basic calibration model. The median of the dry density of all calibration samples used; To determine the number of segments in the calibration interval The temperature correction coefficient was obtained through machine learning methods. For calibration interval The reference temperature is used to construct the basic calibration model. The median temperature of all calibration samples used.
[0104] Understandably, by using the above methods, while maintaining the simplicity of the basic calibration model structure, the deviations caused by soil type differences, dry density differences, and temperature disturbances can be explicitly corrected, thereby further improving the calibration accuracy.
[0105] In some embodiments, the interval-based multi-factor calibration method proposed in this invention includes determining the optimal calibration interval segment and its corresponding optimal correction calibration parameter, specifically including:
[0106] All learning samples are divided into training and validation sets according to a set ratio (in this embodiment, the ratio of the number of samples in the training set to the number in the validation set and the number in the test set is 8:1:1), and candidate intervals for the number of calibration interval segments are defined. , These are the maximum and minimum values of the number of segments in the calibration interval, respectively. In this embodiment, , , The step size is set to 1;
[0107] For candidate intervals The number of candidate segments within each segment is used to obtain a corrected calibration model using the training set, and the accuracy of the corrected moisture content calculated by the corrected calibration model is evaluated using the validation set; the coefficient of determination is selected as the evaluation index. :
[0108]
[0109] in, To verify the first set Reference moisture content for each learning sample; To obtain the corrected calibration model from the training set and apply it to the validation set... The corrected moisture content obtained from the training samples; To verify the mean reference moisture content of all learning samples in the set;
[0110] The highest evaluation result (i.e. The smallest number of candidate segments is used as the optimal calibration interval segment number. In this embodiment, the determined optimal calibration interval segment number is 9, and the optimal correction calibration parameter is determined based on this optimal calibration interval segment number.
[0111] Table 3: Performance Comparison
[0112] Overall performance indicators Before revision Correction Calibration Parameters <![CDATA[R 2 ]]> 0.8711 0.9699 RMSE 0.0394 0.0191 MAE 0.0310 0.0116
[0113] Referring to Table 3, the R values of the sensor measurements were statistically analyzed before calibration using the method of this invention. 2 The R² value is 0.8711, the RMSE is 0.0394, and the MAE is 0.0310. After correction using the calibration model obtained by the method of this invention, R²... 2 The results achieved a value of 0.9699, an RMSE of 0.0191, and a MAE of 0.0116, significantly improving the sensor's measurement performance.
[0114] Understandably, to extend the initial calibration parameters obtained under discrete calibration conditions to intermediate dry density conditions that are not directly measured, continuous training based on machine learning is performed on the initial calibration parameters after fitting. This continuous machine learning training does not directly replace the basic calibration models, but rather outputs continuous correction parameters based on the calibration interval number, soil type identifier, dry density, and temperature. These continuous correction parameters then form the corrected calibration parameters, which are subsequently substituted into the explicit correction formula for moisture content correction calculation.
[0115] A second aspect of the present invention provides a multi-factor calibration device for a soil moisture sensor, comprising:
[0116] The calibration sample library construction module is configured to prepare soil samples with different soil types, dry densities, and temperatures, and to measure the moisture content of each soil sample using a soil moisture sensor. The measured values of the soil moisture sensor are then matched one-to-one with the reference moisture content obtained by weighing each soil sample to construct the calibration sample library.
[0117] The initial calibration parameter determination module is configured to divide the range of the soil moisture sensor into multiple calibration intervals according to a given number of calibration interval segments, construct a basic calibration model for each calibration interval using the calibration sample library, and perform a two-stage residual method fitting on each basic calibration model to obtain a corresponding set of initial calibration parameters. Let the first... The initial calibration parameters of the group include the calibration interval. The corresponding soil type's correction offset, dry density correction factor, and temperature correction factor;
[0118] The correction calibration model construction module is configured to continuously correct the initial calibration parameter set using machine learning methods. The machine learning methods automatically match a set of correction calibration parameters based on the input soil moisture sensor measurements, soil type, dry density, and temperature, thereby obtaining the correction calibration model.
[0119] The correction calculation module is configured to acquire the measured value of the soil moisture sensor for the soil to be tested and input it into the basic calibration model corresponding to the calibration interval to which the measured value belongs, so as to obtain the initial moisture content of the soil to be tested. The initial moisture content, soil type, dry density and temperature of the soil to be tested are input into the correction calibration model to obtain the corrected moisture content of the soil to be tested.
[0120] Furthermore, the aforementioned interval-based multi-factor calibration device also includes:
[0121] The optimization module is configured to divide all learning samples constructed based on the calibration sample library into a training set and a validation set according to a set ratio, and to set a candidate interval for the number of segments in the calibration interval. , These are the maximum and minimum values of the number of segments in the calibration interval, respectively. For candidate intervals The number of candidate segments within each interval is used to obtain a correction calibration model using the training set, and the accuracy of the corrected moisture content calculated by the correction calibration model is evaluated using the validation set. The number of candidate segments with the highest evaluation result is taken as the number of segments in the optimal calibration interval, and the optimal correction calibration parameter is determined based on the number of segments in the optimal calibration interval.
[0122] It should be noted that the aforementioned explanation of the embodiment of the interval multi-factor calibration method for soil moisture sensors also applies to the interval multi-factor calibration device for soil moisture sensors in this embodiment, and will not be repeated here.
[0123] To implement the above embodiments, this invention also proposes a computer-readable storage medium storing a computer program that is executed by a processor to perform the interval-based multi-factor calibration method for the soil moisture sensor described in the above embodiments.
[0124] The following is for reference. Figure 2 The diagram illustrates a structural schematic of an electronic device suitable for implementing embodiments of the present invention. It should be noted that the electronic device in the embodiments of the present invention may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs, desktop computers, and servers. Figure 2 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
[0125] like Figure 2 As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 102 or a program loaded from a storage device 108 into a random access memory (RAM) 103. The RAM 103 also stores various programs and data required for the operation of the electronic device. The processing unit 101, ROM 102, and RAM 103 are interconnected via a bus 104. An input / output (I / O) interface 105 is also connected to the bus 104.
[0126] Typically, the following devices can be connected to I / O interface 105: input devices 106 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, etc.; output devices 107 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 108 including, for example, magnetic tapes, hard disks, etc.; and communication devices 109. Communication device 109 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 2 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have instead.
[0127] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, this embodiment includes a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via communication device 109, or installed from storage device 108, or installed from ROM 102. When the computer program is executed by processing device 101, it performs the functions defined above in the methods of embodiments of this disclosure.
[0128] It should be noted that the computer-readable medium described above in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0129] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0130] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the aforementioned interval multi-factor calibration method for the soil moisture sensor.
[0131] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and Python, as well as conventional procedural programming languages such as the "C-" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0132] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0133] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0134] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the function involved, as will be understood by those skilled in the art to which embodiments of this application pertain.
[0135] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0136] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0137] Those skilled in the art will understand that implementing all or part of the steps of the methods in the above embodiments can be accomplished by instructing related hardware through a program. The developed program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0138] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0139] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.
Claims
1. A method for calibrating a soil moisture sensor by interval and multiple factors, characterized in that, include: Soil samples with different soil types, dry densities, and temperatures were prepared. The moisture content of each soil sample was measured using a soil moisture sensor. The measured values of the soil moisture sensor were matched one-to-one with the reference moisture content obtained by weighing each soil sample to construct a calibration sample library. The soil moisture sensor's measurement range is divided into multiple calibration intervals based on a given number of calibration interval segments. A basic calibration model is constructed for each calibration interval using the calibration sample library. Each basic calibration model is then fitted using a two-stage residual method to obtain the initial calibration parameters for the corresponding group. Let the first... The initial calibration parameters of the group include the calibration interval. The corresponding soil type correction offset, dry density correction factor, and temperature correction factor are as follows: The initial calibration parameters are continuously corrected using machine learning methods. The machine learning methods automatically match a set of correction calibration parameters based on the input soil moisture sensor measurements, soil type, dry density, and temperature, thereby obtaining a correction calibration model. For the soil to be tested, the measured value of the soil moisture sensor is obtained and input into the basic calibration model corresponding to the calibration interval to which the measured value belongs, so as to obtain the initial moisture content of the soil to be tested. The initial moisture content, soil type, dry density and temperature of the soil to be tested are input into the correction calibration model to obtain the corrected moisture content of the soil to be tested.
2. The interval-based multi-factor calibration method according to claim 1, characterized in that, The basic calibration model is a polynomial model obtained by fitting the measured values of soil moisture sensors as independent variables and reference moisture content as dependent variables; within each calibration interval, only calibration samples falling into that calibration interval are used to construct the corresponding basic calibration model.
3. The interval-based multi-factor calibration method according to claim 1, characterized in that, For calibration interval Corresponding basic calibration model Perform a two-stage residual fitting to obtain the first... Group initial calibration parameters ,include: For constructing the basic calibration model For each calibration sample used, the residuals of the basic calibration model were calculated: in, For the first The basic calibration model for a calibration sample The residual; For calibration interval Next The reference moisture content of the calibrated sample; Basic calibration model For the Fitted values of the moisture content of a single calibrated sample; Take the construction of basic calibration models respectively The median dry density and median temperature of all calibration samples were used as the calibration interval. Reference dry density below and reference temperature ; For calibration interval For each calibration sample within the range, the following linear residual model is fitted: in, For calibration interval Soil type correction amount, For calibration interval The dry density correction factor is below. For calibration interval Temperature correction factor below, and separate calibration intervals Next The dry density and temperature of the calibration sample, For calibration interval Next The second-stage residual term of a calibration sample, parameters , and Solve using the least squares method; Construct the first Group initial calibration parameters .
4. The interval-based multi-factor calibration method according to claim 3, characterized in that, The expression for the correction calibration model is: in, To correct for moisture content; This represents the initial moisture content. To determine the number of segments in the calibration interval The soil type offset correction amount obtained through machine learning methods; To determine the number of segments in the calibration interval The dry density correction coefficient obtained through machine learning methods; For calibration interval The reference dry density is used to construct the basic calibration model. The median of the dry density of all calibration samples used; To determine the number of segments in the calibration interval The temperature correction coefficient was obtained through machine learning methods. For calibration interval The reference temperature is used to construct the basic calibration model. The median temperature of all calibration samples used; by , and The correction calibration parameters constitute the aforementioned parameters; The continuous correction of the initial calibration parameter set using machine learning methods includes: Constructing learning samples for machine learning ,in, For calibration interval numbering, ; Number the learning samples. , In order to target the The number of learning samples used in each calibration interval; For soil type identification; and Constructing the first The soil type identifier used in the basic calibration model for each calibration interval is: The The dry density and temperature of the calibration sample; for the training sample The goal of machine learning is , , and These are the soil type correction factor, dry density correction factor, and temperature correction factor for the known nodes of the machine learning objective, respectively, satisfying... , and ; Based on preprocessed learning samples Supervised training of the machine learning model is performed to establish a mapping relationship from calibration interval numbers, soil type identifiers, dry density, and temperature to continuous correction parameters. The preprocessing of the learning samples includes: one-heat encoding of the calibration interval numbers and soil type identifiers, numerical feature input for dry density and temperature, and standardization before training as follows: in, To The dry density obtained after standardization processing To The temperature obtained through standardization; and Here, represents the mean and standard deviation of the dry density for all training samples, respectively. and These are the mean and standard deviation of the temperature for all training samples, respectively. The machine learning model is trained by learning a loss function that minimizes the following parameters: in, This is the total loss function; In order to target the Loss function for a given calibration interval; These are the weighting coefficients corresponding to soil type, dry density, and temperature, respectively. The predicted value output by the machine learning model corresponds to a set of correction calibration parameters. , and .
5. The interval-based multi-factor calibration method according to claim 1, characterized in that, The machine learning model can be any one regression model or a combination of multiple regression models.
6. The method for interval-based multi-factor calibration according to any one of claims 1 to 5, characterized in that, Also includes: All learning samples constructed based on the calibration sample library are divided into training and test sets according to a set ratio, and candidate intervals with a set number of calibration interval segments are defined. , These are the maximum and minimum values of the number of segments in the calibration interval, respectively. ; For candidate intervals The number of each candidate segment within the range is used to obtain a correction calibration model using the training set, and the accuracy of the corrected moisture content calculated by the correction calibration model is evaluated using the test set. The number of candidate segments with the highest evaluation result is taken as the number of segments in the optimal calibration interval, and the optimal correction calibration parameter is determined based on the number of segments in the optimal calibration interval.
7. A multi-factor calibration device for a soil moisture sensor, characterized in that, include: The calibration sample library construction module is configured to prepare soil samples with different soil types, dry densities, and temperatures, and to measure the moisture content of each soil sample using a soil moisture sensor. The measured values of the soil moisture sensor are then matched one-to-one with the reference moisture content obtained by weighing each soil sample to construct the calibration sample library. The initial calibration parameter determination module is configured to divide the range of the soil moisture sensor into multiple calibration intervals according to a given number of calibration interval segments, construct a basic calibration model for each calibration interval using the calibration sample library, and perform a two-stage residual method fitting on each basic calibration model to obtain a corresponding set of initial calibration parameters. Let the first... The initial calibration parameters of the group include the calibration interval. The corresponding soil type's correction offset, dry density correction factor, and temperature correction factor; The correction calibration model construction module is configured to continuously correct the initial calibration parameter set using machine learning methods. The machine learning methods automatically match a set of correction calibration parameters based on the input soil moisture sensor measurements, soil type, dry density, and temperature, thereby obtaining the correction calibration model. The correction calculation module is configured to acquire the measured value of the soil moisture sensor for the soil to be tested and input it into the basic calibration model corresponding to the calibration interval to which the measured value belongs, so as to obtain the initial moisture content of the soil to be tested. The initial moisture content, soil type, dry density and temperature of the soil to be tested are input into the correction calibration model to obtain the corrected moisture content of the soil to be tested.
8. The interval-based multi-factor calibration device according to claim 7, characterized in that, Also includes: The optimization module is configured to divide all learning samples constructed based on the calibration sample library into training set, validation set, and test set according to a set ratio, and to set candidate intervals for the number of calibration interval segments. , These are the maximum and minimum values of the number of segments in the calibration interval, respectively. ; for candidate intervals The number of each candidate segment within the range is used to obtain a correction calibration model using the training set, and the accuracy of the corrected moisture content calculated by the correction calibration model is evaluated using the test set. The number of candidate segments with the highest evaluation result is taken as the number of segments in the optimal calibration interval, and the optimal correction calibration parameter is determined based on the number of segments in the optimal calibration interval.
9. An electronic device, characterized in that, include: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores computer instructions that can be executed by the at least one processor, and when the computer instructions are executed by the at least one processor, they implement the interval multi-factor calibration method as described in any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the interval multi-factor calibration method as described in any one of claims 1 to 6.