Deep learning model-based mature-period rapeseed oil content prediction method and system

By introducing residual connection module, timing feature extraction module and pooling module in the deep learning model, combined with near-infrared spectral data, the problem of incomplete feature extraction in the existing technology is solved, and a higher precision rapeseed oil content prediction is achieved.

CN120164208APending Publication Date: 2025-06-17HUAZHONG AGRI UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510097463.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-22
Publication Date
2025-06-17

AI Technical Summary

Technical Problem

When processing rapeseed spectral data, existing deep learning methods cannot fully explore potential features in the data, resulting in incomplete feature extraction and low prediction accuracy.

Method used

A method for predicting oil content of rapeseed in maturity based on deep learning model is proposed. By introducing residual connection module, timing feature extraction module and pooling module in U-Net, combined with near-infrared spectral data, the depth and timing features of rapeseed samples are extracted.

Benefits of technology

This method can more comprehensively extract the characteristics in the rapeseed spectral data, improve the accuracy and robustness of oil content prediction, and is suitable for large-scale sample detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120164208A_ABST
    Figure CN120164208A_ABST
Patent Text Reader

Abstract

The invention discloses a mature rapeseed oil content prediction method and system based on a deep learning model, and the method comprises the following steps: deleting a decoding layer in an image segmentation network U-Net, and replacing a convolution module in a U-Net coding layer with a residual connection module, the residual connection module is used for performing a series of convolution and nonlinear transformation on the mature rapeseed samples to obtain depth feature representation of the samples; the input of the residual connection module and the depth feature representation are added through jump connection to serve as the output of the residual connection module; a time sequence feature extraction module and an average pooling module are introduced into the U-Net, the time sequence feature extraction module is used for extracting time sequence features in mature-period rapeseed samples, the detail features and the time sequence features are spliced and then input into the average pooling module and a maximum pooling module, and local features and global features in the samples are further extracted; the oil content of the rapeseed sample in the mature period is output through the full connection layer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of detecting the content of plant components, and particularly relates to a method and system for predicting the oil content of mature rapeseed based on a deep learning model. Background Art

[0002] As an important oil crop in China, rapeseed's oil content is a key indicator for measuring its quality, which has a profound impact on edible oil production, livestock feed formulation, and the selection of industrial raw materials. Accurately detecting the oil content of rapeseed not only helps optimize planting strategies and enhance the economic value of crops, but also is of great significance for ensuring national grain and oil security. With the development of agricultural modernization, higher requirements are put forward for the efficiency, accuracy, and non-destructiveness of rapeseed oil content detection.

[0003] Traditional methods for detecting the oil content of rapeseed mostly rely on chemical analysis methods, such as the gravimetric method based on the GB / T14488.1-2008 standard. Although such methods can obtain relatively accurate oil content data, they are cumbersome to operate, time-consuming, destructive during the detection process, costly, and difficult to meet the requirements of high-throughput detection. In view of this, near-infrared spectroscopy technology has emerged. It can quickly and non-destructively obtain the spectral information of rapeseed and has the potential for wide application in the field of precision agriculture. However, the near-infrared spectral data is complex, and traditional spectral analysis means are difficult to fully exploit the effective information related to the oil content therein. Therefore, deep learning methods are introduced to utilize their powerful feature extraction and data processing capabilities to improve the accuracy of oil content prediction.

[0004] However, there are still many problems in the practical application of deep learning methods. Early deep learning models had poor curve fitting effects when dealing with large-scale rapeseed spectral datasets, and were unable to accurately depict the complex relationship between the oil content and spectral data, resulting in large prediction deviations. At the same time, the model structure was not fine enough to comprehensively and efficiently extract the key features in the spectral data. Summary of the Invention

[0005] The present invention proposes a system and method for predicting the oil content of mature rapeseed based on a deep learning model, which solves the problem that existing deep learning methods do not fully exploit various potential features in the spectral data, resulting in incomplete feature extraction.

[0006] To solve the above technical problems, the present invention provides a method for predicting the oil content of mature rapeseed based on a deep learning model, including the following steps:

[0007] Step S1: Delete the decoding layer in the image segmentation network U-Net, and replace the convolutional module in the U-Net encoding layer with a residual connection module. The residual connection module performs a series of convolutions and non-linear transformations on the mature rapeseed samples to obtain a deep feature representation of the mature rapeseed samples; add the input of the residual connection module to the deep feature representation through a skip connection as the output of the residual connection module.

[0008] Step S2: Introduce a temporal feature extraction module and an average pooling module into U-Net. The temporal feature extraction module is used to extract the temporal features in the mature rapeseed samples. After concatenating the outputs of the residual connection module and the temporal feature extraction module, input them into the average pooling module and the max pooling module of U-Net respectively to further extract the global features and local features in the mature rapeseed samples.

[0009] Step S3: Concatenate the local features and the global features and input them into a fully connected layer to obtain the oil content of the mature rapeseed samples.

[0010] Preferably, in step S1, a context information extraction module is introduced at the bottom layer of the U-Net encoding layer. The context information extraction module captures multi-scale features of mature rapeseed samples from local details to global semantics through convolutional operations with different dilation rates.

[0011] Preferably, an attention module is also set in the residual connection module. The attention module adaptively adjusts the weights of different feature channels by learning the correlations between feature channels.

[0012] Preferably, the local feature extraction module extracts the detailed features of mature rapeseed samples through layer-by-layer convolution, and the temporal feature extraction module extracts the temporal features of mature rapeseed samples through a multi-head attention mechanism.

[0013] Preferably, the average pooling module extracts the global features of the feature map by calculating the average value of each region of the input feature map, and the max pooling module retains the local features of the feature map by selecting the maximum value in the local region of the input feature map.

[0014] Preferably, in step S1, a near-infrared spectrometer is used to measure the spectral curve of mature rapeseed, obtain spectral data within a specific wavelength range of mature rapeseed, and obtain mature rapeseed samples.

[0015] Preferably, after obtaining the mature rapeseed samples in step S1, preprocess the samples, including the following steps: smooth the spectral data through a filter to remove high-frequency noise in the spectral data, and introduce random noise into the denoised spectral data.

[0016] The present invention also provides a prediction system for the oil content of mature rapeseed based on a deep learning model, which is implemented based on the above-mentioned prediction method for the oil content of mature rapeseed based on a deep learning model, and includes: a data acquisition module, an oil content determination module, a prediction model construction module, a prediction model training module, and an oil content prediction module;

[0017] The data acquisition module: uses a near-infrared spectrometer to measure the spectral curve of rapeseed samples, and obtains spectral data of rapeseed samples within a specific wavelength range;

[0018] The oil content determination module: uses chemical analysis methods to measure the oil content of rapeseed samples, and obtains the true value of the oil content of rapeseed;

[0019] The prediction model construction module: constructs a prediction model including a local feature extraction module, a temporal feature extraction module, and a pooling module. The local feature extraction module extracts detailed features in the spectral data through layer-by-layer convolution; the temporal feature extraction module extracts temporal features in the spectral data through a multi-head attention mechanism; the pooling module is used to further extract local features and global features in the detailed features and temporal features;

[0020] The prediction model training module: uses rapeseed samples to train the prediction model, and optimizes the parameters of the prediction model by minimizing the gap between the true value of the oil content of rapeseed samples and the predicted value of the prediction model;

[0021] The oil content prediction module: inputs the spectral curve of the rapeseed to be measured into the optimized prediction model, and obtains the oil content of the rapeseed to be measured.

[0022] Preferably, the prediction model training module randomly divides the spectral data into a first data set and a second data set, calculates the test statistic between the two data sets, looks up the critical value according to the test sample size and the set significance level. If the test statistic is greater than the critical value, it is considered that the distributions of the two data sets are significantly different, and the first data set and the second data set are used as the training set and the test set respectively, otherwise the data set is re-divided.

[0023] Preferably, after the prediction model training module divides the spectral data into a training set and a test set, it performs data augmentation on the training set, including the following steps: for each sample in the training set, add every two of the three measured spectral curves in the sample and then take the average, while retaining the three original measured spectral curves, to obtain the data-augmented training set.

[0024] The advantages of the present invention at least include:

[0025] 1. The local feature extraction module in the system extracts detailed features from spectral data through layer-by-layer convolution, which can capture local and subtle feature information in spectral data; the temporal feature extraction module uses a multi-head attention mechanism to extract temporal features from spectral data, which helps to mine the potential patterns and laws of spectral data in the time dimension; the residual connection module adds the input and output and passes them to the subsequent layers, effectively solving the gradient vanishing or gradient exploding problem of deep neural networks during training, enabling the model to learn features at a deeper level; the pooling module further extracts local and global features, retains key information while reducing data dimensions, and improves the generalization ability and computational efficiency of the model;

[0026] 2. The data acquisition module uses a near-infrared spectrometer to measure the spectral curve of rapeseed samples and obtain spectral data within a specific wavelength range. Near-infrared spectroscopy technology can simultaneously obtain crop spatial and spectral information, and can quickly and non-destructively detect rapeseed samples. Compared with traditional detection methods, it will not cause damage to the samples and is more efficient, making it suitable for large-scale sample detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 A schematic diagram of a method flow of an embodiment of the present invention;

[0028] Figure 2 A near infrared spectrum graph of a sample collected according to an embodiment of the present invention;

[0029] Figure 3 A schematic diagram of the oil content distribution of samples collected in an embodiment of the present invention;

[0030] Figure 4a It is the initial convolution module of the U-Net encoding layer;

[0031] Figure 4b The ResNet convolution module of the improved U-Net encoding layer in the embodiment of the present invention;

[0032] Figure 5 It is a structural schematic diagram of an ASPP module according to an embodiment of the present invention;

[0033] Figure 6 A schematic diagram of the structure of a prediction model according to an embodiment of the present invention;

[0034] Figure 7a This is the average relative standard deviation of the near infrared spectrum curves of 291 mature rapeseeds in a certain city;

[0035] Figure 7b This is the average relative standard deviation graph of the near-infrared spectral curves of 280 mature rapeseeds in this city. DETAILED DESCRIPTION

[0036] Combined with the accompanying drawings in the embodiments of the present invention, the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0037] Vegetable oilseeds play an important role in the diets of residents. In particular, rapeseed, whose output accounts for 42.2% of the total domestic edible vegetable oil production, plays a key role in ensuring national grain and oil security. The oil content of rapeseed is an important indicator for evaluating its quality and directly affects its economic and nutritional value.

[0038] As a non-destructive detection method, near-infrared spectroscopy technology has shown great application potential in the agricultural field. Deep learning can automatically extract complex features by processing a large amount of sample data, improving the accuracy and efficiency of detection. Therefore, in the embodiments of the present invention, taking rapeseed as the research object, a method for detecting the quality of crop seeds is proposed. By combining a deep learning network with near-infrared spectral data, a Figure 1 prediction method for the oil content of rapeseed at the mature stage based on a deep learning model as shown is designed, which specifically includes the following steps:

[0039] Step S1: Collect rapeseed samples at the mature stage and obtain the near-infrared spectral curves and oil content data of the rapeseed samples.

[0040] Specifically, the data set in the embodiments of the present invention consists of 681 groups of samples. The test materials cover 41 planting varieties in various main rapeseed production areas and 24 typical rapeseed varieties harvested from various places. This data set fully reflects the diversity of regions and varieties and provides a solid foundation for the training and generalization ability of the model.

[0041] A NIR-M-R2 type near-infrared spectrometer of Puyan Interconnection is used to collect spectral data of rapeseed samples. The wavelength range of this spectrometer is 900 - 1700 nanometers. To ensure the repeatability of test data and the stability of the model, the optical path of the instrument is screened. The absorbance of the reference whiteboard is collected through preliminary tests every 10 minutes and repeated 20 times. The results show that within the wavelength range of 900 - 1633 nanometers, the absorbance of this instrument remains stable and the signal has high reliability. However, after the wavelength exceeds 1636 nanometers, the fluctuation of the absorbance curve increases significantly. Therefore, considering the test stability and accuracy, the embodiments of the present invention select the spectral range of 900 - 1633 nanometers for subsequent analysis.

[0042] The experimental device for spectral data acquisition includes a reference whiteboard, a sample to be measured, and a sample cup. In specific operations, after placing the rapeseed sample in the sample cup, the spectrometer first collects the spectral signal of the reference whiteboard, and then collects the spectral data of the rapeseed in the sample cup. And the absorbance of the sample is calculated according to the following formula:

[0043]

[0044] In the formula, A is the absorbance; I s is the reference spectrum; I a is the sample spectrum.

[0045] In the experiment, a spectral acquisition device was used to obtain data on the test materials. For each rapeseed sample, spectral data was collected 3 times at room temperature, the exposure time was set to 0.635 milliseconds, the initial spectrum was obtained by 6 - time averaging without smoothing, and then the actual spectrum was obtained through 32 - fold gain processing. Finally, a total of 681 groups of samples were collected, generating 2043 spectral data. After averaging the spectral data within the group, the generated near - infrared spectral curve is as Figure 2 shown. It can be seen from Figure 2 that there are differences between the spectral curves of different rapeseed varieties. These differences fully reflect the uniqueness of each variety in chemical composition and structural characteristics, demonstrating the good characterization ability of spectral data for variety characteristic information, and providing a key basis for subsequent classification and prediction analysis.

[0046] According to the national standard GB / T 14488.1 - 2008, the oil content of rapeseed was determined by a Kjeldahl nitrogen analyzer and liquid chromatography. After measurement, the oil content range of the rapeseed samples collected in the embodiments of the present invention is 28.9% to 54.9%, as Figure 3 shown. The statistical analysis results show that the Shapiro - Wilk statistic for the normality test is W = 0.99, and the corresponding significance level P = 0.13, indicating that the data distribution of the samples is close to a normal distribution and does not deviate significantly from normality (P>0.05). The skewness Skewness = 0.22 indicates that the data distribution is slightly skewed to the right, but the deviation degree is small; the kurtosis Kurtosis = 0.24 indicates that the peakedness of the data distribution is close to a normal distribution. Generally speaking, the oil content data is normally distributed, conforms to the normal sampling law, and is suitable for subsequent statistical modeling and analysis.

[0047] After collecting the rapeseed samples at maturity, the data needs to be divided and pre - processed.

[0048] Specifically, the ways of dividing the data set include:

[0049] A. KS division

[0050] The Kolmogorov-Smirnov test is used to evaluate the distribution difference by comparing the empirical distribution functions (EDFs) of two samples. Suppose there are two sample datasets X1, X2,..., X n and Y1, Y2,..., Y m , and their corresponding empirical distribution functions are F n (x) and G m (x) respectively. The calculation formula of the KS statistic D is as follows:

[0051] D = sup x |F n (x) - G m (x)|;

[0052] In the formula, sup x represents taking the maximum value for all x; n is the sample size of F n (x); m is the sample size of G m (x).

[0053] By calculating this statistic, it can be tested whether the distributions of the two groups of data are significantly different. If the KS statistic is greater than the critical value, the null hypothesis is rejected, indicating that there is a significant difference between the datasets.

[0054] B. Spatial balanced random SPXY

[0055] Full name is Sample Set Partitioning Based on Joint X-Y Distances (SPXY), which is a method for partitioning a dataset based on the joint X-Y distance between samples. Its purpose is to achieve a balanced partition by minimizing the distance between samples within a subset and maximizing the distance between subsets. The specific steps include calculating the joint distance i between each pair of samples (X i , Y j ) and (X j , Y to construct a distance matrix D. Using a clustering algorithm such as K-means, partition the dataset based on the distance matrix, so that the samples within the same subset have high similarity and the differences between subsets are large, ensuring the spatial balance of the data partition.

[0056] C. Stratified sampling

[0057] Stratified sampling is a method of dividing the population into multiple sub-groups according to specific categories or characteristics and then independently sampling from each stratum, aiming to ensure that each stratum can represent the overall characteristics. The specific steps are: divide the population into K strata according to a certain characteristic, and then in each stratum L kIndependently extract samples from the population, usually using the proportional sampling method, that is, the number of samples n k extracted from each stratum k is proportional to the proportion p k of that stratum. The formula for calculating the number of samples n

[0058] n k = N × p k ;

[0059]

[0060] In the formula, N is the total number of samples; L k is the number of samples in the k-th stratum; L is the total number of samples.

[0061] D. Random Sampling

[0062] The embodiments of the present invention use four dataset partitioning methods to group 681 sets of samples, including random sampling (Random, None), Kennard-Stone method (KS), spatial balanced random partitioning based on joint X-Y distances (SPXY, sample set partitioning based on joint X-Y distances), and stratified sampling (StratifiedSampling). The dataset is partitioned according to the ratio of 8:2 for the training set and the test set, and finally 544 samples are obtained for training and 137 samples are obtained for testing. The above partitioning methods aim to ensure the representativeness of the data distribution and the stability of model training.

[0063] After the partitioning of the dataset is completed, it is also necessary to preprocess the near-infrared spectral data of multiple crop seeds to remove the noise signals and baseline drifts existing in the original spectra, so as to improve the data recognition ability and prediction accuracy of the model. The preprocessing methods adopted in the embodiments of the present invention include the following:

[0064] A. Normalization and Standardization Methods: By adjusting the scale or distribution of the data to make it suitable for subsequent analysis or modeling. Include:

[0065] Z-Score Standardization: By subtracting the mean and dividing by the standard deviation, the data has a zero mean and a unit standard deviation.

[0066] Multiplicative Scatter Correction (MSC): Eliminate the scattering effect in the spectral data and standardize the data to improve the contrast.

[0067] Standard Normal Variate (SNV): A standardization transformation that removes scattering and illumination effects from spectral data.

[0068] Baseline Correction: Removes baseline drift in the signal to ensure data accuracy and consistency.

[0069] B. Smoothing and Denoising Methods: These methods reduce noise and fluctuations in the data and extract more stable signal features. They include:

[0070] Savitzky-Golay (SG) Smoothing: Uses a Savitzky-Golay filter to smooth the data and reduce high-frequency noise.

[0071] Moving Average (MA): Smooths the data by calculating moving averages to reduce the impact of short-term fluctuations.

[0072] C. Differentiation and Contrast Enhancement Methods: These methods enhance the differences or contrasts in the data to highlight meaningful changes and patterns. They include:

[0073] Multiplicative Normalization (MMS): Normalizes the data through multiplicative operations to enhance the comparability between data.

[0074] Standard Scaling (SS): Through standardization processing, the data is made to have the same scale for easy comparison.

[0075] Central Tendency (CT): Analyzes the data distribution by calculating the central tendency of the data (such as the mean).

[0076] First Difference (D1) / Second Difference (D2): Extracts the changes or trends in the data through first-order or second-order difference analysis.

[0077] Differential Transformation (DT): A differential transformation that extracts change information and periodic patterns in the signal.

[0078] D. No Processing Method: Does not perform any processing on the data and directly uses the raw data for analysis.

[0079] No Preprocessing: Indicates that no preprocessing is performed on the data, and the raw data is used for subsequent analysis, for comparative experiments.

[0080] Due to the possible instrumental errors in portable spectrometers, to enhance the generalization ability of the model, random noise is introduced into the measured data to simulate errors. By retaining a sufficient sample size and not excluding abnormal samples, the uncertainty and error characteristics in actual measurements are more realistically reflected, thereby improving the robustness of the model to complex data. The random noise can be simulated by Gaussian noise:

[0081] X' = X + ∈;

[0082] where X' is the spectral data after adding noise; X is the original spectral data; ~N(0,σ 2 ) is the noise obeying the normal distribution, with a mean of 0 and σ 2 being the variance.

[0083] Step S2: Construct a prediction model for the oil content of rapeseeds at the mature stage.

[0084] Specifically, common deep learning networks include the Convolutional Neural Network CNN, the Image Processing Network VGG, the Image Segmentation Network U-Net, the Residual Learning Network 50ResNet50, the Residual Learning Network 34ResNet34, the Inception structure, the Bidirectional Long Short-Term Memory Network BiLSTM, the Long Short-Term Memory Network LSTM, and the Gated Recurrent Unit GRU, etc. To quantitatively evaluate the performance of these models, the Root Mean Square Error Prediction (RMSE) and the Correlation Coefficient (R 2 ) are selected as evaluation indicators to measure the prediction accuracy and fitting effect of the models. These indicators can comprehensively reflect the error magnitude of the model for the test set and the correlation between the predicted value and the true value, providing a scientific basis for performance evaluation. The calculation formula for the Root Mean Square Error Prediction RMSE is:

[0085]

[0086] The calculation formula for the Correlation Coefficient R 2 is:

[0087]

[0088] In the above formula, N is the total number of samples; y n is the true value of the sample; is the predicted value of the sample; is the average value of the sample.

[0089] These models are trained and their performance is evaluated. The specific results are shown in Table 1. These tests provide an important basis for exploring the applicability and performance differences of different deep learning models in the experimental data of this study, and at the same time provide guidance for subsequent model optimization and selection.

[0090] Table 1 Prediction Results of Each Deep Learning Model

[0091]

[0092] As can be seen from Table 1, convolutional neural networks such as ResNet50, Inception, and U-Net perform best on this task, and the RMSE and R of the test set 2 are significantly better than other models, indicating their strong feature extraction ability and good generalization effect. In contrast, recurrent neural networks such as LSTM, BiLSTM, and GRU perform poorly and are difficult to effectively fit the data. Among them, U-Net is the optimal model, with an RMSE of 1.502 and an R 2 of 0.821 for the test set.

[0093] Compare four partitioning methods and thirteen preprocessing methods respectively to find the optimal dataset partitioning method and preprocessing method for rapeseed oil content prediction.

[0094] Table 2 Prediction Results of Different Partitioning Methods

[0095]

[0096] Considering the performance of the training set and the test set, KS classification is better than other classification methods in terms of both RMSE and R 2 metrics, especially outstanding in the test set, proving that it is more suitable for the experimental data of the embodiments of the present invention and can better balance the fitting ability and generalization ability of the model.

[0097] Table 3 Prediction Results of Different Preprocessing Methods

[0098]

[0099] The comprehensive analysis results show that SG preprocessing performs best on the test set, with an RMSE of 1.413 and an R 2 = 0.825, significantly improving the generalization ability and prediction accuracy compared with the untreated data. This indicates that SG preprocessing can effectively optimize the model performance and make it more robust and stable in complex data environments.

[0100] Therefore, the embodiments of the present invention use the KS partitioning method and the SG preprocessing method to process the collected spectral data. After determining the data processing method, a prediction model of the embodiments of the present invention is constructed based on U-Net, including the following steps:

[0101] Step S21: Delete the decoding layer in the image segmentation network U-Net, and replace the convolutional module in the U-Net encoding layer with a residual connection module. The residual connection module performs a series of convolutions and non-linear transformations on the mature rapeseed samples to obtain the deep feature representation of the samples; the input of the residual connection module is added to the deep feature representation through a skip connection as the output of the residual connection module.

[0102] Specifically, U-Net is a classic symmetric U-shaped structure. Its encoder part focuses on gradually extracting features, and the decoder part is responsible for restoring the resolution. At the same time, multi-level information of the encoder and decoder is fused through skip connections, so as to achieve the balance between global semantics and local details. In image processing tasks, U-Net is favored for its efficient feature extraction and accurate restoration of detailed information.

[0103] However, in the prediction of rapeseed oil content in the embodiments of the present invention, the final output of the model is a specific numerical value, which does not involve the restoration of image resolution. This may weaken the role of the U-Net decoding part, and there may even be a certain redundancy. Therefore, the embodiments of the present invention assume that the contribution of the decoding part to the final performance is limited, which may cause an additional burden on the complexity of the model. To verify this hypothesis, a comparative experiment was designed to explore the impact of retaining and removing the decoding part on the model performance. The experimental indicators include RMSE and R of the training set and the test set 2 , to comprehensively evaluate the role of the decoding part in this task. The comparison results are shown in Table 4.

[0104] Table 4 Comparison of prediction results

[0105]

[0106] As can be seen from the results in Table 4, the prediction performance of the complete U-Net on the test set is slightly better than that of the simplified model using only the encoding layer. Although the complete U-Net has higher accuracy, the improvement amplitude is small, and R 2 only increases by 0.004, indicating that its gain in prediction ability is limited. At the same time, the number of parameters of the complete U-Net is twice that of the simplified model, significantly increasing the computational complexity and resource requirements, and the cost performance between this additional overhead and the performance improvement is not high.

[0107] Based on the requirements of parameter efficiency and model lightweight, the embodiments of the present invention use the U-Net without a decoder as the basic model to carry out subsequent innovation work. This model greatly reduces the number of parameters while ensuring high prediction accuracy, and is therefore more suitable for deployment and application in resource-constrained scenarios.

[0108] On this basis, Figure 4a improve the basic convolutional module of the U-Net encoding layer shown inFigure 4b The residual connection module ResNet shown above. The purpose of doing this is to utilize the advantages of the residual structure to further enhance the model's feature extraction ability and training stability. Especially when dealing with high-dimensional complex spectral data, key information is retained through residual connections, enhancing the model's expressive ability, while also improving the training convergence speed and the optimization efficiency of deep networks. The ResNet module introduces residual blocks, learns the residual function, and directly adds the input to the output through skip connections, effectively alleviating the problems of gradient disappearance and depth degradation, and thus achieving efficient training of ultra-deep networks.

[0109] Since the decoding layer is deleted, the original skip connections in U-Net are also removed accordingly. However, skip connections play a crucial role in deep learning. It can directly transfer the information of the shallow network to the deep network, helping the model capture multi-scale features and fuse shallow details with deep semantics. To make up for this loss, an improved skip connection mechanism is introduced in the U-Net encoding layer. Specifically, after each ResNet module, a skip connection is established to directly connect the current features to the final output layer for feature layer splicing.

[0110] To match the change in data length caused by the max pooling operation MaxPool in the ResNet module, the embodiment of the present invention adds an average pooling operation AvgPool in the skip connection. Different from max pooling that focuses on local significant features, average pooling can better extract the overall trend information, helping the model retain the global background characteristics when fusing shallow features. This design can enhance the feature expression ability, while effectively alleviating the problem of information loss, enabling the key information in the shallow layer to be retained and transmitted to the deep layer, and improving the model's representation ability for complex data. By fully utilizing multi-level information in the feature space, it not only enhances the model's global perception ability for spectral data, but also significantly improves the training stability and prediction robustness.

[0111] In the above improved skip connection process, since the introduction of the AvgPool operation may cause the loss of some information, to further improve the feature retention effect, a squeeze-and-excitation SE module is added to each skip connection. The SE module is a lightweight attention mechanism designed to adaptively adjust the importance of each channel by learning the channel correlations, thereby enhancing the network's feature expression ability.

[0112] Meanwhile, the Atrous Spatial Pyramid Pooling (ASPP) module is introduced at the bottom layer of the U-Net encoding layer. The ASPP module is a spatial pyramid pooling method that focuses on extracting multi-scale context information. By combining convolutional operations with different dilation rates, ASPP can effectively expand the receptive field without reducing the resolution, thereby capturing multi-scale feature information from local details to global semantics. This feature makes it particularly suitable for processing complex scenes or high-dimensional data tasks and is widely used in convolutional neural networks to enhance context awareness. By optimizing the structure of the traditional ASPP module through lightweight design, the number of parameters can be significantly reduced, making it more suitable for resource-constrained environments. Introducing the ASPP module at the bottom layer of the U-Net encoding layer can further strengthen the multi-scale information extraction ability. The ASPP module contains multiple groups of atrous convolutions. After the convolutions with different dilation rates run in parallel, the extracted features are fused into a globally rich context feature map. This fusion method takes into account both local fine-grained information and global semantic information, which helps to improve the model's performance in spectral data tasks.

[0113] To meet the lightweight requirements, the traditional ASPP module is optimized. The structure of the improved ASPP module is shown as Figure 5 follows. The dilation rates are set to 1, 2, and 3, reducing the dilation factor, and a low-dimensional projection layer is used to replace some high-dimensional operations, thereby reducing the number of parameters and computational cost. This lightweight improvement not only retains the multi-scale characteristics of the original ASPP but also significantly improves the running efficiency, making it more in line with the deployment requirements of resource-constrained scenarios.

[0114] Step S22: Introduce a temporal feature extraction module and an average pooling module in the U-Net. The temporal feature extraction module is used to extract the temporal features in the mature rapeseed samples. After concatenating the outputs of the residual connection module and the temporal feature extraction module, they are respectively input into the average pooling module and the max pooling module to further extract the local features and global features in the mature rapeseed samples.

[0115] Specifically, to make full use of the temporal features in the spectral data, the embodiment of the present invention introduces the multi-head attention mechanism in the Transformer module as the temporal feature extraction module in the U-Net. However, the computational complexity of the standard Transformer is relatively high. To meet the lightweight requirements, it is optimized by using 1×1 convolution to replace the traditional Layer Normalization layer. The convolution operation can not only extract features of different scales more efficiently but also effectively control the computational overhead by flexibly adjusting the number of parameters of the convolution kernel.

[0116] By designing the lightweight Transformer module in parallel with the U-Net encoding layer, the two feature extraction methods can work simultaneously. The U-Net encoding layer focuses on the extraction of local features, capturing the detailed characteristics of spectral data through layer-by-layer convolution, while the Transformer module constructs global dependencies through the multi-head attention mechanism and captures the temporal information in the spectral data. Finally, the two types of features are concatenated and fused at the bottom layer to form a comprehensive feature space that contains both temporal features and local information. This parallel design combines the global perception ability of the multi-head attention mechanism with the local feature extraction advantage of convolution, optimizing the prediction performance of the model and improving the adaptability and efficiency for near-infrared spectral data with a lightweight structure.

[0117] After concatenating the outputs of the residual connection module and the temporal feature extraction module, they are respectively input into the average pooling module AvgPool and the max pooling module MaxPool. The AvgPool and MaxPool modules can significantly optimize the integration and expression ability of features. This design extracts the overall trend information between layers through global average pooling, and at the same time uses max pooling to capture the local optimal values in the feature map, enabling the model to more comprehensively represent the data characteristics.

[0118] The role of the AvgPool module is to compress the global information of the feature map, emphasizing the overall trend by calculating the average value, thereby improving the model's perception ability of global patterns. This processing method can effectively eliminate the interference of local noise, making the feature expression of the model smoother and more consistent. The MaxPool module, on the other hand, focuses on retaining local significant features, highlighting the key points in the data by selecting the maximum value and emphasizing its important feature information. The combination of the two forms an efficient fusion of the global and local characteristics of the data, making the model more expressive when generating the final features. This design helps the model fully integrate the features of each layer before entering the fully connected layer, providing a more accurate and comprehensive input for the prediction of the final value.

[0119] During actual use, adjusting the shallow convolutional kernel of the U-Net encoding layer from the original 1×3 to 1×13 can improve the model performance. This is because the length of the input data is 206, and a longer convolutional kernel can cover a larger receptive field at one time, effectively capturing global information and thus enhancing the model's perception ability of the overall pattern. However, when increasing the convolutional kernel size in the deep network, the model performance decreases instead. This is because after multiple downsamplings, the length of the feature map gradually shrinks from 206 to 25. In this case, using a longer convolutional kernel will lead to overfitting of local features, damaging the expression ability of global information and weakening the generalization performance of the model. In addition, an overly long convolutional kernel may introduce unnecessary redundant calculations, increasing the model complexity without corresponding performance improvement.

[0120] Therefore, the prediction model in the embodiments of the present invention optimizes the design of the convolutional kernels in the U-Net encoding layer. Among the 4 ResNet modules, the first two modules adopt relatively long 1×13 convolutional kernels to fully extract global features when the feature map size is relatively large; while the latter two modules adopt relatively short 1×3 convolutional kernels to focus on fine-grained local feature extraction. This design avoids the overfitting phenomenon of deep feature maps while ensuring the fusion of global and local features, and improves the robustness and generalization ability of the model.

[0121] The original U-Net design includes 4 downsampling operations and is suitable for processing complex two-dimensional image data. However, for one-dimensional near-infrared spectral data, its structure is simpler than that of images and does not require such a deep network layer to extract features. Therefore, the U-Net structure is optimized by deleting 1 downsampling and the subsequent convolutional layers. This improvement reduces the depth of the network, makes the model more lightweight, and effectively improves the generalization ability. Deleting the overly deep downsampling and convolutional operations can avoid introducing too many redundant feature extraction steps in the training data, thereby reducing the risk of overfitting. In addition, the shallow network structure is more suitable for processing the global patterns and local features of near-infrared spectral data, retains sufficient feature extraction ability, and optimizes the computational efficiency. Finally, the prediction model as shown in Figure 6 is obtained, where K represents the convolutional kernel size, S represents the stride size, and C represents the channel size. For example, K13S1C64 means that the convolutional kernel size of this module is 13, the stride size is 1, and the channel size is 64.

[0122] Step S3: Train the prediction model using the training set, evaluate the prediction model using the test set, and obtain the optimal prediction model through parameter adjustment.

[0123] Specifically, the KS method is used to divide the spectral data into a training set and a test set, and the SG method is used to preprocess the training set and the test set. As shown in Figure 7, when the Relative Standard Deviation is greater than 5%, the variability of the data is relatively large. Due to the accuracy limitation of the portable spectrometer, there are certain systematic errors in the near-infrared spectral curves measured for each sample. Therefore, in order to enhance the generalization ability of the model, corresponding data enhancement processing is required.

[0124] The initial data set contains 681 samples. The near-infrared spectral curves of each sample are averaged after 3 repeated measurements to obtain 681 near-infrared spectral curves for analysis.

[0125] To further expand the diversity of training data, a data augmentation method is proposed: for each sample in the training set, the three measured spectral curves in each sample are pairwise added within the group and then averaged, while the original three measured spectral curves are retained and correspond one-to-one with the oil content data. Through this augmentation method, the data volume of the training set is expanded from 681 to 4767, significantly increasing the scale of the model's training data.

[0126] The augmented training data more fully simulates the uncertainty in actual measurements by the portable spectrometer, further improving the model's adaptability to the complexity of spectral data and the prediction accuracy of the target variable. The training set enhanced by this method is used for model training, and the specific results are shown in Table 5:

[0127] Table 5 Comparison of data prediction results after data augmentation

[0128]

[0129] It can be seen from the data in the table that data augmentation has a significant effect on improving the model performance, especially in the performance on the test set.

[0130] Without data augmentation, the prediction model (Our) of the embodiment of the present invention has shown good performance on the test set, superior to the U-Net and U-Net coding structures. However, by introducing the data augmentation strategy, the performance of the model on both the training set and the test set has been significantly improved. On the augmented training set, the RMSE drops to 0.264, R 2 = 0.995, showing a great improvement in the model's feature fitting ability; on the test set, the RMSE is further reduced to 1.198, R 2 = 0.883. This result indicates that data augmentation not only improves the model's adaptability to complex spectral data by increasing sample diversity and simulating measurement errors, but also effectively reduces the risk of overfitting. At the same time, the augmentation strategy provides richer training features, enabling the model to more comprehensively learn the non-linear relationship between near-infrared spectral data and the target variable.

[0131] Generally speaking, the introduction of the data augmentation method provides important support for the improvement of the model performance. Especially the significant improvement on the test set verifies the effectiveness of the augmentation strategy and further proves the key role of data diversity in improving the model generalization ability.

[0132] At the same time, to avoid the model falling into local optimal points and improve the quality of the training results, the embodiment of the present invention designs an optimized learning strategy, which realizes more efficient model training and stronger generalization ability by combining learning rate dynamic adjustment, early stopping mechanism and L2 regularization technology.

[0133] During the training process, a learning rate decay strategy is adopted. The initial learning rate is set to lr = 0.0001. After 100 training iterations, if the R of the test set 2 indicator does not increase by more than 0.01, the learning rate is adjusted to 1 / 10 of the current value to optimize with a smaller step size, ensuring that the model gradually approaches the optimal solution. At the same time, to further avoid overfitting, an early stopping mechanism is adopted. If the R of the test set after 300 training iterations 2 still shows no significant improvement (more than 0.01), the training is terminated, thus effectively reducing the performance loss caused by overfitting.

[0134] In addition, L2 regularization (weight decay) technology is introduced in the model training. By constraining the weight size, the generalization ability of the model is improved. The regularization parameter is set to weight_decay = 1e -5 . This strategy not only prevents the model parameters from being too large and reduces the risk of overfitting, but also further improves the performance of the model on the test set.

[0135] By comprehensively applying these methods, a model with the best performance is finally trained, which is suitable for actual application requirements.

[0136] After corresponding data processing and model training for multiple models, the comparison of the prediction results is shown in Table 6.

[0137] Table 6 Comparison of prediction results of multiple prediction models

[0138]

[0139] From the results in Table 6, it can be seen that there are obvious differences in the performance of different models on the training set and the test set. The structure of the prediction model designed in the embodiments of the present invention is superior to other models in all indicators, showing stronger prediction ability and generalization performance.

[0140] Specifically, on the test set, the prediction model in the embodiments of the present invention achieved the best RMSE and R 2 indicators, which are 1.304 and 0.856 respectively, significantly better than other models. For example, compared with the U-Net encoding layer with better performance, the RMSE of the prediction model in the embodiments of the present invention on the test set is reduced by 0.124, and the R 2It has increased by 0.035. In addition, compared with classical machine learning models such as partial least squares regression (PLSR) and support vector regression (SVR), the prediction model of the embodiments of the present invention has significantly improved the prediction performance, indicating the significant advantages of deep learning in processing near-infrared spectral data. It should be noted that other deep learning models also show good prediction ability to a certain extent, but there is still a certain gap in their RMSE and R 2 metrics compared with the prediction model of the embodiments of the present invention.

[0141] Generally speaking, the prediction model of the embodiments of the present invention is superior to other models in terms of accuracy and robustness, especially in the fusion of global and local features of complex spectral data. This shows that the prediction model of the embodiments of the present invention can extract features more efficiently and achieve accurate modeling in the prediction of physical and chemical values.

[0142] Step S4: Input the spectral curve of the rapeseed to be measured into the optimal prediction model to obtain the oil content of the rapeseed to be measured.

[0143] Traditional deep learning methods have limitations in prediction performance when dealing with large sample datasets. However, the present invention designs a prediction model by integrating the U-Net encoding layer, Transformer module, ResNet, and ASPP module, significantly enhancing the feature extraction ability and the ability to capture temporal information, thereby improving the prediction accuracy and robustness of the model for the oil content of rapeseed. Moreover, the sample data collected in the embodiments of the present invention has diverse sources, including rapeseed from different years, different locations, and different varieties, making the data for training the model more comprehensive and covering a diverse feature distribution. This diversity enhances the representativeness and generalization of the model, ensuring that it can still maintain a high-precision prediction ability when facing rapeseed samples from different sources and conditions.

[0144] The embodiments of the present invention also provide a prediction system for the oil content of rapeseed at the mature stage based on a deep learning model, including: a data acquisition module, an oil content determination module, a prediction model construction module, a prediction model training module, and an oil content prediction module.

[0145] Data acquisition module: Use a near-infrared spectrometer to measure the spectral curve of rapeseed samples and obtain spectral data of rapeseed samples within a specific wavelength range.

[0146] Oil content determination module: Use chemical analysis methods to measure the oil content of rapeseed samples and obtain the true value of the oil content of rapeseed.

[0147] Prediction model construction module: Construct a prediction model including a local feature extraction module, a temporal feature extraction module, and a pooling module. The local feature extraction module extracts detailed features in spectral data through layer-by-layer convolution; the temporal feature extraction module extracts temporal features in spectral data through a multi-head attention mechanism; the pooling module is used to further extract local features and global features from the detailed features and temporal features.

[0148] Prediction model training module: Use rapeseed samples to train the prediction model, and optimize the parameters of the prediction model by minimizing the gap between the true value of the oil content of the rapeseed samples and the predicted value of the prediction model.

[0149] Oil content prediction module: Input the spectral curve of the rapeseed to be measured into the optimized prediction model to obtain the oil content of the rapeseed to be measured.

[0150] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. Only the preferred embodiments of the present invention are expressed. The description is relatively specific and detailed, but it should not be construed as a limitation to the scope of the present invention. As long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.

[0151] It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the appended claims.

Claims

1. A method for predicting the oil content of rapeseed at maturity based on a deep learning model, characterized in that: The following steps are involved: Step S1: deleting the decoding layer in the image segmentation network U-Net, and replacing the convolution module in the U-Net encoding layer with a residual connection module, wherein the residual connection module performs a series of convolutions and nonlinear transformations on the mature rapeseed samples to obtain a deep feature representation of the mature rapeseed samples; Adding the input of the residual connection module to the deep feature representation through a skip connection as the output of the residual connection module; Step S2: introducing a temporal feature extraction module and an average pooling module into U-Net, wherein the temporal feature extraction module is used to extract temporal features in the rapeseed sample at maturity, splicing the outputs of the residual connection module and the temporal feature extraction module, and inputting the outputs into the average pooling module and the maximum pooling module of U-Net respectively, so as to further extract global features and local features in the rapeseed sample at maturity; Step S3: splicing the local features and the global features and inputting them into a fully connected layer to obtain the oil content of the rapeseed sample at maturity.

2. The method for predicting the oil content of rapeseed at maturity based on a deep learning model according to claim 1, characterized in that: In step S1, a context information extraction module is introduced at the bottom layer of the U-Net encoding layer. The context information extraction module extracts multi-scale features of the mature rapeseed samples from local details to global semantics through convolutions with different dilation rates.

3. The method for predicting the oil content of rapeseed at maturity based on a deep learning model according to claim 1, characterized in that: An attention module is also provided in the residual connection module, and the attention module adaptively adjusts the weights of different feature channels by learning the correlation between the feature channels.

4. The method for predicting the oil content of rapeseed at maturity based on a deep learning model according to claim 1, characterized in that: The local feature extraction module extracts the detail features of the mature rapeseed samples through layer-by-layer convolution, and the temporal feature extraction module extracts the temporal features of the mature rapeseed samples through a multi-head attention mechanism.

5. The method for predicting the oil content of rapeseed at maturity based on a deep learning model according to claim 1, characterized in that: The average pooling module extracts the global features of the feature map by calculating the average values ​​of each region of the input feature map, and the maximum pooling module retains the local features of the feature map by selecting the maximum value in the local region of the input feature map.

6. The method for predicting the oil content of rapeseed at maturity based on a deep learning model according to claim 1, characterized in that: In step S1, a near-infrared spectrometer is used to measure the spectral curve of the mature rapeseed, obtain spectral data within a specific wavelength range of the mature rapeseed, and obtain a mature rapeseed sample.

7. The method for predicting the oil content of rapeseed at maturity based on a deep learning model according to claim 6, characterized in that: After obtaining the mature rapeseed sample in step S1, the sample is preprocessed, including the following steps: smoothing the spectral data through a filter, removing high-frequency noise in the spectral data, and introducing random noise into the denoised spectral data.

8. A system for predicting the oil content of rapeseed at maturity based on a deep learning model, which is implemented based on a method for predicting the oil content of rapeseed at maturity based on a deep learning model as claimed in any one of claims 1 to 7, characterized in that: include: Data acquisition module, oil content determination module, prediction model building module, prediction model training module and oil content prediction module; The data acquisition module: uses a near-infrared spectrometer to measure the spectrum curve of the rapeseed sample to obtain the spectrum data of the rapeseed sample within a specific wavelength range; The oil content determination module: uses a chemical analysis method to determine the oil content of the rapeseed sample to obtain the true value of the rapeseed oil content; The prediction model construction module: constructs a prediction model including a local feature extraction module, a temporal feature extraction module and a pooling module, wherein the local feature extraction module extracts detail features in the spectral data by layer-by-layer convolution; the temporal feature extraction module extracts temporal features in the spectral data by a multi-head attention mechanism; the pooling module is used to further extract local features and global features from detail features and temporal features; The prediction model training module uses rapeseed samples to train the prediction model, and optimizes the parameters of the prediction model by minimizing the gap between the true value of the oil content of the rapeseed sample and the predicted value of the prediction model; The oil content prediction module is used to input the spectrum curve of the rapeseed to be tested into the optimized prediction model to obtain the oil content of the rapeseed to be tested.

9. The system for predicting the oil content of mature rapeseed based on a deep learning model according to claim 8, characterized in that: The prediction model training module randomly divides the spectral data into a first data set and a second data set, calculates the test statistic between the two data sets, and searches for a critical value based on the test sample size and the set significance level. If the test statistic is greater than the critical value, it is considered that the distributions of the two data sets are significantly different, and the first data set and the second data set are used as training sets and test sets, respectively. Otherwise, the data sets are re-divided.

10. The system for predicting the oil content of rapeseed at maturity based on a deep learning model according to claim 9, characterized in that: After the prediction model training module divides the spectral data into a training set and a test set, the training set is enhanced, including the following steps: for each sample in the training set, every two of the three measured spectral curves in the sample are added and the average is calculated, while retaining the three original measured spectral curves to obtain a data-enhanced training set.

Citation Information

Cited By

  • Rape oil content prediction method based on big data

    CN120932102A