Rice spectral stress index construction method, system, device and storage medium
By combining generative adversarial networks and random forest models, the problems of inaccurate feature band selection and insufficient fusion of multi-band information in rice stress diagnosis are solved, and accurate diagnosis and efficient identification of rice stress are achieved.
Patent Information
- Application Number
- CN202510013320.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2045-01-06
AI Technical Summary
Existing technologies for diagnosing stress in rice suffer from inaccurate selection of characteristic bands, insufficient fusion of multi-band information, and a lack of specificity in vegetation indices, resulting in low accuracy and reliability of stress analysis.
Generative adversarial networks were used for feature band selection and multi-band information fusion. Rice leaf spectral data were acquired using a portable hyperspectral camera. Feature bands were extracted from the hyperspectral data using a generator and a discriminator. A stress index was constructed by combining a random forest model, and the band weights were optimized to improve the sensitivity and specificity of stress diagnosis.
It enables accurate diagnosis of stress in rice, improves the accuracy of feature band extraction and the efficiency of multi-band information fusion, enhances the ability to identify stress types, and meets the needs of refined stress diagnosis.
Smart Images

Figure CN119478703B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of rice stress classification technology, specifically involving the method, system, equipment and storage medium for constructing rice spectral stress index. Background Technology
[0002] Rice is subjected to various biotic and abiotic stresses during its growth, such as drought, fertilizer burn, and disease stress, which may affect its yield and quality. These stresses have different mechanisms and manifestations, and in actual field management, the symptoms of different stresses are often difficult to distinguish. Therefore, accurate analysis of the stress factors on rice is of great significance in actual planting and production.
[0003] Traditional methods for diagnosing rice stress can be categorized into field observation, laboratory testing, or fixed-band vegetation index calculation. Field observation relies heavily on experienced agricultural technicians to observe and assess rice plants. However, this method is highly subjective and easily influenced by inconsistencies in the observer's experience and judgment criteria, leading to diagnostic biases. Furthermore, it struggles to detect subtle changes in mild stress or early stages of stress, often only making a diagnosis after symptoms appear, potentially missing the optimal intervention window. While laboratory testing (such as PCR diagnosis) provides accurate results, its complex procedures, typically requiring sample collection and a series of chemical treatments, are time-consuming, labor-intensive, and require expensive specialized equipment and technical personnel. Moreover, the destructive sampling required for laboratory testing prevents continuous monitoring of the same plant, limiting its application in stress tracking studies. In field settings, vegetation indices are commonly used to assess the health of rice under stress conditions. These include the Normalized Difference Vegetation Index (NDVI), calculated from the reflectance of red and near-infrared wavelengths, which is frequently used to monitor vegetation distribution, changes, and health status. The Ratio Vegetation Stress Index (RVSI), on the other hand, assesses the degree of vegetation stress by comparing the reflectance of red and near-infrared wavelengths; higher values often indicate water stress or disease infection. While vegetation indices such as NDVI and RVSI can reflect the overall health of plants, they use a limited number of wavelengths and have weak correlations with the spectral response of rice under different stresses, making it difficult to distinguish the types of stress experienced.
[0004] In recent years, models trained on RGB images have made progress in rice stress analysis. However, relying solely on RGB images is insufficient for in-depth analysis of the specific stress causes affecting rice health, which remains a major challenge in current research and practical applications. RGB images provide limited stress information, confined to the leaf surface, while hyperspectral images offer rich spectral information, enabling the acquisition of information beyond the leaf surface, such as changes in the content of substances within the leaf. Hyperspectral images can capture subtle spectral characteristics of rice leaves under different stresses, facilitating the discovery of sensitive bands under different stresses and achieving more accurate stress analysis.
[0005] Current methods for extracting characteristic bands of rice leaves under different stresses and constructing stress indices still have some shortcomings, mainly including the following aspects:
[0006] 1. Inaccurate selection of characteristic bands: Traditional methods for extracting characteristic bands for rice diseases typically rely on general vegetation indices or existing experience, lacking comprehensive analysis of rice spectral data under different stresses. This results in the extracted characteristic bands failing to accurately characterize the typical spectral features of rice under different stresses, thus affecting the accuracy of the analysis.
[0007] 2. Lack of multi-band information fusion: The spectral response of rice involves multiple sensitive bands, and indices calculated based on a small number of bands cannot fully reflect the stress status of rice. Furthermore, existing methods have limited effectiveness in fusing multi-band information, failing to fully exploit the correlations between bands in hyperspectral images of diseases through techniques such as deep learning, thus limiting the reliability of stress analysis.
[0008] Existing vegetation indices lack specificity and cannot accurately reflect the stress characteristics of rice: Current vegetation indices are mostly based on general indicators and fail to fully incorporate the unique spectral response characteristics of rice under different stresses. When identifying stress categories, the vegetation indices have low specificity and sensitivity and cannot be directly applied. Summary of the Invention
[0009] In view of the above-mentioned problems, the present invention is proposed.
[0010] Therefore, the technical problem solved by this invention is to improve the accuracy of feature band selection. This patent implements a data-driven feature band selection method through generative adversarial networks (GANs). GANs can automatically learn and extract characteristic spectral bands of rice under different stresses from a large amount of hyperspectral data, effectively solving the problem of insufficient extraction accuracy caused by reliance on experience or general vegetation indices in traditional methods. This method can accurately capture the key spectral change characteristics of rice under disease stress, laying a solid foundation for the construction of stress indices.
[0011] To achieve efficient fusion of multi-band information, this invention addresses the problem of insufficient multi-band information fusion in existing methods, which involve multiple sensitive bands in the spectral response of rice under stress. A multi-band fusion strategy based on generative adversarial networks (GANs) is proposed. The generator extracts and fuses information from multiple sensitive bands in hyperspectral data, while a discriminator evaluates the effectiveness of the fused features. This enables dynamic mining and optimization of potential correlations between bands, overcoming the limitations of low band utilization and incomplete information representation in traditional methods. The generated features comprehensively reflect the spectral response characteristics of rice under stresses such as drought, fertilizer damage, and disease, improving the sensitivity and specificity of stress indices and the accuracy and reliability of stress diagnosis.
[0012] This invention develops a more targeted rice stress index. Based on accurate extraction of characteristic bands and fusion of multi-band information, it optimizes the band weights in the generative adversarial network (GAN) and selects the top five bands with the best effect on the stress index, thus obtaining the key bands and band coefficients of the stress index. Through the optimization and iteration of the GAN, the final stress index can comprehensively reflect the response and changes of rice under various stresses, with higher sensitivity and specificity. It can effectively distinguish stress types such as drought, fertilizer damage, and disease, meeting the needs of refined stress diagnosis.
[0013] To address the aforementioned technical problems, this invention provides the following technical solution: a method for constructing a rice spectral stress index, comprising: periodically photographing rice leaves of different groups in the field using a portable hyperspectral camera to obtain original hyperspectral images; performing black-and-white correction on the original hyperspectral images to obtain corrected hyperspectral images; extracting regions of interest from rice leaves under different stresses and calculating average spectral data; processing the average spectral data using an SG smoothing filter; extracting the 50 feature bands with the highest contribution using a generative adversarial network; inputting the average spectral data corresponding to the feature bands as input data into a random forest classification model to obtain the model classification results; simultaneously selecting the top 5 feature bands and their corresponding weights to construct a spectral index, obtaining a stress index to classify stress categories; determining the leaf group based on the model classification results and stress categories, and outputting the stress cause of the rice.
[0014] As a preferred embodiment of the rice spectral stress index construction method of the present invention, the original hyperspectral image includes,
[0015] A portable hyperspectral camera was used, natural sunlight was used as the light source, and a whiteboard with a fixed reflectance of 0.9 was used as a reference.
[0016] Spectral information of rice leaves was obtained through live photography.
[0017] The illumination signal of the hyperspectral camera is dynamically adjusted to maintain it at 3000-4000.
[0018] Data collection was conducted in the field environment, with regular photography of rice leaves in the experimental rice fields under conditions of healthy rice, drought stress, fertilizer stress, and disease stress.
[0019] Record hyperspectral image data of rice leaves under different stresses;
[0020] Rice leaf parts with obvious disease reactions in the groups were selected as typical samples.
[0021] The obtained hyperspectral image has a resolution of 1920×1920.
[0022] As a preferred embodiment of the rice spectral stress index construction method of the present invention, wherein: the black-and-white correction includes,
[0023] The hyperspectral image was corrected using a black-and-white correction method to obtain the corrected hyperspectral image;
[0024] Calculate the reflectance value of the image after black and white correction. :
[0025] ,
[0026] in, The original image reflectance value to be corrected. The reflectance value is obtained by scanning a standard reference whiteboard. This is the blackboard reflectivity value obtained after covering the lens cap.
[0027] As a preferred embodiment of the rice spectral stress index construction method of the present invention, wherein: the extraction of the region of interest includes,
[0028] The ENVI software was used to screen the corrected hyperspectral image data to identify the regions most significantly correlated with stress factors and define them as regions of interest.
[0029] When rice leaves are subjected to drought stress, fertilizer stress, or disease stress, the size of the region of interest is set to 50×50 pixels, and the average spectral data of each region is extracted.
[0030] Based on the shooting time and the actual observed stress symptoms, n ROIs were marked to obtain the average spectral data records of rice leaves under n specific stresses;
[0031] When the rice leaves are healthy, the regions of interest are randomly sampled using the five-point method, and n ROIs are labeled and the corresponding average spectral data are extracted.
[0032] As a preferred embodiment of the rice spectral stress index construction method of the present invention, the generative adversarial network includes:
[0033] Generator, discriminator;
[0034] The generator includes a fully connected layer, a batch normalization layer, a random deactivation layer, and a CBAM module;
[0035] The generator's initial input consists of some real data and random noise vectors. After passing through the first fully connected network, the features are expanded to 512 dimensions. After batch normalization and random deactivation with a ratio of 0.3, the features are further expanded to 1024 dimensions by the second fully connected network. Batch normalization and random deactivation are performed again. The features are further expanded to 2048 dimensions by the third fully connected network, and batch normalization and random deactivation are performed again.
[0036] The features are reshaped into a three-dimensional tensor of shape (16, 16, 8), and the spatial and channel attention of the features are optimized through the CBAM module. The features are converted into one-dimensional vectors through the Flatten layer, and a 306-dimensional output vector is generated through the fully connected layer to represent the reflectance band values of the target hyperspectral data.
[0037] The discriminator employs a 3D convolutional network combined with an attention mechanism to judge the input data;
[0038] The input data is reshaped into a three-dimensional data block, and three-dimensional spatial features are extracted through two sets of 3D convolutional layers and 3D max pooling layers.
[0039] The first group of 3D convolutional layers contains 32 filters, and the second group of 3D convolutional layers contains 64 filters, both with a kernel size of (3, 3, 3).
[0040] After enhancing the perceptual ability of feature weights through the CBAM module, the data passes through two sets of 2D convolutional layers and 2D max pooling layers. After the second set of convolutions, the CBAM module is introduced again to strengthen the attention of features, and an inactivation layer is added. The data is then flattened and fed into a fully connected layer for feature integration, and the discrimination result is output.
[0041] As a preferred embodiment of the rice spectral stress index construction method of the present invention, wherein: the extraction of the 50 feature bands with the highest contribution includes,
[0042] By analyzing the activation maps of the discriminator in different convolutional layers and combining the gradients of the convolutional layer weights, the sensitivity of the convolutional kernel to different bands is located, and the selected feature bands and their corresponding weights are extracted.
[0043] After obtaining the feature weights in the convolutional layer, the bands with high weight values are selected, and then the sensitive bands with the strongest correlation with drought stress, fertilizer stress, and disease stress are selected again.
[0044] By sorting and filtering the weights of the sensitive feature bands output by the convolutional layer, the top 50 most contributing bands in the 400nm to 1200nm band range are determined, and the spectral reflectance data corresponding to the current 50 bands are retained as the input of the model.
[0045] As a preferred embodiment of the rice spectral stress index construction method described in this invention, the model classification results include:
[0046] The dataset after feature band filtering is used as input to the random forest model. The average spectral dataset is labeled according to different stress groups, including 0 for healthy, 1 for drought stress, 2 for fertilizer stress, and 3 for disease stress.
[0047] The random forest model includes a training phase and a prediction phase;
[0048] The training phase includes random forest randomly sampling from the training dataset using the Bagging method to generate m data subsets containing partial samples;
[0049] Build a decision tree on each subset, and randomly select a subset of features to split during the node partitioning process of each tree;
[0050] The prediction phase includes using random forests to predict test samples using all constructed decision trees, and determining the final category result through majority voting.
[0051] The output of the random forest model is represented as:
[0052] ,
[0053] in, For the final prediction result, The total number of decision trees in the random forest. For the The predicted results for each tree;
[0054] The output of the random forest model is the corresponding stress group.
[0055] As a preferred embodiment of the rice spectral stress index construction method of the present invention, the stress category classification includes:
[0056] Based on the weight values of the characteristic bands, the top 5 bands that showed the most positive response of rice leaves under stress were selected and sorted. The corresponding coefficients of the bands were obtained from the weights, and after calculation and normalization, the stress index was constructed.
[0057] Based on the formula for calculating the spectral index, the values of each band in the hyperspectral data are calculated, and the spectral index value of the sample is obtained by combining the formula.
[0058] Using spectral index values as feature inputs, samples are classified under stress based on the stress index using a random forest classification model.
[0059] Another objective of this invention is to provide a system for constructing a rice spectral stress index. This invention aims to address the technical challenges of rapidly and accurately identifying rice stress conditions, including the shortcomings of traditional methods in terms of monitoring efficiency, accuracy, and real-time performance, as well as the complexity of hyperspectral image data processing and analysis. By integrating multiple modules such as leaf imaging, image processing, feature band extraction, and model classification, this system simplifies the data processing workflow, improves analysis efficiency, reduces uncertainty in stress cause analysis, and ultimately achieves real-time and automated rice stress monitoring, providing precise management guidance for agricultural production.
[0060] To address the aforementioned technical problems, this invention provides the following technical solution: a rice spectral stress index construction system, comprising: a leaf imaging module, which uses a portable hyperspectral camera to photograph rice leaves of different groups to obtain raw hyperspectral images; an image processing module, which performs black-and-white correction on the raw hyperspectral images to obtain corrected images, extracts regions of interest and calculates their average spectral data, and processes the average spectral data using an SG smoothing filter; a feature band extraction module, which uses a generative adversarial network to extract the 50 feature bands with the highest contribution, and filters the feature bands according to their correlation with drought, fertilizer damage, and disease stress; a model classification module, which inputs the average spectral data corresponding to the feature bands as model input data into a random forest classification model to obtain the model classification results; and a stress classification module, which constructs a stress index based on the weight values of the feature bands, classifies stress categories, and outputs the final stress cause analysis.
[0061] A computer device includes a memory and a processor, the memory storing a computer program, characterized in that the processor executes the computer program to implement the steps of the method for configuring the rice spectral stress index construction method.
[0062] A computer-readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the steps of the method described in the configuration of the rice spectral stress index construction method.
[0063] The beneficial effects of this invention are as follows: This invention's precise feature band extraction capability, based on generative adversarial networks (GANs) for feature band extraction from hyperspectral data, can more efficiently capture nonlinear relationships in the data compared to traditional methods (such as PCA and LLE), extracting feature bands with higher discriminative and diagnostic significance, improving classification model performance, and providing more accurate data support for feature extraction and classification of rice hyperspectral images under different stresses. It boasts high computational efficiency and strong adaptability; through feature band extraction and stress index construction, the dimensionality of hyperspectral data is significantly reduced, effectively lowering the computational complexity of the model. Simultaneously, the stress classification method based on spectral indices, while maintaining accuracy, can quickly and conveniently identify the health status and stress type of rice, possessing broad applicability and meeting the diverse stress monitoring and analysis needs in rice planting management. Attached Figure Description
[0064] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort, wherein:
[0065] Figure 1 The overall flowchart of a method for constructing a rice spectral stress index according to an embodiment of the present invention is shown.
[0066] Figure 2 This is a generative adversarial network framework diagram for a method of constructing a rice spectral stress index according to an embodiment of the present invention.
[0067] Figure 3 The diagram shows the generative adversarial network structure of a rice spectral stress index construction method according to an embodiment of the present invention.
[0068] Figure 4 The rice leaf spectral curves under different stresses are provided by a method for constructing a rice spectral stress index according to an embodiment of the present invention.
[0069] Figure 5 Visualization of spectral feature band weights for a rice spectral stress index construction method provided in an embodiment of the present invention.
[0070] Figure 6 The confusion matrix diagram of the classification results of the rice spectral stress index construction method provided in an embodiment of the present invention.
[0071] Figure 7 The stress index classification results of the rice spectral stress index construction method provided in an embodiment of the present invention. Detailed Implementation
[0072] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.
[0073] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0074] Example 1, referring to Figure 1 This is the first embodiment of the present invention, which provides a method for constructing a rice spectral stress index, including:
[0075] Addressing the task of analyzing rice stress factors, this invention relates to a method for extracting characteristic bands of rice diseases and constructing stress indices based on generative adversarial networks. The method accurately screens sensitive bands of rice under different stress factors and constructs stress indices based on the extracted sensitive bands. The method flow is as follows: Figure 1 As shown.
[0076] Step S1: Use a portable hyperspectral camera to regularly photograph different groups of rice leaves in the field to obtain raw hyperspectral images.
[0077] Furthermore, based on the need for extracting characteristic bands of rice and constructing stress indices under different stresses, a portable hyperspectral camera was used to obtain real and effective spectral information of rice leaves through live imaging.
[0078] The portable hyperspectral camera is an internal push-broom type device with a spectral wavelength range covering 400 to 1200 nm, a spectral resolution of 2.5 nm, a spatial resolution of 1920×1920, and 1200 spectral channels.
[0079] Data collection was conducted in the field environment, using four groups of materials set up in the rice experimental field as experimental subjects: healthy, drought-stressed, fertilizer-stressed, and disease-stressed. Hyperspectral image data of rice leaves under different stresses were recorded by taking pictures at regular intervals, and rice leaf parts with obvious disease reactions in the groups were selected as typical samples.
[0080] All rice groups were grown in regularly monitored experimental fields to ensure consistent environmental factors, with only stress factors as variables.
[0081] Specifically, during the shooting process, natural sunlight was used as the light source. The amount of light signal from the hyperspectral camera was dynamically adjusted according to changes in light intensity to ensure that the signal amount was kept between 3000 and 4000 in order to obtain the best spectral data quality.
[0082] During filming, the lens was precisely focused on the areas of rice leaves showing symptoms to maximize the capture of symptom information under this stress, while minimizing interference from other non-stressed areas. To improve data consistency and reliability, appropriate shooting distances and angles were selected at the experimental site to ensure uniform light exposure to the samples.
[0083] A whiteboard with a fixed reflectivity of 0.9 was used as a reference to reduce background interference and improve the accuracy of subsequent data correction.
[0084] The captured hyperspectral image has a resolution of 1920×1920. The shooting parameters, including exposure time and focus distance, were repeatedly adjusted to ensure the clarity and high signal-to-noise ratio of the hyperspectral image and to avoid image distortion caused by changes in lighting or equipment movement.
[0085] By using the push-scan acquisition mode of a portable hyperspectral camera, regular, multi-time-period hyperspectral image acquisition of rice samples was carried out, providing high-quality field data support for subsequent band sensitivity analysis feature extraction and stress index construction.
[0086] Step S2: Perform black and white correction on the original hyperspectral image to obtain the corrected hyperspectral image.
[0087] Specifically, the presence of dark current in the hyperspectral camera and the uneven intensity distribution of the light source under different spectra can lead to unstable hyperspectral images.
[0088] Therefore, a black-and-white correction method is needed to correct the hyperspectral image to obtain a usable hyperspectral image.
[0089] Calculate the reflectance value of the image after black and white correction. :
[0090] ,
[0091] in, The original image reflectance value to be corrected. The reflectance value is obtained by scanning a standard reference whiteboard. This is the blackboard reflectivity value obtained after covering the lens cap.
[0092] After black and white correction, the corrected hyperspectral image data was further processed using ENVI software.
[0093] Step S3: Extract the region of interest from rice leaves under different stresses and calculate the average spectral data.
[0094] Furthermore, ENVI software was used to screen the corrected hyperspectral image data to identify the regions most significantly correlated with stress factors. When marking regions, regions with significant symptoms were defined as regions of interest.
[0095] When rice leaves are subjected to drought stress, fertilizer stress, or disease stress, the size of the region of interest is set to 50×50 pixels, and the average spectral data of each region is extracted.
[0096] For each leaf, based on the shooting time and the actual observed stress symptoms, n regions of interest were marked to obtain n average spectral data records of rice leaves under specific stress.
[0097] When the rice leaves are healthy, the regions of interest are randomly sampled using the five-point method, and n regions of interest are marked and the corresponding average spectral data are extracted.
[0098] Step S4: Apply the SG smoothing filter to the average spectral data.
[0099] Specifically, all hyperspectral image data were acquired at the pixel level.
[0100] To reduce the interference of random noise in the spectral data on the analysis, a Savitzky-Golay (SG) smoothing filter is applied to the spectral data of each region of interest to eliminate random noise in the spectral signal and improve the signal-to-noise ratio of the spectral signal.
[0101] The average spectral data of each band corresponding to each pixel in the region of interest is averaged to obtain the average spectral representation of the region.
[0102] The average spectral data of all ROIs under different stress factors are summarized to form a spectral dataset, which provides a basis for feature band extraction and stress index construction.
[0103] Step S5: Use a generative adversarial network to extract the 50 feature bands with the highest contribution.
[0104] It should be noted that generative adversarial networks were used to extract the characteristic bands exhibited by rice leaves under different stresses.
[0105] Generative adversarial networks (GANs) consist of a generator and a discriminator. Through adversarial training, they can effectively capture deep features in data and are suitable for extracting band features from spectral images.
[0106] Compared to traditional feature extraction methods, generative adversarial networks (GANs) can automatically learn features based on latent patterns in data without relying on predefined feature selection methods. Their adaptive capabilities make them more flexible in band selection, enabling them to extract spectral features of rice leaves under different stresses. At the same time, the generator can effectively learn the complex distribution of disease bands during the adversarial process, providing strong support for identifying feature bands of different stress categories.
[0107] In generative adversarial networks, the convolutional layers of the discriminator have fully learned the local and global features of real spectral data in the process of distinguishing between real and fake data. The feature weights of each band are extracted from the convolutional layers of the discriminator, and sensitive feature bands are selected accordingly.
[0108] Specifically, the framework structure of generative adversarial networks is as follows: Figure 2 , Figure 3 As shown, the model consists of a generator and a discriminator, and incorporates a convolutional block attention mechanism to improve feature extraction and generation performance.
[0109] The generator includes fully connected layers, batch normalization layers, random deactivation layers, and a CBAM module to enhance training stability and attention focus.
[0110] The CBAM module includes channel attention and spatial attention;
[0111] The channel attention includes extracting channel information features from the input feature map through global average pooling and global max pooling operations, inputting the extracted features into a shared two-layer fully connected network, generating channel attention weights through an addition operation after activation, and multiplying them with the input feature map channel by channel to complete the weighting process;
[0112] The spatial attention includes performing average pooling and max pooling operations on the weighted feature map in the channel attention dimension, compressing the channel dimension to 1, concatenating the two features, extracting spatial features through 7×7 convolution, generating spatial attention weights through activation, and multiplying them element-wise with the channel-weighted feature map to complete the final weighting.
[0113] The CBAM module combines channel and spatial attention in a serial manner, enabling adaptive refinement of the input feature map while maintaining the advantages of low computational overhead and ease of integration.
[0114] The generator's initial input consists of some real data and random noise vectors. After passing through the first fully connected network layer, the features are expanded to 512 dimensions. Through batch normalization and random deactivation with a ratio of 0.3, the features are then extended to 1024 dimensions through the second fully connected network layer. Batch normalization and random deactivation are performed again. Finally, the features are extended to 2048 dimensions through the third fully connected network layer layer, and batch normalization and random deactivation are performed again.
[0115] The features are reshaped into a three-dimensional tensor of shape (16, 16, 8), and the spatial and channel attention of the features are optimized through the CBAM module. The features are converted into one-dimensional vectors through the Flatten layer, and a 306-dimensional output vector is generated through the fully connected layer to represent the reflectance band values of the target hyperspectral data.
[0116] The discriminator employs a 3D convolutional network combined with an attention mechanism to judge the input data; it reshapes the input data into a three-dimensional data block and extracts three-dimensional spatial features through two sets of 3D convolutional layers and 3D max pooling layers.
[0117] The first group of 3D convolutional layers contains 32 filters, and the second group contains 64 filters, both with a kernel size of (3, 3, 3).
[0118] The CBAM module enhances the perception of feature weights. The data is processed through two sets of 2D convolutional layers and 2D max pooling layers (to further extract features, each set containing 32 and 64 filters respectively, with a kernel size of (3, 3).
[0119] After the second set of convolutions, the CBAM module is introduced again to enhance the attention of features, and an inactive layer is added to improve the generalization ability of the model.
[0120] The data is flattened and fed into a fully connected layer for feature integration, and the result is output as a discrimination result.
[0121] Both the generator and the discriminator focus on key features through the CBAM module. The generator focuses on reconstructing the details of the target data, while the discriminator enhances classification and discrimination capabilities with multi-dimensional convolutional features. The overall model can effectively handle complex hyperspectral data tasks.
[0122] This generative adversarial network model is based on the PyTorch deep learning framework, version 2.2.1. For GPU acceleration, it uses CUDA version 11.1 and cuDNN version 8.9.6 to improve the efficiency of model training and inference.
[0123] The discriminator and generator are trained together to optimize model performance in an adversarial manner.
[0124] During model training, the batch size is set to 32, with half of the batch used for real data and the other half used for fake data generated by the generator.
[0125] The discriminator is trained on real data and generated data respectively, and the maximum training loss between the two is calculated. The maximum number of iterations is 10,000.
[0126] The Adam optimizer is used with an initial learning rate of 0.001, and the weights of the generator and discriminator are updated simultaneously.
[0127] The loss function used is binary cross-entropy, which evaluates the adversarial effect between the generator and the discriminator, and monitors the convergence and adversarial balance of the model in real time.
[0128] To avoid overfitting and improve the generator's generalization ability, a model checkpointing mechanism is added during model training to save only the model parameters with the best generation quality. At the same time, a validation set of the training data is introduced to monitor the generator's performance on real data to ensure that the model converges to the optimal solution.
[0129] It should also be noted that by analyzing the activation maps of the discriminator in different convolutional layers and combining them with the gradients of the convolutional layer weights, the sensitivity of the convolutional kernel to different bands can be located, and the selected feature bands and their corresponding weights can be extracted. This method can directly reveal the contribution of each band to spectral feature extraction, making it easier to select bands with greater diagnostic value.
[0130] After obtaining the feature weights in the convolutional layer, the bands with high weight values are selected, and then the sensitive bands with the strongest correlation with drought stress, fertilizer stress, and disease stress are selected again.
[0131] By sorting and filtering the weights of the sensitive feature bands output by the convolutional layer, the top 50 most contributing bands in the 400nm to 1200nm band range are determined, and the spectral reflectance data corresponding to the current 50 bands are retained as the input of the model.
[0132] Optimize the input features of the model to improve the accuracy of rice data classification under different stress groups.
[0133] Figure 4 , Figure 5 The leaf spectral reflectance characteristic curves of rice under different types of stress and the visualization diagram of the weights of the selected spectral characteristic bands are shown respectively.
[0134] Step S6: Input the average spectral data corresponding to the feature bands into the random forest classification model as input data to obtain the model classification results.
[0135] It should be noted that the classification model uses the classic Random Forest (RF) model to classify the dataset. The RF model is an ensemble learning method, an extension of the decision tree model, which achieves classification or regression by constructing multiple decision trees and combining voting or averaging methods. The RF model has good resistance to overfitting and efficient classification performance, and is particularly suitable for high-dimensional data and datasets after feature selection.
[0136] Step S7: Simultaneously select the top 5 characteristic bands and their corresponding weights to construct a spectral index, and obtain the stress index to classify the stress categories.
[0137] Specifically, the dataset after feature band filtering is used as input to the random forest model, and the average spectral dataset is labeled according to different stress groups, including 0 for healthy, 1 for drought stress, 2 for fertilizer stress, and 3 for disease stress.
[0138] The random forest model includes a training phase and a prediction phase;
[0139] The training phase includes random forest sampling from the training dataset using the Bagging method to generate m data subsets containing partial samples; a decision tree is built on each subset, and during the node partitioning process of each tree, a subset of features is randomly selected for splitting.
[0140] The prediction phase includes the random forest using all the constructed decision trees to predict the test samples, and the final category result is determined by majority voting.
[0141] The output of the random forest model is represented as:
[0142] ,
[0143] in, For the final prediction result, The total number of decision trees in the random forest. For the The predicted results for each tree;
[0144] The output of the random forest model is the corresponding stress group.
[0145] It should be noted that, in order to verify the superiority of generative adversarial networks in feature band extraction, this invention demonstrates the classification effect of the method after feature extraction by comparing it with principal component analysis and local linear embedding methods.
[0146] This method utilizes generative adversarial networks (GANs) for feature extraction, enabling it to better learn the underlying structure and nonlinear relationships within the data. Through adversarial training, the model automatically optimizes and generates more discriminative features during the extraction process, thereby improving the performance of the classification model. Compared to PCA and LLE, the features extracted by this method demonstrate superior classification performance on complex hyperspectral data.
[0147] After obtaining the weights of the bands, the top five bands that showed the most positive response of rice leaves under the stress in this experiment were selected based on the weight values. The corresponding coefficients of the bands were obtained from the weights, and after calculation and normalization, the stress index k was constructed.
[0148] ,
[0149] in, , , , , These represent the reflectance values of the selected bands, with each band corresponding to a weighting coefficient. min and max represent the values selected by the bands themselves. The calculated global minimum and maximum values.
[0150] Furthermore, the stress index is applied to classify the samples according to stress.
[0151] Based on the selected formula for calculating the spectral index, the values of each band in the hyperspectral data are calculated, and the spectral index value of the sample is obtained by combining the formula; for example, This represents the spectral reflectance value corresponding to a wavelength of 572 nm. Each data sample contains reflectance values corresponding to the effective range of 400 nm to 1000 nm. The reflectance value at the corresponding nm in the stress index k is taken and substituted into the formula to calculate the stress index value k corresponding to that sample.
[0152] These spectral index values can effectively reflect the spectral characteristics of rice under different stress conditions, especially the changes related to stresses such as drought, fertilizer damage, and disease.
[0153] The calculated index value is used as the feature input. Based on the feature bands and weights selected by the generative adversarial network, a stress index is constructed. The stress index is used as a new data input and input into the random forest model for stress classification: 0 represents health, 1 represents drought stress, 2 represents fertilizer stress, and 3 represents disease stress.
[0154] Despite using a single spectral index value, the model is still able to accurately distinguish different stress categories in hyperspectral data, demonstrating the effectiveness of spectral indices in stress classification. In addition, the features extracted using spectral indices significantly reduce the dimensionality of the data and the computational load of the model, thereby improving classification efficiency and computation speed. This method not only optimizes computational resources but also provides strong support for large-scale plant stress monitoring and precision agriculture applications, and has broad practical application prospects.
[0155] Step S8: Determine the group to which the leaf belongs based on the model classification results and stress categories. The model classification results directly output the label corresponding to the sample. Based on the category corresponding to the label, determine the group to which the sample belongs and output the stress cause of rice.
[0156] In summary, this patent proposes a method for extracting characteristic bands of rice diseases and constructing stress indices based on generative adversarial networks and hyperspectral images, effectively improving the feature extraction and classification performance of hyperspectral image data in rice stress monitoring. This method allows for more accurate extraction of characteristic bands related to rice stress and stress classification based on spectral indices, improving classification accuracy and efficiency. It not only reduces data dimensionality and model computation but also provides rice growers with more scientific and effective stress monitoring and decision support, contributing to improved management of rice production and promoting sustainable development in agriculture.
[0157] Example 2 is an embodiment of the present invention. This embodiment provides a rice spectral stress index construction system, including: a leaf imaging module 100, an image processing module 200, a feature band extraction module 300, a model classification module 400, and a stress classification module 500.
[0158] The leaf imaging module 100 uses a portable hyperspectral camera to photograph rice leaves of different groups and obtain raw hyperspectral images.
[0159] The image processing module 200 performs black-and-white correction on the original hyperspectral image to obtain the corrected image, extracts the region of interest and calculates its average spectral data, and processes the average spectral data using an SG smoothing filter.
[0160] The feature band extraction module 300 uses a generative adversarial network to extract the 50 feature bands with the highest contribution, and filters the feature bands according to their correlation with drought, fertilizer damage, and disease stress.
[0161] The model classification module 400 inputs the average spectral data corresponding to the feature bands into the random forest classification model as input data to obtain the model classification results.
[0162] The stress classification module 500 constructs a stress index based on the weight values of characteristic bands, classifies stress categories, and outputs the final stress cause analysis.
[0163] Example 3, the third embodiment of the present invention, differs from the previous two embodiments in that:
[0164] Specifically, if the method for constructing the rice spectral stress index is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0165] The computer program includes several instructions that enable a computer device (such as a server, personal computer, or other network device) to perform the following steps:
[0166] A portable hyperspectral camera was used to periodically photograph rice leaves of different groups in the field to obtain raw hyperspectral images. The raw hyperspectral images were then black and white corrected to obtain corrected hyperspectral images. Regions of interest were extracted from rice leaves under different stresses, and average spectral data were calculated. The average spectral data were processed by an SG smoothing filter. A generative adversarial network was used to extract the 50 feature bands with the highest contribution. The average spectral data corresponding to the feature bands were used as input data to a random forest classification model to obtain the model classification results. At the same time, the top 5 feature bands and their corresponding weights were selected to construct a spectral index, which was used to obtain a stress index to classify stress categories. The model classification results and stress categories were used to determine the group to which the leaves belong and output the stress cause of the rice.
[0167] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0168] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0169] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0170] The computer program of this invention further supports real-time operation. For example, this invention uses generative adversarial networks for sensitive band extraction, which can quickly and automatically learn and identify features in hyperspectral data without the need for manual feature selection. This intelligent feature extraction method significantly improves processing speed, enabling the model to be updated and optimized in real time, and is suitable for constantly changing field environments. All steps involved in this invention (such as black-and-white correction, region of interest extraction, and spectral data smoothing) are automated using computer software (such as ENVI software), reducing the time required for manual intervention and improving processing efficiency. This automated process ensures that the required spectral data can be quickly acquired and analyzed promptly.
[0171] Example 4, refer to Figures 6-7 As an embodiment of the present invention, a method for constructing the spectral stress index of rice is provided. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through experiments.
[0172] Figure 6 The classification performance of this method is demonstrated under four categories: healthy, drought stress, fertilizer stress, and disease stress. The confusion matrix shows that:
[0173] The number of samples correctly classified as healthy in category "0-health" was 228, indicating no misclassification.
[0174] The number of samples correctly classified as category "1-drought" was 248, and only a small number of samples (4) were misclassified as "2-fertilizer damage";
[0175] Category "2-Fertilizer damage" was correctly classified as 236, 8 samples were misclassified as "0-Healthy", and 4 samples were misclassified as "3-Disease".
[0176] Category "3-Disease" was correctly classified as 228, while 4 samples were misclassified as "2-Fertilizer Damage".
[0177] After using a generative adversarial network to extract feature bands, the random forest classification model achieved a classification accuracy of 97.92%, and the classification results were visualized using a confusion matrix. After feature extraction, a large amount of redundant data can be removed, significantly reducing the data input while still achieving high classification accuracy. In particular, for the categories of "healthy", "drought" and "disease", there were almost no misclassifications, demonstrating the strong ability of this feature extraction method to distinguish different stress states of rice.
[0178] As shown in Table 1, the features extracted by this method perform better in multiple evaluation indicators such as classification accuracy, average accuracy, and Kappa coefficient.
[0179] Specifically, Table 1 shows a comparison of the classification performance of our proposed feature extraction method with traditional feature extraction methods such as PCA and LLE under a random forest classifier. It can be seen that our proposed method outperforms traditional PCA and LLE feature extraction methods in all metrics. This indicates that the feature extraction method of this invention can more accurately capture the hyperspectral features of rice under different stress conditions, improving the classification effect, as shown in Table 1 below:
[0180] Table 1
[0181] ,
[0182] Using spectral index values as a single feature input, the classification model achieved an accuracy of 85%. The classification results are visualized using a confusion matrix, as shown below. Figure 7 As shown, the classification and error distribution among the categories are further illustrated.
[0183] Specifically, Figure 7 The demonstration shows that classification is performed using the stress index value. Compared to the full band and the top 50 feature bands extracted by this method (each data has 50 feature values), it goes a step further by using only a single feature value (stress index value) to input into the random forest classification model, and achieves a classification accuracy of 85%.
[0184] Using a single stress index value to further simplify feature input, although classification performance decreases slightly, it still reaches 85%, indicating that the stress index has high representativeness. Compared with traditional methods, the stress index designed in this invention maintains high classification ability even with low-dimensional features, demonstrating its strong application potential in practical agricultural monitoring. In hyperspectral image analysis, while using full-band features or the top 50 bands offers better classification performance, it also results in higher computational complexity and requires more resources for model training and prediction. The single stress index value significantly reduces data dimensionality, is lightweight, and is suitable for resource-constrained scenarios such as mobile devices or real-time monitoring systems.
[0185] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for constructing a spectral stress index for rice, characterized by: include, We used a portable hyperspectral camera to regularly photograph different groups of rice leaves in the field to obtain the original hyperspectral images; The original hyperspectral image is black and white corrected to obtain the corrected hyperspectral image. Regions of interest were extracted from rice leaves under different stresses, and average spectral data were calculated. The average spectral data were processed using an SG smoothing filter. The 50 feature bands with the highest contribution were extracted using a generative adversarial network; The average spectral data corresponding to the feature bands are used as input data to the random forest classification model to obtain the model classification results. Simultaneously, the top 5 characteristic bands and their corresponding weights are selected to construct a spectral index, which is then used to classify stress categories. The model classification results and stress categories determine the group to which the leaves belong, and output the stress causes of rice.
2. The method for constructing the rice spectral stress index as described in claim 1, characterized in that: The original hyperspectral image, include, A portable hyperspectral camera was used, natural sunlight was used as the light source, and a whiteboard with a fixed reflectance of 0.9 was used as a reference. Spectral information of rice leaves was obtained through live photography. The illumination signal of the hyperspectral camera is dynamically adjusted to maintain it at 3000-4000. Data collection was conducted in the field environment, with regular photography of rice leaves in the experimental rice fields under conditions of healthy rice, drought stress, fertilizer stress, and disease stress. Record hyperspectral image data of rice leaves under different stresses; Rice leaf parts with obvious disease reactions in the groups were selected as typical samples. The obtained hyperspectral image has a resolution of 1920×1920.
3. The method for constructing the rice spectral stress index as described in claim 1 or 2, characterized in that: The black-and-white correction includes, The hyperspectral image was corrected using a black-and-white correction method to obtain the corrected hyperspectral image; Calculate the reflectance value of the image after black and white correction. : in, The original image reflectance value to be corrected. The reflectance value is obtained by scanning a standard reference whiteboard. This is the blackboard reflectivity value obtained after covering the lens cap.
4. The method for constructing the rice spectral stress index as described in claim 3, characterized in that: The extraction of the region of interest includes, The ENVI software was used to screen the corrected hyperspectral image data to identify the regions most significantly correlated with stress factors and define them as regions of interest. When rice leaves are subjected to drought stress, fertilizer stress, or disease stress, the size of the region of interest is set to 50×50 pixels, and the average spectral data of each region is extracted. Based on the shooting time and the actual observed stress symptoms, n ROIs were marked to obtain the average spectral data records of rice leaves under n specific stresses; When the rice leaves are healthy, the regions of interest are randomly sampled using the five-point method, and n ROIs are labeled and the corresponding average spectral data are extracted.
5. The method for constructing the rice spectral stress index as described in claim 2 or 4, characterized in that: The generative adversarial network includes, Generator, discriminator; The generator includes a fully connected layer, a batch normalization layer, a random deactivation layer, and a CBAM module; The generator's initial input consists of some real data and random noise vectors. After passing through the first fully connected network, the features are expanded to 512 dimensions. After batch normalization and random deactivation with a ratio of 0.3, the features are further expanded to 1024 dimensions by the second fully connected network. Batch normalization and random deactivation are performed again. The features are further expanded to 2048 dimensions by the third fully connected network, and batch normalization and random deactivation are performed again. The features are reshaped into a three-dimensional tensor of shape (16, 16, 8), and the spatial and channel attention of the features are optimized through the CBAM module. The features are converted into one-dimensional vectors through the Flatten layer, and a 306-dimensional output vector is generated through the fully connected layer to represent the reflectance band values of the target hyperspectral data. The discriminator employs a 3D convolutional network combined with an attention mechanism to judge the input data; The input data is reshaped into a three-dimensional data block, and three-dimensional spatial features are extracted through two sets of 3D convolutional layers and 3D max pooling layers. The first group of 3D convolutional layers contains 32 filters, and the second group of 3D convolutional layers contains 64 filters, both with a kernel size of (3,3, 3). After enhancing the perceptual ability of feature weights through the CBAM module, the data passes through two sets of 2D convolutional layers and 2D max pooling layers. After the second set of convolutions, the CBAM module is introduced again to strengthen the attention of features, and an inactivation layer is added. The data is then flattened and fed into a fully connected layer for feature integration, and the discrimination result is output.
6. The method for constructing the rice spectral stress index as described in claim 5, characterized in that: The 50 feature bands with the highest contribution are extracted, including: By analyzing the activation maps of the discriminator in different convolutional layers and combining the gradients of the convolutional layer weights, the sensitivity of the convolutional kernel to different bands is located, and the selected feature bands and their corresponding weights are extracted. After obtaining the feature weights in the convolutional layer, the bands with high weight values are selected, and then the sensitive bands with the strongest correlation with drought stress, fertilizer stress, and disease stress are selected again. By sorting and filtering the weights of the sensitive feature bands output by the convolutional layer, the top 50 most contributing bands in the 400nm to 1200nm band range are determined, and the spectral reflectance data corresponding to the current 50 bands are retained as the input of the model.
7. The method for constructing the rice spectral stress index as described in claims 1, 2, 4, or 6, characterized in that: The model classification results include, The dataset after feature band filtering is used as input to the random forest model. The average spectral dataset is labeled according to different stress groups, including 0 for healthy, 1 for drought stress, 2 for fertilizer stress, and 3 for disease stress. The random forest model includes a training phase and a prediction phase; The training phase includes random forest randomly sampling from the training dataset using the Bagging method to generate m data subsets containing partial samples; Build a decision tree on each subset, and randomly select a subset of features to split during the node partitioning process of each tree; The prediction phase includes using random forests to predict test samples using all constructed decision trees, and determining the final category result through majority voting. The output of the random forest model is represented as: in, For the final prediction result, The total number of decision trees in the random forest. For the The predicted results for each tree; The output of the random forest model is the corresponding stress group.
8. The method for constructing the rice spectral stress index as described in claims 1, 2, 4 or 6, characterized in that: The classification of stress categories includes, Based on the weight values of the characteristic bands, the top 5 bands that showed the most positive response of rice leaves under stress were selected and sorted. The corresponding coefficients of the bands were obtained from the weights, and after calculation and normalization, the stress index was constructed. Based on the formula for calculating the spectral index, the values of each band in the hyperspectral data are calculated, and the spectral index value of the sample is obtained by combining the formula. Using spectral index values as feature inputs, samples are classified under stress based on the stress index using a random forest classification model.
9. A system for constructing a spectral stress index for rice, characterized in that, include, The leaf imaging module (100) uses a portable hyperspectral camera to photograph rice leaves of different groups and obtain raw hyperspectral images; Image processing module (200) performs black and white correction on the original hyperspectral image to obtain the corrected image, extracts the region of interest and calculates its average spectral data, and processes the average spectral data with SG smoothing filter. The feature band extraction module (300) uses a generative adversarial network to extract the 50 feature bands with the highest contribution, and filters the feature bands according to their correlation with drought, fertilizer damage and disease stress; The model classification module (400) inputs the average spectral data corresponding to the feature bands into the random forest classification model as model input data to obtain the model classification result; The stress classification module (500) constructs a stress index based on the weight values of the characteristic bands, classifies stress categories, and outputs the final stress cause analysis.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, The processor executes the computer program to implement the steps of the method for constructing the rice spectral stress index.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for constructing the rice spectral stress index.
Citation Information
Patent Citations
Method for identifying drought stress of tomatoes
CN114494689A
Rice salt stress early-stage quantitative monitoring method based on sunlight-induced chlorophyll fluorescence index
CN115684107A