Signal unmixing and multi-task learning fused fresh corn quality detection method
Through the method of signal demixing and multi-task learning, combined with three-linear decomposition and multi-task attention neural network, the problem of scattered interference in the quality detection of fresh corn is solved, and high-precision and real-time quality detection is achieved, which is suitable for agricultural product quality grading and intelligent sorting.
Patent Information
- Application Number
- CN202510704861.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2045-05-29
AI Technical Summary
Traditional near-infrared spectroscopy analysis in the quality detection of fresh corn is difficult to obtain pure grain spectra due to scattering interference between the bracts, mandrels and grains, which affects the analysis accuracy.
Using a combination of signal demixing and multi-task learning, the mixed spectral data is collected at different offset distances, and the pure grain spectral vector is extracted using a trilinear decomposition and least squares alternating iteration algorithm, and combined with the multi-task attention-guided neural network model for quality detection.
It realizes non-destructive, strong real-time and high-precision quality detection of fresh corn, improves signal resolution accuracy and robustness of multi-quality prediction, and is suitable for agricultural product quality grading and intelligent sorting.
Smart Images

Figure CN120489982A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of corn quality detection, and in particular to a fresh corn quality detection method that integrates signal unmixing and multi-task learning. Background Art
[0002] Moisture and sugar content are important quality indicators of fresh corn. A non-destructive, rapid, and highly accurate method for measuring these quality indicators is crucial for optimizing the corn industry chain. While traditional near-infrared spectroscopy is non-destructive, multi-level and multi-scale scattering interference between the outer husk, cob, and kernel makes it difficult to directly obtain spectra of pure fresh corn kernels, severely impacting the accuracy of analyzing these quality indicators. Summary of the Invention
[0003] In response to the above-mentioned problems and technical needs, this application proposes a fresh corn quality detection method that integrates signal unmixing and multi-task learning. The technical solution of this application is as follows:
[0004] A fresh corn quality detection method integrating signal unmixing and multi-task learning, the fresh corn quality detection method comprising:
[0005] A laser source is used to illuminate the surface of fresh corn, and mixed spectral data of the fresh corn are collected at K measurement positions with different offset distances relative to the laser incident point. The fresh corn includes cob tissue, kernel tissue, and husk tissue. The integer parameter K is ≥ 2.
[0006] The mixed spectrum data X collected at the i-th measurement position i Follow X i =A i ·S i T Decompose to obtain the contribution matrix A at the i-th measurement position i =[a i b i c i ] and the spectral set matrix S i =[s i g i l i ]; where a i 、b i 、c i Respectively represent the relative contribution values of the core tissue, grain tissue, and bract tissue at the i-th measurement position; s i 、g i 、l i Represent the single tissue spectrum vectors of the mandrel tissue, grain tissue, and bract tissue at the i-th measurement position respectively;
[0007] The single-tissue spectral vectors of the kernel tissue at all K measurement positions are merged in the order of the offset distances of the K measurement positions to obtain a two-dimensional spectral scattering image of the kernel tissue. The dimension of the two-dimensional spectral scattering image is K×C, where C is the number of bands of the single-tissue spectral vector of the kernel tissue at each measurement position.
[0008] The two-dimensional spectral scattering image of the kernel tissue is input into the corn kernel quality detection model to obtain the detection results of multiple mutually coupled quality indicators of fresh corn; among them, the corn kernel quality detection model is trained based on a multi-task attention-guided neural network model.
[0009] A further technical solution is to decompose the contribution matrix A at the i-th measurement position i and the spectral set matrix S i include:
[0010] In the contribution matrix A i and the spectral set matrix S i Under the respective biophysical constraints, the least squares alternating iterative algorithm is used to optimize the solution of X i =A i ·S i T Get the contribution matrix A i and the spectral set matrix S i .
[0011] Its further technical solution is that the contribution matrix A i The biophysical constraints include:
[0012] The relative contribution value of each tissue at the i-th measurement position is non-negative;
[0013] as well as,
[0014] The relative contribution value of each tissue at different measurement locations showed a unimodal distribution characteristic.
[0015] Its further technical solution is that the spectrum set matrix S i The biophysical constraints include:
[0016] The spectral intensities in C bands in the single tissue spectral vector of each tissue are non-negative;
[0017] as well as,
[0018] For any α=s i ,g i ,l i and β = s i ,g i ,l i , Get the minimum value so that the spectrum set matrix Si The independence between single tissue spectral vectors of different tissues is the largest.
[0019] A further technical solution is to combine and obtain a two-dimensional spectral scattering image of the grain tissue, including:
[0020] Based on the scattering smoothing characteristics, the single-tissue spectral vector of the grain tissue at the i-th measurement position is attenuated and corrected. The attenuation-corrected single-tissue spectral vectors of the grain tissue at all K measurement positions are merged in the order of the offset distances of the K measurement positions to obtain a two-dimensional spectral scattering image of the grain tissue.
[0021] A further technical solution is to perform attenuation correction on the single tissue spectrum vector of the grain tissue at the i-th measurement position based on the scattering smoothing characteristic, including:
[0022] Determine the attenuation function of light in any wavelength band λ with the offset distance d relative to the laser incident point based on the scattering smoothing characteristics
[0023] The single tissue spectrum vector g of the kernel tissue at the i-th measurement position i Spectral intensity I at mid-band λ i (λ) According to Perform attenuation correction to obtain the spectral intensity after attenuation correction at band λ Among them, d i is the offset distance of the ith measurement position relative to the laser incident point, and ε is a positive constant that does not exceed a predetermined threshold.
[0024] A further technical solution is to determine the attenuation function of light of any wavelength λ with the offset distance d relative to the laser incident point based on the scattering smoothness characteristic. include:
[0025] Extract the single tissue spectrum vector g of the kernel tissue at the i-th measurement position i Spectral intensity I at mid-band λ i (λ), and determine the offset distance d of the i-th measurement position relative to the laser incident point i ;
[0026] An intensity distance coordinate system is established with the spectral intensity at band λ as the vertical axis and the offset distance relative to the laser incident point as the horizontal axis. The discrete point corresponding to the i-th measurement position in the intensity distance coordinate system is constructed. By utilizing the physical property that the spectral signal decays smoothly with spatial distance within the tissue, an exponential function or a low-order polynomial is used to perform curve fitting on all K discrete points in the intensity distance coordinate system to obtain the attenuation function of the light in band λ with the offset distance d relative to the laser incident point.
[0027] Its further technical solution is that the corn kernel quality detection model includes a task sharing network, a moisture detection network and a sugar content detection network. The two-dimensional spectral scattering image of the kernel tissue is input into the task sharing network, the moisture detection network outputs the kernel moisture detection result, and the sugar content detection network outputs the kernel sugar content detection result.
[0028] The task sharing network includes a first convolution structure, a second convolution structure, and a third convolution structure connected in sequence. The task sharing network sequentially extracts multi-scale features from the two-dimensional spectral scattering image of the grain tissue through the three consecutive convolution structures, and outputs a shallow feature map of the two-dimensional spectral scattering image of the grain tissue through the first convolution structure, a middle feature map of the two-dimensional spectral scattering image of the grain tissue through the second convolution structure, and a deep feature map of the two-dimensional spectral scattering image of the grain tissue through the third convolution structure.
[0029] The network structures of the moisture detection network and the sugar content detection network are the same. Each detection network includes a first attention mechanism structure, a second attention mechanism structure, a third attention mechanism structure, a global average pooling module and a fully connected layer connected in sequence; each attention mechanism structure includes an attention module, a convolution module and a pooling module connected in sequence; the three-level feature maps output by the task sharing network are input into the three attention mechanism structures of each detection network, the first attention mechanism structure of the detection network inputs the shallow feature map, the output of the first attention mechanism structure is channel-joined with the middle feature map and then input into the second attention mechanism structure, and the output of the second attention mechanism structure is channel-joined with the deep feature map and then input into the third attention mechanism structure.
[0030] Its further technical solution is that the first convolution structure in the task sharing network includes a first convolution module, a second convolution module and a first maximum pooling layer connected in sequence, the second convolution structure includes a third convolution module, a fourth convolution module and a second maximum pooling layer connected in sequence, and the third convolution structure includes a fifth convolution module and a sixth convolution module connected in sequence; each convolution module includes a convolution layer, a batch normalization layer and a nonlinear activation layer in sequence;
[0031] The task sharing network derives shallow feature maps through the output of the second convolution module, derives middle feature maps through the output of the fourth convolution module, and derives deep feature maps through the output of the sixth convolution module.
[0032] A further technical solution is that, in the process of training the corn kernel quality detection model using fresh corn samples in the training sample set, the loss function L used is:
[0033]
[0034] in, The kernel moisture test results of fresh corn samples and the measured value of grain moisture y (w) The mean square error between The sugar content of fresh corn samples and the measured value of sugar content of grains y (s) The mean square error between ω1 and ω2 is the weight parameter; is the detection relevance constraint loss, ρ(y (w) ,y (s) ) represents the measured value y of the kernel moisture of the fresh corn sample (w) and the measured value of sugar content of grains y (s) The Pearson correlation coefficient between Indicates the kernel moisture test results of fresh corn samples and grain sugar content test results The Pearson correlation coefficient between .
[0035] The beneficial technical effects of this application are:
[0036] The present application discloses a method for detecting the quality of fresh corn by integrating signal unmixing and multi-task learning. The method obtains mixed spectral data at multiple different measurement positions of fresh corn, extracts pure single-tissue spectral vectors of kernel tissue from the mixed spectral data at each measurement position based on a trilinear decomposition strategy, and then performs spatial mixed modeling and merging on the single-tissue spectral vectors of kernel tissue at different spatial measurement positions to obtain a two-dimensional spectral scattering image of the kernel tissue. The two-dimensional spectral scattering image has both chemical composition characteristics and physical tissue contours, providing an important input basis for subsequent high-resolution and high-reliability quality information extraction. Combined with a corn kernel quality detection model obtained by training a multi-task attention-guided neural network model, the method can quickly and accurately output multiple mutually coupled quality index detection results of fresh corn, mainly the detection results of kernel moisture and kernel sugar content. The method has the advantages of being non-destructive, highly real-time, highly accurate, and adaptable.
[0037] In order to improve the prediction accuracy of kernel moisture and kernel sugar content, two types of quality indicators that are strongly coupled but may have inconsistent changing trends, the corn kernel quality detection model used in this application integrates shared and private feature expression mechanisms to achieve simultaneous and efficient prediction of quality indicators such as corn kernel moisture and sugar content. At the same time, the proposed attention mechanism can dynamically select multi-level features to achieve automatic focus on task-critical features, reduce redundant interference, and improve prediction accuracy. In addition, the loss function is also adaptively designed. The overall method has good scalability, a high degree of automation and practical application value, and is suitable for a variety of industrial application scenarios such as agricultural product quality grading and intelligent sorting.
[0038] This method combines the trilinear decomposition strategy with the multi-task attention mechanism to perform corn kernel spectral signal separation and multi-quality in-situ detection, which can improve the signal analysis accuracy without prior conditions and the robustness and real-time performance of multi-quality prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 This is a flow chart of a method for detecting the quality of fresh corn according to an embodiment of the present application.
[0040] Figure 2 It is a detection scene graph of this application.
[0041] Figure 3 It is a data processing flow chart for extracting a two-dimensional spectral scattering image of grain tissue.
[0042] Figure 4 This is a network structure diagram of a corn kernel quality detection model in one embodiment of the present application. DETAILED DESCRIPTION
[0043] The specific implementation of this application will be further described below with reference to the accompanying drawings.
[0044] In order to solve the problem of low accuracy of fresh corn quality detection using traditional near-infrared spectroscopy due to scattering interference between bracts, cobs and kernels, this application discloses a fresh corn quality detection method that integrates signal unmixing and multi-task learning. The method includes the following steps, please refer to Figure 1 The flowchart shown:
[0045] Step 110 : A laser source is used to emit laser light onto the surface of the fresh corn, and mixed spectral data of the fresh corn is collected at K measurement positions having different offset distances relative to the laser incident point. The integer parameter K is ≥ 2.
[0046] Fresh corn consists of cob tissue, kernel tissue, and husk tissue. The kernel tissue is arranged on the cob tissue, and the husk tissue covers the cob tissue and kernel tissue. Figure 2 The detection scenario diagram shows the laser light emitted by the laser source incident on the surface of fresh corn at point 210, and mixed spectral data collected at four measurement locations 221, 222, 223, and 224. When the laser light emitted by the laser source illuminates the surface of the fresh corn, it actually illuminates the surface of the husk tissue of the fresh corn. The laser light penetrates the inner layer of the fresh corn and generates multi-level and multi-scale scattering interference between the husk tissue, kernel tissue, and cob tissue. Therefore, the mixed spectral data collected at each measurement location is a mixed spectrum of the three tissue components of the husk tissue, kernel tissue, and cob tissue.
[0047] The structure of fresh corn ears is complex, and different areas have obvious differences in tissue composition and spectral response. Therefore, this application obtains mixed spectral data at different positions of the fresh corn ears at K measurement positions to avoid information loss and insufficient regional representativeness caused by single-point acquisition. The distance between each measurement position and the laser incident point is its offset distance relative to the laser incident point, such as Figure 2 , the offset distance of the measurement position 221 relative to the laser incident point 210 is d1, the offset distance of the measurement position 222 relative to the laser incident point 210 is d2, the offset distance of the measurement position 223 relative to the laser incident point 210 is d3, and the offset distance of the measurement position 224 relative to the laser incident point 210 is d4.
[0048] The selection of the number K is adjusted based on experience. After comparison in actual applications, a typical value with better results is K = 4.
[0049] Step 120: The mixed spectrum data X collected at the i-th measurement position is i Follow X i =A i ·S i T Decompose to obtain the contribution matrix A at the i-th measurement position i and the spectral set matrix S i , please combine Figure 3 Schematic diagram of data processing.
[0050] Contribution matrix A i It can be expressed as A i =[a i b i c i ], a i represents the relative contribution value of the core shaft structure at the i-th measurement position, b i represents the relative contribution value of the grain tissue at the i-th measurement position, c i Represents the relative contribution value of the bract tissue at the i-th measurement position. Figure 2 In the example, the contribution matrix A1 at measurement position 221 is A1 = [a1 b1 c1], where a1 represents the relative contribution value of the cob tissue at measurement position 221, b1 represents the relative contribution value of the kernel tissue at measurement position 221, and c1 represents the relative contribution value of the bract tissue at measurement position 221. The contribution matrix A2 at measurement position 222 is A2 = [a2 b2 c2], where a2 represents the relative contribution value of the cob tissue at measurement position 222, b2 represents the relative contribution value of the kernel tissue at measurement position 222, and c2 represents the relative contribution value of the bract tissue at measurement position 222. The contribution matrices at measurement positions 223 and 224 can be obtained similarly.
[0051] Spectral collection matrix S i It can be expressed as S i =[s i g i l i ],s i represents the single tissue spectrum vector of the mandrel tissue at the i-th measurement position, g i represents the single tissue spectrum vector of the kernel tissue at the i-th measurement position, l i The single-tissue spectrum vector of the bract tissue at the i-th measurement position is represented by . The single-tissue spectrum vector of each tissue is pure spectrum data containing only the tissue without being affected by other tissues. The single-tissue spectrum vector of each tissue includes the spectral intensities of each C band.
[0052] The above process separates the mixed spectral data through the spectral signal trilinear decomposition strategy, and can separate and extract the pure spectra of the three tissues. In order to ensure that the separation results have biophysical characteristics, the contribution matrix A i and the spectral set matrix S i The model is solved under the respective biophysical constraints to achieve spectral data separation. In order to efficiently achieve the orderly decoupling of multi-source spectral information, the least squares alternating iterative algorithm is used to optimize the solution of X under the biophysical constraints. i =A i ·S i T Get the contribution matrix A i and the spectral set matrix S i .
[0053] Contribution matrix A i and the spectral set matrix S i The biophysical constraints include several a priori constraints, which are introduced as follows:
[0054] (1) Contribution matrix A i The biophysical constraints include non-negativity and unimodality.
[0055] Non-negativity constraint: The relative contribution value of each tissue at the i-th measurement position is non-negative, that is, a i ≥0, b i ≥0, c i ≥0.
[0056] Unimodal constraint: The relative contribution of each tissue at different measurement locations exhibits a unimodal distribution. The specific distribution characteristics of the three tissues are different. The relative contribution of the mandrel tissue at different measurement locations increases with the increase of the offset distance of the measurement location relative to the laser incident point. The relative contribution of the grain tissue at different measurement locations increases or first increases and then decreases with the increase of the offset distance of the measurement location relative to the laser incident point. The relative contribution of the bract tissue at different measurement locations decreases with the increase of the offset distance of the measurement location relative to the laser incident point.
[0057] (2) Spectral set matrix S i The biophysical constraints include non-negativity and independence constraints.
[0058] Non-negativity constraint: The spectral intensity of the single tissue spectrum vector of each tissue at the i-th measurement position in C bands is non-negative, that is, for any band λ, the spectral intensity I of the single tissue spectrum vector of each tissue at the i-th measurement position in band λ is i (λ)≥0.
[0059] Independence constraint: Spectral set matrix S at the i-th measurement position i The independence between the single tissue spectral vectors of different tissues is the largest, which can be expressed mathematically as follows: for any α = s i ,g i ,l i and β = s i ,g i ,l i , Get the minimum value so that the spectrum set matrix S i The independence between the single tissue spectral vectors of different tissues is the largest, where α T β represents the inner product of vector α and vector β.
[0060] In step 130, the single-tissue spectral vectors of the kernel tissue at all K measurement positions are merged in the order of the offset distances of the K measurement positions to obtain a two-dimensional spectral scattering image of the kernel tissue. The horizontal axis of the resulting two-dimensional spectral scattering image represents the spectral band and the vertical axis represents the number of the measurement position. The dimension of the two-dimensional spectral scattering image is K×C, where C is the number of bands of the single-tissue spectral vector of the kernel tissue at each measurement position. This means that the measurement points at different parts of fresh corn are simulated in the channel dimension, and the spectral band changes are expressed in the width direction. For example, in one example, the dimension is 4*955. The two-dimensional spectral scattering image of the kernel tissue obtained in this way not only retains the typical absorption characteristics of the kernel but also expresses its spatial distribution characteristics in different regions on the corn surface. The two-dimensional spectral scattering image also contains chemical composition regions (such as the moisture absorption peak in the kernel tissue value) and physical tissue contours (such as the kernel tissue region), providing an important input basis for subsequent high-resolution and high-reliability quality information extraction.
[0061] In one embodiment, in order to suppress the intensity deviation caused by scattering differences due to the scattering attenuation characteristics of the spectral signal during propagation inside fresh corn, the single-tissue spectral vector of the kernel tissue at the i-th measurement position is first attenuated based on the scattering smoothing characteristics. The attenuation-corrected single-tissue spectral vectors of the kernel tissue at all K measurement positions are then merged in the order of the offset distances of the K measurement positions to obtain a two-dimensional spectral scattering image of the kernel tissue. The attenuation correction method includes:
[0062] (1) Determine the attenuation function of light in any wavelength band λ with the offset distance d relative to the laser incident point based on the scattering smoothing characteristics include:
[0063] First, extract the single tissue spectrum vector g of the kernel tissue at the i-th measurement position i Spectral intensity I at mid-band λ i (λ), and determine the offset distance d of the i-th measurement position relative to the laser incident point i . Then, an intensity distance coordinate system is established with the spectral intensity at the band λ as the vertical axis and the offset distance relative to the laser incident point as the horizontal axis, and the discrete point corresponding to the i-th measurement position in the intensity distance coordinate system is constructed. The other measurement positions are processed similarly, and thus K discrete points can be constructed in the intensity distance coordinate system. Then, using the physical property that the spectral signal decays smoothly with spatial distance inside the tissue, an exponential function or a low-order polynomial is used to perform curve fitting on all K discrete points in the intensity distance coordinate system, and the attenuation function of the light in the band λ with the offset distance d relative to the laser incident point can be obtained.
[0064] (2) The single tissue spectrum vector g of the grain tissue at the i-th measurement positioni Spectral intensity I at mid-band λ i (λ) Perform attenuation correction according to the following formula to obtain the spectral intensity after attenuation correction at band λ
[0065]
[0066] Among them, d i is the offset distance of the i-th measurement position relative to the laser incident point. ε is a positive constant that does not exceed a predetermined threshold, that is, a small constant that prevents division by zero.
[0067] Step 140 : Input the two-dimensional spectral scattering image of the kernel tissue into a corn kernel quality detection model to obtain detection results of multiple mutually coupled quality indicators of fresh corn.
[0068] The corn kernel quality detection model used in this step is trained based on a multi-task attention guided neural network model. The quality indicators detected by the corn kernel quality detection model include kernel moisture and kernel sugar content. The two quality indicators are strongly coupled but their changing trends may be inconsistent. In order to improve the feature expression ability and model robustness, in one embodiment, the corn kernel quality detection model includes a task sharing network, a moisture detection network, and a sugar content detection network. Figure 4 The model network diagram is as follows. The two-dimensional spectral scattering image of the fresh corn kernel tissue extracted through the above process is input into the task sharing network. The moisture detection network outputs the moisture detection result of the fresh corn kernel, and the sugar content detection network outputs the sugar content detection result of the fresh corn kernel.
[0069] The task sharing network includes a first convolution structure, a second convolution structure and a third convolution structure connected in sequence. The task sharing network performs multi-scale feature extraction on the two-dimensional spectral scattering image of the grain tissue in sequence through three consecutive convolution structures, and outputs the shallow feature map of the two-dimensional spectral scattering image of the grain tissue through the first convolution structure, the middle feature map of the two-dimensional spectral scattering image of the grain tissue through the second convolution structure, and the deep feature map of the two-dimensional spectral scattering image of the grain tissue through the third convolution structure.
[0070] Specifically, the first convolutional architecture in the task-sharing network consists of a first convolutional module, a second convolutional module, and a first maximum pooling layer, connected in sequence. The second convolutional architecture consists of a third convolutional module, a fourth convolutional module, and a second maximum pooling layer, connected in sequence. The third convolutional architecture consists of a fifth convolutional module and a sixth convolutional module, connected in sequence. Each of the three convolutional architectures consists of a convolutional layer, a batch normalization layer, and a nonlinear activation layer. The convolutional layer extracts local spectral-spatial features, the batch normalization layer stabilizes the training process, and the nonlinear activation layer uses a ReLU activation function to introduce nonlinear representation capabilities. The two convolutional modules in the first convolutional architecture extract low-level edge and texture features, while the first maximum pooling layer downsamples the feature maps and enhances feature robustness. The two convolutional modules in the second convolutional architecture extract mid-level semantic features, while the second maximum pooling layer further compresses the spatial dimensions. The two convolutional modules in the third convolutional architecture extract high-level abstract features without pooling, preserving more spatial details to facilitate subsequent multi-task recognition. The task sharing network derives the shallow feature map F1 through the output of the second convolution module, the middle feature map F2 through the output of the fourth convolution module, and the deep feature map F3 through the output of the sixth convolution module.
[0071] The network structure of the moisture detection network and the sugar content detection network is the same. Each detection network includes the first attention mechanism structure, the second attention mechanism structure, the third attention mechanism structure, the global average pooling module, and the fully connected layer. Each attention mechanism structure includes the attention module, the convolution module, and the pooling module connected in sequence:
[0072] (a) Attention is used to automatically learn the importance weights of channels at each layer, enabling dynamic selection and emphasis of task-related features. The attention mechanism is implemented using the Squeeze-and-Excitation structure.
[0073] (b) The convolution module is used to further process the feature map output by the attention module. It also includes a sequentially connected convolution layer, batch normalization layer, and nonlinear activation layer. It improves the feature expression capability by increasing the number of channels and achieves fusion matching with the shared feature map in the channel dimension.
[0074] (c) The pooling module is used to compress the spatial size of the feature map, reducing the amount of computation while retaining the discriminant information. A 2×2 sliding window is used for pooling operation in each layer.
[0075] Each attention module plays a key role in the entire network. Essentially, it acts as a feature selector, reweighting the intermediate features output by the task-sharing network. This effectively improves the perception of task-related information and reduces redundant interference. The final average pooling module in the detection network is used to globally compress the feature map into a one-dimensional feature vector. The fully connected layer serves as a regression prediction head to output quality indicator detection results.
[0076] The three levels of feature maps output by the task-sharing network are fed into the three attention mechanisms of each detection network. For either the sugar content detection network or the moisture detection network, the first attention mechanism receives the shallow feature map F1 as input. The output of the first attention mechanism is channel-wise concatenated with the mid-level feature map F2 before being fed into the second attention mechanism. The output of the second attention mechanism is channel-wise concatenated with the deep feature map F3 before being fed into the third attention mechanism.
[0077] This model employs a multi-task collaborative learning framework, taking a two-dimensional spectral scattering image of "spatial position × band" as input and using two-dimensional convolutional processing to model local regions across multiple measurement locations. The attention mechanisms of the two detection networks acquire shared features from shallow, mid, and deep layers, forming a cross-scale information pathway. This enables task-based feature extraction and processing of feature maps and completes multi-scale feature fusion. The two detection networks are relatively independent, and the number of feature channels and output layer parameters can be adjusted separately to adapt to the feature expression requirements of different quality indicators.
[0078] Before using the above corn kernel quality detection model, Figure 4 After building the network structure, it is necessary to obtain a training sample set and use it to train a corn kernel quality detection model. The constructed training sample set includes several fresh corn samples, and each fresh corn sample has a measured value of kernel moisture and kernel sugar content. In view of the specific physiological coupling characteristics of kernel moisture and kernel sugar content, a coupled perception loss function is proposed. The loss function L used in the model process is:
[0079]
[0080] in, The kernel moisture test results of fresh corn samples and the measured value of grain moisture y (w) The mean square error between The sugar content of fresh corn samples and the measured value of sugar content of grains y (s) The mean square error between them, ω1 and ω2 are weight parameters. is the detection relevance constraint loss, ρ(y (w) ,y(s) ) represents the measured value y of the kernel moisture of the fresh corn sample (w) and the measured value of sugar content of grains y (s) The Pearson correlation coefficient between Indicates the kernel moisture test results of fresh corn samples and grain sugar content test results The Pearson correlation coefficient between . The difference between the Pearson correlation coefficient between the true labels and the correlation coefficient between the predicted values is calculated to guide the model to learn output trends that are more in line with the actual physiological laws of corn.
[0081] After the model training is completed, the root mean square error (RMSE), determination coefficient (R 2 ) and relative prediction error (RPD) and other regression evaluation indicators were used to comprehensively evaluate the accuracy, stability and generalization ability of the corn kernel quality detection model, thereby verifying its actual adaptability and application value in complex environments.
[0082] The above description is only a preferred embodiment of the present application, and the present application is not limited to the above embodiments. It is understood that other improvements and variations directly derived or imagined by those skilled in the art without departing from the spirit and concept of the present application should be considered to be included in the scope of protection of the present application.
Claims
1. A fresh corn quality detection method integrating signal unmixing and multi-task learning, characterized in that: The fresh corn quality detection method comprises: A laser source is used to illuminate the surface of fresh corn, and mixed spectral data of the fresh corn are collected at K measurement positions with different offset distances relative to the laser incident point. The fresh corn includes cob tissue, kernel tissue, and husk tissue. The integer parameter K is ≥ 2. The mixed spectrum data X collected at the i-th measurement position i Follow X i =A i ·S i T Decompose to obtain the contribution matrix A at the i-th measurement position i =[a i b i c i ] and the spectral set matrix S i =[s i g i l i ]; where a i 、b i 、c i Respectively represent the relative contribution values of the core tissue, grain tissue, and bract tissue at the i-th measurement position; s i 、g i 、l i Represent the single tissue spectrum vectors of the mandrel tissue, grain tissue, and bract tissue at the i-th measurement position respectively; The single-tissue spectral vectors of the kernel tissue at all K measurement positions are merged in the order of the offset distances of the K measurement positions to obtain a two-dimensional spectral scattering image of the kernel tissue. The dimension of the two-dimensional spectral scattering image is K×C, where C is the number of bands of the single-tissue spectral vector of the kernel tissue at each measurement position. The two-dimensional spectral scattering image of the kernel tissue is input into a corn kernel quality detection model to obtain multiple mutually coupled quality index detection results of fresh corn; wherein, the corn kernel quality detection model is trained based on a multi-task attention-guided neural network model.
2. The method for detecting quality of fresh corn according to claim 1, wherein: Decompose to obtain the contribution matrix A at the i-th measurement position i and the spectral set matrix S i include: In the contribution matrix A i and the spectral set matrix S i Under the respective biophysical constraints, the least squares alternating iterative algorithm is used to optimize the solution of X i =A i ·S i T Get the contribution matrix A i and the spectral set matrix S i .
3. The method for detecting the quality of fresh corn according to claim 2, wherein: Contribution matrix A i The biophysical constraints include: The relative contribution value of each tissue at the i-th measurement position is non-negative; as well as, The relative contribution value of each tissue at different measurement locations showed a unimodal distribution characteristic.
4. The method for detecting the quality of fresh corn according to claim 2, wherein: Spectral collection matrix S i The biophysical constraints include: The spectral intensities in C bands in the single tissue spectral vector of each tissue are non-negative; as well as, For any α=s i ,g i ,l i and β = s i ,g i ,l i , Get the minimum value so that the spectrum set matrix S i The independence between single tissue spectral vectors of different tissues is the largest.
5. The method for detecting quality of fresh corn according to claim 1, wherein: The combined two-dimensional spectral scattering image of the grain tissue includes: Based on the scattering smoothing characteristics, the single-tissue spectral vector of the grain tissue at the i-th measurement position is attenuated and corrected. The attenuation-corrected single-tissue spectral vectors of the grain tissue at all K measurement positions are merged in the order of the offset distances of the K measurement positions to obtain a two-dimensional spectral scattering image of the grain tissue.
6. The method for detecting quality of fresh corn according to claim 5, wherein: The attenuation correction of the single tissue spectrum vector of the kernel tissue at the i-th measurement position based on the scattering smoothing characteristic includes: Determine the attenuation function of light in any wavelength band λ with the offset distance d relative to the laser incident point based on the scattering smoothing characteristics The single tissue spectrum vector g of the kernel tissue at the i-th measurement position i Spectral intensity I at mid-band λ i (λ) According to Perform attenuation correction to obtain the spectral intensity after attenuation correction at band λ Among them, d i is the offset distance of the ith measurement position relative to the laser incident point, and ε is a positive constant that does not exceed a predetermined threshold.
7. The method for detecting quality of fresh corn according to claim 6, wherein: Determine the attenuation function of light of any wavelength λ with the offset distance d relative to the laser incident point based on the scattering smoothing characteristics include: Extract the single tissue spectrum vector g of the kernel tissue at the i-th measurement position i Spectral intensity I at mid-band λ i (λ), and determine the offset distance d of the i-th measurement position relative to the laser incident point i ; An intensity distance coordinate system is established with the spectral intensity at band λ as the vertical axis and the offset distance relative to the laser incident point as the horizontal axis. The discrete point corresponding to the i-th measurement position in the intensity distance coordinate system is constructed. By utilizing the physical property that the spectral signal decays smoothly with spatial distance within the tissue, an exponential function or a low-order polynomial is used to perform curve fitting on all K discrete points in the intensity distance coordinate system to obtain the attenuation function of the light in band λ with the offset distance d relative to the laser incident point.
8. The method for detecting quality of fresh corn according to claim 1, wherein: The corn kernel quality detection model includes a task sharing network, a moisture detection network, and a sugar content detection network. The two-dimensional spectral scattering image of the kernel tissue is input into the task sharing network, the moisture detection network outputs the kernel moisture detection result, and the sugar content detection network outputs the kernel sugar content detection result. The task sharing network includes a first convolution structure, a second convolution structure, and a third convolution structure connected in sequence. The task sharing network sequentially extracts multi-scale features from the two-dimensional spectral scattering image of the grain tissue through the three consecutive convolution structures, and outputs a shallow feature map of the two-dimensional spectral scattering image of the grain tissue through the first convolution structure, a middle feature map of the two-dimensional spectral scattering image of the grain tissue through the second convolution structure, and a deep feature map of the two-dimensional spectral scattering image of the grain tissue through the third convolution structure. The network structures of the moisture detection network and the sugar content detection network are the same. Each detection network includes a first attention mechanism structure, a second attention mechanism structure, a third attention mechanism structure, a global average pooling module and a fully connected layer connected in sequence; each attention mechanism structure includes an attention module, a convolution module and a pooling module connected in sequence; the three-level feature maps output by the task sharing network are input into the three attention mechanism structures of each detection network, the first attention mechanism structure of the detection network inputs the shallow feature map, the output of the first attention mechanism structure is channel-joined with the middle feature map and then input into the second attention mechanism structure, and the output of the second attention mechanism structure is channel-joined with the deep feature map and then input into the third attention mechanism structure.
9. The method for detecting quality of fresh corn according to claim 8, wherein: The first convolutional structure in the task sharing network includes a first convolutional module, a second convolutional module, and a first maximum pooling layer connected in sequence; the second convolutional structure includes a third convolutional module, a fourth convolutional module, and a second maximum pooling layer connected in sequence; the third convolutional structure includes a fifth convolutional module and a sixth convolutional module connected in sequence; each convolutional module includes a convolutional layer, a batch normalization layer, and a nonlinear activation layer in sequence; The task sharing network derives shallow feature maps through the output of the second convolution module, derives middle feature maps through the output of the fourth convolution module, and derives deep feature maps through the output of the sixth convolution module.
10. The method for detecting quality of fresh corn according to claim 1, wherein: In the process of training the corn kernel quality detection model using fresh corn samples in the training sample set, the loss function L used is: in, The kernel moisture test results of fresh corn samples and the measured value of grain moisture y (w) The mean square error between The sugar content of fresh corn samples and the measured value of sugar content of grains y (s) The mean square error between ω1 and ω2 is the weight parameter; is the detection relevance constraint loss, ρ(y (w) ,y (s) ) represents the measured value y of the kernel moisture of the fresh corn sample (w) and the measured value of sugar content of grains y (s) The Pearson correlation coefficient between Indicates the kernel moisture test results of fresh corn samples and grain sugar content test results The Pearson correlation coefficient between .
Citation Information
Patent Citations
Cancer hyperspectral image segmentation method and system based on double-branch attention deep learning
CN111667489A
Spatial-spectral combined hyperspectral image classification method based on deep learning
CN118587482A
Cold fresh mutton freshness nondestructive testing method based on double-branch hierarchical spectral feature sensing network
CN119992541A