Method, equipment and medium for detecting water content and distribution condition of chrysanthemum based on hyperspectral technology
By using hyperspectral technology to obtain image data of the front and back of chrysanthemums, a moisture content prediction model was established and image segmentation was performed, which solved the problem of accuracy of moisture content detection in chrysanthemum production and realized intelligent and refined control of chrysanthemum production.
Patent Information
- Application Number
- CN202510852722.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2025-10-10
AI Technical Summary
Existing technologies make it difficult to accurately detect the moisture content and distribution of chrysanthemums during production, especially in chrysanthemum samples rolling and stacking on a conveyor belt. The application of hyperspectral imaging technology has not been reported.
Hyperspectral technology is used to obtain hyperspectral image data of the front and back of chrysanthemums, and moisture content prediction models for the front and back are established respectively. The real-time target detection algorithm is used to segment the image, and the partial least squares regression, support vector machine regression, principal component regression and other algorithms are combined for prediction to generate a pseudo-color map of moisture content distribution.
It realizes the accurate detection of chrysanthemum moisture content and visualization of its distribution, is suitable for online monitoring of chrysanthemum production, and supports the intelligent and refined development of chrysanthemum production and processing.
Smart Images

Figure CN120766211A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for detecting the moisture content of chrysanthemums, and in particular to a method, equipment and medium for detecting the moisture content and distribution of chrysanthemums based on hyperspectral technology. Background Art
[0002] Chrysanthemum tea is made from fresh chrysanthemums that have been dried. Freshly picked chrysanthemums have a high moisture content, generally over 80%. Drying reduces the moisture content to below 15%, making it easier to store and transport the flowers.
[0003] Currently, the moisture content of agricultural products is mainly measured based on empirical methods such as touch and feel, drying and weighing. However, these methods are not very accurate, or are time-consuming, labor-intensive, and destructive to the products.
[0004] Near-infrared spectroscopy is a nondestructive testing technique, but it relies on point detection, making it more suitable for uniform samples. However, chrysanthemums have a complex structure, and in actual production, they are rolled and stacked on conveyor belts. Existing technologies cannot accurately measure the moisture content and distribution of chrysanthemums.
[0005] Compared to existing moisture detection technologies (such as offline drying and weighing methods and near-infrared spectroscopy), hyperspectral imaging combines spectral and image information. By collecting hyperspectral data from samples, it not only obtains spectral information reflecting the sample's moisture content, but also obtains image information of the sample's spatial distribution of moisture, enabling accurate prediction and display of moisture content and distribution. However, the application of hyperspectral imaging technology to measure the moisture content of chrysanthemums in dried chrysanthemum production has not yet been reported. Summary of the Invention
[0006] Purpose of the invention: The purpose of the present invention is to provide a method for detecting the moisture content and distribution of chrysanthemums based on hyperspectral technology, so as to solve the problem of how to apply hyperspectral imaging technology to detect the moisture content of chrysanthemums.
[0007] Technical solution: The present invention provides a method for detecting the water content and distribution of chrysanthemums based on hyperspectral technology, comprising the following steps:
[0008] (1) Obtain hyperspectral image data of the front and back of a single chrysanthemum with different water contents;
[0009] (2) Based on the front hyperspectral image data of a single chrysanthemum, the front area of the chrysanthemum is selected as the region of interest, and the spectrum of the region of interest is extracted to obtain the original spectrum data of the front of the single chrysanthemum;
[0010] (3) removing interference factors from the original spectral data of the front side of a single chrysanthemum to obtain the front preprocessed data;
[0011] (4) The frontal preprocessed data were used to train the regression algorithm in supervised learning to establish a chrysanthemum frontal moisture content prediction model;
[0012] (5) Based on the hyperspectral image data of the back side of a single chrysanthemum, repeat steps (2)-(4) to establish a chrysanthemum back side moisture content prediction model;
[0013] (6) Using a real-time target detection algorithm to segment the hyperspectral image to be predicted to obtain hyperspectral image data of a single chrysanthemum to be predicted;
[0014] (7) Classifying the hyperspectral image data of a single chrysanthemum to be predicted into a positive image and a negative image;
[0015] (8) The chrysanthemum front moisture content prediction model is used to predict the moisture content of each pixel in the front image to obtain the moisture content of different areas on the front of the chrysanthemum;
[0016] (9) Repeat step (8) and use the chrysanthemum back surface moisture content prediction model to predict the moisture content in different areas of the chrysanthemum back surface.
[0017] Preferably, the chrysanthemum includes at least one of Hangzhou chrysanthemum, Gong chrysanthemum, Chu chrysanthemum, Bo chrysanthemum, Huai chrysanthemum and Jinsihuang chrysanthemum.
[0018] Preferably, extracting the spectrum of the region of interest includes: the size of the region of interest is the size of a single chrysanthemum, and taking the average spectrum of all pixels in the region of interest as the original spectrum data of the front side of the single chrysanthemum.
[0019] Preferably, the method of removing interference factors from the original spectral data of the front of a single chrysanthemum includes: using at least one of the SG smoothing method, the multivariate scattering correction method, and the mean centering method to preprocess the original spectral data of the front of a single chrysanthemum to remove interference factors, and the interference factors include that when the hyperspectral imaging system collects data, the data is interfered with by the uneven distribution of particles of the object to be measured, different particle sizes, and instrument signal noise.
[0020] Preferably, the regression algorithm in the supervised learning includes one of a partial least squares regression algorithm, a support vector machine regression algorithm, and a principal component regression algorithm.
[0021] Preferably, the real-time target detection algorithm includes a YOLOv8 model.
[0022] Preferably, the classifying the hyperspectral image data of the single chrysanthemum to be predicted into the front image and the back image comprises using one of an artificial neural network, a random forest algorithm, and a linear discriminant analysis algorithm to classify the hyperspectral image data of the single chrysanthemum to be predicted into the front image and the back image.
[0023] Preferably, the step (8) further includes the following steps:
[0024] The predicted moisture content values in different areas of the front of the chrysanthemum are represented by different colors to generate a pseudo-color map of the moisture content distribution.
[0025] A second aspect of the present invention discloses a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the above method when executing the computer program.
[0026] A third aspect of the present invention discloses a computer storage medium, wherein the computer storage medium stores instructions, and when the instructions are executed on a computer, the computer executes the above method.
[0027] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages:
[0028] This method is suitable for online monitoring in the actual production of chrysanthemums. During the actual production and drying process, chrysanthemums move and roll on the conveyor belt, so only the spectral information of a single side can be collected. However, the spectra of the front and back sides of the chrysanthemums are quite different. This method establishes a front and back classifier, constructs a prediction model for the front and back images of the chrysanthemums respectively, and performs moisture content prediction to achieve accurate detection of the moisture content of the chrysanthemums. At the same time, in the stacked state of actual production, the chrysanthemums block each other, resulting in the mixing of their hyperspectral information, making it difficult to directly apply the moisture content prediction model of a single chrysanthemum. The present invention achieves accurate detection of the moisture content of chrysanthemums through image segmentation.
[0029] The present invention is a fast and accurate real-time online detection technology for chrysanthemum moisture content that meets the production needs of factories. It provides technical support for quality control during the production and processing of chrysanthemums, and realizes the intelligent and refined development of chrysanthemum production and processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 Schematic diagram of the placement of chrysanthemums when collecting hyperspectral image data of the front and back of a single chrysanthemum;
[0031] Figure 2 is the SVR fitting curve;
[0032] Figure 3 is the LDA confusion matrix for the positive and negative classification of Chuju;
[0033] Figure 4 This is a pseudo-color picture of the moisture content of Chuju with different moisture contents;
[0034] Figure 5 This is the image segmentation effect diagram of the YOLOv8 model in different scenes. DETAILED DESCRIPTION
[0035] The technical solution of the present invention will be further described below with reference to the accompanying drawings.
[0036] A method for detecting the water content and distribution of chrysanthemums based on hyperspectral technology is as follows:
[0037] (1) Freshly picked chrysanthemums were dried to different moisture contents, and a line scanning hyperspectral imaging system was used to obtain hyperspectral image data of the front and back of single chrysanthemums with different moisture contents. The system includes a hyperspectral camera (FX17E, Specim) with a spectral range of 939-1726nm, a resolution of 3.5nm, and a total of 224 bands. When collecting data, the experimental device was placed in a light-proof environment to maintain the best experimental conditions. After setting the system parameters, the chrysanthemums were evenly placed on a blackboard fixed at a conveyor belt platform (such as Figure 1 The platform moves at a constant speed (25 mm / s) to scan the Chuju sample to obtain hyperspectral data.
[0038] (2) Based on the hyperspectral image data of the front side of a single chrysanthemum, the entire Chuzhou chrysanthemum (including the front and back sides) is selected as the region of interest (ROI), and the average spectrum of all pixels in the ROI is used as the original spectrum data of the front side of the single chrysanthemum.
[0039] (3) When using a hyperspectral imaging system for data acquisition, the data is often affected by uneven distribution of particles, different particle sizes, and instrument signal noise, thereby reducing data quality. The present invention uses different preprocessing methods such as SG smoothing method (SG), multivariate scatter correction method (MSC), and mean centering method (MC) to preprocess the front raw spectral data of a single Chuju flower to remove interference factors and improve data quality, thereby obtaining full-band front preprocessed data.
[0040] SG smoothing is a convolution smoothing method based on polynomial fitting. It improves the signal-to-noise ratio of spectral data by reducing high-frequency noise caused by instrument noise and random errors. When operating, first determine a data window of odd width, use a polynomial of a specific order to fit the data within the window, and use the value of the fitting curve at the center point of the window as the smoothed result at that point. This process is then repeated point by point along the data sequence until the entire data set is processed. While improving data clarity, it also retains important features such as peak position and width. In this chapter, the window width is 11 and the polynomial order is set to 2.
[0041] The function of multiplicative scatter correction (MSC) is similar to that of SNV. By performing linear regression fitting on the sample spectrum and the average reference spectrum, the scattering effect and baseline shift caused by uneven particle distribution or surface roughness are eliminated, and the characteristic expression in the spectrum that is directly related to the chemical composition (such as water content) is enhanced.
[0042] Mean Centering (MC) is commonly used to eliminate baseline shifts in spectral data and highlight spectral features. This method subtracts the average spectral vector of the entire sample set from the spectral vector of each sample, returning the mean reflectance intensity of each band in the spectral matrix to zero. This shifts the analytical focus from absolute intensity to relative spectral changes. This processing method not only enables a better model to be established for the quantitative relationship between spectral changes and chemical component concentrations, but also enhances the ability to extract target component features by increasing spectral differences between samples.
[0043] (4) Partial least squares regression (PLSR) is a multivariate statistical method that finds the best fit function for a set of data by obtaining the minimum sum of squared errors. The number of principal components in PLSR is a key parameter of the model and is the most widely used linear regression model analysis method in spectral modeling. The parameters of PLSR in the present invention are set as follows: number of principal components 10, number of folds 5, and maximum number of iterations 500.
[0044] Support Vector Regression (SVR) is a machine learning method based on statistical learning theory, mainly used to solve regression analysis problems. Unlike traditional support vector machines (SVM) for classification tasks, SVR focuses on predicting continuous value outputs. Its core is to map the input data into a high-dimensional feature space by selecting a suitable kernel function (such as linear, polynomial or RBF kernel), and find an optimal regression hyperplane in this space to handle complex nonlinear relationships while maintaining good generalization ability. To reduce noise and errors in the data, SVR introduces two important parameters: slack variables and penalty coefficients. Slack variables allow the model to have a certain tolerance for the prediction errors of certain samples, while the penalty coefficient adjusts the model's penalty for errors that exceed the tolerance range, helping to balance model complexity and training error, effectively reducing the risk of overfitting, and improving the model's adaptability to new data. The parameters of the SVR model in the present invention are set as follows: regularization parameter C = 10, insensitive region size (epsilon) = 0.01, kernel function gamma value is 0.1, and RBF (radial basis function) is selected as the kernel function.
[0045] Principal Component Regression (PCR) is a modeling method that combines principal component analysis (PCA) with linear regression. It is suitable for dealing with high dimensionality and multicollinearity problems in hyperspectral data. First, the hyperspectral data is standardized to ensure that each variable has the same scale. Then, PCA is used to convert the original data into a set of linearly independent principal components. The top-ranked principal components are selected based on the cumulative explained variance, reducing the data dimension while retaining as much information as possible. The selected principal components are then used as new independent variables to perform linear regression with the target variable to establish a model and make predictions. This method not only improves computational efficiency and reduces the risk of overfitting, but also solves the correlation problem between the original variables through mutually orthogonal principal components.
[0046] The frontal preprocessed data were used to train different algorithms, including partial least squares regression (PLSR), support vector machine regression (SVR), and principal component regression (PCR), to establish a chrysanthemum frontal moisture content prediction model. The performance of different prediction models under different preprocessing methods was evaluated. The model evaluation criteria are as follows:
[0047] The coefficient of determination (R 2 ), root mean square error (RMSE) and relative performance deviation (RPD) to evaluate the performance of the model.
[0048] R 2 The calculation formula is:
[0049]
[0050] x i is the actual measured value, y i is the predicted value, x is the average measured value, and y is the average predicted value.
[0051] The calculation formula of RMSE is:
[0052]
[0053] n is the number of samples, y i is the actual value of the i-th sample, and yi is the predicted value of the i-th sample.
[0054] The formula for calculating RPD is:
[0055]
[0056] STD is standard deviation.
[0057] After the model is established, the coefficient of determination of the training set (R 2 c), prediction set determination coefficient (R 2p) and the cross-validation determination coefficient (R 2 cv) approach 1 and the root mean square error of the training set (RMSEc), the root mean square error of the prediction set (RMSEp) and the root mean square error (RMSEcv) approach 0, indicating that the performance of the model is better.
[0058] An ideal model should have a high R 2 c and R 2 p value (approach 1), and the difference between them is small (a large difference generally indicates that the model is over-fitted); at the same time, the RMSEc and RMSEp values are small (approach 0), and the difference is not large, so as to indicate that the model has consistency in each performance index, has high reliability and credibility, and the RPD is greater than 2.0, indicating good prediction ability, greater than 3.0, indicating excellent, and less than 1.5, indicating insufficient prediction ability, not suitable for practical application.
[0059] The evaluation results are shown in Tables 1-3:
[0060] Table 1 PLSR performance under different pretreatments
[0061]
[0062] Table 2 PCR model performance under different pretreatments
[0063]
[0064] Table 3 SVR model performance under different pretreatments
[0065]
[0066]
[0067] In Tables 1-3, "Raw" represents the original data.
[0068] The results of Tables 1-3 show that for the front sample, the spectral data value and the moisture content fitting model of Chrysanthemum established by using the MSC pretreatment method and the partial least squares regression algorithm (PLSR) has a good fitting effect; and for the back sample, the MSC pretreatment method and the support vector machine regression algorithm (SVR) are used to obtain the optimal model effect. Figure 2 Fig. (a) is the SVR fitting curve of the front of the chrysanthemum, and Fig. (b) is the SVR fitting curve of the back of the chrysanthemum.
[0069] (5) Based on the hyperspectral image data of the back of a single chrysanthemum, repeat steps (2)-(4) above to establish a chrysanthemum back moisture content prediction model;
[0070] (6) A real-time target detection algorithm is used to segment the hyperspectral image to be predicted to obtain the hyperspectral image data of a single chrysanthemum to be predicted; in the actual processing of stacked chrysanthemums, the hyperspectral information is mixed due to mutual occlusion, making it difficult to directly apply the moisture content model of a single chrysanthemum. Through the superior performance of the YOLOv8n network structure in its target detection and instance segmentation tasks, the accurate segmentation and classification tasks of stacked chrysanthemums are achieved. After training, the model has good generalization ability and stability in processing complex stacking situations. The image of stacked chrysanthemum is segmented with good segmentation confidence. The YOLOv8 model performs very well in image segmentation tasks. Specifically, among the 276 target instances, only about 1% of the instances were incorrectly classified as background (i.e., misjudgment), showing extremely high accuracy and robustness. The results are as follows Figure 5 As shown in Figure 2, the segmentation model of the present invention shows good segmentation effect in different scenes, whether it is a simple one (only need to distinguish Chuju from the background, such as Figure 5 It is still more complicated (it is necessary to identify the Chuju that covers each other, such as Figure 5 The model can accurately identify and segment the chrysanthemums with high confidence, demonstrating its high efficiency in processing single or small categories of objects. For the chrysanthemums with more dispersed locations, the model can identify and segment them with very high confidence, indicating that the model has excellent performance under ideal conditions in these scenarios.
[0071] (7) A positive and negative classifier was established to classify the hyperspectral image data of a single chrysanthemum to be predicted into a positive image and a negative image. Table 4 shows the interactive verification results of the prediction of the moisture content of the front and back sides of Chuchrysanthemum. It can be seen that when the model established on the positive side is used to predict the moisture content of the back side or the negative model is used to predict the moisture content of the front side, the model performance is reduced compared with the evaluation indicators of the positive model predicting the positive side and the negative model predicting the negative side. This shows that the versatility of the Chuchrysanthemum front and back moisture content prediction model is reduced when mutual prediction is performed. It is necessary to classify the front and back spectra of Chuchrysanthemum.
[0072] Table 4 Interactive prediction of moisture content of front and back surfaces of Chuchrysanthemum by PLSR model
[0073]
[0074] In the task of classifying the front and back sides of Chuju, the present invention uses different classification algorithms, including:
[0075] Linear Discriminant Analysis (LDA) is a supervised classification technique suitable for dimensionality reduction and classification tasks on big data. Its core idea is to project sample data into a new space through a projection transformation, so that the projected points of samples of the same category are as close as possible, while the projected points of samples of different categories are as far apart as possible.
[0076] Artificial Neural Networks (ANNs) mimic the connections between neurons in the brain and are suitable for classification tasks. They receive data through the input layer, process it through weighted summation and nonlinear activation functions in the hidden layer, capturing complex patterns, and finally convert it into class probabilities using the softmax function in the output layer for classification tasks.
[0077] Random Forest (RF) achieves classification by integrating the predictions of multiple decision trees. It uses random sampling with replacement to generate multiple subsets, training a decision tree on each subset. When constructing each tree, only a subset of features is randomly selected to find the optimal split point, increasing model diversity. When presented with a new sample, RF feeds the sample into all decision trees for prediction, and the final classification is determined by majority voting. This approach reduces the risk of overfitting, improves model stability, and improves computational efficiency, making it well-suited for complex data environments.
[0078] Table 5. Classification data of Chuju front and back based on different classification algorithms
[0079]
[0080]
[0081] Table 5 shows that the accuracy of ANN is 96.64%, which has good adaptability, while LDA has the best effect, with only three errors in 238 classification tasks (such as Figure 3 shown).
[0082] (8) The chrysanthemum front moisture content prediction model is used to predict the moisture content of each pixel in the front image. Before making the prediction, the spectral data of each pixel in the image needs to be preprocessed before making the prediction. The preprocessing method is shown in step (3), so as to obtain the moisture content information of different areas of Chu chrysanthemum. Then, based on this moisture content distribution map, the moisture content changes of Chu chrysanthemum in different drying periods can be observed. Different predicted values are represented by different colors, and the generated moisture content distribution pseudo-color map is as follows: Figure 4 Through the visualization study of the moisture content of Chuchrysanthemum during the drying process, the current moisture content of Chuchrysanthemum can be directly observed, providing technical support for the high-quality production of Chuchrysanthemum.
[0083] (9) Repeat step (8) to predict the water content in different areas of the reverse side of the chrysanthemum using the water content prediction model for the reverse side of the chrysanthemum.
Claims
1. A method for detecting the water content and distribution of chrysanthemums based on hyperspectral technology, characterized in that: The steps include: (1) Obtain hyperspectral image data of the front and back of a single chrysanthemum with different water contents; (2) Based on the front hyperspectral image data of a single chrysanthemum, the front area of the chrysanthemum is selected as the region of interest, and the spectrum of the region of interest is extracted to obtain the original spectrum data of the front of the single chrysanthemum; (3) removing interference factors from the original spectral data of the front side of a single chrysanthemum to obtain the front preprocessed data; (4) The frontal preprocessed data were used to train the regression algorithm in supervised learning to establish a chrysanthemum frontal moisture content prediction model; (5) Based on the hyperspectral image data of the back side of a single chrysanthemum, repeat steps (2)-(4) to establish a chrysanthemum back side moisture content prediction model; (6) Using a real-time target detection algorithm to segment the hyperspectral image to be predicted to obtain hyperspectral image data of a single chrysanthemum to be predicted; (7) Classifying the hyperspectral image data of a single chrysanthemum to be predicted into a positive image and a negative image; (8) The chrysanthemum front moisture content prediction model is used to predict the moisture content of each pixel in the front image to obtain the moisture content of different areas on the front of the chrysanthemum; (9) Repeat step (8) and use the chrysanthemum back surface moisture content prediction model to predict the moisture content in different areas of the chrysanthemum back surface.
2. The method for detecting the moisture content and distribution of chrysanthemum based on hyperspectral technology according to claim 1, characterized in that: The chrysanthemum includes at least one of Hangzhou chrysanthemum, Gong chrysanthemum, Chu chrysanthemum, Bo chrysanthemum, Huai chrysanthemum and golden chrysanthemum.
3. The method for detecting the moisture content and distribution of chrysanthemum based on hyperspectral technology according to claim 1, characterized in that: The extracting of the spectrum of the region of interest includes: the size of the region of interest is the size of a single chrysanthemum, and the average spectrum of all pixels in the region of interest is used as the original spectrum data of the front side of the single chrysanthemum.
4. The method for detecting the moisture content and distribution of chrysanthemums based on hyperspectral technology according to claim 1, characterized in that: The method of removing interference factors from the front original spectral data of a single chrysanthemum includes: preprocessing the front original spectral data of a single chrysanthemum using at least one of an SG smoothing method, a multivariate scattering correction method, and a mean centering method to remove interference factors. The interference factors include interference caused by uneven distribution of particles of the object to be measured, different particle sizes, and instrument signal noise when the hyperspectral imaging system collects data.
5. The method for detecting the moisture content and distribution of chrysanthemum based on hyperspectral technology according to claim 1, characterized in that: The regression algorithm in the supervised learning includes one of a partial least squares regression algorithm, a support vector machine regression algorithm, and a principal component regression algorithm.
6. The method for detecting the moisture content and distribution of chrysanthemums based on hyperspectral technology according to claim 1, characterized in that: The real-time target detection algorithm includes the YOLOv8 model.
7. The method for detecting the moisture content and distribution of chrysanthemums based on hyperspectral technology according to claim 1, characterized in that: The classifying the hyperspectral image data of the single chrysanthemum to be predicted into the front image and the back image includes using one of an artificial neural network, a random forest algorithm, and a linear discriminant analysis algorithm to classify the hyperspectral image data of the single chrysanthemum to be predicted into the front image and the back image.
8. The method for detecting the moisture content and distribution of chrysanthemums based on hyperspectral technology according to claim 1, characterized in that: The step (8) further comprises the following steps: The predicted moisture content values in different areas of the front of the chrysanthemum are represented by different colors to generate a pseudo-color map of the moisture content distribution.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.
10. A computer storage medium, characterized in that The computer storage medium stores instructions, and when the instructions are executed on a computer, the computer is caused to perform the method according to any one of claims 1 to 8.