A soil nutrient detection method and system fusing priori guidance and global optimization
Patent Information
- Application Number
- CN202610197366.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-11
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2046-02-11
AI Technical Summary
[0004]本发明旨在提供一种融合先验引导和全局优化的土壤养分检测方法及系统,以解决上述技术问题,通过融合先验引导和全局优化,实现了对土壤养分高光谱的高效精准筛选,避免出现检测精度不足和检测效率偏低的问题,从而完成对土壤养分的快速无损检测
所述土壤养分含量反演模块,用于基于第一特征子集、待测区域的土壤养分实测数据和光谱特征数据集,获取土壤养分含量数值。
Smart Images

Figure CN122200384B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of soil nutrient detection technology, and in particular to a soil nutrient detection method and system that integrates prior guidance and global optimization. Background Technology
[0002] Soil nutrients are a core indicator for measuring soil fertility, guiding agricultural production, and assessing ecosystem health. Traditional soil nutrient detection mainly relies on field sampling and laboratory chemical analysis. While this method offers high accuracy, it is time-consuming, labor-intensive, costly, and limited in its ability to achieve large-scale continuous monitoring. Hyperspectral remote sensing technology, with its "image-spectrum integration" characteristic, can acquire spectral information in hundreds of continuous bands in the visible-near-infrared region, making it an important tool for quantitative inversion of ground features. However, soil, as a heterogeneous and complex mixture, has components (such as organic matter, minerals, and water) that are intertwined, resulting in a large amount of background noise and mutual interference in the acquired spectral information. For example, the strong absorption of water near 1400nm and 1900nm can mask weak nutrient signals. Furthermore, the inherent "curse of dimensionality" problem of hyperspectral data is particularly prominent in soil detection. The sheer number of bands and the extremely high multicollinearity between adjacent bands mean that many bands are redundant or even detrimental for the inversion of specific nutrients. Using full-band data containing a large amount of noise and redundant information directly for modeling not only results in extremely high computational complexity and a high risk of model overfitting, but also severely reduces the model's prediction accuracy for soil nutrients due to interference from irrelevant bands. Therefore, identifying key spectral features that characterize soil nutrients from massive amounts of band data and eliminating redundancy and background interference has become a crucial step in hyperspectral inversion of soil nutrients. Currently, feature selection methods are mainly divided into three categories: filter, embedded, and wrapper. Among them, wrapper methods, which use the performance of the prediction model (such as random forest) as the evaluation criterion, usually achieve higher accuracy. Traditional wrapper methods (such as recursive feature elimination (RFE) and sequential forward selection (SFS) often employ a greedy search strategy. Although computationally fast, the search path is singular, making it prone to getting trapped in local optima in the complex high-dimensional spectral feature space. In contrast, metaheuristic algorithms based on swarm intelligence, by simulating the cooperative behavior of biological populations, not only do not require gradient information but also possess more powerful global search capabilities. In recent years, they have been widely used to solve the feature optimization problem of high-dimensional data. The Harris Hawks Optimizer (HHO), a novel metaheuristic algorithm proposed in recent years, simulates the cooperative predation behavior (search, encirclement, and ambush) of Harris Hawks in nature. Compared to traditional algorithms such as Particle Swarm Optimization (PSO) or Grey Wolf Optimization (GWO), HHO introduces a dynamic exploration and exploitation mechanism, demonstrating strong competitiveness in solving continuous global optimization problems. In feature selection tasks, HHO typically maps continuous position vectors to binary representations using transfer functions to indicate feature combinations, attempting to find the optimal solution that minimizes the objective function (such as model error) within a vast combination space.However, the standard HHO algorithm is essentially a general mathematical optimization tool. When directly applied to the selection of hyperspectral features of soil nutrients, it has significant limitations due to its lack of adaptability to the inherent distribution characteristics of the data, and targeted improvements are urgently needed to overcome the technical bottleneck.
[0003] Under the current technological background, soil nutrient detection methods based on the HHO algorithm have many shortcomings in practical applications and are difficult to adapt to the complex characteristics of soil spectral data. First, the initialization ignores the non-uniformity of spectral information density, resulting in a blind and inefficient search start: Existing HHO algorithms typically generate initial solutions (feature combinations) in a completely random manner when initializing the population. However, the effective information of soil hyperspectral data (i.e., the characteristic bands corresponding to nutrient absorption) is not uniformly distributed, but sparsely hidden in massive background noise and irrelevant bands. The completely random initialization ignores the prior distribution differences in feature importance, causing the initial population to be scattered in low signal-to-noise ratio or ineffective information-poor areas with a high probability. The algorithm needs to consume a lot of computational resources in the early stages of iteration to find effective information, which seriously slows down the convergence speed and makes it difficult to quickly identify potential advantageous regions containing key spectral fingerprints. Second, the search dynamics mechanism is simple and difficult to adapt to the complex soil spectral feature space. The HHO algorithm relies on a linear "prey escape energy" decay strategy to regulate global exploration and local development behavior. The high degree of multicollinearity among soil spectral bands results in a feature space characterized by multiple extreme values, highly similar local regions ("multi-peak"), and unclear gradient directions, making it difficult for the algorithm to perceive the optimization direction. A single linear decay strategy lacks adaptability and cannot meet the dynamic search requirements in complex spaces: in the early stages, it easily misses weak feature signal regions due to excessively rapid decay of exploration intensity; in the later stages, it lacks fine-tuning capabilities in neighboring regions, making it difficult to accurately lock the optimal solution among highly similar adjacent bands. Simultaneously, the randomly set "prey jump intensity" in the local development stage is not adaptively adjusted with the iteration process, causing the algorithm to oscillate violently when approaching the optimal feature subset, thus compromising the stability of local development. Finally, there is a lack of escape mechanisms for "local optimum traps." Because soil hyperspectral feature peaks are weak and dispersed, and there is extremely high correlation between bands, the feature space is filled with a large number of similar local peaks. Existing HHO algorithms lack effective mutation or perturbation mechanisms. Once the population gets stuck in a local optimum, the algorithm has difficulty escaping the trap using conventional position update formulas. As a result, the final selected feature subset often fails to further remove redundant information or only locks in suboptimal feature bands, limiting the final accuracy and robustness of the soil nutrient inversion model. Summary of the Invention
[0004] This invention aims to provide a soil nutrient detection method and system that integrates prior guidance and global optimization to solve the above-mentioned technical problems. By integrating prior guidance and global optimization, it achieves efficient and accurate screening of soil nutrients using hyperspectral imaging, avoiding problems such as insufficient detection accuracy and low detection efficiency, thereby completing rapid and non-destructive detection of soil nutrients.
[0005] To address the aforementioned technical problems, this invention provides a soil nutrient detection method that integrates prior guidance and global optimization, comprising: Acquire soil hyperspectral remote sensing image data and soil nutrient measured data of the area to be tested, and obtain spectral feature dataset based on the soil hyperspectral remote sensing image data; Based on the spectral feature dataset, several initial out-of-bag sample subsets are obtained, and the global importance score of the spectral features is calculated based on the initial out-of-bag sample subsets. The spectral feature dataset is then sorted based on the global importance score of the spectral features to obtain the prior important feature set. Based on the preset population size, spectral feature dataset and prior important feature set, an initial Harris Hawk population is generated, and the initial prey location and initial prey escape energy are obtained based on the initial Harris Hawk population. Based on the exploration and development strategy, initial prey location, and initial prey escape energy, the initial Harris Eagle population is updated until a preset number of iterations is met, and the first Harris Eagle population is obtained, so as to obtain the first feature subset based on the first Harris Eagle population; Based on the first feature subset, the measured soil nutrient data of the area to be tested, and the spectral feature dataset, the soil nutrient content values are obtained.
[0006] In the above scheme, by dividing the sample into several initial out-of-bag subsets, an objective data foundation is provided for the subsequent quantification of the global importance score of spectral features. Simultaneously, by calculating the global importance score of spectral features using the initial out-of-bag subsets, the contribution weight of each spectral feature to the accuracy of soil nutrient detection is quantified, forming a rankable feature importance quantification index, namely the global importance score. This can accurately locate spectral features that play a key role in soil nutrient inversion, screen out spectral features highly correlated with soil nutrients, obtain a priori important feature set, define the scope for subsequent global optimization search, avoid interference from invalid features, and improve the efficiency and accuracy of soil nutrient detection. Next, an initial Harris Hawk population is constructed by presetting the population size, spectral feature dataset, and prior important feature set, and the initial prey location and initial prey escape energy are obtained. Using the initial Harris Hawk population as the starting point for global optimization guided by priors reduces the invalid screening of low signal-to-noise ratio and irrelevant bands in the spectral feature dataset, improving the overall detection efficiency. Then, by exploring development strategies, initial prey locations, and initial prey escape energy to update the initial Harris Hawk population, further screening can be performed to find a first feature subset that highly matches soil nutrients. Finally, by using the first feature subset, measured soil nutrient data of the test area, and spectral feature dataset, soil nutrient content values can be obtained, and the soil nutrient content results of the test area can be calculated and output, completing a rapid and non-destructive detection of soil nutrients.
[0007] Further, based on the spectral feature dataset, several initial out-of-bag sample subsets are obtained, and the global importance score of the spectral features is calculated based on the initial out-of-bag sample subsets. The spectral feature dataset is then ranked according to the global importance score of the spectral features to obtain a priori important feature set, including: Based on the spectral feature dataset, several initial out-of-bag sample subsets are obtained; Based on the initial out-of-bag sample subset and the preset decision tree regression model, the initial baseline mean square error corresponding to the initial out-of-bag sample subset is calculated. The spectral features of the initial out-of-bag sample subset are randomly shuffled to obtain a perturbed out-of-bag sample subset; Based on the perturbation outside bag sample subset and the preset decision tree regression model, the perturbation baseline mean square error corresponding to the perturbation outside bag sample subset is calculated. The global importance score of the spectral features is calculated based on the initial reference mean square error and the perturbation reference mean square error. Based on the global importance score of spectral features, the spectral feature dataset is sorted, and the set of prior important features is obtained based on the preset sorting order.
[0008] In the above scheme, by dividing the sample into several initial out-of-bag subsets, an objective data foundation is provided for the subsequent quantification of the global importance score of spectral features. Next, the initial baseline mean squared error is calculated using the initial out-of-bag subsets and the pre-defined decision tree regression model, quantifying the prediction accuracy of the pre-defined decision tree regression model under the original feature state. This can serve as a reference standard for measuring the importance of spectral features. Then, by randomly shuffling the spectral features in the initial out-of-bag subsets, the original correlation between individual spectral features and soil nutrients can be disrupted, obtaining a perturbed out-of-bag subset. This allows for the assessment of the degree of influence of the spectral feature on the prediction results of the pre-defined decision tree regression model. Subsequently, by perturbing the out-of-bag sample subset and calculating the perturbed baseline mean square error using a pre-defined decision tree regression model, the prediction error of the pre-defined decision tree regression model after the spectral features are perturbed can be obtained. Then, the global importance score of the spectral features is calculated using the initial baseline mean square error and the perturbed baseline mean square error, quantifying the contribution weight of each spectral feature to the accuracy of soil nutrient detection. This forms a rankable feature importance quantification index, namely the global importance score, which enables precise identification of spectral features that play a key role in soil nutrient inversion. Finally, the spectral feature dataset is ranked using the global importance scores of the spectral features, and a set of prior important features is obtained based on a pre-defined ranking order. This allows for the selection of spectral features highly correlated with soil nutrients, defining the scope for subsequent global optimization search, avoiding interference from invalid features, and improving the efficiency and accuracy of soil nutrient detection.
[0009] Furthermore, the process of generating an initial Harris Hawk population based on a preset population size, spectral feature dataset, and prior important feature set, and obtaining the initial prey location and initial prey escape energy based on the initial Harris Hawk population, includes: An initial Harris Eagle population is constructed based on a pre-defined population size, spectral feature dataset, and prior important feature set. Based on the initial Harris Hawk population and the preset machine learning regression model, the initial feature subset corresponding to the initial Harris Hawk population is selected and the initial fitness of the initial features is calculated in turn. If the initial fitness meets the preset fitness condition, the individual in the initial Harris Hawk population corresponding to the initial fitness is marked as the initial prey location. The initial prey escape energy is obtained based on the initial Harris Eagle population.
[0010] In the above scheme, by pre-setting the population size, spectral feature dataset, and prior important feature set, an initial Harris Hawk population focusing on key spectral features of soil nutrients is constructed. This avoids blind searching in invalid feature regions from the outset, improving the initial efficiency of spectral feature screening. Next, using the initial Harris Hawk population and a pre-set machine learning regression model, an initial feature subset is selected and initial fitness is calculated. This quantifies the suitability of the initial feature subset for soil nutrient detection, and individuals in the initial Harris Hawk population that meet the pre-set fitness conditions are marked as initial prey locations. This locks in the optimal feature combination in the initial stage, providing a high-quality iterative starting point for subsequent global optimization and reducing iterative trial-and-error costs. Finally, by obtaining the initial prey escape energy from the initial Harris Hawk population, a basis is provided for subsequently adaptively adjusting the search strategy of the hawk flock, ensuring the orderly progress of the global optimization process.
[0011] Further, the acquisition of soil hyperspectral remote sensing image data and measured soil nutrient data of the area to be tested, and the acquisition of a spectral feature dataset based on the soil hyperspectral remote sensing image data, includes: Acquire hyperspectral remote sensing image data of the soil in the area to be tested and measured soil nutrient data of the area to be tested; Based on soil hyperspectral remote sensing image data, the original spectral reflectance was extracted; The original spectral reflectance is differentiated and logarithmically transformed to obtain the enhanced spectral reflectance. The spectral index of the enhanced spectral reflectance is then calculated to obtain the spectral index corresponding to the enhanced spectral reflectance. The enhanced spectral reflectance and the corresponding spectral index constitute the enhanced spectral data; Obtain a spectral feature dataset based on enhanced spectral data.
[0012] In the above scheme, by acquiring hyperspectral remote sensing image data and measured soil nutrient data of the area to be measured, corresponding remote sensing image data and ground-based measured data can be provided for subsequent spectral feature extraction and acquisition of soil nutrient content values. Next, by extracting the raw spectral reflectance, the basic spectral information characterizing soil material composition, i.e., the raw spectral reflectance, can be extracted from the soil hyperspectral remote sensing image data, providing raw data for subsequent spectral feature enhancement processing. Then, by performing differential processing and logarithmic transformation on the raw spectral reflectance, weak spectral information masked by noise in the raw spectrum can be amplified and background interference information suppressed, obtaining enhanced spectral reflectance. Subsequently, spectral index calculation is performed on the enhanced spectral reflectance to further explore the correlation information between spectral bands, thereby improving the correlation between features and soil nutrients. Finally, by integrating the enhanced spectral reflectance and the corresponding spectral index into enhanced spectral data, multiple types of spectral feature information can be integrated to form a more dimensional spectral feature dataset, providing high-quality data support for subsequent feature selection. Finally, by enhancing the spectral data, a structured spectral feature dataset was constructed, laying the data foundation for subsequent screening of important prior features and global optimization search, thus ensuring the accuracy and reliability of soil nutrient detection.
[0013] Furthermore, based on the exploration-exploitation strategy, initial prey location, and initial prey escape energy, the initial Harris Eagle population is updated until a preset number of iterations is reached to obtain the first Harris Eagle population. A first feature subset is then obtained based on this first Harris Eagle population. The exploration-exploitation strategy includes a global exploration strategy and a local exploitation strategy, specifically: If the initial prey escape energy is greater than or equal to a preset first escape energy value, the initial Harris Eagle population is updated based on the global exploration strategy to obtain the first Harris Eagle population, and the first feature subset is obtained based on the first Harris Eagle population. Specifically, the initial Harris Eagle population is updated based on the initial prey location and the preset first eagle population update model until a preset number of iterations is met, and the first Harris Eagle population is obtained, and the first feature subset is obtained based on the first Harris Eagle population. If the initial prey escape energy is less than a preset first escape energy value, the initial Harris Eagle population is updated based on the local development strategy, the initial prey location, the initial prey escape energy, and the preset random hunting success probability until a preset number of iterations is met, and the first Harris Eagle population is obtained, so as to obtain the first feature subset based on the first Harris Eagle population.
[0014] In the above scheme, when the initial prey escape energy is greater than or equal to a preset first escape energy value, the initial Harris Eagle population is updated based on the initial prey location and a preset first eagle flock update model. This allows the initial Harris Eagle population to conduct extensive exploration within the neighborhood of high-potential feature areas, fully traversing the unexplored feature space. This avoids missing potential key features highly correlated with soil nutrients due to limited search range, providing a more comprehensive range of feature candidates for subsequent precise screening. This process continues until a preset number of iterations is met, obtaining the first Harris Eagle population and the first feature subset, further improving the accuracy and reliability of soil nutrient detection. Then, when the initial prey escape energy is less than the preset first escape energy value, the initial Harris Eagle population is updated using a local development strategy, initial prey location, initial prey escape energy, and a preset random hunting success probability. This allows for further screening to find the first feature subset highly matched with soil nutrients.
[0015] Further, if the initial prey escape energy is less than a preset first escape energy value, then based on the local development strategy, the initial prey location, the initial prey escape energy, and a preset random hunting success probability, the initial Harris Eagle population is updated until a preset number of iterations is met, thus obtaining a first Harris Eagle population. The first feature subset is then obtained based on the first Harris Eagle population, including: If the initial prey escape energy is less than the preset first escape energy value, the initial prey escape energy is greater than or equal to the preset second escape energy value, and the preset random hunting success probability is greater than or equal to the preset first success probability, then the initial Harris Eagle population is updated based on the preset prey jump intensity, initial prey position, initial prey escape energy, and preset second eagle flock update model until the preset number of iterations is met, and the first Harris Eagle population is obtained, so as to obtain the first feature subset based on the first Harris Eagle population.
[0016] In the above scheme, when the initial prey escape energy is less than the preset first escape energy value, the initial prey escape energy is greater than or equal to the preset second escape energy value, and the preset random hunting success probability is greater than or equal to the preset first success probability, the initial Harris eagle population is updated based on the preset prey jump intensity, initial prey position, initial prey escape energy, and preset second eagle flock update model. This allows for stable local development and avoids drastic disturbances to the potential optimal spectral feature combination until the preset number of iterations is met, thereby selecting the first feature subset with a higher degree of matching with soil nutrients.
[0017] Furthermore, it also includes: If the initial prey escape energy is less than the preset first escape energy value, the initial prey escape energy is greater than or equal to the preset second escape energy value, and the preset random hunting success probability is less than the preset first success probability, then the initial Harris Eagle population is updated based on the preset prey jump intensity, initial prey position, initial prey escape energy, and preset third eagle flock update model until the preset number of iterations is met, and the first Harris Eagle population is obtained, so as to obtain the first feature subset based on the first Harris Eagle population; If the initial prey escape energy is less than the preset second escape energy value and the preset random hunting success probability is less than the preset first success probability, then based on the preset prey jump intensity, initial prey position, initial prey escape energy and preset fourth eagle flock update model, the initial Harris eagle population is updated until the preset number of iterations is met, and the first Harris eagle population is obtained, so as to obtain the first feature subset based on the first Harris eagle population. If the initial prey escape energy is less than the preset second escape energy value and the preset random hunting success probability is greater than or equal to the preset first success probability, then the initial Harris Eagle population is updated based on the initial prey location, the initial prey escape energy, and the preset fifth eagle flock update model until the preset number of iterations is met, and the first Harris Eagle population is obtained, so as to obtain the first feature subset based on the first Harris Eagle population.
[0018] In the above scheme, when the initial prey escape energy is less than the preset first escape energy value, the initial prey escape energy is greater than or equal to the preset second escape energy value, and the preset random hunting success probability is less than the preset first success probability, the initial Harris eagle population is updated based on the preset prey jump intensity, initial prey position, initial prey escape energy, and preset third eagle flock update model. This allows the initial Harris eagle population to perform a perturbation-based fine search, effectively uncovering weak soil nutrient spectral feature signals masked by noise, avoiding the omission of potential optimal spectral feature combinations due to a single search strategy, until the preset number of iterations is met, obtaining the first Harris eagle population and the first feature subset, thus improving the matching degree between the feature subset and soil nutrients. Next, when the initial prey escape energy is less than a preset second escape energy value and the preset random hunting success probability is less than a preset first success probability, the initial Harris eagle population is updated based on the preset prey jump intensity, initial prey position, initial prey escape energy, and a preset fourth eagle flock update model. This further narrows the search range, corrects spectral feature shifts, locks the spectral bands with the strongest response to soil nutrients, and improves the accuracy of feature selection until a preset number of iterations is met, obtaining the first Harris eagle population and the first feature subset. Then, when the initial prey escape energy is less than a preset second escape energy value and the preset random hunting success probability is greater than or equal to the preset first success probability, the initial Harris eagle population is updated based on the initial prey position, initial prey escape energy, and a preset fifth eagle flock update model. This performs a stable search without jump perturbations, avoiding oscillations when approaching the optimal solution, ensuring the stability and reliability of feature subset selection, until a preset number of iterations is met, obtaining the first Harris eagle population and the first feature subset, providing high-quality spectral features for subsequent soil nutrient detection.
[0019] Furthermore, the initial Harris Eagle population is updated based on the exploration and development strategy, initial prey location, and initial prey escape energy until a preset number of iterations is met to obtain a first Harris Eagle population. The process of obtaining a first feature subset based on the first Harris Eagle population includes: Based on the exploration and development strategy, initial prey location, and initial prey escape energy, the initial Harris Eagle population is updated to obtain the first iteration Harris Eagle population; Based on the first iteration Harris Eagle population, generate several quasi-reverse position vectors corresponding to individuals in the first iteration Harris Eagle population; The quasi-reverse fitness of the quasi-reverse position vector and the first fitness of individuals in the first iteration Harris Eagle population are calculated sequentially. If the quasi-reverse fitness is less than the first fitness, individuals in the first iteration Harris Eagle population are replaced with the quasi-reverse position vector and a second iteration Harris Eagle population is obtained. The initial prey position is updated based on the quasi-reverse position vector and the initial Harris Eagle population is updated based on the second iteration Harris Eagle population until a preset number of iterations is met. The first Harris Eagle population is then obtained, and a first feature subset is obtained based on the first Harris Eagle population.
[0020] In the above scheme, several quasi-reverse position vectors corresponding to individuals in the first iteration of the Harris Eagle population are generated through the first iteration Harris Eagle population. This allows for the exploration of the complementary space of the current feature selection scheme, effectively preventing the population from falling into the optimal trap due to over-focusing on local areas, and broadening the coverage of feature selection. Then, the quasi-reverse fitness of the quasi-reverse position vectors and the first fitness of individuals in the first iteration Harris Eagle population are calculated respectively. If the quasi-reverse fitness is less than the first fitness, the individuals in the first iteration Harris Eagle population are replaced with quasi-reverse position vectors, and the second iteration Harris Eagle population is obtained. The initial prey position is then updated based on the quasi-reverse position vectors, and the initial Harris Eagle population is updated based on the second iteration Harris Eagle population. This filters out spectral feature combinations with stronger adaptability, while updating the prey position as a new search reference, until the preset number of iterations is met, thus obtaining the first Harris Eagle population and finally obtaining the first feature subset that highly matches the soil nutrients.
[0021] Further, the step of obtaining soil nutrient content values based on the first feature subset, measured soil nutrient data of the area to be tested, and spectral feature dataset includes: A quantitative estimation model is established based on the first feature subset and the measured soil nutrient data of the area to be tested. Based on the first feature subset and the spectral feature dataset, the spectral feature data corresponding to the first feature subset is extracted and input into the quantitative estimation model to obtain the soil nutrient content value.
[0022] In the above scheme, a quantitative estimation model is established using the first feature subset and measured soil nutrient data from the area to be tested. This establishes a quantitative correlation between spectral features and soil nutrient content, providing reliable model support for the subsequent accurate measurement of soil nutrient content and ensuring the accuracy of the test results. Next, corresponding spectral feature data is extracted from the first feature subset and the spectral feature dataset and input into the quantitative estimation model to obtain soil nutrient content values, achieving rapid and non-destructive detection of soil nutrients.
[0023] This invention provides a soil nutrient detection system that integrates prior guidance and global optimization, including a dataset construction module, a prior important feature extraction module, a Harris eagle population construction module, a feature subset generation module, and a soil nutrient content inversion module, specifically: The dataset construction module is used to acquire soil hyperspectral remote sensing image data and soil nutrient measured data of the area to be tested, and to acquire spectral feature dataset based on the soil hyperspectral remote sensing image data. The prior important feature extraction module is used to obtain several initial out-of-bag sample subsets based on the spectral feature dataset, calculate the global importance score of the spectral features based on the initial out-of-bag sample subsets, and arrange the spectral feature dataset according to the global importance score of the spectral features to obtain the prior important feature set. The Harris Eagle population construction module is used to generate an initial Harris Eagle population based on a preset population size, spectral feature dataset, and prior important feature set, and to obtain the initial prey location and initial prey escape energy based on the initial Harris Eagle population. The feature subset generation module is used to update the initial Harris Eagle population based on the exploration and development strategy, the initial prey location, and the initial prey escape energy until a preset number of iterations is met, thereby obtaining the first Harris Eagle population and obtaining the first feature subset based on the first Harris Eagle population. The soil nutrient content inversion module is used to obtain soil nutrient content values based on the first feature subset, measured soil nutrient data of the area to be tested, and spectral feature dataset.
[0024] This invention provides a soil nutrient detection system that integrates prior guidance and global optimization. In practical applications, it only requires a prior important feature extraction module. By dividing the initial out-of-bag sample subsets, it provides an objective data basis for the subsequent quantification of the global importance score of spectral features. At the same time, by calculating the global importance score of spectral features using the initial out-of-bag sample subsets, it quantifies the contribution weight of each spectral feature to the accuracy of soil nutrient detection, forming a sortable feature importance quantification index, namely the global importance score. This system can accurately locate the spectral features that play a key role in soil nutrient inversion, screen out spectral features that are highly correlated with soil nutrients, obtain a set of prior important features, define the scope for subsequent global optimization search, avoid interference from invalid features, and improve the efficiency and accuracy of soil nutrient detection. Next, a Harris Eagle population construction module is used to construct an initial Harris Eagle population by presetting the population size, spectral feature dataset, and prior important feature set. It also obtains the initial prey location and initial prey escape energy. This initial Harris Eagle population serves as the starting point for global optimization guided by priors, reducing ineffective screening of low signal-to-noise ratio and irrelevant bands in the spectral feature dataset and improving overall detection efficiency. Then, a feature subset generation module is used to update the initial Harris Eagle population through exploration and development strategies, initial prey location, and initial prey escape energy, enabling further screening to find a first feature subset highly matching soil nutrients. Finally, a soil nutrient content inversion module is used to obtain soil nutrient content values using the first feature subset, measured soil nutrient data from the test area, and the spectral feature dataset. This allows for the calculation and output of the soil nutrient content results for the test area, completing rapid and non-destructive detection of soil nutrients. Attached Figure Description
[0025] Figure 1 A flowchart illustrating a soil nutrient detection method that integrates prior guidance and global optimization, as provided in an embodiment of the present invention; Figure 2 This is an architecture diagram of a soil nutrient detection system that integrates prior guidance and global optimization, provided as an embodiment of the present invention. Detailed Implementation
[0026] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0027] This embodiment provides a soil nutrient detection method that integrates prior guidance and global optimization. Please refer to the flowchart for the method. Figure 1 ,include: Step S1: Obtain soil hyperspectral remote sensing image data and soil nutrient measurement data of the area to be tested, and obtain spectral feature dataset based on the soil hyperspectral remote sensing image data; Step S2: Based on the spectral feature dataset, obtain several initial out-of-bag sample subsets, and calculate the global importance score of the spectral features based on the initial out-of-bag sample subsets. Sort the spectral feature dataset according to the global importance score of the spectral features to obtain the prior important feature set. Step S3: Based on the preset population size, spectral feature dataset and prior important feature set, generate an initial Harris Hawk population, and obtain the initial prey location and initial prey escape energy based on the initial Harris Hawk population; Step S4: Based on the exploration and development strategy, the initial prey location and the initial prey escape energy, update the initial Harris Eagle population until the preset number of iterations is met, and obtain the first Harris Eagle population, so as to obtain the first feature subset based on the first Harris Eagle population; Step S5: Based on the first feature subset, the measured soil nutrient data of the area to be tested, and the spectral feature dataset, obtain the soil nutrient content values.
[0028] In this embodiment, by dividing the sample into several initial out-of-bag subsets, an objective data foundation is provided for the subsequent quantification of the global importance score of spectral features. Simultaneously, by calculating the global importance score of spectral features using these initial out-of-bag subsets, the contribution weight of each spectral feature to the accuracy of soil nutrient detection is quantified, forming a rankable feature importance quantification index, namely the global importance score. This allows for the precise identification of spectral features that play a crucial role in soil nutrient inversion, the selection of spectral features highly correlated with soil nutrients, and the acquisition of a priori important feature set. This defines the scope for subsequent global optimization search, avoids interference from invalid features, and improves the efficiency and accuracy of soil nutrient detection. Next, an initial Harris Hawk population is constructed by presetting the population size, spectral feature dataset, and prior important feature set, and the initial prey location and initial prey escape energy are obtained. Using the initial Harris Hawk population as the starting point for global optimization guided by priors reduces the invalid screening of low signal-to-noise ratio and irrelevant bands in the spectral feature dataset, improves overall detection efficiency, significantly reduces the computational cost of subsequent data, and enhances the accuracy of the final soil nutrient content results for the tested area. The initial prey escape energy E is dynamically updated using an inverse Sigmoid function, which adapts to the "wide-band, slowly changing" physical characteristics of soil spectral absorption features, ensuring the initial prey escape energy... The initial prey escape energy E decays slowly in the early stages of iteration, allowing the eagle flock to explore a wider range of continuous absorption areas of soil nutrients globally; it decreases rapidly in the middle stages of iteration to accelerate convergence to a specific absorption peak; and it maintains low energy in the later stages of iteration for fine-grained local exploitation of adjacent bands. The update formula for the initial prey escape energy E is: ,in, for Random numbers between Let t be the preset stopping iteration number and t be the current population iteration number. Then, by exploring development strategies, initial prey locations, and initial prey escape energy, the initial Harris Eagle population is updated, allowing for further screening to find a first feature subset that highly matches soil nutrients. Finally, using the first feature subset, measured soil nutrient data from the test area, and spectral feature datasets, soil nutrient content values are obtained. The soil nutrient content results for the test area can be calculated and output, completing rapid and non-destructive detection of soil nutrients. This effectively addresses the characteristics of sparse and weak effective information and strong multicollinearity between bands in soil hyperspectral data.
[0029] Further, based on the spectral feature dataset, several initial out-of-bag sample subsets are obtained, and the global importance score of the spectral features is calculated based on the initial out-of-bag sample subsets. The spectral feature dataset is then ranked according to the global importance score of the spectral features to obtain a priori important feature set, including: Based on the spectral feature dataset, several initial out-of-bag sample subsets are obtained; Based on the initial out-of-bag sample subset and the preset decision tree regression model, the initial baseline mean square error corresponding to the initial out-of-bag sample subset is calculated. The spectral features of the initial out-of-bag sample subset are randomly shuffled to obtain a perturbed out-of-bag sample subset; Based on the perturbation outside bag sample subset and the preset decision tree regression model, the perturbation baseline mean square error corresponding to the perturbation outside bag sample subset is calculated. The global importance score of the spectral features is calculated based on the initial reference mean square error and the perturbation reference mean square error. Based on the global importance score of spectral features, the spectral feature dataset is sorted, and the set of prior important features is obtained based on the preset sorting order.
[0030] In this embodiment, Bootstrap resampling technology is first used to extract data from the spectral feature dataset. A training set is extracted from the dataset, and a pre-defined initial decision tree regression model is trained using this set to obtain a pre-defined decision tree regression model containing K decision trees. Then, the data in the spectral feature dataset that does not belong to the training set is partitioned to obtain several initial out-of-bag (OOB) sample subsets. The perturbation sensitivity of the out-of-bag data can be used to quantify the sensitivity of each spectral band to soil nutrient inversion, providing an objective data basis for subsequent quantification of the global importance score of spectral features. Next, the initial baseline mean squared error is calculated using the initial out-of-bag sample subsets and the pre-defined decision tree regression model. Specifically, for the k-th decision tree (k=1,2,…,K), its corresponding initial out-of-bag sample subset is identified. The initial baseline mean squared error (MSE) of the corresponding decision tree is calculated using this initial out-of-bag sample subset, denoted as . : ,in, For the first The initial number of out-of-bag samples for each decision tree. For the first The measured soil nutrient data for each sample For decision trees For the sample The predicted values, and the resulting initial baseline mean squared error, quantify the prediction accuracy of the preset decision tree regression model under the original feature state, and can be used as a reference standard to measure the importance of spectral features. Then, by applying the initial out-of-bag sample subset... Spectral characteristics of all samples in (the first) By randomly shuffling the spectral feature values in one dimension while keeping the features in other dimensions unchanged, the original correlation between individual spectral features and soil nutrients can be disrupted, thus obtaining a subset of samples outside the perturbed bag. This allows for the assessment of the impact of the spectral characteristics on the prediction results of the pre-defined decision tree regression model. Subsequently, the mean squared error of the perturbation baseline is calculated using a perturbed out-of-bag sample subset and the pre-defined decision tree regression model. : ,in, To predict the value of sample 'i' in the decision tree 'i' for the sample subset outside the perturbed bag, the prediction error of the pre-set decision tree regression model after the spectral features are perturbed is obtained, and the global importance score of the spectral features is calculated using the initial baseline mean square error and the perturbed baseline mean square error. Specifically: This method quantifies the contribution weight of each spectral feature to the accuracy of soil nutrient detection, forming a rankable feature importance quantification index, namely the global importance score. This allows for the precise identification of spectral features that play a crucial role in soil nutrient retrieval. Finally, the spectral feature dataset is sorted in descending order based on the global importance score of the spectral features, and a set of prior important features is obtained based on the preset sorting order. This allows for the selection of spectral features highly correlated with soil nutrients, defining the scope for subsequent global optimization search, avoiding interference from invalid features, and improving the efficiency and accuracy of soil nutrient detection. The preset sorting order can be the top 30%.
[0031] Furthermore, the process of generating an initial Harris Hawk population based on a preset population size, spectral feature dataset, and prior important feature set, and obtaining the initial prey location and initial prey escape energy based on the initial Harris Hawk population, includes: An initial Harris Eagle population is constructed based on a pre-defined population size, spectral feature dataset, and prior important feature set. Based on the initial Harris Hawk population and the preset machine learning regression model, the initial feature subset corresponding to the initial Harris Hawk population is selected and the initial fitness of the initial features is calculated in turn. If the initial fitness meets the preset fitness condition, the individual in the initial Harris Hawk population corresponding to the initial fitness is marked as the initial prey location. The initial prey escape energy is obtained based on the initial Harris Eagle population.
[0032] In this embodiment, the population size is preset. (i.e., the total number of Harris Hawk individuals performing the feature search task), spectral feature dataset, and prior important feature set were used to construct an initial Harris Hawk population focusing on key spectral features of soil nutrients. Specifically: Initial Harris Hawk Population For one The matrix is represented as: Each row Representing the Individual position vectors in the initial Harris Hawks Individuals representing the initial Harris Eagle population In the The search position value on the feature is based on the feature index. Does it belong to the set of prior important features? Generate using the following equation Initial value: ; in, To obey Uniformly distributed random numbers can effectively maintain the diversity of the initial Harris eagle population and prevent over-reliance on priors from leading to local optima. According to the experimental results, This is the preferred setting. ,when At that time, it represents the first Dimensional features are individual Selected, otherwise not selected. A predefined upper bound vector for the search space is provided. and lower bound vector Since feature selection is a two-dimensional discrete optimization problem, features are usually encoded in binary to indicate whether they are selected; therefore, we set... To predefine the lower bound of the search space, , As a preset upper bound for the search space, Through the above steps, prior important features are identified. During initialization, features selected by the majority of individuals and those excluded by the majority of individuals are used to generate an initial Harris Eagle population. This avoids blind searching in invalid feature regions from the outset, improving the initial efficiency of spectral feature selection. Next, using the initial Harris Eagle population and a pre-defined machine learning regression model, an initial feature subset is selected and the initial fitness is calculated. Specifically, an initial feature subset is selected, and a 5-fold cross-validation method is used to determine the root mean square error of the initial feature subset and the pre-defined machine learning regression model. To obtain the initial feature subset most favorable for soil nutrient prediction and achieve good dimensionality reduction, a fitness function was designed to calculate the initial fitness: in, For initial fitness, Let c be the dimension of the initial feature subset, and c is a weighting constant controlling the dimension, set to 0.3. This quantifies the suitability of the initial feature subset for soil nutrient detection and marks individuals in the initial Harris eagle population that meet the preset fitness conditions as initial prey locations. This process locks in the optimal feature combination in the initial stage, providing a high-quality iterative starting point for subsequent global optimization and reducing iterative trial-and-error costs. The preset machine learning regression model can be a random forest model, and the preset fitness condition can be set to the minimum fitness value. Then, by obtaining the initial prey escape energy through the initial Harris eagle population, a basis can be provided for the subsequent adaptive adjustment of the eagle flock's search strategy, ensuring the orderly progress of the global optimization process.
[0033] Further, the acquisition of soil hyperspectral remote sensing image data and measured soil nutrient data of the area to be tested, and the acquisition of a spectral feature dataset based on the soil hyperspectral remote sensing image data, includes: Acquire hyperspectral remote sensing image data of the soil in the area to be tested and measured soil nutrient data of the area to be tested; Based on soil hyperspectral remote sensing image data, the original spectral reflectance was extracted; The original spectral reflectance is differentiated and logarithmically transformed to obtain the enhanced spectral reflectance. The spectral index of the enhanced spectral reflectance is then calculated to obtain the spectral index corresponding to the enhanced spectral reflectance. The enhanced spectral reflectance and the corresponding spectral index constitute the enhanced spectral data; Obtain a spectral feature dataset based on enhanced spectral data.
[0034] In this embodiment, by acquiring hyperspectral remote sensing image data of the soil in the area to be measured from a satellite or UAV platform, and ground-based measured data of soil nutrients in the area to be measured, corresponding remote sensing image data and ground-based measured data can be provided for subsequent spectral feature extraction and acquisition of soil nutrient content values. Next, by extracting the raw spectral reflectance, the basic spectral information characterizing soil material composition, i.e., the raw spectral reflectance, can be extracted from the soil hyperspectral remote sensing image data, providing raw data for subsequent spectral feature enhancement processing. Then, by performing differential processing and logarithmic transformation on the raw spectral reflectance, weak spectral information masked by noise in the raw spectrum can be amplified and background interference information suppressed, obtaining enhanced spectral reflectance. Subsequently, spectral index calculation is performed on the enhanced spectral reflectance to further mine the correlation information between spectral bands, thereby improving the correlation between features and soil nutrients. Finally, by integrating the enhanced spectral reflectance and the corresponding spectral index into enhanced spectral data, multiple types of spectral feature information can be integrated to form a more dimensional spectral feature dataset, providing high-quality data support for subsequent feature selection. Finally, by enhancing the spectral data, a structured spectral feature dataset was constructed, specifically: Spectral Feature Dataset ,in, The total dimension of spectral features. For the first Spectral characteristics of dimensionality ( This refers to the spectral reflectance value or the corresponding spectral index value corresponding to a specific band in the soil hyperspectral remote sensing image data after transformation. This lays the data foundation for subsequent screening of important prior features and global optimization search, ensuring the accuracy and reliability of soil nutrient detection.
[0035] Furthermore, based on the exploration-exploitation strategy, initial prey location, and initial prey escape energy, the initial Harris Eagle population is updated until a preset number of iterations is reached to obtain the first Harris Eagle population. A first feature subset is then obtained based on this first Harris Eagle population. The exploration-exploitation strategy includes a global exploration strategy and a local exploitation strategy, specifically: If the initial prey escape energy is greater than or equal to a preset first escape energy value, the initial Harris Eagle population is updated based on the global exploration strategy to obtain the first Harris Eagle population, and the first feature subset is obtained based on the first Harris Eagle population. Specifically, the initial Harris Eagle population is updated based on the initial prey location and the preset first eagle population update model until a preset number of iterations is met, and the first Harris Eagle population is obtained, and the first feature subset is obtained based on the first Harris Eagle population. If the initial prey escape energy is less than a preset first escape energy value, the initial Harris Eagle population is updated based on the local development strategy, the initial prey location, the initial prey escape energy, and the preset random hunting success probability until a preset number of iterations is met, and the first Harris Eagle population is obtained, so as to obtain the first feature subset based on the first Harris Eagle population.
[0036] In this embodiment, when the initial prey escape energy is greater than or equal to a preset first escape energy value, the initial Harris Eagle population is updated based on the initial prey location and a preset first eagle flock update model. Specifically, the preset first escape energy value can be 1. When the initial prey escape energy is greater than or equal to the preset first escape energy value, i.e. The initial Harris Hawk population is updated based on the initial prey location and the preset first hawk flock update model, specifically as follows: Preset first eagle flock update model: ; In the formula, Indicates the first The search location of individuals in the initial Harris Eagle population during the next iteration. Indicates the first The search location of individuals in the Harris Eagle population during the second iteration. This indicates the location of an individual randomly selected from the initial Harris eagle population. Indicates the first Initial prey position in the next iteration This represents the average position of the initial Harris Hawk population, which is calculated by taking the arithmetic mean of the search position vectors of all individuals in the initial Harris Hawk population. , , , and All Random numbers within a range The upper bound vector sum of the predefined search space This is the lower bound vector of the predefined search space. At this point, the flock of eagles is in the global exploration phase, with each eagle equally likely to choose to roost randomly or follow the initial prey location. (Corresponding to the initial feature subset) and the average position of the initial Harris Eagle population The initial Harris Eagle population, guided by prior knowledge and with global optimization capabilities, explores extensively within the neighborhood of high-potential feature areas. This comprehensive exploration of the unexplored feature space avoids overlooking crucial features highly correlated with soil nutrients due to limited search range, providing a more comprehensive range of feature candidates for subsequent precise screening. This process continues until a preset number of iterations is reached, resulting in the acquisition of the first Harris Eagle population and the first feature subset, further improving the accuracy and reliability of soil nutrient detection. Then, when the initial prey escape energy is less than a preset first escape energy value, the initial Harris Eagle population is updated using a local development strategy, initial prey location, initial prey escape energy, and a preset random hunting success probability. This allows for further screening to find the first feature subset highly matched to soil nutrients.
[0037] Further, if the initial prey escape energy is less than a preset first escape energy value, then based on the local development strategy, the initial prey location, the initial prey escape energy, and a preset random hunting success probability, the initial Harris Eagle population is updated until a preset number of iterations is met, thus obtaining a first Harris Eagle population. The first feature subset is then obtained based on the first Harris Eagle population, including: If the initial prey escape energy is less than the preset first escape energy value, the initial prey escape energy is greater than or equal to the preset second escape energy value, and the preset random hunting success probability is greater than or equal to the preset first success probability, then the initial Harris Eagle population is updated based on the preset prey jump intensity, initial prey position, initial prey escape energy, and preset second eagle flock update model until the preset number of iterations is met, and the first Harris Eagle population is obtained, so as to obtain the first feature subset based on the first Harris Eagle population.
[0038] In this embodiment, when At this stage, the initial Harris eagle population enters a local development phase. An exponential jump intensity decay strategy is introduced to update the prey jump intensity J, replacing the traditional purely random jumps. This gradually reduces perturbation as it approaches the optimal feature subset, progressively narrowing the eagle flock's search range to the neighborhood of the current key features. This corrects for minor shifts caused by high similarity between bands, thus accurately pinpointing the band position with the strongest response to soil nutrients without disrupting the overall feature pattern, thereby improving computational efficiency. The mathematical expression for the preset prey jump intensity J is as follows: During this phase, the initial Harris eagle population employs four strategies to target their initial prey locations. Encirclement or attack on the prey and its neighborhood is equivalent to further development and approximation around the current optimal feature space. The choice of strategy is affected by the initial prey escape energy. and preset random hunting success probability Control. When the initial prey escape energy is less than a preset first escape energy value, the initial prey escape energy is greater than or equal to a preset second escape energy value, and the preset random hunting success probability is greater than or equal to a preset first success probability, that is, when the preset second escape energy value can be taken as 0.5, and the preset random hunting success probability can be taken as 0.5, that is, when... and At that time, the prey jumps at a preset prey jumping intensity. The Harris Eagle leaps around the initial prey location. Perform a soft encirclement, depleting the prey's energy, based on the preset prey jump intensity J and the initial prey position. The initial prey escape energy and the preset second flock update model are used to update the initial Harris Eagle population, specifically as follows: In the formula, Indicates the first The search position of individual i in the initial Harris Eagle population during the next iteration. Indicates the first In the next iteration, the search position of individual i in the Harris Eagle population from the first iteration. Indicates the first In the next iteration, the initial prey position can be used for stable local development, avoiding drastic disturbances to the potential optimal spectral feature combination, until the preset number of iterations is met, thereby selecting the first feature subset with a higher degree of matching with soil nutrients.
[0039] Furthermore, it also includes: If the initial prey escape energy is less than the preset first escape energy value, the initial prey escape energy is greater than or equal to the preset second escape energy value, and the preset random hunting success probability is less than the preset first success probability, then the initial Harris Eagle population is updated based on the preset prey jump intensity, initial prey position, initial prey escape energy, and preset third eagle flock update model until the preset number of iterations is met, and the first Harris Eagle population is obtained, so as to obtain the first feature subset based on the first Harris Eagle population; If the initial prey escape energy is less than the preset second escape energy value and the preset random hunting success probability is less than the preset first success probability, then based on the preset prey jump intensity, initial prey position, initial prey escape energy and preset fourth eagle flock update model, the initial Harris eagle population is updated until the preset number of iterations is met, and the first Harris eagle population is obtained, so as to obtain the first feature subset based on the first Harris eagle population. If the initial prey escape energy is less than the preset second escape energy value and the preset random hunting success probability is greater than or equal to the preset first success probability, then the initial Harris Eagle population is updated based on the initial prey location, the initial prey escape energy, and the preset fifth eagle flock update model until the preset number of iterations is met, and the first Harris Eagle population is obtained, so as to obtain the first feature subset based on the first Harris Eagle population.
[0040] In this embodiment, when the initial prey escape energy is less than a preset first escape energy value, the initial prey escape energy is greater than or equal to a preset second escape energy value, and the preset random hunting success probability is less than a preset first success probability, that is... but At that time, the prey still has enough energy to jump or In a maneuver escape, the Harris Eagle employs a gradual, rapid dive attack, essentially a soft encirclement based on a preset prey jump intensity J and initial prey position. The initial prey escape energy and the preset third flock update model are used to update the initial Harris Eagle population, specifically as follows: ; In the formula, It is the size of And the element value is random vectors, for Motion function, As the first strategy, This is the second strategy. First, execute the first strategy. If fitness does not improve, then switch to the second strategy. This allows the initial Harris Eagle population to perform a perturbed, fine-grained search, effectively uncovering weak soil nutrient spectral feature signals masked by noise. It avoids missing potential optimal spectral feature combinations due to a single search strategy, continuing until a preset number of iterations is reached, obtaining the first Harris Eagle population and the first feature subset, thus improving the matching degree between the feature subset and soil nutrients. Then, when the initial prey escape energy is less than a preset second escape energy value and the preset random hunting success probability is less than a preset first success probability, i.e., when... but At this time, the prey escapes with minimal energy, and the Harris Eagle executes a gradual, rapid, and hard-hitting attack. This involves updating the initial Harris Eagle population based on preset prey jump intensity, initial prey position, initial prey escape energy, and a preset fourth eagle flock update model. Specifically: As the third strategy, This is the fourth strategy. First, the third strategy will be executed. If fitness does not improve, then switch to the fourth strategy. This allows for further narrowing of the search range, correction of spectral feature shifts, and locking onto the spectral bands that respond most strongly to soil nutrients, improving the accuracy of feature selection until a preset number of iterations is reached, obtaining the first Harris Eagle population and the first feature subset. Then, when the initial prey escape energy is less than a preset second escape energy value and the preset random hunting success probability is greater than or equal to a preset first success probability, i.e. and At this point, the prey stops jumping, and the Harris Eagles execute a hard encirclement, that is, updating the initial Harris Eagle population based on the initial prey position, the initial prey escape energy, and the preset fifth eagle flock update model, specifically: It can perform stable search without jumping perturbations, avoiding oscillations when approaching the optimal solution, and ensuring the stability and reliability of feature subset selection until the preset number of iterations is met, to obtain the first Harris Eagle population and the first feature subset, providing high-quality spectral features for subsequent soil nutrient detection.
[0041] Furthermore, the initial Harris Eagle population is updated based on the exploration and development strategy, initial prey location, and initial prey escape energy until a preset number of iterations is met to obtain a first Harris Eagle population. The process of obtaining a first feature subset based on the first Harris Eagle population includes: Based on the exploration and development strategy, initial prey location, and initial prey escape energy, the initial Harris Eagle population is updated to obtain the first iteration Harris Eagle population; Based on the first iteration Harris Eagle population, generate several quasi-reverse position vectors corresponding to individuals in the first iteration Harris Eagle population; The quasi-reverse fitness of the quasi-reverse position vector and the first fitness of individuals in the first iteration Harris Eagle population are calculated sequentially. If the quasi-reverse fitness is less than the first fitness, individuals in the first iteration Harris Eagle population are replaced with the quasi-reverse position vector and a second iteration Harris Eagle population is obtained. The initial prey position is updated based on the quasi-reverse position vector and the initial Harris Eagle population is updated based on the second iteration Harris Eagle population until a preset number of iterations is met. The first Harris Eagle population is then obtained, and a first feature subset is obtained based on the first Harris Eagle population.
[0042] In this embodiment, due to the combined effects of high collinearity in the soil spectral bands and weak dispersion of characteristic peaks, the feature space is riddled with "pseudo-extreme traps." To address the local optimum stagnation problem in the iterative process, a QOBL-based evolutionary mechanism is introduced. After each round of position updates, the complementary feature space of individuals is explored, and a flock evolution operation is performed. Because each individual in each iteration... Each individual has a 10% probability of mutation; therefore, the corresponding quasi-reverse position vector is generated by searching the individual positions in the Harris Eagle population during the first iteration. This allows for the exploration of complementary spaces among current feature selection schemes, effectively preventing the population from falling into the optimal trap due to over-focusing on local regions, and broadening the coverage of feature selection. The specific steps for generating the corresponding quasi-reverse position vectors from the search positions of individuals in the Harris Eagle population during the first iteration are as follows: ; In the formula, For the first In the round of iteration, the quasi-reverse position vector No. The elements of dimension. Then, the quasi-reverse fitness of the quasi-reverse position vector and the first fitness of individuals in the first iteration Harris Eagle population are calculated respectively. If the quasi-reverse fitness is less than the first fitness, the individuals in the first iteration Harris Eagle population are replaced with the quasi-reverse position vector and the second iteration Harris Eagle population is obtained. Then, the initial prey position is updated based on the quasi-reverse position vector and the initial Harris Eagle population is updated based on the second iteration Harris Eagle population, specifically: This process filters out spectral feature combinations with better compatibility, while updating the prey location as a new search reference, until the preset number of iterations is met, obtaining the first Harris Eagle population and finally obtaining the first feature subset that is highly matched with soil nutrients.
[0043] Further, the step of obtaining soil nutrient content values based on the first feature subset, measured soil nutrient data of the area to be tested, and spectral feature dataset includes: A quantitative estimation model is established based on the first feature subset and the measured soil nutrient data of the area to be tested. Based on the first feature subset and the spectral feature dataset, the spectral feature data corresponding to the first feature subset is extracted and input into the quantitative estimation model to obtain the soil nutrient content value.
[0044] In this embodiment, a quantitative estimation model is established using a first feature subset and measured soil nutrient data from the test area. This establishes a quantitative correlation between spectral features and soil nutrient content, providing reliable model support for accurate subsequent calculation of soil nutrient content and ensuring the accuracy of the test results. Next, corresponding spectral feature data is extracted from the first feature subset and the spectral feature dataset and input into the quantitative estimation model to obtain soil nutrient content values, achieving rapid and non-destructive detection of soil nutrients.
[0045] This embodiment provides a soil nutrient detection system that integrates prior guidance and global optimization. Please refer to [link to relevant documentation]. Figure 2It includes a dataset construction module, a priori important feature extraction module, a Harris Eagle population construction module, a feature subset generation module, and a soil nutrient content inversion module, specifically: The dataset construction module is used to acquire soil hyperspectral remote sensing image data and soil nutrient measured data of the area to be tested, and to acquire spectral feature dataset based on the soil hyperspectral remote sensing image data. The prior important feature extraction module is used to obtain several initial out-of-bag sample subsets based on the spectral feature dataset, calculate the global importance score of the spectral features based on the initial out-of-bag sample subsets, and arrange the spectral feature dataset according to the global importance score of the spectral features to obtain the prior important feature set. The Harris Eagle population construction module is used to generate an initial Harris Eagle population based on a preset population size, spectral feature dataset, and prior important feature set, and to obtain the initial prey location and initial prey escape energy based on the initial Harris Eagle population. The feature subset generation module is used to update the initial Harris Eagle population based on the exploration and development strategy, the initial prey location, and the initial prey escape energy until a preset number of iterations is met, thereby obtaining the first Harris Eagle population and obtaining the first feature subset based on the first Harris Eagle population. The soil nutrient content inversion module is used to obtain soil nutrient content values based on the first feature subset, measured soil nutrient data of the area to be tested, and spectral feature dataset.
[0046] This embodiment provides a soil nutrient detection system that integrates prior guidance and global optimization. In practical applications, it only requires a prior important feature extraction module. By dividing the initial out-of-bag sample subsets, it provides an objective data basis for the subsequent quantification of the global importance score of spectral features. At the same time, by calculating the global importance score of spectral features through the initial out-of-bag sample subsets, it quantifies the contribution weight of each spectral feature to the accuracy of soil nutrient detection, forming a sortable feature importance quantification index, namely the global importance score. This can accurately locate the spectral features that play a key role in soil nutrient inversion, screen out spectral features that are highly correlated with soil nutrients, obtain the set of prior important features, define the scope for subsequent global optimization search, avoid interference from invalid features, and improve the efficiency and accuracy of soil nutrient detection. Next, a Harris Hawk population construction module was used to construct an initial Harris Hawk population by presetting the population size, spectral feature dataset, and prior important feature set. The initial prey location and initial prey escape energy were also obtained. This initial Harris Hawk population serves as the starting point for global optimization guided by priors, reducing ineffective screening of low signal-to-noise ratio and irrelevant bands in the spectral feature dataset, improving overall detection efficiency, significantly reducing the computational cost of subsequent data, and enhancing the accuracy of the final soil nutrient content results for the tested area. The initial prey escape energy E is dynamically updated using an inverse Sigmoid function, which adapts to the "wide-band, slowly changing" physical characteristics of soil spectral absorption features, ensuring the accuracy of the initial prey escape energy. The initial prey escape energy E decays slowly in the early stages of iteration, allowing the eagle flock to explore a wider range of continuous absorption areas of soil nutrients globally; it decreases rapidly in the middle stages of iteration to accelerate convergence to a specific absorption peak; and it maintains low energy in the later stages of iteration for fine-grained local exploitation of adjacent bands. The update formula for the initial prey escape energy E is: ,in, for Random numbers between The preset stopping iteration number is defined as t, where t represents the current population iteration number. Then, a feature subset generation module is used to update the initial Harris Hawk population by exploring development strategies, initial prey locations, and initial prey escape energy, enabling further screening to find a first feature subset highly matching soil nutrients. Finally, a soil nutrient content inversion module is employed to obtain soil nutrient content values using the first feature subset, measured soil nutrient data from the test area, and spectral feature datasets. This allows for the calculation and output of soil nutrient content results for the test area, achieving rapid and non-destructive detection of soil nutrients. This effectively addresses the characteristics of sparse and weak effective information and strong multicollinearity between bands in soil hyperspectral data.
[0047] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A soil nutrient detection method integrating prior guidance and global optimization, characterized in that, include: Acquire soil hyperspectral remote sensing image data and soil nutrient measured data of the area to be tested, and obtain spectral feature dataset based on the soil hyperspectral remote sensing image data; Based on the spectral feature dataset, several initial out-of-bag sample subsets are obtained, and the global importance score of the spectral features is calculated based on the initial out-of-bag sample subsets. The spectral feature dataset is then ranked according to the global importance score of the spectral features to obtain a priori important feature set, including: Based on the spectral feature dataset, several initial out-of-bag sample subsets are obtained; Based on the initial out-of-bag sample subset and the preset decision tree regression model, the initial baseline mean square error corresponding to the initial out-of-bag sample subset is calculated. The spectral features of the initial out-of-bag sample subset are randomly shuffled to obtain a perturbed out-of-bag sample subset; Based on the perturbation outside bag sample subset and the preset decision tree regression model, the perturbation baseline mean square error corresponding to the perturbation outside bag sample subset is calculated. The global importance score of the spectral features is calculated based on the initial reference mean square error and the perturbation reference mean square error. Based on the global importance score of spectral features, the spectral feature dataset is sorted, and the set of prior important features is obtained based on the preset sorting order. Based on the preset population size, spectral feature dataset and prior important feature set, an initial Harris Hawk population is generated, and the initial prey location and initial prey escape energy are obtained based on the initial Harris Hawk population. Based on the exploration and development strategy, initial prey location, and initial prey escape energy, the initial Harris Eagle population is updated until a preset number of iterations is met, and the first Harris Eagle population is obtained, so as to obtain the first feature subset based on the first Harris Eagle population; Based on the first feature subset, the measured soil nutrient data of the area to be tested, and the spectral feature dataset, the soil nutrient content values are obtained.
2. The soil nutrient detection method integrating prior guidance and global optimization according to claim 1, characterized in that, The process of generating an initial Harris Hawk population based on a preset population size, spectral feature dataset, and prior important feature set, and obtaining initial prey locations and initial prey escape energy based on the initial Harris Hawk population, includes: An initial Harris Eagle population is constructed based on a pre-defined population size, spectral feature dataset, and prior important feature set. Based on the initial Harris Hawk population and the preset machine learning regression model, the initial feature subset corresponding to the initial Harris Hawk population is selected and the initial fitness of the initial features is calculated in turn. If the initial fitness meets the preset fitness condition, the individual in the initial Harris Hawk population corresponding to the initial fitness is marked as the initial prey location. The initial prey escape energy is obtained based on the initial Harris Eagle population.
3. The soil nutrient detection method integrating prior guidance and global optimization according to claim 1, characterized in that, The process involves acquiring hyperspectral remote sensing image data of the soil in the area to be tested and measured soil nutrient data of the area to be tested, and obtaining a spectral feature dataset based on the hyperspectral remote sensing image data of the soil, including: Acquire hyperspectral remote sensing image data of the soil in the area to be tested and measured soil nutrient data of the area to be tested; Based on soil hyperspectral remote sensing image data, the original spectral reflectance was extracted; The original spectral reflectance is differentiated and logarithmically transformed to obtain the enhanced spectral reflectance. The spectral index of the enhanced spectral reflectance is then calculated to obtain the spectral index corresponding to the enhanced spectral reflectance. The enhanced spectral reflectance and the corresponding spectral index constitute the enhanced spectral data; Obtain a spectral feature dataset based on enhanced spectral data.
4. The soil nutrient detection method integrating prior guidance and global optimization according to claim 1, characterized in that, Based on the exploration-exploitation strategy, initial prey location, and initial prey escape energy, the initial Harris Eagle population is updated until a preset number of iterations is reached to obtain the first Harris Eagle population. A first feature subset is then obtained based on this first Harris Eagle population. The exploration-exploitation strategy includes a global exploration strategy and a local exploitation strategy, specifically: If the initial prey escape energy is greater than or equal to a preset first escape energy value, the initial Harris Eagle population is updated based on the global exploration strategy to obtain the first Harris Eagle population, and the first feature subset is obtained based on the first Harris Eagle population. Specifically, the initial Harris Eagle population is updated based on the initial prey location and the preset first eagle population update model until a preset number of iterations is met, and the first Harris Eagle population is obtained, and the first feature subset is obtained based on the first Harris Eagle population. If the initial prey escape energy is less than a preset first escape energy value, the initial Harris Eagle population is updated based on the local development strategy, the initial prey location, the initial prey escape energy, and the preset random hunting success probability until a preset number of iterations is met, and the first Harris Eagle population is obtained, so as to obtain the first feature subset based on the first Harris Eagle population.
5. The soil nutrient detection method integrating prior guidance and global optimization according to claim 4, characterized in that, If the initial prey escape energy is less than a preset first escape energy value, then based on the local development strategy, the initial prey location, the initial prey escape energy, and the preset random hunting success probability, the initial Harris Eagle population is updated until a preset number of iterations is met, thus obtaining the first Harris Eagle population. A first feature subset is then obtained based on the first Harris Eagle population, including: If the initial prey escape energy is less than the preset first escape energy value, the initial prey escape energy is greater than or equal to the preset second escape energy value, and the preset random hunting success probability is greater than or equal to the preset first success probability, then the initial Harris Eagle population is updated based on the preset prey jump intensity, initial prey position, initial prey escape energy, and preset second eagle flock update model until the preset number of iterations is met, and the first Harris Eagle population is obtained, so as to obtain the first feature subset based on the first Harris Eagle population.
6. The soil nutrient detection method integrating prior guidance and global optimization according to claim 5, characterized in that, Also includes: If the initial prey escape energy is less than the preset first escape energy value, the initial prey escape energy is greater than or equal to the preset second escape energy value, and the preset random hunting success probability is less than the preset first success probability, then the initial Harris Eagle population is updated based on the preset prey jump intensity, initial prey position, initial prey escape energy, and preset third eagle flock update model until the preset number of iterations is met, and the first Harris Eagle population is obtained, so as to obtain the first feature subset based on the first Harris Eagle population; If the initial prey escape energy is less than the preset second escape energy value and the preset random hunting success probability is less than the preset first success probability, then based on the preset prey jump intensity, initial prey position, initial prey escape energy and preset fourth eagle flock update model, the initial Harris eagle population is updated until the preset number of iterations is met, and the first Harris eagle population is obtained, so as to obtain the first feature subset based on the first Harris eagle population. If the initial prey escape energy is less than the preset second escape energy value and the preset random hunting success probability is greater than or equal to the preset first success probability, then the initial Harris Eagle population is updated based on the initial prey location, the initial prey escape energy, and the preset fifth eagle flock update model until the preset number of iterations is met, and the first Harris Eagle population is obtained, so as to obtain the first feature subset based on the first Harris Eagle population.
7. The soil nutrient detection method integrating prior guidance and global optimization according to claim 1, characterized in that, The initial Harris Eagle population is updated based on the exploration and development strategy, initial prey location, and initial prey escape energy until a preset number of iterations is met to obtain the first Harris Eagle population. A first feature subset is then obtained based on this first Harris Eagle population, including: Based on the exploration and development strategy, initial prey location, and initial prey escape energy, the initial Harris Eagle population is updated to obtain the first iteration Harris Eagle population; Based on the first iteration Harris Eagle population, generate several quasi-reverse position vectors corresponding to individuals in the first iteration Harris Eagle population; The quasi-reverse fitness of the quasi-reverse position vector and the first fitness of individuals in the first iteration Harris Eagle population are calculated sequentially. If the quasi-reverse fitness is less than the first fitness, individuals in the first iteration Harris Eagle population are replaced with the quasi-reverse position vector and a second iteration Harris Eagle population is obtained. The initial prey position is updated based on the quasi-reverse position vector and the initial Harris Eagle population is updated based on the second iteration Harris Eagle population until a preset number of iterations is met. The first Harris Eagle population is then obtained, and a first feature subset is obtained based on the first Harris Eagle population.
8. The soil nutrient detection method integrating prior guidance and global optimization according to claim 1, characterized in that, The process of obtaining soil nutrient content values based on the first feature subset, measured soil nutrient data of the area to be tested, and spectral feature dataset includes: A quantitative estimation model is established based on the first feature subset and the measured soil nutrient data of the area to be tested. Based on the first feature subset and the spectral feature dataset, the spectral feature data corresponding to the first feature subset is extracted and input into the quantitative estimation model to obtain the soil nutrient content value.
9. A soil nutrient detection system integrating prior guidance and global optimization, characterized in that, It includes a dataset construction module, a priori important feature extraction module, a Harris Eagle population construction module, a feature subset generation module, and a soil nutrient content inversion module, specifically: The dataset construction module is used to acquire soil hyperspectral remote sensing image data and soil nutrient measured data of the area to be tested, and to acquire spectral feature dataset based on the soil hyperspectral remote sensing image data. The prior important feature extraction module is used to obtain several initial out-of-bag sample subsets based on the spectral feature dataset; and to calculate the initial benchmark mean square error corresponding to the initial out-of-bag sample subsets based on the initial out-of-bag sample subsets and the preset decision tree regression model. The spectral features of the initial out-of-bag sample subset are randomly shuffled to obtain a perturbed out-of-bag sample subset; based on the perturbed out-of-bag sample subset and the preset decision tree regression model, the perturbed baseline mean square error corresponding to the perturbed out-of-bag sample subset is calculated; The global importance score of the spectral features is calculated based on the initial reference mean square error and the perturbation reference mean square error. Based on the global importance score of spectral features, the spectral feature dataset is sorted, and the set of prior important features is obtained based on the preset sorting order. The Harris Eagle population construction module is used to generate an initial Harris Eagle population based on a preset population size, spectral feature dataset, and prior important feature set, and to obtain the initial prey location and initial prey escape energy based on the initial Harris Eagle population. The feature subset generation module is used to update the initial Harris Eagle population based on the exploration and development strategy, the initial prey location, and the initial prey escape energy until a preset number of iterations is met, thereby obtaining the first Harris Eagle population and obtaining the first feature subset based on the first Harris Eagle population. The soil nutrient content inversion module is used to obtain soil nutrient content values based on the first feature subset, measured soil nutrient data of the area to be tested, and spectral feature dataset.
Citation Information
Patent Citations
Rotary cement kiln temperature soft measurement modeling method based on offset compensation and optimized Elman neural network
CN118656593A
Soil organic carbon content prediction method based on hyperspectrum
CN118794896A