A Method for Monitoring and Early Warning of Soil Fertility in Tobacco Planting Based on Multi-Level Data
By using multi-level data collection and processing, combined with feature extraction and CNN-LSTM models, a dual-threshold early warning mechanism and feedback iterative optimization were constructed. This solved the problems of insufficient hierarchical structure, inadequate feature fusion, and limited assessment accuracy in tobacco-growing soil fertility monitoring, and enabled accurate assessment and dynamic management of soil fertility.
Patent Information
- Application Number
- CN202610256683.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-04
- Publication Date
- 2026-05-26
- Estimated Expiration
- 2046-03-04
AI Technical Summary
Existing methods for monitoring soil fertility in tobacco-growing areas lack hierarchical design, have insufficient feature extraction, limited assessment accuracy, and lack a closed-loop system for early warning and optimization, thus failing to meet the needs of refined management in tobacco production.
By employing multi-level data acquisition and processing, and combining PCA, random forest, and mutual information entropy methods to extract features, a CNN-LSTM evaluation model is constructed. Through a dual-threshold early warning mechanism and feedback iterative optimization, the accurate assessment and dynamic adjustment of soil fertility levels are achieved.
It significantly improved the accuracy and stability of soil fertility assessment, ensured the pertinence and operability of management measures, and realized refined and long-term management of soil fertility in tobacco-growing areas.
Smart Images

Figure CN121808277B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data processing technology, and in particular relates to a method for monitoring and early warning of tobacco soil fertility based on multi-level data. Background Technology
[0002] As an economic crop sensitive to soil fertility conditions, the stability of soil fertility directly determines the yield, quality, and internal chemical composition of tobacco. Tobacco-growing areas often cover complex terrains such as mountains, hills, and plains. The fertility characteristics of different soil profiles and different planting cycles vary significantly. Furthermore, soil fertility is influenced by the synergistic effects of environmental factors and planting management measures, exhibiting a multi-dimensional and dynamic pattern of change.
[0003] Existing methods for monitoring soil fertility in tobacco-growing areas mostly focus on single-dimensional data or single-level characteristics, which have significant technical limitations.
[0004] First, the data collection and processing lacks a hierarchical design. Most sampling and monitoring are only carried out on the soil surface, ignoring the fertility contribution of the middle and deep soil layers. Furthermore, the data is not classified and analyzed in combination with the hierarchical differences in topography and planting cycle, resulting in insufficient data representativeness and an inability to fully reflect the spatial heterogeneity and temporal dynamics of soil fertility in tobacco-growing areas.
[0005] Second, the feature extraction methods are too simple, often using simple methods such as principal component analysis and single machine learning algorithms to extract features. This makes it difficult to capture the correlation between features of different dimensions, which can easily lead to the omission of key features or interference from redundant features.
[0006] Third, the assessment model is not adaptable enough. Traditional models often use convolutional neural networks (CNN) to capture spatial features or long short-term memory networks (LSTM) to capture temporal features. They cannot simultaneously take into account the spatial distribution pattern of soil fertility and the dynamic change pattern within the planting cycle. Furthermore, they lack the attention mechanism to enhance key features, resulting in limited assessment accuracy.
[0007] Fourth, the early warning mechanism and model optimization closed loop are missing. Existing early warnings are mostly based on fixed threshold triggers, without dynamically calibrating the thresholds in conjunction with the model output performance. Furthermore, there is a lack of feedback and iteration mechanisms after the implementation of early warning schemes, which makes it impossible to achieve dynamic optimization of model parameters, early warning thresholds, and management schemes. This results in an imbalance between early warning sensitivity and accuracy, making it difficult to meet the needs of refined management in tobacco production.
[0008] Therefore, in view of the problems of insufficient hierarchical structure, insufficient feature fusion, limited assessment accuracy, and lack of closed-loop early warning and optimization in existing tobacco soil fertility monitoring technologies, this invention aims to provide a method for monitoring and early warning of tobacco soil fertility based on multi-level data. Through hierarchical design, multi-dimensional feature fusion, accurate assessment, and dynamic iterative optimization, this method can achieve accurate monitoring and efficient early warning of tobacco soil fertility throughout the entire process. Summary of the Invention
[0009] The purpose of this invention is to provide a method for monitoring and early warning of tobacco soil fertility based on multi-level data, in order to solve the technical problems of insufficient hierarchical structure, inadequate feature fusion, limited assessment accuracy, and lack of closed-loop early warning and optimization in existing tobacco soil fertility monitoring technologies.
[0010] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0011] A method for monitoring and early warning of tobacco-growing soil fertility based on multi-level data includes the following steps:
[0012] S1: Soil samples were collected according to the topographic level, soil profile level and planting cycle level of the tobacco planting area. Based on the samples, the original soil fertility data was obtained. At the same time, environmental data and planting management data of the corresponding level were collected and preprocessed to obtain a standardized multi-level dataset.
[0013] S2: Perform multi-level feature extraction and fusion on the standardized multi-level dataset to obtain profile-level feature vectors, cross-level feature vectors, and collaborative-level feature vectors. Then, use an attention mechanism to fuse and assign dynamic weights to the features at each level to obtain a fused feature set.
[0014] S3: Construct a CNN-LSTM evaluation model, use a standardized multi-level dataset to train, validate and optimize the model, use soil fertility level as the label, and obtain the trained soil fertility level evaluation model by adjusting the model hyperparameters;
[0015] S4: Input the multi-level data collected in real time and preprocessed and feature fused into the soil fertility level assessment model to obtain the real-time soil fertility level; construct a dual-threshold early warning mechanism based on the assessment results, setting the fertility level "poor" as the first-level early warning threshold and "extremely poor" as the second-level early warning threshold;
[0016] S5: When the assessment result is a Level 1 warning, a corresponding fertilization adjustment plan is generated by combining the collaborative hierarchical feature vector; when the assessment result is a Level 2 warning, irrigation strategy optimization and soil improvement suggestions are superimposed on the fertilization adjustment plan.
[0017] S6: Use the soil fertility monitoring data from the adjusted plan after implementation as feedback data, input it into the soil fertility level assessment model, dynamically adjust the model parameters and early warning thresholds, and achieve iterative optimization of the model and early warning plan.
[0018] Preferably, the specific process for obtaining the profile-level feature vector in step S2 is as follows:
[0019] S211: For each soil profile level including the top layer (0-20cm), middle layer (20-40cm), and deep layer (40-60cm), soil physical, chemical, and biological indicators are extracted from the standardized multi-level dataset to construct the indicator matrix for each level.
[0020] S212: Calculate the covariance matrix of the index matrix;
[0021] S213: Perform eigenvalue decomposition on the covariance matrix to obtain eigenvalues and corresponding eigenvectors;
[0022] S214: Calculate the variance contribution rate of each eigenvalue, and select the top eigenvalues whose cumulative variance contribution rate is ≥85%. p The eigenvectors corresponding to each eigenvalue are used as principal component loading vectors;
[0023] S215: Using the indicator matrix and the selected... p The principal component load vectors are used to construct a matrix product to obtain the principal component matrix of the profile level. The principal component matrix is then used as the feature vector of the profile level. By summing the feature vectors of all profile levels, the complete profile level feature vector is obtained. F 1.
[0024] Preferably, the specific process for obtaining the cross-level feature vector in step S2 is as follows:
[0025] S221: The standardized multi-level dataset is paired and matched according to the terrain level and the planting cycle level to form 9 cross-levels. For each cross-level, the standardized environmental data, planting management data and the corresponding profile level feature vector set output by the first level are integrated to construct the feature dataset of each cross-level.
[0026] S222: Train a random forest model with the feature dataset of each cross-level as input and the actual soil fertility level of the corresponding cross-level as output label. Set the number of decision trees to 100, and select the splitting features of each decision tree by random sampling. Set the depth of the decision tree to 10-15 layers.
[0027] S223: Feature Importance Calculation: Based on the trained random forest model, the Gini coefficient method is used to calculate the importance weight of each feature in the feature dataset at each cross level;
[0028] S224: Feature Selection and Vector Construction: Sort all features in each cross-level feature dataset in descending order of importance weight, and select the top 30% of features by weight as the key features for that cross-level; concatenate and integrate the key features of the 9 cross-levels according to the cross-level category order to construct a cross-level feature vector with uniform dimension. F 2.
[0029] Preferably, the specific process for obtaining the collaborative layer feature vector in step S2 is as follows:
[0030] S231: From the standardized multi-level dataset, extract the environmental data subset E and the planting management data subset M, and construct a one-to-one corresponding collaborative data pair {( E k ,M k |k=1,2,…, m}, m The total number of samples;
[0031] S232: Calculate each indicator in the environmental data subset E based on the mutual information formula of information theory. eᵢ Each indicator in the subset M of planting management data m j mutual information value I ( e i ,m j and the information entropy of each indicator itself. H ( e i ), H( m j );
[0032] S233: Calculate the degree of collaborative association R ( e i ,m j )= I ( eᵢ,m j ) / [ H ( e i )· H ( m j )] 1 / 2 Set the correlation threshold R 0 Filter out R ( eᵢ,m j For each pair of collaborative indices ≥ R0, one collaborative feature is generated by multiplication.
[0033] S234: Standardize all generated collaborative features, arrange them in a fixed order according to the environment-management indicator pairs, and construct a collaborative hierarchical feature vector. F 3.
[0034] Preferably, the specific process of obtaining the fused feature set through attention mechanism fusion is as follows:
[0035] S241: Construct an attention weight function and calculate dynamic weights α, β, and γ by combining the contribution index of feature vectors at each level;
[0036] S242: The fused feature set F is obtained through linear weighted fusion, as shown in the following formula:
[0037] F = α·F1 + β·F2 + γ·F3.
[0038] Preferably, the soil fertility assessment model includes a CNN module, an LSTM module, and a classification output module, with each module connected in series, and an attention mechanism embedded in the fully connected layer of the CNN-LSTM model;
[0039] The CNN module is used to extract spatial correlation features from the fused feature set;
[0040] The LSTM module is used to capture temporal correlation features in the fused feature set;
[0041] An attention mechanism is embedded in the fully connected layer of the CNN-LSTM model.
[0042] Preferably, the CNN module adopts an alternating structure of 3 convolutional layers and 2 max pooling layers, and the input is the 3D feature tensor reshaped from the fused feature set F. F in The kernel size of the convolutional layer is set to 3×3.
[0043] Every two convolutional layers are followed by a max pooling layer with a 2×2 window size. This pooling window is used to compress feature dimensions and preserve key spatial information, ultimately outputting the spatial feature map of the CNN module. F cnn ;
[0044] LSTM module: Receives the output of the CNN module. F cnn The input is converted to a temporal format, and two hidden layers are set, with 64 neurons in each layer. The LSTM module uses forget gates, input gates, and output gates to remember and update temporal information, and finally outputs an LSTM temporal feature vector. F lstm ;
[0045] Attention enhancement mechanisms: Flstm Using this as input, attention weights are calculated for each temporal feature to enhance the contribution of key features to the ranking assessment; the weight calculation employs... softmax Normalization;
[0046] Classification output module: Set up 2 fully connected layers, the first layer input is F att The first layer has an output dimension of 32 and uses the ReLU activation function; the second layer has an output dimension of 5, corresponding to 5 levels of soil fertility, and uses the softmax activation function. The output probability distribution P=[p1,p2,p3,p4,p5] for each level satisfies Σ i=1 5 p i =1, the level corresponding to the maximum probability is the model prediction level.
[0047] Preferably, the specific process of step S4 is as follows:
[0048] S41: Real-time sampling is performed on the tobacco-growing area to be monitored, and the terrain, soil profile and planting cycle are divided into levels. Real-time soil fertility, environmental and planting management data of the corresponding levels are collected, preprocessed and output as real-time multi-level datasets.
[0049] S42: Based on a real-time multi-level dataset, the following methods are used to extract the profile-level feature vector F1 using PCA, the terrain-planting cycle cross-level feature vector F2 using random forest, and the environment-management collaboration-level feature vector F3 using mutual information entropy. These features are then weighted and fused using an attention mechanism to calculate the real-time fused feature set F. 实时 ;
[0050] S43: Will F 实时 Input the trained CNN-LSTM evaluation model, and output the probability distribution of real-time soil fertility levels: P 实时 =[p1,p2,p3,p4,p5], which represent the probability values for five levels: Excellent, Good, Medium, Poor, and Very Poor, respectively. The level corresponding to the highest probability value is selected as the real-time fertilizer level. L 实时 ;
[0051] S44: Dual threshold early warning mechanism judgment: Set the fertility level "poor" as the first-level early warning threshold T1 and "extremely poor" as the second-level early warning threshold T2, and perform early warning judgment based on the real-time fertility level.
[0052] Preferably, the specific process for generating the hierarchical feedback adjustment scheme in step S5 is as follows:
[0053] Level 1 early warning feedback adjustment: Combining the F3 feature vector of the environment-management synergy hierarchy, analyze the synergistic correlation between environmental data and planting management data; use multiple regression analysis to determine the optimal nitrogen, phosphorus and potassium fertilizer ratio;
[0054] When the soil organic matter content is below 2%, the amount of micronutrient supplementation is increased by 20%; at the same time, the irrigation frequency is adjusted, and the irrigation amount is dynamically matched based on real-time precipitation data to ensure that the soil moisture content is maintained within the suitable range for tobacco planting.
[0055] Level II Early Warning Feedback Adjustment: Based on the Level I Early Warning Fertilization and Irrigation Adjustment Plan, soil improvement measures are added:
[0056] Based on the detected soil physical indicators, soil porosity is calculated. When the porosity is less than 45%, the amount of soil amendment added should not be less than 5% of the dry weight of the soil to improve soil structure and enhance fertility. After the adjusted management measures are implemented, data are collected again and fertility is assessed according to the process of steps S1-S3.
[0057] Preferably, the specific process of step S6 is as follows:
[0058] S61: After the hierarchical feedback adjustment plan is completed, re-collect soil samples, environmental data, and planting management data at each level to obtain the original feedback dataset. Then, extract and fuse these features to generate a feedback fusion feature set. F 反馈 The fertility level assessment results were obtained using a CNN-LSTM model. L 反馈 and corresponding probability distribution P 反馈 Build a complete feedback dataset D 反馈 ;
[0059] S62: Feedback dataset D 反馈 The original training set from step S3 is mixed with the training set from step S3 in a specified ratio to form the iterative training set. D 迭代 Incremental training was performed on the model to adjust the parameters.
[0060] S63: Based on the output of the iterated model and the fertility level distribution of the feedback dataset, calibrate the first and second warning thresholds.
[0061] The beneficial effects of this invention include:
[0062] 1. Sampling units were divided according to topographic level, soil profile level, and planting cycle level, and soil fertility data, environmental data, and planting management data were collected simultaneously. Compared with traditional single surface sampling, this method effectively covers the spatial heterogeneity and temporal dynamics of tobacco-growing soils. The standardized multi-level dataset, after removing outliers and filling in missing values, provides high-quality data support for subsequent feature extraction and model construction, significantly reducing monitoring errors caused by data partiality.
[0063] 2. Through a three-level feature extraction process, PCA is used to extract core features at the soil profile level, random forest is used to screen key features at the topographic-planting cycle intersection level, and mutual information entropy is used to capture features related to the environment-management collaboration level. Then, an attention mechanism is used to dynamically assign weights to features at each level for fusion. This approach overcomes the limitations of traditional single feature extraction, achieving not only accurate extraction of features at different levels but also dynamically balancing the contribution of each feature through the attention mechanism. This strengthens key features that play a dominant role in soil fertility assessment, effectively eliminates redundant information, and improves the discriminability and adaptability of the feature set, laying a core foundation for subsequent accurate model evaluation.
[0064] 3. An improved CNN-LSTM evaluation model is constructed. The CNN module extracts spatial correlation features from the fused features, while the LSTM module captures temporal correlation features. An attention mechanism is embedded in the fully connected layer to strengthen the role of key features. Compared to traditional single CNN or LSTM models or simple combination models, this invention achieves the collaborative capture of spatial and temporal features. By combining the cross-entropy loss function with the parameter iteration of the Adam optimizer, the model achieves high evaluation accuracy, significantly improving the precision and stability of soil fertility level assessment.
[0065] 4. A dual-threshold early warning mechanism is constructed, using "poor" and "extremely poor" levels as warning thresholds. Combined with environmental-management synergy characteristics, a tiered adjustment plan is generated. The first-level warning optimizes fertilizer application ratios, while the second-level warning overlays irrigation adjustments and soil improvement. Furthermore, soil porosity calculations precisely match the dosage of soil amendments, ensuring the targeted and operable nature of the adjustment plan. Compared to traditional fixed threshold and single-control schemes, this tiered early warning and control model can dynamically adapt management measures according to fertility levels, avoiding resource waste caused by over-control while rapidly improving soil fertility and ensuring the needs of tobacco growth.
[0066] 5. Feedback data from the implementation of the early warning scheme is used to adjust model parameters and calibrate early warning thresholds. Model parameters are optimized using the momentum gradient descent method, and early warning thresholds are dynamically calibrated based on prediction accuracy, forming a complete closed loop of monitoring-evaluation-early warning-control-feedback-optimization. Compared to existing methods without feedback optimization, this iterative mechanism allows the model and early warning thresholds to dynamically adapt to actual planting conditions, continuously reducing root mean square error and mean absolute error, ensuring the accuracy and stability of long-term monitoring and early warning, and achieving refined and long-term management of tobacco-growing soil fertility. Attached Figure Description
[0067] Figure 1 This is a flowchart illustrating the method for monitoring and early warning of tobacco soil fertility based on multi-level data according to the present invention.
[0068] Figure 2 This is a schematic diagram of the process for obtaining profile-level feature vectors according to the present invention.
[0069] Figure 3 This is a schematic diagram of the soil fertility level assessment model of the present invention. Detailed Implementation
[0070] The following is in conjunction with the appendix Figure 1~Figure 3 The present invention will be further described in detail below:
[0071] Example 1
[0072] See appendix Figure 1 As shown, the method for monitoring and early warning of tobacco soil fertility based on multi-level data is characterized by the following steps:
[0073] S1: Multi-level tobacco planting soil sampling and data preprocessing: Sampling units were divided according to the topographic level, soil profile level, and planting cycle level of the tobacco planting area. Soil samples were collected in each sampling unit using a five-point mixed sampling method. The topographic level included mountains, hills, and plains; the soil profile level included the top layer (0-20cm), middle layer (20-40cm), and deep layer (40-60cm); and the planting cycle level included the seedling stage, vigorous growth stage, and maturity stage. Environmental data, including temperature, precipitation, and sunshine duration, as well as planting management data, including fertilizer type, fertilizer amount, and irrigation frequency, were collected simultaneously at the corresponding levels.
[0074] After air-drying, grinding, and sieving, the collected soil samples were analyzed using a laser particle size analyzer, elemental analyzer, and pH meter. The analysis included physical indicators such as particle size distribution and bulk density; chemical indicators such as organic matter, nitrogen, phosphorus, and potassium content, and pH value; and biological indicators such as microbial biomass carbon and urease activity. This yielded raw soil fertility data. Outliers were removed from the raw soil fertility data, environmental data, and planting management data using the 3σ criterion. Missing values were filled using hierarchical similarity-based interpolation. The data were then normalized to the [0,1] interval to output a standardized multi-level dataset.
[0075] S2: Multi-level feature extraction and fusion: Based on the standardized multi-level dataset output in step S1, three-level feature extraction is performed. The first level targets the soil profile level, using principal component analysis (PCA) to extract the core features of soil physical, chemical, and biological indicators at each profile level, thus obtaining profile level feature vectors.
[0076] The second level targets the terrain-planting cycle cross-level. The random forest algorithm is used to rank the importance of features matched between different terrain levels and planting cycle levels, and to select the cross-level features with the top 30% weight in terms of their influence on tobacco soil fertility, thus obtaining the cross-level feature vector.
[0077] The third level targets the environment-management collaboration level. It uses the mutual information entropy method to calculate the collaborative correlation features between environmental data and planting management data, and obtains the collaboration level feature vector. The profile level feature vector, the cross level feature vector, and the collaboration level feature vector are fused through an attention mechanism, and dynamic weights are assigned to each level feature. The weight values are adaptively adjusted based on the contribution of the feature to the fertility effect, and the fused feature set is output.
[0078] S3: Input the fused feature set into the soil fertility level assessment model. The soil fertility level assessment model is a convolutional neural network-long short-term memory network (CNN-LSTM) assessment model. It is trained, validated and optimized using the standardized multi-level dataset preprocessed in step S1. The soil fertility level (excellent, good, medium, poor, very poor) is used as the label. The model assessment accuracy is improved by adjusting the model hyperparameters (learning rate, number of iterations, number of hidden layer neurons) to obtain the trained soil fertility level assessment model.
[0079] S4: Dynamic early warning and feedback adjustment of soil fertility: The multi-level data collected in real time and preprocessed in step S1 and feature fusion in step S2 are input into the soil fertility level assessment model trained in step S3 to obtain the real-time soil fertility level; a dual-threshold early warning mechanism is constructed based on the assessment results, setting the fertility level "poor" as the first-level early warning threshold and "extremely poor" as the second-level early warning threshold.
[0080] S5: When the assessment result is a Level 1 warning, combine the collaborative hierarchical features extracted in step S2 to generate a targeted fertilization adjustment plan, including optimizing the nitrogen, phosphorus and potassium ratio and supplementing micronutrients; when the assessment result is a Level 2 warning, on the basis of the fertilization adjustment plan, add irrigation strategy optimization (which can adjust the irrigation frequency and irrigation volume) and soil improvement suggestions (which can add organic soil conditioners).
[0081] S6: Iterative optimization of early warning results: The soil fertility monitoring data after the implementation of the adjustment plan in step S4 (re-collected, processed, and evaluated according to the process of steps S1-S3) is used as feedback data and input into the soil fertility level assessment model. The model parameters and early warning thresholds are dynamically adjusted to achieve iterative optimization of the model and early warning plan, thereby improving the accuracy of subsequent monitoring and early warning.
[0082] Example 2
[0083] Based on Example 1, see Figure 2 In step S2, principal component analysis is used to extract the core features of soil physical, chemical, and biological indicators at each profile level, and the specific process for obtaining the profile-level feature vectors is as follows:
[0084] S211: For each soil profile layer (top 0-20cm, middle 20-40cm, and deep 40-60cm), soil physical indicators (particle size distribution, bulk density), chemical indicators (organic matter, nitrogen, phosphorus, and potassium content, pH value), and biological indicators (microbial biomass carbon, urease activity) are extracted from the standardized multi-level dataset to construct an indicator matrix for each layer. X mn ,in m This represents the number of samples at this level. n This represents the total number of indicators at this level (combined physical, chemical, and biological indicators).
[0085] S212: Calculate the index matrix X mn The covariance matrix C nn Covariance matrix elements C ij The calculation formula is: C ij = Cov ( X i ,X j )=(1 / ( m -1))·Σ k=1 m ( X ik -m i ()( X jk -m j),in Xᵢ、X j These are the first in the index matrix. i The, the j One indicator, m i ,m j The first i The, the j The average of the indicators, X ik 、X jk The first k In the nth sample i The, the j The standardized values of each indicator.
[0086] S213: For the covariance matrix C nn Perform eigenvalue decomposition to obtain eigenvalues. l 1 ≥λ 2 ≥…≥λ n and corresponding feature vectors x 1 ,x 2 ,…,x n The eigenvalue decomposition satisfies the formula: C nn ·ξ=λ·ξ ,in x For feature vectors, l For the corresponding eigenvalues.
[0087] S214: Calculate the variance contribution rate of each eigenvalue or i =λ i / S k=1 n l k Select the top performers with a cumulative variance contribution rate ≥ 85%. p The eigenvectors corresponding to the eigenvalues are used as principal component loading vectors. p≤n .
[0088] S215: Using the index matrix X mn With the selected p The principal component matrix of this profile level is obtained by constructing a matrix product from the principal component load vectors. Y mp ,Y mp =X mn ·x p , x p for p Composed of principal component loading vectors n×p Matrix, principal component matrix Y mp As the feature vector of this profile level, the feature vectors of each profile level are summarized to obtain the complete profile level feature vector. F 1.
[0089] In step S2, the second level targets the terrain-planting cycle cross-level. A random forest algorithm is used to rank the importance of features matched between different terrain and planting cycle levels, selecting the top 30% of cross-level features with the highest weight influencing tobacco soil fertility. The specific process for obtaining the cross-level feature vector is as follows:
[0090] S221: Feature Matching and Cross-Set Construction: The standardized multi-level datasets obtained in step S1 are paired and matched according to the terrain level (mountains, hills, plains) and the planting cycle level (seedling stage, vigorous growth stage, maturity stage) to form 9 cross-levels, such as mountains-seedling stage, hills-vigorous growth stage, etc. For each cross-level, the standardized environmental data, planting management data and the corresponding profile level feature vector set output by the first level are fused to construct the feature dataset Zq of each cross-level, where q is the cross-level category number, q=1,2,…,9. The dimension of each cross-level feature dataset Zq is s×t, where s is the number of samples in the cross-level and t is the total number of fused features in the cross-level.
[0091] S222: Random Forest Model Training: Using the feature dataset Zq of each cross-level as input and the actual soil fertility level of the corresponding cross-level (consistent with the labels in step S3, divided into excellent, good, medium, poor, and very poor) as output labels, train the random forest model. Set the number of decision trees to 100, and select the split features of each decision tree by random sampling, with a sampling ratio equal to the total number of features. t 1 / 2 The decision tree depth is set to 10-15 layers to avoid overfitting.
[0092] S223: Feature Importance Calculation: Based on the trained random forest model, the Gini coefficient method is used to calculate the importance weight of each feature in the feature dataset at each cross-level. (Single feature...) f Importance weight G ( f The calculation formula is:
[0093] G ( f )=Σ tree∈T [Δ Gini tree (f )] / | T |;
[0094] in, T Let be the set of decision trees in a random forest, | T | represents the number of decision trees, Δ Gini tree ( f ) is a single decision tree through features f The decrease in the Gini coefficient after splitting;
[0095] Δ Gini tree ( f )= Gini before -Σ v ∈ V ( n v / n )· Gini v ;
[0096] in, Gini before Features f The Gini coefficient of the node before splitting. V Features f The set of child nodes after splitting n v child node v The number of samples, n This represents the total number of samples in the parent node. Gini v child node v The Gini coefficient, the basic formula for the Gini coefficient is: Gini= 1 - Σ i=1 5 P i 2 , P i For the first i The percentage of samples in nodes of the fertility level.
[0097] S224: Feature Selection and Vector Construction: Weight all features in each cross-level feature dataset according to their importance. G ( f Sort the features in descending order and select the top 30% by weight as the key features of the cross-level, removing redundant features. Then, concatenate and integrate the key features of the nine cross-levels according to the cross-level category order to construct a cross-level feature vector with uniform dimensions. F 2. Ensure that the vector dimension is compatible with the feature vectors of subsequent collaborative layers.
[0098] In step S2, the third level targets the environment-management collaboration layer. The mutual information entropy method is used to calculate the collaborative correlation features between environmental data and planting management data, resulting in a collaboration-level feature vector. The profile-level feature vector, the cross-level feature vector, and the collaboration-level feature vector are then fused using an attention mechanism. Dynamic weights are assigned to each level of features, and these weights can be adaptively adjusted based on the feature's contribution to fertility. The specific process for outputting the fused feature set is as follows:
[0099] S231: Collaborative Dataset Partitioning: From the standardized multi-level dataset in step S1, extract the environmental data subset E (containing three indicators: temperature, precipitation, and sunshine duration) and the planting management data subset M (containing three indicators: fertilizer type, fertilizer amount, and irrigation frequency). Construct one-to-one corresponding collaborative data pairs {( E k ,M k |k=1,2,…, m}, m The total number of samples.
[0100] S232: Mutual Information Entropy Calculation: Based on the information theory mutual information formula, calculate the entropy of each index in the environmental data subset E. eᵢ Each indicator in the subset M of planting management data m j mutual information value I ( e i ,m j The formula is:
[0101] I ( e i ,m j )=Σ e∈Ei Σ m∈Mj P ( e,m )· log 2[ P ( e,m ) / ( P ( e )·P( m ))];
[0102] in, P ( e,m ) as an indicator e i and m j The joint probability distribution, P ( e ) as an indicator ei Marginal probability distribution, P ( m ) as an indicator m j The marginal probability distribution.
[0103] Simultaneously calculate the information entropy of each indicator. H ( e i ), H( m j The formulas are as follows:
[0104] H( e i )=-Σ e∈Ei P ( e )· log 2 P ( e );
[0105] H ( m j )=-Σ m∈Mj P ( m )· log 2 P ( m ).
[0106] S233: Collaborative Feature Screening: Calculating Collaborative Association Degree R ( e i ,m j )= I ( e i ,m j ) / [ H ( e i )· H ( m j )] 1 / 2 The correlation score ranges from [0,1], with values closer to 1 indicating a stronger synergistic correlation between the two indicators; a correlation threshold is set. R 0 = 0.5, filter out R ( e i ,m j )≥ R 0 The collaborative index pairs, each of which generates one collaborative feature through a product operation, i.e. f协同 = e i ×m j .
[0107] S234: Collaborative Vector Construction: Standardize all generated collaborative features, normalize them to the [0,1] interval, and arrange them in a fixed order according to the environment-management indicator pairs to construct a collaborative hierarchical feature vector. F 3. Its dimensions and profile-level feature vectors F 1. Cross-level feature vectors F 2. Maintain consistency.
[0108] The specific process of obtaining the fused feature set through attention mechanism fusion is as follows:
[0109] Construct an attention weight function and calculate dynamic weights by combining the contribution index of feature vectors at each level. The formula is as follows:
[0110] a=ω·η 1 + ( 1-h ) ·i 1;
[0111] β=ω·η 2+(1- oh )· i 2;
[0112] γ=ω·η 3+(1- oh )· i 3;
[0113] In the formula oh An adaptive balance coefficient of 0.4-0.6. or 1 is F The cumulative value of PCA variance contribution rate of 1 or 2 is F The mean importance of features in a random forest is 2. or 3 is F The mean degree of collaborative association of 3, i 1 、the 2 、the 3 represents the contribution rate of the confusion matrix of each feature vector individually input into the model in step S3; α, β, and γ are normalized to satisfy... a+b+c =1; The fused feature set F is obtained through linear weighted fusion, as shown in the following formula:
[0114] F = α·F1 + β·F2 + γ·F3;
[0115] The weights are adaptively adjusted according to the sample data, strengthening the dominant role of core features in fertility assessment, and finally outputting a fused feature set.
[0116] Example 3
[0117] Based on Example 1 or Example 2, see Figure 3 The soil fertility assessment model includes a CNN module, an LSTM module, and a classification output module. The attention mechanism is embedded in the fully connected layer of the CNN-LSTM model, and the modules are connected in series.
[0118] The CNN module is used to extract spatial correlation features from the fused feature set, that is, the spatial distribution pattern of soil fertility in different levels and regions.
[0119] The LSTM module is used to capture temporal correlation features in the fusion feature set, that is, the dynamic change pattern of soil fertility during the planting cycle.
[0120] An attention mechanism embedded in the fully connected layer of a CNN-LSTM model is used to enhance the role of key features in fertility level assessment.
[0121] In this embodiment, the CNN module adopts an alternating structure of 3 convolutional layers (Conv1d) and 2 max pooling layers (MaxPool1d), and the input is the 3D feature tensor reshaped by the fused feature set F. F in (dimension is) batch size × feature dim ×1, where batch size For the batch sample size, feature dim (To fuse feature dimensions); the convolutional layer kernel size is set to 3×3, and the convolution operation formula is:
[0122] Conv( F in )=Σ k=1 ksise (F in ⊗W k )+b k ;
[0123] In the formula, ⊗ represents the cross-correlation operation. W k For the first k Each convolutional kernel weight matrix b k For the corresponding bias term, k sise The number of convolutional kernels is 64 in the first layer, 128 in the second layer, and 256 in the third layer.
[0124] A max pooling layer is inserted after every two convolutional layers, with a pooling window size of 2×2. The pooling calculation formula is as follows:
[0125] Pool ( Conv out )= max { Conv_out [ i:i +2, j:j +2]}; used to compress feature dimensions, retain key spatial information, and finally output the spatial feature map of the CNN module. F cnn , dimension batch size ×( feature dim / 4)×256.
[0126] LSTM temporal feature capture module: receives the output of the CNN module. F cnn Dimensionally converted to time-series input format ( batch size ×( feature dim (4)×256), with 2 hidden layers, each with 64 neurons; the LSTM module uses forget gate, input gate, and output gate to remember and update temporal information. The core operation formula is:
[0127] Forgotten Gate: f t = s ( W f ·[ h t-1 ,x t ]+ b f )
[0128] Input Gate: i t =s ( W i ·[ h t-1 ,x t ] +b i )
[0129] Candidate memory states: Yes t =tanh ( W C ·[ h t-1 ,xt ]+ b C )
[0130] Memory state update: C t = f t ⊗ C t-1 +i t ⊗ Yes t ;
[0131] Output gate: o t = s ( W o ·[ h t-1 ,x t ]+ b o );
[0132] Hidden state output: h t = o t ⊗ tanh ( C t );
[0133] In the formula s It is the sigmoid activation function. tanh The hyperbolic tangent activation function is used. W f 、W i 、W C 、W o These are the weight matrices for each major category. b f 、b i 、b C 、b o For the corresponding bias term, h t-1 This is the hidden state from the previous moment. x t Input features for the current time step. C t This serves as the memory state at the current time step; to suppress overfitting, a Dropout layer is added after each LSTM hidden layer. Dropout The coefficients are set to 0.3, and the final output is the LSTM temporal feature vector. Flstm , dimension batch size ×64.
[0134] Attention enhancement mechanism: Embedded in the fully connected layer of the model, to F lstm Using this as input, attention weights are calculated for each temporal feature to enhance the contribution of key features to the ranking assessment; the weight calculation employs... softmax Normalization, the formula is: a t = exp ( s ( W a · h t + b a )) / Σ t=1 T exp (s(W a · h t + b a ));
[0135] In the formula s For the sigmoid function, W a , b a For attention layer parameters, T For timing step size, a t Let be the attention weights for the t-th temporal feature; obtain the attention-enhanced feature by weighted summation. F att =Σ t=1 T a t · h t ;
[0136] Classification output module: Set up 2 fully connected layers (FC), the first layer input is F att The output dimension is 32, and the ReLU activation function is used (ReLU( x )= max (0, x The second layer output dimension is 5 (corresponding to 5 levels of soil fertility: excellent, good, medium, poor, and very poor). It uses the softmax activation function to output the probability distribution P=[p1,p2,p3,p4,p5] for each level, satisfying Σ i=1 5 pi =1, the level corresponding to the maximum probability is the model prediction level.
[0137] Model Training and Validation: The standardized multi-level dataset preprocessed in step S1 was used and divided into training, validation, and test sets in a 7:2:1 ratio. The training set was used for iterative updates of model parameters, the validation set for hyperparameter tuning, and the test set for final performance evaluation. Soil fertility level was used as the label (converted to a 5-dimensional vector using one-hot encoding), and the cross-entropy loss function was selected as the training objective function, with the following formula:
[0138] Loss =-Σ i=1 5 y i ·log( p i );
[0139] In the formula y i The actual value of the label (0 or 1). p i Predict probabilities for the model;
[0140] The Adam optimizer is used to optimize the loss function. The initial learning rate is set to 0.001, and the learning rate is adjusted using a learning rate decay strategy (decaying to 0.8 times the original value every 10 iterations). The number of iterations is set to 50-100, and the batch size is (…). batch size Set it to 32.
[0141] Example 4
[0142] Based on Example 1, Example 2, or Example 3, the specific process of step S4 is as follows:
[0143] S41: Real-time Multi-level Data Acquisition and Preprocessing: Following the sampling rules in step S1, real-time sampling is performed on the tobacco-growing area, dividing it into topographical levels (mountains, hills, plains), soil profile levels (top layer 0-20cm, middle layer 20-40cm, deep layer 40-60cm), and planting cycle levels (seedling stage, vigorous growth stage, maturity stage). Soil samples, environmental data (temperature, precipitation, sunshine duration), and planting management data (fertilizer type, fertilizer amount, irrigation frequency) are collected for each corresponding level. Soil samples are air-dried, ground, and sieved. Soil physical, chemical, and biological indicators are detected to obtain real-time soil fertility data. Outliers are removed using the 3σ criterion from step S1, missing values are filled using interpolation based on hierarchical similarity, and the data is normalized to the [0,1] interval to complete standardization processing, outputting a real-time multi-level dataset.
[0144] S42: Real-time fusion feature set generation: The real-time multi-level dataset is input into the three-level feature extraction model of step S2. The model sequentially extracts the profile-level feature vector F1 using PCA, the terrain-planting cycle cross-level feature vector F2 using random forest, and the environment-management collaboration-level feature vector F3 using mutual information entropy. These features are then weighted and fused using an attention mechanism to calculate the real-time fusion feature set F. 实 At that time, the fusion formula follows the dynamic weighting formula from step S2:
[0145] F 实时 =α·F1+β·F2+γ·F3;
[0146] Where α, β, and γ are weights that are adaptively adjusted based on the contribution of real-time data features, and satisfy α+β+γ=1.
[0147] S43: Real-time Soil Fertility Level Assessment: [This will...] F 实时 Input the CNN-LSTM evaluation model trained in step S3, and the model outputs the probability distribution of real-time soil fertility levels:
[0148] P 实时 =[p1,p2,p3,p4,p5], which represent the probability values for five levels: Excellent, Good, Medium, Poor, and Very Poor, respectively. The level corresponding to the highest probability value is selected as the real-time fertilizer level. L 实时 The determination formula is:
[0149] L 实时 = argmax (P 实时 )= argmax ([p1,p2,p3,p4,p5]);
[0150] S44: Dual-threshold early warning mechanism judgment: Set the soil fertility level "poor" as the first-level early warning threshold T1 and "extremely poor" as the second-level early warning threshold T2. The early warning judgment is performed based on the real-time soil fertility level. The judgment logic formula is as follows:
[0151] like L 实时 =Poor performance → Triggers Level 1 warning;
[0152] like L 实时 =Extreme difference → Triggers Level 2 warning;
[0153] like L 实时 ∈{Excellent, Good, Average} → No warning.
[0154] The specific process for generating the hierarchical feedback adjustment scheme in step S5 is as follows:
[0155] Level 1 Early Warning Feedback Adjustment: Combining the environmental-management synergy-level feature vector F3 extracted in step S2, analyze the synergistic correlation between environmental data (precipitation, sunshine duration) and planting management data (fertilizer application rate, fertilizer type); use multiple regression analysis to determine the optimal nitrogen, phosphorus, and potassium fertilizer ratio, the ratio formula is:
[0156] N:P:K=1:(0.3~0.5):(0.8~1.2);
[0157] When the soil organic matter content is below 2%, the amount of micronutrient supplementation is increased by 20%; at the same time, the irrigation frequency is adjusted, and the irrigation amount is dynamically matched based on real-time precipitation data to ensure that the soil moisture content is maintained in the suitable range for tobacco planting (20%~25%).
[0158] Level II Early Warning Feedback Adjustment: Based on the Level I early warning fertilization and irrigation adjustment plan, soil improvement measures are added; based on the soil physical indicators (particle size distribution, bulk density) detected in step S1, soil porosity is calculated, and the porosity formula is: Por =(1- Bd / Dp )×100%, where Bd For soil bulk density, Dp The soil particle density is determined; organic amendments (such as decomposed straw and organic fertilizer) are added based on the porosity results. When the porosity is less than 45%, the amount of amendment added should not be less than 5% of the dry weight of the soil to improve soil structure and enhance fertility. After the adjusted management measures are implemented, data are collected again and fertility is evaluated according to the process of steps S1-S3 to provide feedback data for the model iteration optimization in step S6.
[0159] The specific process of step S6 is as follows:
[0160] S61: Feedback Dataset Construction: After the graded adjustment scheme in step S4 is completed (three sampling verifications within a single planting cycle: seedling stage, vigorous growth stage, and maturity stage), according to the sampling and preprocessing standards in step S1, soil samples, environmental data, and planting management data at each level are collected again. After outlier removal, missing value imputation, and normalization, the original feedback dataset is obtained. Then, according to the three-level feature extraction and fusion method in step S2, the feedback fused feature set is generated. F 反馈 Finally, the CNN-LSTM model in step S3 is used to obtain the feedback fertility level assessment results. L 反馈 and corresponding probability distribution P 反馈 Construct a complete feedback dataset:
[0161] D 反馈 ={( F 反馈 ,L 反馈 , P 反馈 )}.
[0162] S62: Dynamic adjustment of model parameters: adjusting the feedback dataset D 反馈 The training set is mixed with the original training set from step S3 at a ratio of 1:4 to form the iterative training set. D 迭代 Using the same model structure, loss function, and optimizer as in step S3, perform incremental training to adjust the parameters. The core adjustment logic is as follows:
[0163] Parameter update formula: The momentum gradient descent method is used to optimize the model weight parameters. W The updated formula is:
[0164] W n+1 = W n - m · ( W n )+ n ·( W n -W n-1 );
[0165] In the formula, m The learning rate is set to 0.0005, which is lower than the initial training learning rate to avoid parameter oscillation. (W n ) represents the loss gradient for the current parameters. n The momentum coefficient is taken as 0.9. W n , W n-1 These are the parameter values for the current and previous iterations, respectively; bias term. b Synchronous Press b n+1 = b n - m; ( b n )Adjustment.
[0166] Performance Evaluation and Termination Criteria: After each iteration, the model performance is evaluated using the root mean square error (RMSE) and mean absolute error (MAE), calculated as follows:
[0167] RMSE=[(1 / N )·Σ k=1 N (L 预测k - L 真实k )²] 1 / 2 ;
[0168] MAE=(1 / N )·Σ k=1 N | L 预测k - L 真实k |;
[0169] In the formula, N is the sample size of the feedback dataset. L 预测k The predicted grade after model iteration (quantified as 1-5 points, Excellent=5, Good=4, Average=3, Poor=2, Extremely Poor=1). L 真实k This is the quantitative value of the measured fertility level;
[0170] When RMSE≤0.05 and MAE≤0.03, stop parameter adjustment; otherwise, repeat the incremental training process. The iteration cycle is one complete planting cycle.
[0171] S63: Adaptive Calibration of Early Warning Thresholds: Based on the output of the iterated model and combined with the fertility level distribution of the feedback dataset, the primary and secondary early warning thresholds are calibrated to ensure a balance between early warning sensitivity and accuracy.
[0172] Threshold calibration is based on the calculated prediction accuracy of the model for the "poor" and "range" levels after iteration. A cc1 , A cc2 ;
[0173] A cc1 = (Number of samples that were predicted as poor and were actually measured as poor) / Total number of samples that were actually measured as poor;
[0174] A cc2 = (Number of samples predicted as the range and actually measured as the range) / Total number of samples actually measured as the range.
[0175] Dynamic calibration rules: If A cc1 If the probability is less than 88%, the probability threshold corresponding to the first-level warning threshold will be lowered by 5%. That is, when the probability of the model outputting the "poor" level is greater than or equal to the original threshold minus 5%, the first-level warning will be triggered.
[0176] like A cc2 If the probability is less than 88%, the probability threshold corresponding to the Level 2 warning threshold will be lowered by 5%; if Acc1 、A cc2 If all are ≥92%, the corresponding threshold will be increased by 3% to reduce the false alarm rate; after the threshold is adjusted, the probability of the first-level warning threshold must be lower than that of the second-level warning threshold, and both must be within the range of [30%, 70%].
[0177] Consolidation and application of iteration results: After parameter adjustment and threshold calibration, the current model parameters and early warning thresholds are consolidated as the basis model for the next round of tobacco soil fertility monitoring and early warning; at the same time, parameter changes, threshold adjustment range and performance improvement data during the iteration process are recorded to form an iteration log, which provides a reference for subsequent optimization.
[0178] Example 5
[0179] This embodiment uses a specific scenario as an example to illustrate the monitoring and early warning process of the present invention:
[0180] Multi-level data acquisition and preprocessing:
[0181] Sampling division: The area was divided into 27 sampling units based on topographic level (300 mu of mountainous areas, 400 mu of hilly areas, and 100 mu of plains), soil profile level (top layer 0-20cm, middle layer 20-40cm, and deep layer 40-60cm), and planting cycle level (seedling stage, vigorous growth stage, and maturity stage). Each sampling unit adopted a five-point mixed sampling method, collecting 1 kg of soil sample from each point, and taking 2 kg of the mixed sample as the sample for that unit. Environmental data (temperature, precipitation, sunshine duration) and planting management data (fertilizer type: compound fertilizer + organic fertilizer, fertilizer application rate 20 kg / mu, irrigation frequency once every 7 days) were recorded simultaneously for each unit.
[0182] Sample testing: Soil samples were air-dried, ground, and sieved through a 2mm sieve. The following indicators were tested using the corresponding equipment: physical indicators (particle size distribution: sand 35%, silt 40%, clay 25%; bulk density 1.3g / cm³); chemical indicators (organic matter 1.8%, total nitrogen 1.2g / kg, available phosphorus 25mg / kg, available potassium 180mg / kg, pH 6.5); and biological indicators (microbial biomass carbon 200mg / kg, urease activity 15μmol / (g·d)). The original soil fertility data were obtained.
[0183] Data preprocessing: Two outlier samples (fertility data deviation caused by abnormal precipitation) were removed using the 3σ criterion. Three missing sample data were filled using interpolation based on hierarchical similarity. All data were normalized to the [0,1] interval, and a standardized multi-level dataset (135 samples, 28 feature dimensions) was output.
[0184] Multi-level feature extraction and fusion:
[0185] Profile-level feature extraction (PCA method): For the three soil profile levels, an index matrix X is constructed respectively. mn ( m =45, n =8), calculate the covariance matrix C 88 After eigenvalue decomposition, eight eigenvalues are obtained, with variance contribution rates of 38%, 25%, 15%, 8%, 5%, 4%, 3%, and 2%, respectively. The eigenvectors corresponding to the first three eigenvalues (cumulative contribution rate of 78%, close to 85%, due to the high correlation of sample features) are selected as principal component loading vectors. After matrix multiplication, the eigenvectors of each profile level are obtained and summarized into F1 (dimension 45×3).
[0186] Cross-level feature extraction (random forest method): The standardized dataset is combined into 9 cross-levels according to terrain-planting cycle, and a feature dataset Zq (s=15, t=11) is constructed for each cross-level. A random forest model with 100 decision trees is trained, and the split feature sampling ratio is 11. 1 / 2 ≈36%, tree depth 12 layers, feature importance is calculated by the Gini coefficient method, TOP30% (3) key features (organic matter, urease activity, precipitation) are selected, and F2 (dimension 45×3) is obtained after splicing.
[0187] Collaborative hierarchical feature extraction (mutual information entropy method): Extract environmental subset E (temperature, precipitation, sunshine duration) and management subset M (fertilizer application rate, irrigation frequency, organic fertilizer ratio), construct 135 collaborative data pairs, and calculate the mutual information value I. e i , m j ) and information entropy, collaborative correlation degree R( e i , m j The index pairs with a value ≥ 0.5 are “precipitation-irrigation frequency” and “sunshine duration-fertilizer application”, generating two collaborative features. After standardization, F3 (dimension 45×2) is obtained, which is then adjusted to 45×3 after dimension alignment.
[0188] Attention mechanism fusion: Taking ω=0.5, η1=78%, η2=0.62, η3=0.65, θ1=0.71, θ2=0.68, θ3=0.63, the weights are calculated as α=0.5×0.78+0.5×0.71=0.745, β=0.5×0.62+0.5×0.68=0.65, γ=0.5×0.65+0.5×0.63=0.64. After normalization, α=0.36, β=0.32, γ=0.32. The weighted fusion yields F=0.36F1+0.32F2+0.32F3 (dimension 45×3).
[0189] CNN-LSTM Model Training and Optimization:
[0190] Dataset partitioning: The standardized multi-level dataset was divided into a training set (95 groups), a validation set (27 groups), and a test set (13 groups) in a ratio of 7:2:1. The fertility level labels were labeled according to the actual test results (20 groups of excellent, 45 groups of good, 40 groups of medium, 18 groups of poor, and 12 groups of very poor). One-hot encoding was used to convert it into a 5-dimensional vector.
[0191] Model Training: An improved CNN-LSTM model was constructed. The CNN module (3 convolutional layers with 64 / 128 / 256 convolutional kernels and 2 max pooling layers) extracted spatial features, and the LSTM module (2 hidden layers with 64 neurons and Dropout=0.3) captured temporal features. The fully connected layers embedded an attention mechanism. The model adopted the cross-entropy loss function and the Adam optimizer (initial learning rate of 0.001, decaying to 0.8 times every 10 rounds) for 80 rounds with a batch size of 32.
[0192] Model optimization: After adjusting the hyperparameters, the test set accuracy reached 92.3%, precision 89.1%, and recall 88.5%, meeting the requirements, and the trained fertility level assessment model was obtained.
[0193] Dynamic early warning judgment:
[0194] Real-time data processing: During the peak season (mid-June), real-time sampling was conducted at the base. The dataset was preprocessed according to the S1 workflow to obtain a real-time dataset, which was then fused using the S2 feature fusion method to generate F. 实时 (Dimensions 15×3).
[0195] Real-time assessment and early warning: F 实时 Input model, output probability distribution P 实时 After argmax, the real-time fertility levels of 15 units were obtained. Among them, 3 units were "poor" (mountain surface, organic matter 1.5%), 2 units were "very poor" (hilly deep layer, organic matter 1.2%), triggering level 1 and level 2 warnings, and the remaining units did not trigger warnings.
[0196] Tiered feedback adjustment:
[0197] Level 1 Warning Adjustment: For the three "poor" grade units, based on the F3 analysis of synergistic correlation, a compound fertilizer with an N:P:K ratio of 1:0.4:1.0 is adopted. Since the organic matter content is 1.5% < 2%, the amount of micronutrient fertilizer (boron fertilizer) is increased by 20% (from 0.5 kg / mu to 0.6 kg / mu). Based on the real-time precipitation (monthly average 120 mm), the irrigation frequency is adjusted to once every 10 days to maintain the soil moisture content at 22%.
[0198] Level 2 warning adjustment: For the two "extremely poor" level units, based on the Level 1 adjustment, calculate the soil porosity Por=(1-1.3 / 2.6)×100%=50% (close to the 45% threshold), add decomposed straw amendment (5% of soil dry weight, i.e. 50kg / mu) to improve soil structure.
[0199] Iterative optimization: Feedback dataset construction: One month after the implementation of the adjusted scheme (early maturity stage), resampling and testing were performed to obtain the feedback dataset D. 反馈 (15 groups), the evaluation results were obtained through the S2-S3 process.
[0200] Model parameter adjustment: Adjust D 反馈 The model was mixed with the original training set at a 1:4 ratio and incrementally trained using momentum gradient descent (μ=0.0005, ν=0.9). After iteration, RMSE=0.042 and MAE=0.028, meeting the termination condition. Threshold calibration: After iteration, the model's prediction accuracy for "poor" and "extremely poor" levels was 90.5% and 89.2%, respectively, both ≥88% and <92%. The original warning thresholds were maintained, and the model parameters were solidified.
Claims
1. A method for monitoring and early warning of tobacco soil fertility based on multi-level data, characterized in that, Includes the following steps: S1: Soil samples were collected according to the topographic level, soil profile level and planting cycle level of the tobacco planting area. Based on the samples, the original soil fertility data was obtained. At the same time, environmental data and planting management data of the corresponding level were collected and preprocessed to obtain a standardized multi-level dataset. S2: Perform multi-level feature extraction and fusion on the standardized multi-level dataset to obtain profile-level feature vectors, cross-level feature vectors, and collaborative-level feature vectors. Then, use an attention mechanism to fuse and assign dynamic weights to the features at each level to obtain a fused feature set. S3: Construct a CNN-LSTM evaluation model, use a standardized multi-level dataset to train, validate and optimize the model, use soil fertility level as the label, and obtain the trained soil fertility level evaluation model by adjusting the model hyperparameters; S4: Input the multi-level data collected in real time and after preprocessing and feature fusion into the soil fertility level assessment model to obtain the real-time soil fertility level; construct a dual-threshold early warning mechanism based on the assessment results, setting the fertility level "poor" as the first-level early warning threshold and "extremely poor" as the second-level early warning threshold; S5: When the assessment result is a Level 1 warning, a corresponding fertilization adjustment plan is generated by combining the collaborative hierarchical feature vector; when the assessment result is a Level 2 warning, irrigation strategy optimization and soil improvement suggestions are superimposed on the fertilization adjustment plan. S6: Use the soil fertility monitoring data of the adjusted plan after implementation as feedback data, input it into the soil fertility level assessment model, dynamically adjust the model parameters and early warning thresholds, and realize the iterative optimization of the model and early warning plan; Step S2 performs three-level feature extraction based on a standardized multi-level dataset: The first level targets the soil profile layer, using principal component analysis to extract the core features of soil physical, chemical, and biological indicators at each profile layer, thus obtaining the profile layer feature vector. The second level targets the terrain-planting cycle intersection level. The random forest algorithm is used to rank the importance of the features matched between different terrain levels and planting cycle levels, and to filter out the intersection level features to obtain the intersection level feature vector. The third level targets the environment-management collaboration layer, using the mutual information entropy method to calculate the collaborative correlation features between environmental data and planting management data, thus obtaining the collaboration layer feature vector.
2. The method for monitoring and early warning of tobacco soil fertility based on multi-level data according to claim 1, characterized in that, The specific process of obtaining the profile-level feature vector in step S2 is as follows: S211: For each soil profile level including the top layer (0-20cm), middle layer (20-40cm), and deep layer (40-60cm), soil physical, chemical, and biological indicators are extracted from the standardized multi-level dataset to construct the indicator matrix for each level. S212: Calculate the covariance matrix of the index matrix; S213: Perform eigenvalue decomposition on the covariance matrix to obtain eigenvalues and corresponding eigenvectors; S214: Calculate the variance contribution rate of each eigenvalue, and select the top eigenvalues whose cumulative variance contribution rate is ≥85%. p The eigenvectors corresponding to each eigenvalue are used as principal component loading vectors; S215: Using the indicator matrix and the selected... p The principal component load vectors are used to construct a matrix product to obtain the principal component matrix of the profile level. The principal component matrix is then used as the feature vector of the profile level. By summing the feature vectors of all profile levels, the complete profile level feature vector is obtained. F 1.
3. The method for monitoring and early warning of tobacco soil fertility based on multi-level data according to claim 2, characterized in that, The specific process of obtaining the cross-level feature vector in step S2 is as follows: S221: The standardized multi-level datasets are paired and matched according to the terrain level and the planting cycle level to form 9 cross-levels. For each cross-level, the standardized environmental data, planting management data and the corresponding profile level feature vector set are integrated to construct the feature dataset of each cross-level. S222: Train a random forest model with the feature dataset of each cross-level as input and the actual soil fertility level of the corresponding cross-level as output label. Set the number of decision trees to 100, and select the splitting features of each decision tree by random sampling. Set the depth of the decision tree to 10-15 layers. S223: Feature Importance Calculation: Based on the trained random forest model, the Gini coefficient method is used to calculate the importance weight of each feature in the feature dataset at each cross level; S224: Feature Selection and Vector Construction: Sort all features in each cross-level feature dataset in descending order of importance weight, and select the top 30% of features by weight as the key features for that cross-level; concatenate and integrate the key features of the 9 cross-levels according to the cross-level category order to construct a cross-level feature vector with uniform dimension. F 2.
4. The method for monitoring and early warning of tobacco soil fertility based on multi-level data according to claim 3, characterized in that, The specific process of obtaining the collaborative layer feature vector in step S2 is as follows: S231: From the standardized multi-level dataset, extract the environmental data subset E and the planting management data subset M, and construct a one-to-one corresponding collaborative data pair {( E k ,M k |k=1,2,…, m }, m The total number of samples; S232: Calculate each indicator in the environmental data subset E based on the mutual information formula of information theory. eᵢ Each indicator in the subset M of planting management data m j mutual information value I ( e i ,m j and the information entropy of each indicator itself. H ( e i ), H( m j ); S233: Calculate the degree of collaborative association R ( e i ,m j )= I ( eᵢ,m j ) / [ H ( e i )· H ( m j )] 1 / 2 Set the correlation threshold R 0 Filter out R ( eᵢ,m j For each pair of collaborative indices ≥ R0, one collaborative feature is generated by multiplication. S234: Standardize all generated collaborative features, arrange them in a fixed order according to the environment-management indicator pairs, and construct a collaborative hierarchical feature vector. F 3.
5. The method for monitoring and early warning of tobacco soil fertility based on multi-level data according to claim 4, characterized in that, The specific process of obtaining the fused feature set through attention mechanism fusion is as follows: S241: Construct an attention weight function and calculate dynamic weights α, β, and γ by combining the contribution index of feature vectors at each level; S242: The fused feature set F is obtained through linear weighted fusion, as shown in the following formula: F = α·F1 + β·F2 + γ·F3.
6. The method for monitoring and early warning of tobacco soil fertility based on multi-level data according to claim 1, characterized in that, The soil fertility assessment model includes a CNN module, an LSTM module, and a classification output module. These modules are connected in series, and an attention mechanism is embedded in the fully connected layer of the CNN-LSTM model. The CNN module is used to extract spatial correlation features from the fused feature set; The LSTM module is used to capture temporal correlation features in the fused feature set; An attention mechanism is embedded in the fully connected layer of the CNN-LSTM model.
7. The method for monitoring and early warning of tobacco soil fertility based on multi-level data according to claim 6, characterized in that, The CNN module employs an alternating structure of 3 convolutional layers and 2 max-pooling layers, with the input being a 3D feature tensor reshaped from the fused feature set F. F in The kernel size of the convolutional layer is set to 3×3. Every two convolutional layers are followed by a max pooling layer with a 2×2 window size. This pooling window is used to compress feature dimensions and preserve key spatial information, ultimately outputting the spatial feature map of the CNN module. F cnn ; LSTM module: Receives the output of the CNN module. F cnn The input is converted to a temporal format, and two hidden layers are set, with 64 neurons in each layer. The LSTM module realizes the memory and update of temporal information through forget gate, input gate, and output gate, and finally outputs the LSTM temporal feature vector. F lstm ; Attention enhancement mechanisms: F lstm Using this as input, attention weights are calculated for each temporal feature to enhance the contribution of key features to the ranking assessment; the weight calculation employs... softmax Normalization; Classification output module: Set up 2 fully connected layers, the first layer input is F att The first layer has an output dimension of 32 and uses the ReLU activation function; the second layer has an output dimension of 5, corresponding to 5 levels of soil fertility, and uses the softmax activation function. The output probability distribution P=[p1,p2,p3,p4,p5] for each level satisfies Σ i=1 5 p i =1, the level corresponding to the maximum probability is the model prediction level.
8. The method for monitoring and early warning of tobacco soil fertility based on multi-level data according to claim 1, characterized in that, The specific process of step S4 is as follows: S41: Real-time sampling is performed on the tobacco-growing area to be monitored, and the terrain, soil profile and planting cycle are divided into levels. Real-time soil fertility, environmental and planting management data of the corresponding levels are collected, preprocessed and output as real-time multi-level datasets. S42: Based on a real-time multi-level dataset, the following methods are used to extract the profile-level feature vector F1 using PCA, the terrain-planting cycle cross-level feature vector F2 using random forest, and the environment-management collaboration-level feature vector F3 using mutual information entropy. These features are then weighted and fused using an attention mechanism to calculate the real-time fused feature set F. 实时 ; S43: Will F 实时 Input the trained CNN-LSTM evaluation model, and output the probability distribution of real-time soil fertility levels: P 实时 =[p1,p2,p3,p4,p5], which correspond to the probability values of five levels: excellent, good, average, poor, and very poor, respectively; The level corresponding to the highest probability is selected as the real-time fertility level. L 实时 ; S44: Dual threshold early warning mechanism judgment: Set the fertility level "poor" as the first-level early warning threshold T1 and "extremely poor" as the second-level early warning threshold T2, and perform early warning judgment based on the real-time fertility level.
9. The method for monitoring and early warning of tobacco soil fertility based on multi-level data according to claim 1, characterized in that, The specific process for generating the hierarchical feedback adjustment scheme in step S5 is as follows: Level 1 early warning feedback adjustment: Combining the F3 feature vector of the environment-management synergy hierarchy, analyze the synergistic correlation between environmental data and planting management data; use multiple regression analysis to determine the optimal nitrogen, phosphorus and potassium fertilizer ratio; When the soil organic matter content is below 2%, the amount of micronutrient supplementation is increased by 20%; at the same time, the irrigation frequency is adjusted, and the irrigation amount is dynamically matched based on real-time precipitation data to ensure that the soil moisture content is maintained within the suitable range for tobacco planting. Level II Early Warning Feedback Adjustment: Based on the Level I Early Warning Fertilization and Irrigation Adjustment Plan, soil improvement measures are added: Based on the detected soil physical indicators, soil porosity is calculated. When the porosity is less than 45%, the amount of soil amendment added should not be less than 5% of the dry weight of the soil to improve soil structure and enhance fertility. After the adjusted management measures are implemented, data are collected again and fertility is assessed according to the process of steps S1-S3.
10. The method for monitoring and early warning of tobacco soil fertility based on multi-level data according to claim 9, characterized in that, The specific process of step S6 is as follows: S61: After the hierarchical feedback adjustment plan is completed, re-collect soil samples, environmental data, and planting management data at each level to obtain the original feedback dataset. Then, perform feature extraction and fusion to generate a feedback fusion feature set. F 反馈 The fertility level assessment results were obtained using a CNN-LSTM model. L 反馈 and corresponding probability distribution P 反馈 Build a complete feedback dataset D 反馈 ; S 62: Feedback dataset D 反馈 The original training set from step S3 is mixed with the training set from step S3 in a specified ratio to form the iterative training set. D 迭代 Incremental training was performed on the model to adjust the parameters. S63: Based on the output of the iterated model and the fertility level distribution of the feedback dataset, calibrate the first and second warning thresholds.
Citation Information
Patent Citations
Method for improving tobacco-planting soil by using biochar
AU2020101609A4
Server for forecasting agricultural supply demand and method agricultural for harvesting optimal location analysis
KR102175904B1