Method for determining soil moisture in farmland and related device

By optimizing the features and parameters of the multispectral sensor using the snake optimization algorithm and the CatBoost model, the problem of collinearity interference in the multispectral sensor inversion was solved, achieving high-precision soil moisture inversion, reducing equipment costs, and facilitating large-scale application in farmland.

CN122130615BActive Publication Date: 2026-07-31INST OF GEOGRAPHICAL SCI & NATURAL RESOURCE RES CAS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610589029.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-04-30
Publication Date
2026-07-31
Estimated Expiration
2046-04-30

AI Technical Summary

Technical Problem

In existing technologies, when multispectral sensors are used for soil moisture content inversion, collinearity interference between features makes it difficult to obtain the optimal combination of model input features, thus affecting the inversion accuracy.

Method used

The snake optimization algorithm was used to optimize the reflectance and vegetation index of the characteristic bands of the multispectral sensor. Combined with the CatBoost machine learning model, the model parameters were optimized to construct a farmland soil moisture content inversion model.

Benefits of technology

Under limited band conditions, the system automatically identifies the most sensitive and least redundant feature combinations, improving the model's generalization ability and stability, reducing equipment costs, and facilitating its widespread application in farmland.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122130615B_ABST
    Figure CN122130615B_ABST
Patent Text Reader

Abstract

This invention discloses a method and related equipment for determining farmland soil moisture. The method includes: determining multiple feature band reflectances based on collected UAV multispectral image data of farmland, and calculating multiple vegetation indices based on the feature band reflectances; using the multiple feature band reflectances and / or multiple vegetation indices as input to a snake optimization algorithm, and optimizing candidate vegetation features composed of combinations of the feature band reflectances and / or vegetation indices according to a preset number of vegetation features; constructing a farmland soil moisture content inversion model based on the optimized vegetation features and model parameters, and performing inversion calculations on the soil moisture of the target farmland. This method solves the problem that conventional machine learning methods and multispectral sensors easily generate collinear features and mutual interference between features through limited band combinations, making it difficult to obtain the most suitable key input feature combination for the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more specifically, to a method and related equipment for determining soil moisture in farmland. Background Technology

[0002] Accurate determination of soil moisture content is fundamental to improving the efficiency of farmland water resource utilization, and is of great significance for drought diagnosis, appropriate irrigation, and water conservation. Due to differences in topography, soil texture, crop growth, irrigation, and precipitation, soil moisture content exhibits strong spatial variability. Currently, various methods exist for soil moisture content determination, with the drying and weighing method considered the most accurate, but this method requires extensive field sampling, which is time-consuming and labor-intensive. Unmanned aerial vehicle (UAV) remote sensing inversion of soil moisture content is a rapidly emerging non-destructive diagnostic method in recent years. UAV platforms can carry various sensors, including hyperspectral, multispectral, thermal infrared, and visible light sensors; the complementary use of multiple sensors can effectively invert farmland soil moisture content. However, the high cost and low spatial resolution of hyperspectral and thermal infrared sensors have become significant obstacles to large-scale adoption. Multispectral sensors are affordable and versatile, but their accuracy in retrieving soil moisture content using conventional machine learning methods is currently low. This is mainly because multispectral sensors have a limited number of bands, and the limited combination of bands can easily generate collinear features. The mutual interference between features makes it difficult to obtain the most suitable combination of key input features for the model. Summary of the Invention

[0003] The summary section introduces a series of simplified concepts, which will be further explained in detail in the detailed description section. The summary section of this invention is not intended to limit the key features and essential technical features of the claimed technical solution, nor is it intended to determine the scope of protection of the claimed technical solution.

[0004] To address the problem that conventional machine learning methods and multispectral sensors easily generate collinear features and mutual interference between features through limited band combinations, making it difficult to obtain the optimal combination of key input features for the model, this invention proposes, in a first aspect, a method for determining farmland soil moisture, the method comprising: Based on the collected UAV multispectral image data of farmland and the corresponding soil moisture content, the reflectance of multiple characteristic bands is determined, and multiple vegetation indices are calculated based on the reflectance of the characteristic bands. The multiple feature band reflectances and / or multiple vegetation indices are used as inputs to the snake optimization algorithm. According to the preset number of vegetation features, the candidate vegetation features composed of the combination of the feature band reflectances and / or vegetation indices are optimized, and the model parameters of the machine learning model are optimized. The feature optimization includes feature derivation and feature screening. Based on the optimized vegetation features, model parameters and corresponding soil moisture content data, a farmland soil moisture content inversion model is constructed to invert the soil moisture of the target farmland based on the vegetation features calculated from the actual multispectral image data of the target farmland.

[0005] Optionally, the soil moisture content is at least two layers of soil moisture content data, the spectral image data includes green, red, red-edge and near-infrared band images, the vegetation index is obtained based on the green, red, red-edge and near-infrared bands, and the vegetation index does not include the texture features of the green, red, red-edge and near-infrared bands.

[0006] Optionally, the machine learning model is CatBoost. The step of constructing a farmland soil moisture content inversion model based on optimized vegetation features, model parameters, and corresponding soil moisture content data, to invert the soil moisture of the target farmland using vegetation features calculated from the actual multispectral image data of the target farmland, includes: Based on the optimized vegetation features, model parameters, and corresponding soil moisture content data, a farmland soil moisture content inversion model is constructed using CatBoost to invert and calculate the soil moisture of the target farmland using vegetation features calculated from the actual multispectral image data of the target farmland.

[0007] Optionally, the method uses the multiple feature band reflectances and / or multiple vegetation indices as input to the snake optimization algorithm, optimizes the candidate vegetation features composed of the combination of the feature band reflectances and / or vegetation indices according to a preset number of vegetation features, and optimizes the model parameters of the machine learning model. The feature optimization includes feature derivation and feature selection, including: Each snake individual is encoded as a vector of length N. Each vector consists of three parts: machine learning model parameters, operators, and input features. k The first location stores the parameter values ​​that need to be tuned for machine learning. k +1~ j The first location stores operator information, the second... j +1~ N Each location stores the reflectance or vegetation index value of the input feature band, grouped into sets of two data points. j +1~ N The total number of positions is k +1~j Twice the total number of locations , Two data points within the same group are processed according to their sorting and the corresponding sorting operators to form new vegetation features, and from the first... k Integer encoding begins at position +1; Introducing hybrid fuzzy search factors Mc , ;where X worst20% The encoding vectors of the bottom 20% of snake individuals with the lowest fitness. M c Its function is to achieve fuzzy and chaotic perturbation.

[0008] when S / 2 <rand< S and Q< At 0.25, only update 1~ k This position is only in the 1st to 2nd position. k One position is affected while the others remain unchanged; When 0 <rand≤ S / 2 and Q< At 0.25, only the first [item] is updated. k +1~ N The position, only in the first k +1~ N One position is affected while the others remain unchanged; When Q < 0.25 and food is scarce, snakes enter an exploration phase and update their position relative to food based on the following: , in, i It is a position number, and i∈ 1~ N Q is the food sufficiency factor used to distinguish different optimization paths. Xi , m ( t +1) is the first t +1 generation population i Male individuals at each location m Encoded value, round (·) is the floor function. Xrand , m ( t ) represents the encoded value of a randomly selected male individual. b This is the scaling factor at this time. frand , m , fi , m They are randomly selected and the first. i Male individuals in each location m The fitness corresponding to the encoded value, Ximax and Xi min represents the first, second, and third min respectively. i The upper and lower limits of the values ​​for each individual position. rand A random number in the range [0,1]. When Q ≥ 0.25, food is plentiful, and temperature Temp > 0.5,

[0009] in, Xfood The encoded value corresponding to the individual with the best fitness. c This is the scaling factor at this time; When food is plentiful and the temperature (Temp ≤ 0.5) is low, snakes will enter either a fighting mode or a mating mode, respectively:

[0010]

[0011] in, fbest , f The fitness of the best female individuals throughout history. fi , f and fi , m The first i Fitness of female and male individuals at each position Xbest , f This represents the encoded value of the best individual fitness of females throughout generations. Xi , f For female individuals i The encoded value at each position; For the bottom 20% of male and female individuals in terms of fitness ranking X worst20% Hybrid chaotic search mechanisms are employed respectively. Then, update the location.

[0012] Optionally, the function of fitness is:

[0013] in, For all observed and simulated values, the value with an absolute error greater than a preset threshold is selected. The total number of samples is 0.5% in the soil moisture retrieval.

[0014] Optionally, the number of preset vegetation features is 5, and the optimized vegetation features are (0.15NIR-RE) / (0.15NIR+RE), NIR / RE, (0.12NIR-R) / (0.12NIR+R), NIR-G and (NIR-RE) / (NIR+RE)×(NIR-G) / (NIR+G), where NIR, RE, R and G are the reflectance of the near-infrared, red-edge, red and green bands, respectively.

[0015] Secondly, the present invention also provides a device for determining farmland soil moisture, comprising: The determination unit is used to determine multiple characteristic band reflectances based on the collected UAV multispectral image data of farmland and the corresponding soil moisture content, and to calculate multiple vegetation indices based on the characteristic band reflectances. An optimization unit is used to take the multiple feature band reflectances and / or multiple vegetation indices as inputs to a snake optimization algorithm, optimize candidate vegetation features composed of the combination of the feature band reflectances and / or vegetation indices according to a preset number of vegetation features, and optimize the model parameters of the machine learning model. The feature optimization includes feature derivation and feature screening. The inversion unit is used to construct a farmland soil moisture inversion model based on optimized vegetation features, model parameters and corresponding soil moisture data, so as to perform inversion calculation on the soil moisture of the target farmland based on the vegetation features calculated from the actual multispectral image data of the target farmland.

[0016] Thirdly, an electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program stored in the memory to implement the steps of the method for determining farmland soil moisture as described in any of the first aspects above.

[0017] Fourthly, the present invention also proposes a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method for determining farmland soil moisture according to any one of the preceding claims of the first aspect.

[0018] In summary, the method for determining farmland soil moisture proposed in this application determines multiple feature band reflectances based on collected UAV multispectral image data of farmland and corresponding soil moisture content, and calculates multiple vegetation indices based on these feature band reflectances. The multiple feature band reflectances and / or multiple vegetation indices are used as input to a snake optimization algorithm. According to a preset number of vegetation features, the algorithm optimizes candidate vegetation features composed of combinations of the feature band reflectances and / or vegetation indices, and optimizes the model parameters of the machine learning model. The feature optimization includes feature derivation and feature selection. Based on the optimized vegetation features, model parameters, and corresponding soil moisture data, a farmland soil moisture inversion model is constructed to invert and calculate the soil moisture of the target farmland using vegetation features calculated from the actual multispectral image data of the target farmland. By constructing a rich candidate feature library and using the snake optimization algorithm for feature selection, this scheme can automatically identify the feature combinations that are most sensitive to soil moisture content and have the least redundancy under limited band conditions, effectively alleviating the problem of mutual interference between collinear features in traditional multispectral inversion. This approach eliminates the separate processes of feature selection and model parameter tuning. Instead, it utilizes a snake optimization algorithm to simultaneously optimize within the joint space, ensuring that the final feature subset and model parameters are aligned and unified under the same evaluation criteria. This significantly enhances the model's generalization ability and stability. Compared to approaches relying on hyperspectral or thermal infrared sensors, this method requires only a moderately priced multispectral sensor and a conventional UAV platform, resulting in lower equipment purchase and maintenance costs and facilitating widespread adoption in farmland. By constructing high spatial resolution soil moisture distribution maps, this approach provides farmers and irrigation management departments with visualized decision-making support, enabling various applications such as zoned irrigation, water replenishment regulation, and drought early warning. This improves farmland water resource utilization efficiency and crop yield stability, demonstrating significant practical value in agricultural production.

[0019] The method for determining farmland soil moisture of the present invention, other advantages, objectives and features of the present invention will be apparent in part from the following description, and in part will be understood by those skilled in the art through study and practice of the present invention. Attached Figure Description

[0020] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit this specification. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 This is a schematic flowchart of a method for determining farmland soil moisture provided in an embodiment of this application; Figure 2The flowchart provided in this application illustrates the optimization of CatBoost using the improved snake optimization algorithm. Figure 3 This is a graph showing the trend of the decreasing factor in the embodiments of this application; Figure 4 The fitness variation graph for each test function; Figure 5 Scatter plot of observed and simulated values ​​from two comparative models for determining farmland soil moisture provided in the embodiments of this application; Figure 6 This is a schematic diagram of a farmland soil moisture determination device provided in an embodiment of this application; Figure 7 This is a schematic diagram of an electronic device for determining farmland soil moisture, provided in an embodiment of this application. Detailed Implementation

[0021] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus. The technical solutions of the embodiments of this application will now be clearly and completely described in conjunction with the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them.

[0022] To address the issue that conventional machine learning methods and multispectral sensors easily generate collinear features and mutual interference between features through limited band combinations, making it difficult to obtain the optimal combination of key input features for the model, please refer to [link to relevant documentation]. Figure 1 This is a schematic flowchart of a method for determining farmland soil moisture provided in an embodiment of this application, which may specifically include steps S110 to S130.

[0023] S110, based on the collected UAV multispectral image data of farmland and the corresponding soil moisture content, determine the reflectance of multiple characteristic bands, and calculate multiple vegetation indices based on the reflectance of the characteristic bands.

[0024] S120, the multiple feature band reflectances and / or multiple vegetation indices are used as inputs to the snake optimization algorithm. According to the preset number of vegetation features, the candidate vegetation features composed of the combination of the feature band reflectances and / or vegetation indices are optimized, and the model parameters of the machine learning model are optimized. The feature optimization includes feature derivation and feature screening.

[0025] S130, Based on the optimized vegetation features, model parameters and corresponding soil moisture content data, a farmland soil moisture content inversion model is constructed to invert the soil moisture of the target farmland based on the vegetation features calculated from the actual multispectral image data of the target farmland.

[0026] For example, the steps of determining multiple characteristic band reflectances based on the collected UAV multispectral image data of farmland and the corresponding soil moisture content, and calculating multiple vegetation indices based on the characteristic band reflectances, can be understood as a comprehensive process of data acquisition, spectral feature construction, and physical mechanism mapping: Specifically, typical sample plots and several sampling points are set up in the farmland area to be measured. A UAV equipped with a multispectral camera performs aerial photography during clear, low-wind periods. The multispectral camera acquires raw image data in multiple spectral bands such as blue, green, red, red-edge, and near-infrared. By deploying standard reflectors on the ground and combining the camera's built-in radiometric calibration parameters, the raw digital quantization values ​​are converted into surface reflectance. Further geometric and orthorectification corrections are used to generate multispectral orthorectified images consistent with geographic coordinates. Before and after the aerial survey, at each sampling point... Soil samples were collected at different depths using a soil auger. The samples were then brought back to the laboratory, where the soil moisture content was determined using the oven-drying mass method. The coordinates of the sampling points were spatially registered with the pixel positions in the UAV imagery to find the corresponding multispectral reflectance information for each measured soil moisture content value. After obtaining this one-to-one correspondence, the reflectance of each sampling point in different bands was extracted from the multispectral imagery as characteristic band reflectance. Based on these characteristic band reflectances, multiple vegetation indices were constructed. For example, the normalized vegetation index (NDI) which reflects vegetation growth was selected, the soil-regulated vegetation index which incorporates a soil background adjustment term was selected, and the red-edge correlated vegetation index which is more sensitive to changes in chlorophyll and moisture was selected. If necessary, composite indices or transformation features reflecting soil brightness and moisture status can also be constructed to form a set of vegetation indices that contain both original spectral information and clearly defined physical meanings. Considering that changes in soil moisture content lead to regular variations in the reflectance of the soil surface and crop canopy across different wavelengths—for example, increased moisture content typically reduces reflectance in some visible light bands, and changes in near-infrared reflectance are related to cell structure and leaf water content—these changes can be amplified and encoded as numerical features through appropriate band combinations and exponential construction. This provides subsequent machine learning models with input information closely related to soil moisture. Through this step, a high-dimensional feature set describing farmland spectral response and vegetation status can be constructed using only low-cost multispectral sensors. This allows subsequent models to perceive soil moisture status without direct contact with the soil, achieving a foundation of input data with good sensitivity to changes in soil moisture content with less field sampling and lower sensor costs, laying the groundwork for improving inversion accuracy.

[0027] For example, the method uses multiple feature band reflectances and / or multiple vegetation indices as input to the snake optimization algorithm. Based on a preset number of vegetation features, it optimizes candidate vegetation features composed of combinations of the feature band reflectances and / or vegetation indices, and optimizes the model parameters of the machine learning model. This feature optimization includes steps of feature derivation and feature selection, which can be understood as a joint intelligent search process within a unified framework, determining which features to select and how to set the model. Specifically, a candidate vegetation feature library is first constructed based on the aforementioned feature band reflectances and vegetation indices. This feature library includes not only the original band reflectances but also directly calculated... The vegetation index can also include derived features formed through methods such as difference, ratio, and logarithmic transformation. For example, constructing a combined feature reflecting soil brightness, constructing a near-infrared and red-edge difference feature that is more sensitive to soil moisture, or constructing a composite index sensitive to vegetation water stress, so that the candidate feature library can cover information with different physical meanings and different scales; then, a flag bit indicating whether to select each candidate feature is set, and these flag bits are concatenated with the key parameter values ​​of the machine learning model in a fixed order to form a solution vector. Each component in the solution vector jointly determines the current feature subset and model parameter configuration; in the snake optimization algorithm... During the process, several solution vectors are initialized as individual snakes. By simulating the collaborative food-hunting behavior of a snake swarm in the environment, iterative updates are performed in the feature selection space and parameter space. Each iteration trains a machine learning model based on the feature subset specified by the current solution vector and the model parameters. The error between the predicted and measured soil moisture content is calculated on validation data. This error, or its transformation, is used as a fitness evaluation index, ensuring that individuals with better fitness are more likely to be retained and expanded in the next iteration, while individuals with poor fitness are eliminated or subjected to significant random perturbations. Through this swarm intelligence search method, snakes achieve optimal... In the process of continuously updating the solution vector, the algorithm gradually eliminates redundant features that contribute little or even cause significant interference to the prediction of soil moisture content, while retaining key features that show a strong response to changes in soil moisture. At the same time, it automatically adjusts the number of trees, depth, regularization strength, kernel function parameters, or learning rate of the model to ensure that the model is neither too simple to cause underfitting nor too complex to cause overfitting. By utilizing the snake optimization algorithm's ability to jointly search in continuous and discrete spaces, the multispectral feature selection problem is transformed into a fitness-driven optimization problem. By taking the soil moisture content prediction error as the direct target, the algorithm is guided to autonomously discover the best feature combination and model structure.This allows for the automatic removal of highly redundant and interfering features when the number of bands is limited and the original features exhibit strong collinearity. This avoids the problem of model instability caused by simply stacking a large number of exponents. At the same time, it significantly reduces the workload of manually selecting features based on experience and manually tuning parameters, resulting in a more compact feature subset with clearer physical meaning. The constructed model has better generalization ability and robustness under different plots and crop conditions, thus providing an optimized combination of input and model structure for the subsequent accurate inversion of soil moisture content.

[0028] For example, the step of constructing a farmland soil moisture inversion model based on optimized vegetation features, model parameters, and corresponding soil moisture data, and inverting the soil moisture of the target farmland using vegetation features calculated from actual multispectral image data of the target farmland, can be understood as the process of establishing a mapping relationship between spectral features and soil moisture on a larger scale using an optimized feature subset and machine learning model, and applying it to actual farmland monitoring. Specifically, after the snake optimization algorithm outputs the optimal feature combination and model parameters, all sample data are reorganized using this feature combination. The measured soil moisture values ​​of all sampling points are combined with the corresponding optimal vegetation features to form a complete training sample. The system is trained using the selected machine learning model type. During the training process, cross-validation can be used to evaluate the performance stability of the model under different sample partitions, and the feature importance index output by the model can be used to verify whether the features selected by snake optimization do indeed play a dominant role in soil moisture prediction. Based on this, the final model structure was selected as the farmland soil moisture content inversion model. When monitoring the spatial distribution of soil moisture in a target farmland, the farmland was photographed using a multispectral UAV platform consistent with the training phase. After radiometric calibration and geometric correction, the required vegetation feature values ​​were calculated for each pixel or management unit of the target farmland according to the optimal feature combination, forming a feature vector in the same format as the training phase. These feature vectors were then input into the trained inversion model, which outputs the soil moisture content estimate for the corresponding location. The estimation results were then spatially stitched together to form a soil moisture distribution map or a classification map. In practical use, this soil moisture map can be overlaid with information such as irrigation zones, crop variety distribution, and topographic relief to identify areas of persistent drought, excessive waterlogging, and areas with suitable moisture, guiding differentiated irrigation decisions. For example, priority irrigation can be arranged for high-lying plots that have been in a low moisture content range for a long time, while the irrigation frequency can be reduced for areas with soil moisture content close to field capacity, thereby saving water and reducing the risk of waterlogging. Considering the nonlinear mapping established using machine learning models, soil moisture information that cannot be directly measured through a single band or index can be indirectly inferred through vegetation spectral response relationships. This transforms the combined information of multi-band reflectance and vegetation indices into a quantitative estimate of soil moisture content. Therefore, firstly, it can acquire soil moisture information with high spatial resolution over a large spatial area, more comprehensively reflecting the spatial heterogeneity of farmland moisture compared to traditional point sampling, providing a basis for refined management; secondly, due to targeted optimization of features and model parameters using the snake optimization algorithm, the inversion model exhibits reduced sensitivity to noise under different times, meteorological conditions, and crop growth stages, demonstrating good stability; and thirdly, the overall solution relies on a moderately costly hardware platform, suitable for widespread application in large-scale farmland, which is beneficial for improving water resource utilization efficiency and crop yield stability while ensuring water supply security.

[0029] In summary, the farmland soil moisture determination method provided in this application determines multiple feature band reflectances based on collected UAV multispectral image data of farmland and corresponding soil moisture content, and calculates multiple vegetation indices based on the feature band reflectances. The multiple feature band reflectances and / or multiple vegetation indices are used as input to a snake optimization algorithm. According to a preset number of vegetation features, the algorithm optimizes candidate vegetation features composed of combinations of feature band reflectances and / or vegetation indices, and optimizes the model parameters of the machine learning model. The feature optimization includes feature derivation and feature selection. Based on the optimized vegetation features, model parameters, and corresponding soil moisture data, a farmland soil moisture inversion model is constructed to invert and calculate the soil moisture of the target farmland using vegetation features calculated from the actual multispectral image data of the target farmland. By constructing a rich candidate feature library and using the snake optimization algorithm for feature selection, this solution can automatically identify the feature combinations most sensitive to soil moisture content and with minimal redundancy under limited band conditions, effectively alleviating the problem of mutual interference between collinear features in traditional multispectral inversion. This approach eliminates the separate processes of feature selection and model parameter tuning. Instead, it utilizes a snake optimization algorithm to simultaneously optimize within the joint space, ensuring that the final feature subset and model parameters are aligned and unified under the same evaluation criteria. This significantly enhances the model's generalization ability and stability. Compared to approaches relying on hyperspectral or thermal infrared sensors, this method requires only a moderately priced multispectral sensor and a conventional UAV platform, resulting in lower equipment purchase and maintenance costs and facilitating widespread adoption in farmland. By constructing high spatial resolution soil moisture distribution maps, this approach provides farmers and irrigation management departments with visualized decision-making support, enabling various applications such as zoned irrigation, water replenishment regulation, and drought early warning. This improves farmland water resource utilization efficiency and crop yield stability, demonstrating significant practical value in agricultural production.

[0030] According to some embodiments, the soil moisture content is at least two layers of soil moisture content data, the spectral image data includes green, red, red-edge and near-infrared band images, the vegetation index is obtained based on the green, red, blue, red-edge and near-infrared bands, and the vegetation index does not include the texture features of the green, red, blue, red-edge and near-infrared bands.

[0031] According to some embodiments, the machine learning model is CatBoost. The process of constructing a farmland soil moisture content inversion model based on optimized vegetation features, model parameters, and corresponding soil moisture content data, to invert soil moisture in the target farmland using vegetation features calculated from actual multispectral image data, includes: Based on the optimized vegetation features, model parameters, and corresponding soil moisture content data, a farmland soil moisture content inversion model is constructed using CatBoost to invert and calculate the soil moisture of the target farmland using vegetation features calculated from the actual multispectral image data of the target farmland.

[0032] According to some embodiments, such as Figure 2 As shown, the method uses the multiple feature band reflectances and / or multiple vegetation indices as input to the snake optimization algorithm. According to a preset number of vegetation features, it optimizes the candidate vegetation features composed of combinations of the feature band reflectances and / or vegetation indices, and optimizes the model parameters of the machine learning model. The feature optimization includes feature derivation and feature selection, including: Each snake individual is encoded as a vector of length N. Each vector consists of three parts: machine learning model parameters, operators, and input features. k The first location stores the parameter values ​​that need to be tuned for machine learning. k +1~ j The first location stores operator information, the second... j +1~ N Each location stores the reflectance or vegetation index value of the input feature band, grouped into sets of two data points. j +1~ N The total number of positions is k +1~ j Twice the total number of locations , Two data points within the same group are processed according to their sorting and the corresponding sorting operators to form new vegetation features, and from the first... k Integer encoding begins at position +1; Original locking factor S, ,in t For the number of iterations, T max This represents the total number of iterations; this factor enables optimization of CatBoost model parameters only in the early stages and feature optimization only in the later stages.

[0033] The original decreasing factor is replaced by the Gamma function, and the improved decreasing factor is as follows: The general form of the gamma function is as follows:

[0034] Transforming the above equation yields the following equivalent gamma function:

[0035] Taking the function in the integral of the above equation as the probability density, we obtain the following gamma distribution density function:

[0036] make The following gamma distribution density function is obtained:

[0037] In the formula, t For the number of iterations, It is the probability density function; The shape parameter controls the amplitude of the curve. hour It is a decreasing function. hour (It is a unimodal function); This is a scale parameter that controls the width of the curve.

[0038] The improved expression for the decreasing factor S' is shown below:

[0039]

[0040] In the above formula, For the number of iterations, ; This represents the maximum number of iterations.

[0041] In this improved snake optimization algorithm, the parameters =1, parameter =1.5, this factor changes with the number of iterations as follows Figure 3 As shown: The beneficial effects of the improvement are due to Figure 3 As shown in the figure, the improved S' is represented as the improved S. With the increase of the number of iterations, both the traditional S and the improved S' show a decreasing trend, which ensures the convergence of the algorithm. The difference is that, at the same number of iterations, the value of the improved S' is smaller than that of the traditional S, which means that the improved algorithm converges faster.

[0042] To verify the performance of the improved algorithm, internationally recognized algorithm test functions were used to perform performance tests on both algorithms. To comprehensively verify the algorithm's generality, three types of functions—single-peak, multi-peak, and combined—were used for verification. The test functions are shown in the following formula. To avoid the randomness of a single calculation, the number of comparison calculations was set to 50. The calculation results are as follows: Figures 3-4 As shown in Table 1, the performance analysis of the two algorithms for minimum, average, maximum, and standard deviation is presented in Table 1.

[0043] 1) Unimodal function

[0044] This function is There is a global minimum at =0, which tests the local search capability and convergence speed.

[0045] 2) Multimodal function

[0046] This function is There is a global minimum of 0 at point =1, which tests the ability to search globally, escape local optima, and handle subproblems of different dimensions.

[0047] 3) Combinatorial functions

[0048] In the above formula, d q ,e q It is a constant. [4 4 4 4;1 1 1 1;8 8 8 8;6 6 6 6;3 7 3 7;2 9 29;5 5 3 3;8 1 8 1;6 2 6 2;7 3.6 7 3.6]; [0.1 0.2 0.2 0.4 0.4 0.6 0.3 0.7 0.5 0.5]; This function is in There is a global minimum value of -10.4029405667869 at point =4, which mainly tests the ability to handle heterogeneous subproblems.

[0049] Depend on Figure 4 As can be seen, the improved S' is represented as the improved S in the figure. For a unimodal function, with the same number of iterations, the improved S' has a smaller fitness value than the traditional S, indicating that the improved S' has better accuracy with the same number of iterations. Figure 3 It can be seen that for complex multimodal functions, the improved S' converges completely after 220 iterations, while the traditional S lags behind. This indicates that the improved S' has better convergence in multimodal problems. For combinatorial functions, the improved S' converges around 60 iterations, while the traditional S converges more slowly.

[0050] The average value reflects the optimal value obtained from multiple calculations, avoiding the incomparability caused by the uncertainty of a single calculation. The standard deviation reflects the robustness of the algorithm. Table 1 shows that for unimodal functions, the improved SO average is 1.32048E-92, much smaller than the traditional SO average of 1.69449E-45; the improved SO standard deviation is 9.02428E-92, much smaller than the traditional SO average of 3.95997E-45. For multimodal functions, the improved SO average is 0.18588515, smaller than the traditional SO average of 0.244611329; the improved SO standard deviation is 0.192986528, smaller than the traditional SO average of 0.482097646. For the combinatorial function, the improved SO average is -10.36782584, which is less than the traditional SO average of -10.30151289; the improved SO standard deviation is 0.059959714, which is less than the traditional SO average of 0.263025889. These values ​​fully demonstrate that the improved SO algorithm not only has better computational accuracy than the traditional SO algorithm, but also exhibits better robustness.

[0051] By combining the performance tests of the three types of functions, the improved algorithm demonstrates excellent computational accuracy, high robustness, and good convergence performance. Table 1 Algorithm Performance Comparison

[0052] Introducing hybrid fuzzy search factors Mc , ;where X worst20% The encoding vectors of the bottom 20% of snake individuals with the lowest fitness. M c Its function is to achieve fuzzy and chaotic perturbation.

[0053] when S / 2 <rand< S and Q< At 0.25, only update 1~ k This position is only in the 1st to 2nd position. k One position is affected while the others remain unchanged; When 0 <rand≤ S / 2 and Q< At 0.25, only the first [item] is updated. k +1~ N The position, only in the first k +1~ N One position is affected while the others remain unchanged; When Q < 0.25 and food is scarce, snakes enter an exploration phase and update their position relative to food based on the following: , in, i It is a position number, and i∈ 1~ N , Xi , m ( t +1) is the first t +1 generation population i The m-coded value of a male individual at each location. round (·) is the floor function. Xi , m ( t +1) is the first t +1 generation population i Male individuals at each location m Encoded value, round (·) is the floor function. Xrand , m ( t ) represents the encoded value of a randomly selected male individual. b This is the scaling factor at this time. frand , m , fi , m They are randomly selected and the first. i Male individuals in each location m The fitness corresponding to the encoded value, Xi max and Xi min represents the first, second, and third min respectively. i The upper and lower limits of the values ​​for each individual position. rand A random number in the range [0,1]. When Q ≥ 0.25, food is plentiful, and temperature Temp > 0.5,

[0054] in, Xfood The encoded value corresponding to the individual with the best fitness. c This is the scaling factor at this time; When food is plentiful and the temperature (Temp ≤ 0.5) is low, snakes will enter either a fighting mode or a mating mode, respectively:

[0055]

[0056] in, fbest , f The fitness of the best female individuals throughout history. fi , f and fi , m The first iFitness of female and male individuals at each position Xbest , f This represents the encoded value of the best individual fitness of females throughout generations. Xi , f For female individuals i The encoded value at each position; For the bottom 20% of male and female individuals in terms of fitness ranking X worst20% Hybrid chaotic search mechanisms are employed respectively. Then, update the location.

[0057] According to some embodiments, the function of fitness is:

[0058] in, For all observed and simulated values, the value with an absolute error greater than a preset threshold is selected. N y The total number of samples is 0.5% in the soil moisture retrieval.

[0059] For example, soil moisture content and UAV multispectral image data from the same day can be collected and processed, image stitching and radiometric correction can be performed to obtain more than 40 vegetation indices. A two-year cotton experiment was conducted from 2022 to 2023, using a DJI Phantom 4 multispectral UAV to observe cotton. The observation period included the seedling stage, budding stage, and boll-forming stage, with a total of 6 observations over 2 years, obtaining 40 samples per observation. Soil moisture content was measured using a soil drill and drying method, with samples taken in three layers at 0-20cm, 20-40cm, and 40-60cm depths, also with 6 observations over 2 years, obtaining 40 samples per observation. The UAV multispectral images of the area were processed, and the soil moisture content sampling range was cut within 0.5×0.5m. Green (G), red (R), red-edge (RE), and near-infrared (NIR) bands were selected to calculate vegetation indices in the table, resulting in 42 vegetation indices, as shown in Table 2.

[0060] Table 2. Vegetation Index Calculation Table

[0061] Next, the snake optimization algorithm can be improved by setting the number of input vegetation features to enable feature derivation and feature selection. It should be noted that the snake optimization algorithm, proposed in 2022, is a novel swarm intelligence algorithm that simulates the predation, fighting, and mating behavior of snakes in their natural environment. The algorithm divides the population into male and female groups, using two control variables—food quantity Q and temperature T—to determine the search phase. A food quantity threshold controls whether global or local exploration is performed, while food abundance controls individual competition and mating. Males and females attract each other and generate new solutions. Finally, the worst individual is randomly reset to maintain diversity. The population dimensions, upper and lower limits for each dimension, population size, maximum number of iterations, and current number of iterations can be set first. Secondly, the population is randomly initialized. N The first half of the individuals were set to be male. N m The latter half of the individuals are set to female. N f .temperature Food quantity When food is scarce (Q < 0.25), snakes enter a global exploration phase, where t is the number of iterations and Tmax is the maximum number of iterations.

[0062] in, Xi , m ( t +1) is the first t +1 generation population i The encoded value of male individuals (m) at each location. round (·) is the floor function. Xi , m ( t +1) is the first t +1 generation population i Male individuals at each location m Encoded value, round (·) is the floor function. Xrand , m ( t ) represents the encoded value of a randomly selected male individual. b This is the scaling factor at this time. frand , m , fi , m They are randomly selected and the first. i Male individuals in each location m The fitness corresponding to the encoded value, Xi max and Xi min represents the first, second, and third min respectively. i The upper and lower limits of the values ​​for each individual position. rand It is a random number in the range [0,1].

[0063] When food is plentiful (Q≥0.25) and temperature >0.5,

[0064] in, Xfood The encoded value corresponding to the individual with the best fitness. c This is the scaling factor for this step.

[0065] When food is plentiful and the temperature (Temp ≤ 0.5) is low, male and female snakes will enter either a fighting mode or a mating mode, as follows:

[0066]

[0067] in, fbest , f and fi , m These are the best fitness of the best female individuals in each generation and the first... i Fitness of male individuals at each location Xbest , f ( t ) represents the encoded value for the optimal individual fitness of females. Xi , f For female individuals i The encoded value of each position.

[0068] Finally, for the males and females with the lowest fitness rankings... X worst The following random search mechanism is used for position updates. This method has been used for parameter optimization or feature selection in machine learning. However, when performing both simultaneously, the machine learning model parameters and feature combinations are prone to change, making it difficult to find more suitable machine learning parameter combinations while locking in the input feature combinations. Furthermore, this optimization algorithm is prone to premature convergence. Finally, considering that the number of vegetation indices is relatively limited and mainly obtained through previous empirical experiments, whether different vegetation indices can generate more suitable input features through computation remains to be studied. Therefore, this application improves the snake optimization algorithm to address the above three issues.

[0069] The improved first step allows setting the population size, population dimension, upper and lower limits for each dimension, maximum number of iterations, and current number of iterations. The population dimension consists of the number of machine learning parameters to be tuned, the number of operators, and the model input features. Taking setting the number of input vegetation features to 3 as an example, the parameter setting method for this step is introduced. The population size is set to 50. When using CatBoost for machine learning, the following four parameters need to be tuned (iterations, learning_rate, depth, l2_leaf_reg). Therefore, in the encoding, the first four bits are the above four parameters in order, with values ​​ranging from [50, 800], [0.001, 0.3], [2, 15], and [2, 8], respectively. The 5th to 7th bits are the operators between the three groups of vegetation features, with values ​​ranging from [1, 20] (see the operator encoding table for the meaning of the encoded values). The 8th and 9th bits encode the first group of vegetation features, the 10th and 11th bits encode the second group of vegetation features, and the 12th and 13th bits encode the third group of vegetation features. The maximum number of iterations is set to 200 generations, with the initial generation being the first generation. The operator codes are shown in Table 3.

[0070] Table 3 Operator Encoding

[0071] To further illustrate the encoding method, Table 4 below serves as an example for detailed explanation. It can be seen that there are 13 positions in the table, with the 2nd and 4th positions using floating-point encoding, while the other positions use integer encoding. The CatBoost model parameters are iterations=775, learning_rate=0.278, depth=5, and l2_leaf_reg=3.754. The operator codes 3, 6, and 5 are “×”, “cos”, and “sin”, respectively. The vegetation indices corresponding to bits 8-13 are NIR / R, 1.5(NIR-RE) / (N+RE+0.5), 2.5(NIR-R) / (NIR+2.4R+1), none, visible light atmospheric impedance vegetation index ((GR) / (G+R)), and terrestrial chlorophyll index ((NIR-RE) / (RE-R)). The combination of operators and vegetation indices yields three input factors: NIR / R×1.5(NIR-RE) / (NIR+RE+0.5), 2.5(NIR-R) / (NIR+2.4R+1), and sin((GR) / (G+R)+(NIR-RE) / (RE-R)). Table 4 shows an example of a snake individual's coding.

[0072] Table 4 Examples of individual snake codes

[0073] The improved second step is to randomly initialize the population.N z The first half of the individuals were set to be male. N m The latter half of the individuals are set to female. N f When food is scarce (Q < 0.25), snakes enter a global exploration phase, at which point a locking factor S is introduced. ,in t For the number of iterations, T max This represents the total number of iterations.

[0074] The original decreasing factor is replaced by the Gamma function, and the improved decreasing factor is as follows: The general form of the gamma function is as follows:

[0075] Transforming the above equation yields the following equivalent gamma function:

[0076] Taking the function in the integral of the above equation as the probability density, we obtain the following gamma distribution density function:

[0077] make The following gamma distribution density function is obtained:

[0078] In the formula, t For the number of iterations, It is the probability density function; The shape parameter controls the amplitude of the curve. hour It is a decreasing function. hour (It is a unimodal function); This is a scale parameter that controls the width of the curve.

[0079] The improved expression for the decreasing factor S' is shown below:

[0080]

[0081] In the above formula, For the number of iterations, ; This represents the maximum number of iterations.

[0082] In this improved snake optimization algorithm, the parameters =1, parameter =1.5, this factor changes with the number of iterations as follows Figure 3 As shown: The beneficial effects of the improvement are due to Figure 3 It can be seen that as the number of iterations increases, both the traditional S and the improved S' show a decreasing trend, which ensures the convergence of the algorithm. The difference is that, at the same number of iterations, the improved S' value is smaller than the traditional S value, which means that the improved algorithm converges faster.

[0083] To verify the performance of the improved algorithm, internationally recognized algorithm test functions were used to perform performance tests on both algorithms. To comprehensively verify the algorithm's generality, three types of functions—single-peak, multi-peak, and combined—were used for verification. The test functions are shown in the following formula. To avoid the randomness of a single calculation, the number of comparison calculations was set to 50. The calculation results are as follows: Figures 3-4 As shown in Table 1, the performance analysis of the two algorithms for minimum, average, maximum, and standard deviation is presented in Table 1.

[0084] Depend on Figure 4 It can be seen that for a unimodal function, with the same number of iterations, the improved S' has a smaller fitness value than the traditional S, indicating that, with the same number of iterations, the improved S' has better accuracy; from Figure 3 It can be seen that for complex multimodal functions, the improved S' converges completely after 220 iterations, while the traditional S lags behind. This indicates that the improved S' has better convergence in multimodal problems. For combinatorial functions, the improved S' converges around 60 iterations, while the traditional S converges more slowly.

[0085] The average value reflects the optimal value obtained from multiple calculations, avoiding the incomparability caused by the uncertainty of a single calculation. The standard deviation reflects the robustness of the algorithm. Table 1 shows that for unimodal functions, the improved SO average is 1.32048E-92, much smaller than the traditional SO average of 1.69449E-45; the improved SO standard deviation is 9.02428E-92, much smaller than the traditional SO average of 3.95997E-45. For multimodal functions, the improved SO average is 0.18588515, smaller than the traditional SO average of 0.244611329; the improved SO standard deviation is 0.192986528, smaller than the traditional SO average of 0.482097646. For the combinatorial function, the improved SO average is -10.36782584, which is less than the traditional SO average of -10.30151289; the improved SO standard deviation is 0.059959714, which is less than the traditional SO average of 0.263025889. These values ​​clearly demonstrate that the improved SO algorithm not only has better computational accuracy than the traditional SO algorithm, but also exhibits better robustness. S / 2 <rand<S and Q< At 0.25, only update 1~ k For each position, the following formula applies only to the first to last position. k One position is affected while the others remain unchanged; and when 0 <rand≤ S / 2 and Q< At 0.25, only the first [item] is updated. k +1~ N The following formula applies only to the position . k +1~ N One position is affected while the others remain unchanged.

[0086] That is, when food is plentiful (Q≥0.25) and temperature Temp>0.5, the floating-point encoding position is:

[0087] Integer encoding position:

[0088] in, round (·) is the integer function. Xfood The encoding value corresponding to the optimal fitness, where c is the scaling factor for this step.

[0089] When food is plentiful and the temperature (Temp ≤ 0.5) is low, male and female snakes will enter either a fighting or mating mode, as follows: Battle Mode: Floating-point number encoding location:

[0090] Integer encoding position:

[0091] Mating pattern: Floating-point number encoding location:

[0092] Integer encoding position:

[0093] in, fbest , f and fi , m These represent the optimal fitness of female individuals and the fitness of the top 80% of male individuals, respectively. i Fitness of male individuals at each location Xbest , f This is the encoded value for the optimal individual fitness of females. Xi ,f For female individuals i The encoded value of each position.

[0094] In addition, parameters b and c The adjustment factor for controlling the amplitude of individual snake movements is crucial to the model's performance; its correct selection has a significant impact. The default value for the snake optimization algorithm is 2. However, different encoding positions have different upper and lower limits, especially the upper limits for operator encoding and feature encoding differ considerably. Therefore, different values ​​should be selected for different encoding positions c. After extensive trial and error, the values ​​for positions 5 to 7 were determined. b and c Take 0.5 and 4 respectively; take 0.3 and 6 for the 8th to 13th digits respectively.

[0095] For the bottom 20% of males in terms of fitness, the following mixed chaotic search mechanism is used to reselect locations: Floating-point number encoding location:

[0096] Integer encoding position:

[0097] For example, the snake optimization algorithm can be coupled with the CatBoost algorithm to establish a multi-layer farmland soil moisture content inversion model. Building upon the previous step, information distinguishing the soil moisture content layers is added as model input to invert the soil moisture content of multi-layer farmland. The technical route is shown in the figure. The fitness function calculation method is as follows:

[0098] in For all observed and simulated values, the value with an absolute error greater than a certain threshold, N y The total number of samples is 0.5% in the soil moisture retrieval.

[0099] For example, the established multi-layer farmland soil moisture content inversion model can be used for farmland soil moisture content inversion. The observation data is subjected to 5-fold cross-validation, with 80% of the data used for model training and the remaining 20% ​​for validation; this process is repeated 5 times. To eliminate strong correlations between different depths at the same location, training and validation data are distinguished by location; soil moisture content data at different depths at the same location are either entirely used for 5-fold cross-validation training or entirely used for validation.

[0100] like Figure 5As shown, the scatter points of the method proposed in this invention are distributed near the 1:1 line, and the slope is also close to 1, which has obvious advantages compared with particle swarm optimization CatBoost (PSO-Cat) and traditional snake optimization algorithm optimization CatBoost (SO-Cat).

[0101] Table 5 shows the input factors and statistical results determined by different models. It can be seen that the RMSE of the method in this invention is between 0.37% and 0.66%, significantly lower than the 1.19% to 1.51% of the comparative methods. 2 The values ​​ranged from 0.95 to 0.98, which was significantly higher than the comparative method's values ​​of 0.73 to 0.83. The nRMSE ranged from 0.021 to 0.037, and the MCE ranged from 0.11 to 0.28%, all of which were also superior to the comparative method.

[0102] Table 5. Input factors and statistical results determined by different models.

[0103] As shown in Table 5, the model is optimal when the improved snake optimization algorithm is used to optimize CatBoost and the input factor is set to 5. The combination of input factors is (0.15NIR-RE) / (0.15NIR+RE), NIR / RE, (0.12NIR-R) / (0.12NIR+R), NIR-G, (NIR-RE) / (NIR+RE)×(NIR-G) / (NIR+G), where NIR, RE, R and G are the reflectance of the near-infrared, red-edge, red and green bands, respectively.

[0104] In some examples, the method further includes: While acquiring the UAV multispectral image data of the farmland, the corresponding digital elevation model and / or digital surface model of the area are acquired or associated. Based on the solar altitude angle and solar azimuth angle at the imaging time, the slope, aspect, theoretical incident radiation, and shading factor of each pixel are calculated. At least one of the slope, aspect, theoretical incident radiation, and shading factor is included as a geometric illumination feature along with the multiple feature band reflectance and / or multiple vegetation indices as candidate vegetation features. In the feature optimization process, the feature band reflectance and / or vegetation indices are normalized or derived based on the geometric illumination features to form vegetation features that reflect the spectral response under unit incident radiation. This allows the farmland soil moisture inversion model to distinguish between the reflectance reduction caused by insufficient geometric illumination and the reflectance change caused by the reduction in soil moisture content in the presence of local shadows such as slope shade and forest edge shading, thereby reducing the systematic bias in soil moisture inversion in slope and shadow areas.

[0105] For example, addressing the problem of insufficient incident light in local pixels of sloping farmland due to slope, aspect, and vegetation shading, resulting in low reflectance and a seemingly dry appearance in multispectral images, leading to a systematic overestimation of soil drought in such areas by the model, the farmland soil moisture determination method further includes: simultaneously acquiring or associating high-resolution digital elevation data during UAV multispectral aerial photography; generating digital surface models through stereo image pairs or calling existing terrain data; calculating the slope and aspect parameters of each pixel; and calculating the theoretical incident radiation and potential shading factor of the pixel based on the solar altitude angle, solar azimuth angle, and imaging time; incorporating the geometric illumination features composed of slope, aspect, theoretical incident radiation, and shading factor, along with the original characteristic band reflectance and vegetation index, into a candidate vegetation feature library; and allowing the construction of derived features with more explicit physical meaning based on geometric illumination features and spectral features during feature derivation and feature selection using the snake optimization algorithm, such as using actual reflectance and theoretical incident radiation. The ratio approximates the reflection response under unit incident energy. The normalized vegetation index and soil brightness correlation index are normalized using a shading factor, ensuring that pixels darkened simply by being in shadow are no longer equated to truly arid pixels with low water content in the feature space. The principle is that illumination conditions and geometric relationships significantly affect multispectral reflectance. Without explicit modeling, the model might mistakenly interpret geometric darkening as insufficient moisture. By introducing geometric illumination features and jointly selecting them during snake optimization, the model can automatically learn the implicit rule that the same reflectance corresponds to different water contents under different illumination conditions, thus correcting the systematic bias in shady slopes and forest edge areas. The resulting technical effect is that, even in complex terrain and farmland environments with tree rows and facility shading, this method can maintain good soil moisture content inversion accuracy, avoiding misclassification of shady slopes and forest edge areas as severely arid areas, thereby reducing unnecessary supplemental irrigation or incorrect adjustments to irrigation plans.

[0106] In some examples, the method further includes: In farmland containing areas of plastic film mulching, crop residue mulching, and bare soil, based on field-marked endmember samples and UAV multispectral image data, characteristic spectral templates representing plastic film mulching, crop residue mulching, and bare soil are extracted respectively. A constrained non-negative unmixing algorithm and / or other sub-pixel decomposition algorithms are used to decompose the multispectral reflectance of mixed pixels, obtaining the proportion of plastic film mulching, crop residue mulching, and visible bare soil within each pixel. At least one of the proportions of plastic film mulching, crop residue mulching, and visible bare soil is added as a structural feature to the candidate vegetation features. During feature derivation, soil-related vegetation indices are weighted or amplified based on these proportions to obtain derived vegetation features indicating the moisture state of the covered soil. During feature selection, a snake optimization algorithm is allowed to automatically select the endmember proportion features and their derived features, thereby preserving effective information representative of soil moisture content in the presence of plastic film mulching and crop residue mulching, and improving the accuracy of farmland soil moisture inversion under plastic film mulching and straw return scenarios.

[0107] For example, in some cash crop and vegetable plots where there are a large number of mixed pixels with plastic film mulching, straw residue mulching, and bare soil, the multispectral reflectance of these pixels simultaneously includes the high-brightness reflectance of the plastic film, the yellowish-brown reflectance of the straw, and the background reflectance of the soil. Simply removing these pixels would result in a significant loss of information, while directly incorporating them into the model would severely distort the relationship between the spectrum and soil moisture. Therefore, the method for determining farmland soil moisture further includes: selecting typical areas with plastic film mulching, straw residue mulching, and bare soil in the study area, and conducting field surveys and using high-resolution image markers... Meta-samples were used to extract characteristic spectral templates representing three types of cover: plastic film, stubble, and bare soil. Sub-pixel decomposition methods, such as constrained least squares or non-negative matrix factorization, were applied to the multispectral image. The observed reflectance of each mixed pixel was expressed as a weighted superposition of the three types of endmembers. The decomposition coefficients for the proportion of plastic film cover, stubble cover, and visible bare soil within that pixel were then calculated. When constructing candidate vegetation features, these three endmember proportions were introduced as new structural features, and the snake optimization algorithm was allowed to utilize these endmember proportions in conjunction with existing vegetation indices during the feature derivation stage. The soil brightness index is combined to construct "soil moisture indication features shielded by mulch film." For example, the weight of soil-related indices is amplified when only a small proportion of bare soil is visible, while soil indices are used directly for estimation when the proportion of bare soil is high. Simultaneously, the decomposition coefficients of pure mulch film or pure stubble areas are used to identify anomalous areas unsuitable for moisture inversion. The principle of this scheme is to explicitly model the spectral components of mulch film and stubble, traditionally considered interference, as endmembers, and decompose mixed pixels into the effectively visible soil portion and the non-soil cover portion. Then, a snake optimization algorithm automatically finds the most favorable conditions for moisture retrieval. This method recovers the characteristic combination of soil moisture content from the decomposed information, thereby physically translating the information of the covered soil back into numerical features that can be used in the model. As a result, in fields where mulching and straw return have become common farming practices, this method no longer needs to simply discard these mixed pixels, but can extract the effective parts that still have analytical value for soil moisture content, significantly increasing the number of usable samples and the spatial coverage range, while reducing the interference of high reflectivity of mulch and yellowing of stubble on the model. Thus, it can still provide reliable moisture estimates in complex and fragmented areas such as the outer edge of the greenhouse and between rows of mulch.

[0108] In some examples, the method further includes: When drip irrigation or seepage irrigation is used in farmland, the start time, end time, and irrigation volume of irrigation are obtained based on irrigation management data. Multi-temporal UAV multispectral image data of the same target farmland are acquired at multiple preset time points after irrigation. Geometric registration is performed on the multispectral images at different time points to obtain pixel-level aligned multi-temporal images. Temporal vegetation features characterizing post-irrigation spectral and vegetation state changes are constructed based on the characteristic band reflectance and / or vegetation index of each temporal phase. These temporal vegetation features include at least one of the following: vegetation index difference between any two temporal phases, rate of change, and / or duration required to approach a stable state. The temporal vegetation features, along with single-temporal vegetation features, are input into a snake optimization algorithm as candidate vegetation features. This allows the feature optimization process to select key time windows and their combinations that reflect the delayed response of the drip irrigation wetting body to the surface and plants. This ensures that the farmland soil moisture content inversion model can accurately estimate soil moisture even when the surface has not yet become significantly wet while the underground soil moisture content has significantly increased.

[0109] For example, in farmland using drip or seepage irrigation, where irrigation time is short and moisture is mainly concentrated in the soil profile below the crop rows, the exposed surface may still appear relatively dry for a short period. When multispectral images are acquired immediately after irrigation, it is difficult to directly identify a significant increase in groundwater content from single-phase reflectance. This results in a severe disconnect between the spectral characteristics of the surface at a given time point and the actual groundwater level. The farmland soil moisture determination method further includes, where irrigation management data is available, using parameters such as irrigation start and end times, irrigation volume, and dripper spacing as auxiliary inputs to plan the irrigation... Multi-temporal multispectral aerial photography by UAVs was conducted at several key moments, such as several hours, one day, and two days after irrigation. Geometric registration ensured pixel-level alignment of the images at each time point, and profile sampling points were simultaneously deployed on the ground to measure soil moisture content at different depths. When constructing candidate vegetation features, not only were single-temporal characteristic band reflectance and vegetation indices extracted for each moment, but temporal water recovery features were also constructed, such as the change in a certain index, the rate of change, the slope of the curve, and the length of time to reach a near-stationary state between two consecutive images, to reflect the dynamic process of groundwater transfer to the surface and plants after irrigation. When the snake optimization algorithm performs feature selection and parameter optimization, these time-derived features are included in the search along with static spectral features. This allows the fitness function to examine not only the fitting ability of a single time phase to water content, but also the explanatory ability of multi-time phase combinations on the trend of water content changes. This enables the algorithm to automatically select time-series features closely related to groundwater recharge, such as the normalized vegetation index increment one to two days after irrigation, as key inputs. Considering that the spectral response of drip-irrigated wetlands has a significant time lag, and that surface reflectance does not change much in the short period after irrigation, while plant water status and spectral characteristics gradually change over time... Gradual adjustment, by introducing time-series observations and constructing features based on the time dimension, can link this response curve to the actual soil moisture content. Snake optimization helps to find the most representative time window and feature combination in the high-dimensional time-series feature space. The resulting technical effect is that, for modern farmland that uses water-saving drip irrigation extensively but does not appear wet on the surface, this method can effectively capture the delayed effects of underground moisture bodies on vegetation and the ground surface, avoiding misjudging fields that have just been irrigated but whose surface has not yet darkened significantly as arid areas. This makes the inversion results more consistent with the actual moisture conditions and provides a quantitative basis for optimizing drip irrigation systems and adjusting intervals.

[0110] In some examples, it also includes: While sampling the soil, the soil electrical conductivity and / or soil salinity of each sampling point are acquired. Based on the reflectance of the characteristic band, at least one spectral index related to soil salinity is calculated. The soil electrical conductivity and / or soil salinity are used as auxiliary label data, and the salinity spectral index is used as part of the candidate vegetation features and input into the snake optimization algorithm. The snake optimization algorithm adopts a comprehensive fitness function that simultaneously constrains the prediction error of soil moisture content and the prediction error of soil salinity when performing feature optimization and model parameter optimization. This encourages the selection of vegetation feature combinations that are sensitive to changes in soil moisture content and less affected by changes in soil salinity. When constructing the farmland soil moisture content inversion model, at least one of soil moisture content and soil salinity is used as the model output. This allows the farmland soil moisture determination method to reduce the influence of salt crystallization on spectral reflectance and improve the reliability of soil moisture content inversion results in saline-alkali land or areas with rich surface salt.

[0111] For example, in saline-alkali land or farmland where excessive long-term fertilization has led to salt accumulation on the soil surface, salt crystallization significantly alters the reflectance characteristics in the visible and near-infrared bands. This means that reflectance changes are simultaneously influenced by both moisture content and salinity. If the model is trained solely on soil moisture content, it may misjudge high reflectance caused by salt as an extremely dry state, or misjudge bright areas of salt crystallization under humid conditions as abnormally humid areas. The method for determining farmland soil moisture further includes: simultaneously collecting conductivity or laboratory-measured salt content data during soil sampling; and introducing salt-sensitive spectral indices during feature construction, such as a salinization index constructed based on blue and green light bands, or a salt reflectance index constructed based on short-wave infrared or red-edge bands. The model training samples include labels for salinity conductivity or salinity, along with labels for water content. When the snake optimization algorithm performs multi-objective feature optimization, a comprehensive fitness function is designed to ensure that feature selection and model parameter optimization simultaneously consider the combined performance of soil water content prediction errors and salinity prediction errors. This encourages the algorithm to find feature subsets that perform well in distinguishing different water contents while exhibiting separability or minimal interference with salinity changes, such as prioritizing band combinations or indices that are sensitive to water content but have a relatively weak impact on salinity. In the final inversion model construction stage, joint modeling or multi-task learning can be used, with soil water content and soil salinity as two output variables, allowing the model to automatically separate water-related and salinity-related components from spectral features during the learning process. By explicitly introducing salinity-related information and simultaneously constraining the predictive performance of both objectives during feature selection and modeling, the model can avoid treating the salinity effect as noise and instead actively extract feature patterns from high-dimensional features that can simultaneously explain both physical processes. This enables the synergistic inversion of water content and salinity in highly saline-alkali environments. The resulting technical effect is that in medium-to-high salinity farmland, marginal plots with poor water conditions, and areas where poor irrigation and drainage lead to salinization, this method can reduce the water estimation bias caused by salinity interference. This allows decision-makers to see the true distribution of soil moisture content and simultaneously grasp the salinity level when formulating salt leaching irrigation and desalination measures, which is of great significance for comprehensive improvement and precision watering.

[0112] According to some embodiments, the method further includes: While determining the reflectance of the characteristic bands and multiple vegetation indices, each pixel and / or each sampling point is associated with its corresponding farmland management unit identifier. Based on long-term agricultural management information, plot-level management features such as soil type, average fertilization intensity, long-term yield level, and / or irrigation system of each management unit are obtained. The plot-level management features corresponding to the management unit identifier are used as part of the candidate vegetation features and input into the snake optimization algorithm. In the process of feature optimization and model parameter optimization, a fitness evaluation rule that includes spatial consistency constraints on prediction results within plots is adopted. This ensures that while meeting the accuracy requirements of soil moisture content point prediction, the soil moisture content prediction results within the same management unit are constrained to maintain a smoothness or range of variation that spatially matches the actual management level of the management unit. In areas with sparse samples and large differences in plot management, this reduces unreasonable and drastic jumps in soil moisture estimation within the same contracted plot, and improves the consistency and interpretability of farmland soil moisture content inversion results at the plot level.

[0113] For example, in large-scale farmland areas where numerous small contracted plots and management units exist, fertilization habits, cultivation methods, crop combinations, and irrigation patterns vary significantly. Furthermore, due to limitations in manpower and funding, many peripheral plots lack actual measured moisture content samples. Directly using a uniform model for pixel-level prediction can easily lead to drastic fluctuations in moisture estimates within the same management unit, or even unreasonable spatial distributions where some pixels within the same plot are estimated to be very wet while others are estimated to be very dry. Therefore, the farmland soil moisture determination method further includes: when constructing training samples and applying the model, […]. In the method for introducing farmland zoning information, each pixel or sampling point is mapped to its corresponding management unit identifier. Statistical information such as the average fertilization intensity, long-term yield level, and soil type of the corresponding plot is added as additional features to the candidate vegetation feature library. When designing the fitness function for the snake optimization algorithm, in addition to considering the water content prediction error of a single sample, an intra-plot consistency constraint term is introduced. For example, the spatial variance of the predicted values ​​for a plot with sufficient validation samples is calculated, and cases with excessively large variances are penalized, encouraging the algorithm to select those values ​​that ensure accurate predictions at sample points. It can provide a relatively smooth combination of features and model parameters for the spatial distribution of soil moisture within the same management unit, matching the overall management level of the plot. During model training, hierarchical modeling or plot-level parameter adjustment can be adopted, allowing plots of the same crop type and similar management habits to share some model parameters, while allowing slight differences in feature weights for extremely different management units. Considering that although soil moisture has strong spatial variability, within the same plot with unified management measures, the moisture status is usually constrained by similar fertilization and irrigation systems and soil properties, making it difficult to have an extremely fragmented spatial distribution. By incorporating this intra-plot similarity into feature optimization and model training as a constraint, structured inference can be performed using management unit information in sparse sample areas. The resulting technical effect is that, in large-scale multi-contracted farmland, even if some plots lack sufficient ground sampling, this method can still output a soil moisture distribution map that is more consistent with the actual management status by using prior information at the plot level and intra-plot consistency constraints, avoiding speckled false anomalies caused by local sample noise, and improving the interpretability and trustworthiness of the inversion results in agricultural production departments and farmers.

[0114] Please see Figure 6 One embodiment of the farmland soil moisture determination device in this application may include: The determining unit 21 is used to determine multiple characteristic band reflectances based on the collected UAV multispectral image data of farmland and the corresponding soil moisture content, and to calculate multiple vegetation indices based on the characteristic band reflectances. The optimization unit 22 is used to take the multiple feature band reflectances and / or multiple vegetation indices as inputs to the snake optimization algorithm, optimize the candidate vegetation features composed of the combination of the feature band reflectances and / or vegetation indices according to the preset number of vegetation features, and optimize the model parameters of the machine learning model. The feature optimization includes feature derivation and feature screening. Inversion unit 23 is used to construct a farmland soil moisture inversion model based on optimized vegetation features, model parameters and corresponding soil moisture data, so as to perform inversion calculation on the soil moisture of the target farmland based on the vegetation features calculated from the actual multispectral image data of the target farmland.

[0115] like Figure 7 As shown, this application embodiment also provides an electronic device 300, including a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and executable on the processor. When the processor 320 executes the computer program 311, it implements the steps of any of the above-described methods for determining farmland soil moisture: Based on the collected UAV multispectral image data of farmland and the corresponding soil moisture content, the reflectance of multiple characteristic bands is determined, and multiple vegetation indices are calculated based on the reflectance of the characteristic bands. The multiple feature band reflectances and / or multiple vegetation indices are used as inputs to the snake optimization algorithm. According to the preset number of vegetation features, the candidate vegetation features composed of the combination of the feature band reflectances and / or vegetation indices are optimized, and the model parameters of the machine learning model are optimized. The feature optimization includes feature derivation and feature screening. Based on the optimized vegetation features, model parameters and corresponding soil moisture content data, a farmland soil moisture content inversion model is constructed to invert the soil moisture of the target farmland based on the vegetation features calculated from the actual multispectral image data of the target farmland.

[0116] Since the electronic device described in this embodiment is the device used to implement the farmland soil moisture determination device in the embodiments of this application, those skilled in the art can understand the specific implementation method and various variations of the electronic device in this embodiment based on the method described in the embodiments of this application. Therefore, how the electronic device implements the method in the embodiments of this application will not be described in detail here. Any device used by those skilled in the art to implement the method in the embodiments of this application is within the scope of protection of this application.

[0117] In practical implementation, when the computer program 311 is executed by the processor, it can achieve the following: Figure 1 Any of the implementation methods in the corresponding embodiments: Based on the collected UAV multispectral image data of farmland and the corresponding soil moisture content, the reflectance of multiple characteristic bands is determined, and multiple vegetation indices are calculated based on the reflectance of the characteristic bands. The multiple feature band reflectances and / or multiple vegetation indices are used as inputs to the snake optimization algorithm. According to the preset number of vegetation features, the candidate vegetation features composed of the combination of the feature band reflectances and / or vegetation indices are optimized, and the model parameters of the machine learning model are optimized. The feature optimization includes feature derivation and feature screening. Based on the optimized vegetation features, model parameters and corresponding soil moisture content data, a farmland soil moisture content inversion model is constructed to invert the soil moisture of the target farmland based on the vegetation features calculated from the actual multispectral image data of the target farmland.

[0118] It should be noted that the descriptions of each embodiment in the above embodiments have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0119] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application 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. Such 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 this application.

Claims

1. A method of determining water content of farmland soil, characterized by, include: Based on the collected UAV multispectral image data of farmland and the corresponding soil moisture content of at least two layers, the reflectance of multiple characteristic bands is determined, and multiple vegetation indices are calculated based on the reflectance of the characteristic bands. The UAV multispectral image data includes green, red, red-edge and near-infrared band images, and the vegetation indices are obtained based on the green, red, red-edge and near-infrared bands. The vegetation indices do not include the texture features of the green, red, red-edge and near-infrared bands. The multiple feature band reflectances and / or multiple vegetation indices are used as inputs to the snake optimization algorithm. According to the preset number of vegetation features, the candidate vegetation features composed of the combination of the feature band reflectances and / or vegetation indices are optimized, and the CatBoost model parameters are optimized. The feature optimization includes feature derivation and feature screening. Each snake individual is encoded as a vector of length N. Each vector is composed of three parts: CatBoost model parameters, operators, and input features. The first to k positions store the parameter values ​​of CatBoost that need to be tuned. The (k+1) to j positions store operator information. The (j+1) to N positions store the input feature band reflectance or vegetation index values ​​in groups of two. The total number of the (j+1) to N positions is twice the total number of the (k+1) to j positions. The two data in the same group are operated according to the sorting and the corresponding sorting operator to form a new vegetation feature. Integer encoding is used starting from the (k+1) position. When food is scarce (Q < 0.25), snakes enter the exploration phase. Specifically, when S / 2 < rand, rand < S, and Q < 0.25, only positions 1 to k are updated, and this only affects positions 1 to k while the remaining positions remain unchanged. When 0 < rand, rand < or equal to S / 2, and Q < 0.25, only positions (k+1 to N) are updated, and this only affects positions (k+1 to N) while the remaining positions remain unchanged. Q is a food sufficiency factor used to distinguish different optimization paths. An improved decreasing factor S' is obtained by replacing the original decreasing factor S with the Gamma function. rand A random number in the range [0,1]. The mixed fuzzy search factor M is introduced c Wherein, X worst20% The encoding vector of the snake individual of the last 20% individual with the lowest fitness, M c The function is to realize fuzzy chaotic disturbance; for the last 20% male and female individuals X worst20% , respectively, the mixed chaotic search mechanism is used for position update; MCE is used as the fitness function, where MCE is the ratio of the absolute error of all observed and simulated values ​​that is greater than a preset threshold to the total number of samples. The preset threshold is 0.5% in soil moisture retrieval. The preset number of vegetation features is 5. The optimized vegetation features are (0.15NIR-RE) / (0.15NIR+RE), NIR / RE, (0.12NIR-R) / (0.12NIR+R), NIR-G, and (NIR-RE) / (NIR+RE)×(NIR-G) / (NIR+G), where NIR, RE, R, and G are the reflectance of the near-infrared, red-edge, red, and green bands, respectively. Based on the optimized vegetation features, CatBoost model parameters, and corresponding soil moisture content data, a farmland soil moisture content inversion model is constructed to invert the soil moisture of the target farmland using vegetation features calculated from the actual multispectral image data of the target farmland.

2. The method of claim 1, wherein, The method uses the multiple characteristic band reflectances and / or multiple vegetation indices as input to the snake optimization algorithm. According to a preset number of vegetation features, it optimizes the candidate vegetation features composed of combinations of the characteristic band reflectances and / or vegetation indices, and optimizes the model parameters of the machine learning model. The feature optimization includes feature derivation and feature selection, including: Each snake individual is encoded as a vector of length N. Each vector consists of three parts: machine learning model parameters, operators, and input features. k The first location stores the parameter values ​​that need to be tuned for machine learning. k +1~ j The first location stores operator information, the second... j +1~ N Each location stores the reflectance or vegetation index value of the input feature band, grouped into sets of two data points. j +1~ N The total number of positions is k +1~ j Twice the total number of locations , Two data points within the same group are processed according to their sorting and the corresponding sorting operators to form new vegetation features, and from the first... k Integer encoding begins at position +1; Introducing hybrid fuzzy search factors , ; wherein X worst20% the encoding vector of the snake individual of the last 20% individuals with the lowest fitness, M c the function of realizing fuzzy chaos disturbance, when S / 2 <rand< S and Q< At 0.25, only update 1~ k This position is only in the 1st to 5th position. k One position is affected while the others remain unchanged; When 0 <rand≤ S / 2 and Q< At 0.25, only the first [item] is updated. k +1~ N The position, only in the first k +1~ N One position is affected while the others remain unchanged; When Q < 0.25 and food is scarce, snakes enter an exploration phase and update their position relative to food based on the following: , in, i It is a position number, and i∈ 1~ N , For the first t +1 generation population i Male individuals at each location m Encoded value, round (·) is the floor function. The encoded value is for a randomly selected male individual. b This is the scaling factor at this time. , They are randomly selected and the first. i Male individuals in each location m The fitness corresponding to the encoded value, and The first i The upper and lower limits of the values ​​for each individual position; When Q ≥ 0.25, food is plentiful, and temperature Temp > 0.5, wherein, is the encoding value of the best fitness individual, c is the scaling factor at this time, is the encoding value of the male individual m at the i-th position in the t-th generation population; When food is plentiful and the temperature (Temp ≤ 0.5) is low, snakes will enter either a fighting mode or a mating mode, respectively: in, The fitness of the best female individuals throughout history. Let i be the fitness of the i-th individual. and The first i Fitness of female and male individuals at each position This represents the encoded value of the best individual fitness of females throughout generations. For female individuals i The encoded value at each position; For the bottom 20% of male and female individuals in terms of fitness ranking X worst20% Hybrid chaotic search mechanisms are employed respectively. Then, update the location.

3. The method of any one of claims 1 to 2, wherein, Also includes: While sampling the soil, the soil electrical conductivity and / or soil salinity of each sampling point are obtained, and at least one spectral index related to soil salinity is calculated based on the reflectance of the characteristic band. The soil electrical conductivity and / or soil salinity are used as auxiliary label data, and the spectral index related to soil salinity is used as part of the candidate vegetation features and input into the snake optimization algorithm. The snake optimization algorithm adopts a comprehensive fitness function that simultaneously constrains the soil moisture prediction error and the soil salinity prediction error when performing feature optimization and model parameter optimization, so as to encourage the selection of vegetation feature combinations that are sensitive to changes in soil moisture content and less affected by changes in soil salinity. When constructing the farmland soil moisture content inversion model, at least one of soil moisture content and soil salinity is used as the model output, so that in saline-alkali land or areas with rich surface salt, the farmland soil moisture content inversion model can reduce the influence of salt crystallization on spectral reflectance.

4. An agricultural field soil moisture determining device characterized by, The apparatus comprising, using the method as described in any one of claims 1 to 3, includes: The determination unit is used to determine multiple characteristic band reflectances based on the collected UAV multispectral image data of farmland and the corresponding soil moisture content, and to calculate multiple vegetation indices based on the characteristic band reflectances. An optimization unit is used to take the multiple feature band reflectances and / or multiple vegetation indices as inputs to a snake optimization algorithm, optimize candidate vegetation features composed of the combination of the feature band reflectances and / or vegetation indices according to a preset number of vegetation features, and optimize the model parameters of the machine learning model. The feature optimization includes feature derivation and feature screening. The inversion unit is used to construct a farmland soil moisture inversion model based on optimized vegetation features, model parameters and corresponding soil moisture data, so as to perform inversion calculation on the soil moisture of the target farmland based on the vegetation features calculated from the actual multispectral image data of the target farmland.

5. An electronic device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the computer program stored in the memory, implements the steps of the method for determining farmland soil moisture as described in any one of claims 1-3.

6. A computer readable storage medium having stored thereon a computer program, characterized in that: When the computer program is executed by the processor, it implements the method for determining farmland soil moisture as described in any one of claims 1-3.