Method for rapidly detecting broccoli glucosinolate content based on multispectral image
By combining a BiLSTM and a self-attention mechanism-based CNN model, the problems of low efficiency and insufficient accuracy in the detection of broccoli glucosinolate content in existing technologies are solved, achieving efficient and accurate detection of broccoli glucosinolate content.
Patent Information
- Application Number
- CN202510851308.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2026-02-24
AI Technical Summary
Existing multispectral data processing methods are inefficient, complex, and difficult to fully extract deep feature information when detecting broccoli glucosinolate content. They also lack dynamic feature selection mechanisms, resulting in insufficient robustness and prediction accuracy.
A CNN model combining BiLSTM and self-attention mechanism is used for sequence modeling of multispectral data, dynamically weighting key spectral features, capturing the order dependency and long-range context information between spectral bands, and constructing a quantitative prediction model for total glucosinolates.
This technology enables rapid detection of high-throughput freeze-dried broccoli samples, improving the accuracy and robustness of predicting total glucosinolate content in broccoli and simplifying the detection process.
Smart Images

Figure CN121564705A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of agricultural intelligent detection technology, and more specifically to a method for rapidly detecting glucosinolate content in broccoli based on multispectral images. Background Technology
[0002] Currently, the main method for determining glucosinolate content is high-performance liquid chromatography (HPLC). However, these methods are complex, cumbersome, time-consuming, labor-intensive, environmentally polluting, and incompatible with high-throughput platforms that require rapid analysis of many samples. With the development of spectral imaging technology, scanning crops with spectral equipment allows for rapid and non-destructive understanding of the crop's nutritional status, and assessment of plant growth and size. Many researchers are already using spectral techniques to detect crop moisture content, chlorophyll content, and nitrogen content, among other parameters.
[0003] Traditional linear models (such as multiple linear regression (MLR) and partial least squares regression (PLSR) or shallow machine learning models (such as support vector machine (SVM) and random forest (RF)) often perform poorly when dealing with high-dimensional, nonlinear, and complex multispectral data with inter-band correlations, making it difficult to fully extract the deep feature information contained in the data.
[0004] In recent years, deep learning models, especially convolutional neural networks (CNNs), have demonstrated advantages in spectral and image analysis due to their powerful feature extraction capabilities. CNN models can effectively capture spatial texture features and a certain degree of local spectral patterns in multispectral images. However, CNNs inherently focus more on spatial or spectral features within the local receptive field, and their ability to model long-range dependencies across the spectral dimension is limited. Spectral data is essentially a one-dimensional sequence of signals ordered by wavelength (or band number), where significant correlations may exist between distant bands. Standard CNN architectures struggle to explicitly model such directional long-range dependencies spanning multiple bands.
[0005] Furthermore, existing deep learning-based prediction models, whether CNNs or simple fully connected networks, typically lack dynamic feature selection mechanisms. They assign equal importance to all input spectral features (or extracted features) or process them with fixed weights. However, in practical applications, the spectral response intensities of different glucosinolate components vary and are easily affected by background noise, sample conditions, and other factors. The lack of automatic focusing on key discriminative spectral information reduces the model's robustness when facing complex samples or noise, making it difficult to further improve prediction accuracy.
[0006] Therefore, how to predict the glucosinolate content of broccoli based on hyperspectral images is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0007] In view of this, the present invention provides a method for rapid detection of glucosinolate content in broccoli based on multi-light imaging, which realizes high-throughput rapid detection of freeze-dried broccoli samples.
[0008] To achieve the above objectives, the present invention adopts the following technical solution:
[0009] A method for rapid detection of glucosinolate content in broccoli based on multispectral images includes the following steps:
[0010] A training set is constructed, which includes multispectral images of broccoli powder and the corresponding total glucosinolates;
[0011] Construct a quantitative prediction model for total glucosinolates;
[0012] The total glucosinolate quantitative prediction model is trained using the training set;
[0013] The glucosinolate content in broccoli was detected using the trained optimal quantitative prediction model.
[0014] Preferably, the steps of constructing the training set include:
[0015] Multispectral images were acquired using a Videoometer Lab4 instrument while broccoli powder was spread out in a flat state.
[0016] Glucosinosides were extracted from broccoli powder, and various glucosinosides and their derivatives were measured to obtain total glucosinosides.
[0017] Preferably, the glucosinolates and their derivatives include: 2-hydroxy-3-butenyl thioglycoside (PRO), 4-pentenyl thioglycoside (GBN), 4-methylthiooxybutyl thioglycoside (GRA), 3-butenyl thioglycoside (NAP), 4-hydroxy-3-indolemethyl thioglycoside (4OH), 1-methoxy-3-indolemethyl thioglycoside (NEO), 3-indolemethyl thioglycoside (GBC), and 4-methoxy-3-indolemethyl thioglycoside (4ME).
[0018] Preferably, the step of constructing the training set further includes:
[0019] Threshold segmentation is used to extract multispectral information from the multispectral image. After extracting the green region of the multispectral image, spectral information is extracted.
[0020] Feature band extraction is performed using a continuous projection algorithm.
[0021] Preferably, the obtained raw spectral reflectance is preprocessed before extracting the characteristic bands.
[0022] Preferably, the preprocessing method is SNV, SG smoothing filter or SNV+SG.
[0023] Preferably, the Total-GSLs quantitative prediction model is a CNN model, a CNN-BILSTM model, or a CNN-BILSTM-ATTENTION model.
[0024] A system for rapid detection of glucosinolate content in broccoli based on multi-light images includes: an image acquisition module, a feature extraction module, and a prediction module;
[0025] The image acquisition module is used to acquire multispectral images of broccoli powder;
[0026] The feature extraction module is used to extract target features based on the multispectral image;
[0027] The prediction module is used to predict the total glucosinolate content based on the target characteristics.
[0028] As can be seen from the above technical solution, compared with the prior art, the present invention discloses a method for rapid detection of glucosinolate content in broccoli based on multi-spectral images, which uses multispectral technology combined with image texture to achieve high-throughput rapid detection of freeze-dried broccoli samples.
[0029] This study combines a bidirectional long short-term memory network (BiLSTM) with a self-attention mechanism for sequence modeling of multispectral data. BiLSTM effectively captures the sequential dependencies and long-range contextual information between spectral bands, while the self-attention mechanism dynamically weights key spectral features, focusing on the most discriminative information. The synergy between the two significantly improves the ability to extract deep features from complex spectra to accurately predict the total glucosinolate content of broccoli. Attached Figure Description
[0030] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0031] Figure 1 This is a schematic diagram of a method for rapid detection of glucosinolate content in broccoli using multispectral images, provided by the present invention.
[0032] Figure 2 This is a framework structure diagram of different neural network models in the embodiments of the present invention.
[0033] Figure 3 This is a schematic diagram of the spectral reflectance of broccoli powder under different pretreatment methods in the embodiments of the present invention.
[0034] Figure 4 This is a schematic diagram showing the performance evaluation results of different prediction models for the total glucosinolate content in broccoli samples in this embodiment of the invention. Detailed Implementation
[0035] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0036] Example 1
[0037] like Figure 1 and Figure 2 , Figure 1 In the diagram, a: test sample; b: VideometerLab4 instrument; c: multispectral data acquisition; d: multispectral reflectance curve; e: spectral preprocessing; f: high performance liquid chromatograph; g: single-band spectral characteristics; h: glucosinolate content; i: characteristic spectral extraction; j: deep learning model construction.
[0038] This invention discloses a method for rapidly detecting glucosinolate content in broccoli based on multispectral images, comprising the following steps:
[0039] S1: Construct the training set. The training set consists of multispectral images of broccoli powder and the corresponding total glucosinolates.
[0040] S2: Construct a quantitative prediction model for Total-GSLs.
[0041] S3: Train the Total-GSLs quantitative prediction model using the training set.
[0042] S4: The content of glucosinolates in broccoli was detected using the trained Total-GSLs quantitative prediction model.
[0043] In one embodiment, S1 specifically includes:
[0044] S11: Obtain sample materials.
[0045] For example, prepare 108 portions of broccoli. After the florets mature, divide the florets into equal parts, take one portion, flash-freeze it with liquid nitrogen, and bring it back to the laboratory. Freeze-dry it in a freeze dryer, grind it into powder, and then store it at -80°C for later use.
[0046] S12: Multispectral image acquisition.
[0047] For example, broccoli powder was spread evenly in a 6cm petri dish and analyzed using a Videoometer Lab4 instrument (Videometer A / S). Multispectral image acquisition was performed in Denmark, with a spectral wavelength range of 365 nm to 970 nm. The generated 2056 × 2056 pixel spectral images had a resolution of ~41 μm / pixel, and the processing time for each sample was 5 s to 10 s. Before starting the test, the VideoometerLab4 instrument was warmed up for 30 min, the MSI parameter was set, each sample was placed in the center of the stage, the initial descent height of the instrument sphere was set to 60 mm, and the acquisition height of the sample carrier stage was set to 0 mm. Three technical replicates were performed.
[0048] S13: Data extraction.
[0049] S131: Extract spectral reflectance information from multispectral image data.
[0050] S131: Threshold segmentation is used to extract data from the multispectral image. After extracting the green region of the multispectral image, spectral information is extracted. Image texture reflects the physical and biochemical characteristics of organisms.
[0051] For example, GLCM and LBP are used to extract texture features from multispectral images. Contrast, correlation, energy, and homogeneity are derived from GLCM. Parameters LBP1 to LBP59 are extracted from LBP. Parameters with a value of 0 are removed, leaving a total of 15.
[0052] S14: Data Processing
[0053] S141: Preprocessing of spectral reflectance information. To improve model accuracy, the obtained raw spectral reflectance data is preprocessed. Common preprocessing methods include standardization and derivative methods. This embodiment uses three preprocessing methods: Standard Normalized (SNV), SG smoothing filter, and SG+SNV, to remove data noise and improve model accuracy.
[0054] S142: Extracting feature bands can reduce the computational load of the model, improve its computational speed, and reduce the probability of overfitting. This embodiment uses the Continuous Projection Algorithm (SPA) for feature band extraction. The SPA algorithm projects band information onto other wavelength information through mathematical transformations; the feature band is the band information with the largest projection among these.
[0055] Specifically, initialization is performed first. Let the spectral data be a matrix X (rows: number of samples; columns: wavelength points / spectral channels), and n characteristic wavelengths need to be selected. The initial wavelength point λ1 is randomly selected, or a starting point is selected according to rules (such as selecting bands with large spectral differences).
[0056] Then, iterative projection filtering is performed: for the currently selected wavelength combination, the projection of the remaining wavelength points onto the vector of the selected wavelengths is calculated (using the vector projection formula to highlight the information gain of the new wavelengths). The formula simplifies to...
[0057]
[0058] Where, x j is the spectral vector of the j-th remaining wavelength, and r is the residual vector of the selected wavelength. The goal is to find wavelengths that have a weak linear correlation with the selected wavelengths and can supplement new information.
[0059] The wavelength point with the largest projection value is added to the set of selected wavelengths, and the residual vector is updated (the residual is recalculated based on the new combination to reflect the uninterpreted spectral information).
[0060] Repeat the projection calculation – selecting new wavelengths – until n feature wavelengths are selected, or a preset stopping condition is met (e.g., cross-validation accuracy no longer improves). The resulting n feature wavelengths (or corresponding spectral data) are used for subsequent model construction.
[0061] In one embodiment, S2 specifically includes:
[0062] A quantitative prediction model for total glucosinolates was constructed using preprocessed spectral data and image texture features as input parameters. Using the full spectrum and characteristic spectrum as dependent variables, and total glucosinolates in broccoli powder as independent variables, CNN, CNN-BILSTM, and CNN-BILSTM-ATTENTION models were employed to construct prediction models for GRA and TotalGSLs.
[0063] For example, such as Figure 2 As shown in Figure a, apart from the input layer and the output layer, the basic structure of a CNN consists of an input layer, a convolutional layer, a pooling layer, a fully connected layer, and an output layer.
[0064] like Figure 2 As shown in b, BiLSTM combines two LSTM networks: one processes the data in the forward direction (forward LSTM) and the other processes the data in the reverse direction (reverse LSTM). This bidirectional approach allows BiLSTM to capture dependencies in past and future contexts, making it suitable for tasks that require a comprehensive understanding of temporal relationships.
[0065] like Figure 2As shown in c, CNN-BiLSTM-ATTENTION uses an attention mechanism to perform weighted summation when outputting the hidden state at the last time point, thereby enhancing the representation of key information.
[0066] To further implement the above technical solution, R is used. 2 RMSE is used to evaluate the obtained model, and its R... 2 The larger the value and the closer it is to 1, the lower the RMSE, indicating higher model accuracy.
[25] The formulas for the two evaluation coefficients are as follows:
[0067]
[0068] Among them, y i This is the actual value. It is an estimated value. is the mean of the actual values of the sample, and n is the sample size.
[0069] Next, the effects of the present invention will be further explained with reference to specific experimental data:
[0070] 1. Analysis of total glucosinolate content in broccoli
[0071] Analysis of 108 broccoli inbred lines revealed rich genetic diversity based on the measured total glucosinolate (Total GSL) data (Table 1). The coefficient of variation for Total GSLs was 51.72%, indicating a significant range of variation and suggesting substantial differences among the 108 broccoli inbred lines, thus enhancing model fit.
[0072] Table 1 Total Glucosinolate (GSL) contents
[0073]
[0074] 2. Spectral analysis
[0075] Figure 3Figure 'a' shows the spectral reflectance of all broccoli pollen. Specifically, different samples exhibit similar absorption peaks at the same or similar wavelengths, but differences exist in the peak values of the absorption peaks at the same wavelengths. These differences may be due to changes in the internal physicochemical composition of broccoli during growth and development. The differences in spectral reflectance are most pronounced between 450 nm and 700 nm. The increase in glucosinolates leads to changes in the broccoli spectrum, indicating a potential linear / nonlinear correlation between spectral characteristics and glucosinolate content, providing a theoretical basis for modeling. Since the samples are water-free, no reflectance valley was observed near 920-935 nm, but the remaining spectral overlap complicates the accurate differentiation of sample variations. Further analysis and application of predictive models are necessary for accurate quantitative analysis of Total GSLs.
[0076] Due to environmental factors, the original spectral reflectance contains errors. Using SG smoothing filtering can remove irrelevant signals from the spectral data and make the data smoother. Figure 3 b). Due to the large range of spectral data for the object under test, the SNV standard normalization method was chosen to eliminate the significant discrepancies. Figure 3 c), Fig. 4d shows the preprocessing results of combining SG smoothing filtering and SNV standard normalization.
[0077] 3. Use different deep learning models across the entire spectrum for discrimination and analysis.
[0078] A predictive model for the total GSL content of freeze-dried broccoli samples was constructed using all spectral bands (365–970 nm) and three deep learning algorithms.
[0079] The original data was processed using SG preprocessing and SG+SNV preprocessing. Figure 4 In the model, a, c, and e represent the models after SG preprocessing. Figure 4 In the model, b, d, and e represent the models after SG+SNV preprocessing. A comparison shows that the models after SG+SNV preprocessing all perform better than the models after SG preprocessing. Since the input data of the quantitative prediction model in this invention vary greatly, the model performs better after SNV preprocessing.
[0080] according to Figure 4The results show that the model with the best prediction performance is SG+SNV+CNN+BiLSTM+Attention, with an R2TEST score of 0.943 and an RMSE of 1.567. The second best performance is achieved by SG+CNN_BiLSTM+Attention, with an R2TEST score of 0.937 and an RMSE of 1.641. These results demonstrate that the deep learning model (CNN_BiLSTM+Attention) provided in this invention can more effectively predict glucosinolate content.
[0081] 4. Using different deep learning models for characteristic bands for discrimination and analysis
[0082] To shorten model runtime and improve accuracy, this study employs a continuous projection algorithm for data dimensionality reduction. For data with different preprocessing steps, features highly correlated with total glucosinolates are extracted to reduce model complexity. Feature selection methods help identify wavelengths with the highest information content, effectively minimizing noise and eliminating irrelevant features. By prioritizing relevant features while reducing dimensionality, data quality is improved and model robustness is enhanced.
[0083] Modeling was performed using the extracted feature bands. The final results showed that the SG+CNN model performed best, with its test set R... 2 =0.929, RMSE=1.748. Next, using SG+CNN+BILSTM+AT TENTION, R2TEST=0.901, RMSETEST=2.065. It can be seen that because feature bands are used for modeling, the model input is reduced, so the simpler CNN model performs better.
[0084] Compared to the full-band results, the R-value of the model after feature extraction is higher. 2 The RMSE generally decreased, which is related to the complexity of the model. At the same time, since the spectral information of glucosinolates exhibits complex nonlinear correlations, it can be seen that the deep learning model provided by this invention can extract complex nonlinear and linearly correlated features, and the model using the whole band as input is better than the model using the feature band as input.
[0085] While models using feature bands as input show a decline in some metrics compared to full-band input, relatively simple models like SG+CNN achieve good results. Therefore, in specific situations, this combination with a small amount of data can still be used, as it will perform better in terms of runtime and model robustness.
[0086] Example 2
[0087] Based on the same inventive concept, embodiments of the present invention disclose a system for rapidly detecting glucosinolate content in broccoli based on multispectral images, comprising:
[0088] Image acquisition module: configured to acquire multispectral images and obtain spectral data when broccoli powder is spread out.
[0089] Feature extraction module: configured to receive spectral data from the image acquisition module and extract target features based on the spectral data.
[0090] Prediction module: configured to receive target features from the feature extraction module and predict the total glucosinolate content of broccoli based on the target features using a pre-trained total glucosinolate quantitative prediction model.
[0091] To further implement the above technical solution, the following are also included:
[0092] Training label generation module: configured to extract glucosinolates from the broccoli powder and measure various glucosinolates and their derivatives to obtain the total glucosinolate content as training labels.
[0093] Model training module: configured to train the total glucosinolate quantitative prediction model using a training set containing the spectral data and corresponding total glucosinolate content training labels.
[0094] To further implement the above technical solution, the feature extraction module includes:
[0095] Preprocessing unit: configured to preprocess the multispectral data to obtain spectral reflectance.
[0096] Region segmentation unit: configured to process the multispectral image using threshold segmentation to extract the green region of the multispectral image.
[0097] Texture feature extraction unit: configured to extract texture features on the extracted green area.
[0098] The target features include at least the spectral reflectance and / or the texture features.
[0099] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0100] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for rapid detection of glucosinolate content in broccoli based on multispectral imaging, characterized in that, Includes the following steps: A training set is constructed, which includes multispectral images of broccoli powder and the corresponding total glucosinolate content; a quantitative prediction model for total glucosinolates is constructed. The total glucosinolate quantitative prediction model is trained using the training set; The total glucosinolate content in broccoli was detected using the trained quantitative prediction model.
2. The method for rapid detection of glucosinolate content in broccoli based on multispectral imaging according to claim 1, characterized in that, The steps for constructing the training set include: Multispectral image acquisition was performed while broccoli powder was spread out, spectral data was obtained, and the spectral data was used as model input. Glucosinosides were extracted from broccoli powder, and various glucosinosides and their derivatives were measured to obtain total glucosinosides as training labels.
3. The method for rapid detection of glucosinolate content in broccoli based on multispectral imaging according to claim 2, characterized in that, The thioglucosides and their derivatives include: 2-hydroxy-3-butenyl thioglycoside (PRO), 4-pentenyl thioglycoside (GBN), 4-methylthiooxybutyl thioglycoside (GRA), 3-butenyl thioglycoside (NAP), 4-hydroxy-3-indolemethyl thioglycoside (4OH), 1-methoxy-3-indolemethyl thioglycoside (NEO), 3-indolemethyl thioglycoside (GBC), and 4-methoxy-3-indolemethyl thioglycoside (4ME).
4. The method for rapid detection of broccoli glucosinolate content based on multispectral imaging according to claim 2, characterized in that, The step of constructing the training set further includes: The multispectral data is preprocessed to obtain the spectral reflectance; Threshold segmentation is used to extract the multispectral image, and texture features are extracted after the green region of the multispectral image is extracted.
5. The method for rapid detection of glucosinolate content in broccoli using multispectral imaging according to claim 4, characterized in that, The preprocessing method used is SNV, SG smoothing filter or SNV+SG.
6. The method for rapid detection of glucosinolate content in broccoli using multispectral imaging according to claim 1, characterized in that, The total glucosinolate quantitative prediction model includes: an input module, a feature extraction module, a feature enhancement module, and an output prediction module; The input module is used to acquire the spectral data; The feature extraction module is used to extract preliminary features based on the spectral data; The feature enhancement module is used to perform sequence modeling on the preliminary features using a bidirectional long short-term memory network, and to perform weighted summation on the output of the bidirectional long short-term memory network through a self-attention layer to obtain enhanced features. The output prediction module is used to map the enhanced features to the total glucosinolate value.
7. The method for rapid detection of broccoli glucosinolate content based on multispectral imaging according to claim 1, characterized in that, The quantitative prediction model for total glucosinolates is a CNN model or a CNN-BILSTM model.
8. The method for rapid detection of glucosinolate content in broccoli based on multispectral imaging according to claim 7, characterized in that, The steps for constructing the training set include: After extracting full-band spectral data from the multispectral image, a continuous feature algorithm is used to extract feature bands.
9. A system for rapid detection of glucosinolate content in broccoli based on multispectral imaging, characterized in that, The method described in any one of claims 1-8 includes: an image acquisition module, a feature extraction module, and a prediction module; The image acquisition module is used to acquire multispectral images of broccoli powder; The feature extraction module is used to extract target features based on the multispectral image; The prediction module is used to predict the total glucosinolate content based on the target characteristics.