A fresh corn quality detection method fusing signal unmixing and multi-task learning

By combining signal demixing with multi-task learning, the problem of low accuracy caused by scattering interference in traditional detection is solved, achieving high accuracy and real-time performance in fresh corn quality detection, especially accurate prediction of kernel moisture and sugar content, which is suitable for agricultural product quality grading and intelligent sorting.

CN120489982BActive Publication Date: 2026-07-14JIANGNAN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JIANGNAN UNIV
Filing Date
2025-05-29
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Traditional near-infrared spectroscopy analysis is difficult to obtain pure kernel spectra and has low accuracy when detecting the quality of fresh corn due to multi-level and multi-scale scattering interference between the outer husk, cob and kernel.

Method used

A method combining signal demixing and multi-task learning is adopted. By collecting mixed spectral data at different offset distances, the tissue contribution and spectral set matrix are separated using trilinear decomposition and least squares alternating iterative algorithms. The quality detection is then performed by a neural network model guided by multi-task attention.

Benefits of technology

It achieves non-destructive, rapid, and accurate quality testing of fresh corn, especially high-precision prediction of kernel moisture and sugar content. It is real-time and adaptable, and suitable for agricultural product quality grading and intelligent sorting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120489982B_ABST
    Figure CN120489982B_ABST
Patent Text Reader

Abstract

The application discloses a fresh corn quality detection method fusing signal demixing and multi-task learning, relates to the corn quality detection field, and collects mixed spectrum data at multiple measurement positions on the surface of fresh corn, decouples each group of mixed spectrum data based on a three-linear decomposition strategy to extract pure single-tissue spectrum vectors of grain tissues, performs spatial mixing modeling and merging on the single-tissue spectrum vectors of grain tissues at different measurement positions in space to obtain a two-dimensional spectrum scattering image of grain tissues, and finally combines a corn grain quality detection model trained based on a multi-task attention guide neural network model to perform corn grain spectrum signal separation and multi-quality in-situ detection, so that the signal analysis accuracy under no prior conditions and the robustness and real-time performance of multi-quality prediction can be improved, and the method has the advantages of non-destructiveness, strong real-time performance, high accuracy and good adaptability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of corn quality detection, and in particular to a method for detecting the quality of fresh corn that integrates signal demixing and multi-task learning. Background Technology

[0002] Moisture and sugar content are important quality indicators of fresh sweet corn, and non-destructive, rapid, and high-precision detection methods for these indicators are crucial for optimizing the supply chain. While traditional near-infrared spectroscopy is non-destructive, multi-level and multi-scale scattering interference exists between the outer husks, cob, and kernels of the corn, making it difficult to directly obtain the pure kernel spectrum of fresh sweet corn. This severely impacts the accuracy of analyzing fresh sweet corn quality indicators. Summary of the Invention

[0003] This application addresses the aforementioned problems and technical requirements by proposing a method for detecting the quality of fresh corn that integrates signal demixing and multi-task learning. The technical solution of this application is as follows:

[0004] A method for quality detection of fresh sweet corn that integrates signal demixing and multi-task learning, comprising:

[0005] A laser source emits a laser to irradiate 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 the core tissue, kernel tissue and husk tissue, and the integer parameter K≥2.

[0006] The mixed spectral data X collected at the i-th measurement location i According to X i =A i ·S i T The contribution matrix A at the i-th measurement location is obtained by decomposition. 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 These represent the relative contributions of the core tissue, grain tissue, and bract tissue at the i-th measurement location, respectively; s i g i l i These represent the single-tissue spectral vectors of the core tissue, grain tissue, and bract tissue at the i-th measurement location, respectively.

[0007] The single tissue spectral vectors of the grain tissue at all K measurement locations are merged in order of the offset distance of the K measurement locations to obtain a two-dimensional spectral scattering image of the grain 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 grain tissue at each measurement location.

[0008] Two-dimensional spectral scattering images of kernel tissue are input into the corn kernel quality detection model to obtain the detection results of multiple 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 involves decomposing the matrix A at the i-th measurement location to obtain the contribution matrix. i and the spectral set matrix S i include:

[0010] In contribution matrix A i and the spectral set matrix S i Under their respective biophysical constraints, X is optimized using the least squares alternating iterative algorithm. i =A i ·S i T The contribution matrix A is obtained. i and the spectral set matrix S i .

[0011] Its further technical solution is a contribution matrix A. i The biophysical constraints include:

[0012] The relative contribution of each tissue at the i-th measurement location is non-negative;

[0013] as well as,

[0014] The relative contribution values ​​of each tissue at different measurement locations exhibit a unimodal distribution.

[0015] Its further technical solution is that the spectral set matrix S i The biophysical constraints include:

[0016] In the single-tissue spectral vector of each tissue, the spectral intensities in all C bands are non-negative;

[0017] as well as,

[0018] For any α = s i ,g i ,l i and β = s i ,g i ,l i , To achieve the minimum value of the spectral set matrix Si The independence between the spectral vectors of individual tissues in different tissues is the greatest.

[0019] A further technical solution involves merging the two-dimensional spectral scattering images of the grain tissue to obtain the following:

[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 attenuated and corrected single-tissue spectral vectors of the grain tissue at all K measurement positions are merged in order of the offset distance of the K measurement positions to obtain the two-dimensional spectral scattering image of the grain tissue.

[0021] A further technical solution involves attenuating and correcting the single-tissue spectral vector of the grain tissue at the i-th measurement location based on scattering smoothing characteristics, including:

[0022] Based on the scattering smoothing characteristics, the attenuation function of light of arbitrary wavelength λ with respect to the offset distance d relative to the laser incident point is determined.

[0023] The single tissue spectral vector g of the grain tissue at the i-th measurement position i Spectral intensity I at λ in the mid-band i (λ) according to After attenuation correction, the attenuation-corrected spectral intensity at band λ is obtained. Where, d i ε is the offset distance of the i-th 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 involves determining, based on the scattering smoothing characteristics, the attenuation function of light at any wavelength λ as a function of the offset distance d relative to the laser incident point. include:

[0025] Extract the single-tissue spectral vector g of the grain tissue at the i-th measurement location. i Spectral intensity I at λ in the 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 wavelength λ as the vertical axis and the offset distance relative to the laser incident point as the horizontal axis. Discrete points corresponding to the i-th measurement position in the intensity-distance coordinate system are constructed. Utilizing the physical property that the spectral signal attenuates smoothly with spatial distance within the tissue, an exponential function or a low-order polynomial is used to fit curves to all K discrete points in the intensity-distance coordinate system, yielding the attenuation function of light at wavelength λ with respect to the offset distance d relative to the laser incident point.

[0027] The 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 convolutional structure, a second convolutional structure, and a third convolutional structure connected in sequence. The task-sharing network extracts multi-scale features from the two-dimensional spectral scattering image of the grain tissue through the three consecutive convolutional structures. The first convolutional structure outputs the shallow feature map of the two-dimensional spectral scattering image of the grain tissue, the second convolutional structure outputs the middle feature map of the two-dimensional spectral scattering image of the grain tissue, and the third convolutional structure outputs the deep feature map of the two-dimensional spectral scattering image of the grain tissue.

[0029] The moisture detection network and the sugar content detection network have the same network structure. 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 feature maps of the three levels output by the task-shared network are input to the three attention mechanism structures of each detection network. The first attention mechanism structure of the detection network is input to the shallow feature map. The output of the first attention mechanism structure is concatenated with the middle feature map and then input to the second attention mechanism structure. The output of the second attention mechanism structure is concatenated with the deep feature map and then input to the third attention mechanism structure.

[0030] The further technical solution is that the first convolutional structure in the task-sharing network includes a first convolutional module, a second convolutional module, and a first max pooling layer connected in sequence; the second convolutional structure includes a third convolutional module, a fourth convolutional module, and a second max 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.

[0031] The task-sharing network extracts shallow feature maps through the output of the second convolutional module, mid-level feature maps through the output of the fourth convolutional module, and deep feature maps through the output of the sixth convolutional module.

[0032] A further technical solution involves using the loss function L in the process of training a corn kernel quality detection model using fresh corn samples from the training sample set:

[0033]

[0034] in, These are the kernel moisture test results of fresh sweet corn samples. Measured value of grain moisture y (w) The mean square error between them These are the results of kernel sugar content testing for fresh sweet corn samples. and the measured sugar content of the kernels y (s) The mean square error between them, where ω1 and ω2 are weighting parameters; It is the correlation constraint loss, ρ(y) (w) ,y (s) ) represents the measured kernel moisture content of a fresh corn sample. (w) and the measured sugar content of the kernels y (s) The Pearson correlation coefficient between them This indicates the kernel moisture content of a fresh corn sample. And the results of grain sugar content test The Pearson correlation coefficient between them.

[0035] The beneficial technical effects of this application are:

[0036] This application discloses a method for quality detection of fresh corn that integrates signal demixing and multi-task learning. The method acquires mixed spectral data from multiple different measurement locations of fresh corn, extracts pure single-tissue spectral vectors of kernel tissue from the mixed spectral data at each measurement location based on a trilinear decomposition strategy, and then performs spatial mixing modeling and merging of the single-tissue spectral vectors of kernel tissue at different spatial measurement locations to obtain a two-dimensional spectral scattering image of kernel tissue. This two-dimensional spectral scattering image simultaneously possesses chemical composition features and physical tissue contours, providing an important input foundation for subsequent high-resolution and high-reliability quality information extraction. Combined with a corn kernel quality detection model trained based on a multi-task attention-guided neural network model, the method can quickly and accurately output the detection results of multiple mutually coupled quality indicators of fresh corn, mainly the detection results of kernel moisture and kernel sugar content. This method has the advantages of being non-destructive, highly real-time, highly accurate, and adaptable.

[0037] To improve the prediction accuracy of kernel moisture and kernel sugar content, two quality indicators that are strongly coupled but may have inconsistent trends, this application uses a corn kernel quality detection model that integrates shared and private feature expression mechanisms to achieve simultaneous and efficient prediction of quality indicators such as kernel moisture and sugar content. Simultaneously, the proposed attention mechanism can dynamically select multi-level features, automatically focusing on key features of the task, reducing redundant interference, and improving prediction accuracy. Furthermore, an adaptive design has been implemented for the loss function. The overall method exhibits good scalability, a high degree of automation, and practical application value, making it suitable for various industrial applications such as agricultural product quality grading and intelligent sorting.

[0038] This method integrates a trilinear decomposition strategy with a multi-task attention mechanism for spectral signal separation and in-situ detection of multiple qualities in maize kernels. It can improve the accuracy of signal analysis and the robustness and real-time performance of multi-quality prediction under no prior conditions. Attached Figure Description

[0039] Figure 1 This is a flowchart of a fresh corn quality testing method according to an embodiment of this application.

[0040] Figure 2 This is a detection scenario diagram from this application.

[0041] Figure 3 This is a flowchart of the data processing for extracting two-dimensional spectral scattering images of grain tissue.

[0042] Figure 4 This is a network structure diagram of a corn kernel quality detection model in one embodiment of this application. Detailed Implementation

[0043] The specific embodiments of this application will be further described below with reference to the accompanying drawings.

[0044] To address the issue of low accuracy in fresh corn quality detection using traditional near-infrared spectroscopy due to scattering interference between husks, cob, and kernels, this application discloses a fresh corn quality detection method that integrates signal demixing and multi-task learning. This method includes the following steps, please refer to [reference needed]. Figure 1 The flowchart shown:

[0045] Step 110: Irradiate the surface of fresh corn with a laser source, and collect mixed spectral data of the fresh corn at K measurement locations with different offset distances relative to the laser incident point. Integer parameter K ≥ 2.

[0046] Sweet corn consists of the cob tissue, kernel tissue, and husk tissue. The kernel tissue is arranged on the cob tissue, and the husk tissue covers both the cob tissue and the kernel tissue. Please refer to [reference needed]. Figure 2 The detection scenario diagram uses a laser source emitting laser light at point 210 on the surface of fresh corn, with mixed spectral data collected at four measurement locations (221, 222, 223, and 224) as an example. When the laser emitted by the laser source irradiates the surface of fresh corn, it actually irradiates the surface of the husk tissue. The laser penetrates into the inner layer of the corn and generates multi-level, multi-scale scattering interference between the husk tissue, kernel tissue, and core tissue. Therefore, the mixed spectral data collected at each measurement location is a mixed spectrum of the three tissue components—husk tissue, kernel tissue, and core tissue—coupled together.

[0047] The ear structure of sweet corn is complex, with significant differences in tissue composition and spectral response across different regions. Therefore, this application acquires mixed spectral data from different locations on the ear of sweet corn at K measurement sites to avoid information loss and insufficient regional representativeness caused by single-point acquisition. The distance between each measurement site and the laser incident point is its offset distance relative to the laser incident point. For example, at... Figure 2 In the above, the offset distance of measurement position 221 relative to laser incident point 210 is d1, the offset distance of measurement position 222 relative to laser incident point 210 is d2, the offset distance of measurement position 223 relative to laser incident point 210 is d3, and the offset distance of measurement position 224 relative to laser incident point 210 is d4.

[0048] The choice of quantity K is adjusted based on experience. After comparison in actual applications, a typical value of K of 4 is found to be more effective.

[0049] Step 120: Collect the mixed spectral data X at the i-th measurement location. i According to X i =A i ·S i T The contribution matrix A at the i-th measurement location is obtained by decomposition. i and the spectral set matrix S i Please combine Figure 3 A diagram illustrating data processing.

[0050] Contribution Matrix A i It can be represented as A i =[a i b i c i ], a i b represents the relative contribution value of the mandrel structure at the i-th measurement position. i c represents the relative contribution value of the grain tissue at the i-th measurement location. i This represents the relative contribution value of the bract tissue at the i-th measurement location. For example, in... Figure 2 In the example, the contribution matrix A1 = [a1 b1c1] at measurement position 221, where a1 represents the relative contribution value of the pistil tissue at measurement position 221, b1 represents the relative contribution value of the grain tissue at measurement position 221, and c1 represents the relative contribution value of the husk tissue at measurement position 221. The contribution matrix A2 = [a2 b2 c2] at measurement position 222, where a2 represents the relative contribution value of the pistil tissue at measurement position 222, b2 represents the relative contribution value of the grain tissue at measurement position 222, and c2 represents the relative contribution value of the husk tissue at measurement position 222. The contribution matrices at measurement positions 223 and 224 can be obtained similarly.

[0051] Spectral set matrix S i It can be represented as S i =[s i g i l i ], s i G represents the single-structure spectral vector of the mandrel tissue at the i-th measurement location. i Let l represent the single-tissue spectral vector of the grain tissue at the i-th measurement location. i This represents the single-tissue spectral vector of the bract tissue at the i-th measurement location. The single-tissue spectral vector of each tissue is pure spectral data containing only that tissue and unaffected by other tissues. The single-tissue spectral vector of each tissue includes the spectral intensities of C bands.

[0052] The above process separates the mixed spectral data using a trilinear decomposition strategy of the spectral signal, allowing for the extraction of the pure spectra of the three tissues. To ensure that the obtained separation results have biophysical significance, the contribution matrix A... i and the spectral set matrix S i Spectral data separation is achieved by solving models under their respective biophysical constraints. To efficiently achieve ordered decoupling of multi-source spectral information, a least-squares alternating iterative algorithm is used to optimize the solution of X under biophysical constraints. i =A i ·S i T The contribution matrix A is obtained. 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 prior constraints, which are described below:

[0054] (1) Contribution matrix A i The biophysical constraints include nonnegativity constraints and unimodality constraints.

[0055] Nonnegativity constraint: The relative contribution value of each tissue at the i-th measurement location is nonnegative, that is, a i ≥0, b i ≥0, c i ≥0.

[0056] Unimodal constraint: The relative contribution values ​​of each tissue at different measurement locations exhibit a unimodal distribution characteristic. The specific distribution characteristics of the three tissues are different. The relative contribution value 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 value 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 value 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 nonnegativity constraints and independence constraints.

[0058] Nonnegativity constraint: The spectral intensities in all C bands of the single-tissue spectral vector of each tissue at the i-th measurement location are nonnegative. That is, for any band λ, the spectral intensities I in band λ of the single-tissue spectral vector of each tissue at the i-th measurement location are all nonnegative. i (λ)≥0.

[0059] Independence constraint: The spectral set matrix S at the i-th measurement location i The independence between the spectral vectors of individual tissues in different tissues is maximized, which can be expressed mathematically as: for any α = s i ,g i ,l i and β = s i ,g i ,l i , To achieve the minimum value of the spectral set matrix S i The independence between single-tissue spectral vectors of different tissues is the greatest, where α T β represents the dot product of vectors α and β.

[0060] Step 130: The single-tissue spectral vectors of the grain tissue at all K measurement locations are merged in order of offset distance at the K measurement locations to obtain a two-dimensional spectral scattering image of the grain tissue. The horizontal axis of the final two-dimensional spectral scattering image represents the spectral bands, and the vertical axis represents the measurement location number. The dimension of the two-dimensional spectral scattering image is K×C, where C is the number of bands in the single-tissue spectral vector of the grain tissue at each measurement location. This means that the channel dimension simulates the measurement points of different parts of fresh corn, and the width direction expresses the spectral band changes; for example, in one instance, the dimension is 4*955. The resulting two-dimensional spectral scattering image of the grain tissue retains the typical absorption characteristics of the grain and expresses its spatial distribution characteristics in different regions on the corn surface. This two-dimensional spectral scattering image simultaneously contains chemical composition regions (such as the water absorption peak in the grain tissue values) and physical tissue contours (such as the regions of the grain tissue), providing an important input foundation for subsequent high-resolution, high-reliability quality information extraction.

[0061] In one embodiment, to address the scattering attenuation characteristics of spectral signals propagating within fresh corn, and to suppress intensity deviations caused by scattering differences, the single-tissue spectral vector of the grain tissue at the i-th measurement position is first attenuated based on scattering smoothing characteristics. The attenuated single-tissue spectral vectors of the grain tissue at all K measurement positions are then merged according to the offset distances of the K measurement positions to obtain a two-dimensional spectral scattering image of the grain tissue. The attenuation correction method includes:

[0062] (1) Determine the attenuation function of light of arbitrary wavelength band λ with respect to the offset distance d relative to the laser incident point based on the scattering smoothness characteristics. include:

[0063] First, extract the single-tissue spectral vector g of the grain tissue at the i-th measurement position. i Spectral intensity I at λ in the 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 wavelength λ as the vertical axis and the offset distance relative to the laser incident point as the horizontal axis. Discrete points corresponding to the i-th measurement position in this intensity-distance coordinate system are constructed, and the same process is applied to other measurement positions. Thus, K discrete points can be constructed in this intensity-distance coordinate system. Then, utilizing the physical property that the spectral signal attenuates smoothly with spatial distance within the tissue, an exponential function or a low-order polynomial is used to fit curves to all K discrete points in the intensity-distance coordinate system. This yields the attenuation function of light at wavelength λ with respect to the offset distance d relative to the laser incident point.

[0064] (2) The single-tissue spectral vector g of the grain tissue at the i-th measurement position.i Spectral intensity I at λ in the mid-band i (λ) The attenuation correction is performed according to the following formula to obtain the attenuation-corrected spectral intensity at band λ.

[0065]

[0066] Where, 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, i.e., a small constant to prevent division by zero.

[0067] Step 140: Input the two-dimensional spectral scattering image of the kernel tissue into the corn kernel quality detection model to obtain the 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 this model include kernel moisture and kernel sugar content. These two indicators are strongly coupled but their trends may differ. To improve feature representation 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. Please refer to [the relevant documentation / reference]. Figure 4 The model network diagram is as follows. The two-dimensional spectral scattering image of the fresh corn kernel tissue obtained through the above process is input into the task sharing network. The moisture detection network outputs the moisture content detection result of the fresh corn kernels, and the sugar content detection network outputs the sugar content detection result of the fresh corn kernels. Wherein:

[0069] The task-sharing network comprises a first convolutional structure, a second convolutional structure, and a third convolutional structure connected in sequence. The task-sharing network extracts multi-scale features from the two-dimensional spectral scattering image of the grain tissue through the three consecutive convolutional structures. The first convolutional structure outputs the shallow feature map of the two-dimensional spectral scattering image of the grain tissue, the second convolutional structure outputs the middle feature map of the two-dimensional spectral scattering image of the grain tissue, and the third convolutional structure outputs the deep feature map of the two-dimensional spectral scattering image of the grain tissue.

[0070] The specific task-sharing network's first convolutional structure comprises a first convolutional module, a second convolutional module, and a first max-pooling layer connected in sequence. The second convolutional structure comprises a third convolutional module, a fourth convolutional module, and a second max-pooling layer connected in sequence. The third convolutional structure comprises a fifth convolutional module and a sixth convolutional module connected in sequence. Each convolutional module in the three structures comprises a convolutional layer, a batch normalization layer, and a nonlinear activation layer. The convolutional layer is used to extract local spectral-spatial features, the batch normalization layer is used to stabilize the training process, and the nonlinear activation layer uses the ReLU activation function to introduce nonlinear representation capabilities. The two convolutional modules in the first convolutional structure are used to extract low-level edge and texture features, and the first max-pooling layer is used to downsample the feature map and enhance feature robustness. The two convolutional modules in the second convolutional structure are used to extract mid-level semantic features, and the second max-pooling layer is used to further compress spatial dimensions. The two convolutional modules in the third convolutional structure are used to extract high-level abstract features without pooling operations, preserving more spatial details to facilitate subsequent multi-task recognition. The task-sharing network extracts a shallow feature map F1 through the output of the second convolutional module, a middle feature map F2 through the output of the fourth convolutional module, and a deep feature map F3 through the output of the sixth convolutional module.

[0071] The moisture detection network and the sugar content detection network have the same network structure. 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 sequentially. Each attention mechanism structure includes an attention module, a convolution module, and a pooling module, connected sequentially.

[0072] (a) Attention is used to automatically learn the importance weights of each channel layer, enabling dynamic selection and emphasis of task-related features. The attention mechanism is implemented using a Squeeze-and-Excitation structure.

[0073] (b) The convolutional module is used to further process the feature map output by the attention module. It also includes a series of convolutional layers, batch normalization layers and non-linear activation layers connected in sequence. It enhances the feature representation capability by increasing the number of channels and achieves fusion and matching with the shared feature map in the channel dimension.

[0074] (c) The pooling module is used to compress the feature map space size, reduce the amount of computation while retaining the discrimination information. Each layer uses a 2×2 sliding window for pooling operation.

[0075] Each attention module plays a crucial role in the entire network. Essentially, it acts as a feature selector, reweighting intermediate features from the task-shared network output to effectively enhance the perception of task-related information and reduce redundant interference. The final average pooling module in the detection network globally compresses the feature map into a one-dimensional feature vector, and the fully connected layer serves as the regression prediction head, outputting the quality index detection results.

[0076] The three-layer feature maps output by the task-sharing network are input into the three attention mechanism structures of each detection network. For any one of the sugar content detection network and the moisture detection network, the input of the first attention mechanism structure of the detection network obtains the shallow feature map F1. The output of the first attention mechanism structure is concatenated with the middle feature map F2 and then input into the second attention mechanism structure. The output of the second attention mechanism structure is concatenated with the deep feature map F3 and then input into the third attention mechanism structure.

[0077] This model employs a multi-task collaborative learning framework, using a two-dimensional spectral scattering image ("spatial location × band") as input. It utilizes two-dimensional convolution to model local regions across multiple measurement locations. The attention mechanisms of the two detection networks respectively acquire shared features from shallow, mid-level, and deep layers, forming a cross-scale information pathway. This enables task-based feature map extraction and processing, and completes multi-scale feature fusion. The two detection networks are relatively independent, allowing for independent adjustment of the number of feature channels and output layer parameters to adapt to feature representation requirements of different quality indices.

[0078] Before using the above-mentioned corn kernel quality detection model, it should be in accordance with... Figure 4 After constructing 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 measured values ​​for kernel moisture and kernel sugar content. Considering the specific physiological coupling characteristics of kernel moisture and kernel sugar content, a coupling-sensing loss function is proposed. The loss function L used in the model process is:

[0079]

[0080] in, These are the kernel moisture test results of fresh sweet corn samples. Measured value of grain moisture y (w) The mean square error between them These are the results of kernel sugar content testing for fresh sweet corn samples. and the measured sugar content of the kernels y (s) The mean square error between them, where ω1 and ω2 are weighting parameters. It is the correlation constraint loss, ρ(y) (w) ,y(s) ) represents the measured kernel moisture content of a fresh corn sample. (w) and the measured sugar content of the kernels y (s) The Pearson correlation coefficient between them This indicates the kernel moisture content of a fresh corn sample. And the results of grain sugar content test The Pearson correlation coefficient between them. 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 an output trend that better reflects the actual physiological patterns of maize.

[0081] After the model training is completed, the root mean square error (RMSE) and coefficient of determination (R²) are used. 2 The accuracy, stability and generalization ability of the corn kernel quality detection model are comprehensively evaluated using regression evaluation indicators such as relative prediction error (RPD), thereby verifying its actual adaptability and application value in complex environments.

[0082] The above descriptions are merely preferred embodiments of this application, and this application is not limited to the above embodiments. It is understood that other improvements and variations that can be directly derived or conceived by those skilled in the art without departing from the spirit and concept of this application should be considered to be included within the protection scope of this application.

Claims

1. A method for quality detection of fresh corn that integrates signal demixing and multi-task learning, characterized in that, The method for testing the quality of fresh corn includes: A laser source emits a laser beam that illuminates the surface of fresh corn, with different offset distances relative to the laser incident point. Mixed spectral data of fresh sweet corn were collected at several measurement locations, including the cob tissue, kernel tissue, and husk tissue, with integer parameters. ; The first Mixed spectral data collected at each measurement location according to Decomposition yields the first Contribution matrix at each measurement location and spectral set matrix ;in, , , They represent the first The relative contribution values ​​of the core tissue, grain tissue, and bract tissue at each measurement location; , , They represent the first Single tissue spectral vectors of core tissue, grain tissue, and bract tissue at each measurement location; For grain tissue in all The single tissue spectral vectors at each measurement location are according to The two-dimensional spectral scattering image of the grain tissue is obtained by sequentially merging the offset distances of each measurement location. The dimension of the two-dimensional spectral scattering image is... , It is the number of bands in the single-tissue spectral vector of the grain tissue at each measurement location; Two-dimensional spectral scattering images of kernel tissue are input into a corn kernel quality detection model to obtain the detection results of multiple coupled quality indicators of fresh corn; wherein, the corn kernel quality detection model is trained based on a multi-task attention-guided neural network model. The combined two-dimensional spectral scattering image of the grain tissue includes: extracting the grain tissue in the second... Single tissue spectral vector at each measurement location medium band spectral intensity at and determine the first The offset distance of each measurement position relative to the laser incident point ; in band A coordinate system is established with the spectral intensity at a given location as the vertical axis and the offset distance relative to the laser incident point as the horizontal axis. The first... Each measurement location corresponds to a discrete point in the intensity-distance coordinate system. Utilizing the physical property that spectral signals smoothly attenuate with spatial distance within tissue, an exponential function or low-order polynomial is used to represent all points in the intensity-distance coordinate system. Curve fitting is performed on discrete points to obtain the band. The light changes with the offset distance relative to the laser incident point decay function ; for grain tissue in the first Single tissue spectral vector at each measurement location medium band spectral intensity at according to Attenuation correction is performed to obtain the band. Attenuation-corrected spectral intensity ;in, It is the first The offset distance of each measurement position relative to the laser incident point It is a normal number that does not exceed a predetermined threshold; for all grain tissues The attenuation-corrected single-tissue spectral vectors at each measurement location are calculated according to... The two-dimensional spectral scattering image of the grain tissue is obtained by sequentially merging the offset distances of the measurement locations.

2. The method for detecting the quality of fresh corn according to claim 1, characterized in that, Decomposition yields the first Contribution matrix at each measurement location and spectral set matrix include: In the contribution matrix and spectral set matrix Under their respective biophysical constraints, the solution is optimized using the least squares alternating iterative algorithm. Obtain the contribution matrix and spectral set matrix .

3. The method for detecting the quality of fresh corn according to claim 2, characterized in that, Contribution matrix The biophysical constraints include: No. The relative contribution of each tissue at each measurement location is non-negative; as well as, The relative contribution values ​​of each tissue at different measurement locations exhibit a unimodal distribution.

4. The method for detecting the quality of fresh corn according to claim 2, characterized in that, Spectral set matrix The biophysical constraints include: In the single tissue spectral vector of each tissue The spectral intensity of each band is non-negative; as well as, For any and , To achieve the minimum value of the spectral set matrix The independence between the spectral vectors of individual tissues in different tissues is the greatest.

5. The method for detecting the quality of fresh corn according to claim 1, characterized in 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. The task-sharing network includes a first convolutional structure, a second convolutional structure, and a third convolutional structure connected in sequence. The task-sharing network extracts multi-scale features from the two-dimensional spectral scattering image of the grain tissue through the three consecutive convolutional structures. The first convolutional structure outputs the shallow feature map of the two-dimensional spectral scattering image of the grain tissue, the second convolutional structure outputs the middle feature map of the two-dimensional spectral scattering image of the grain tissue, and the third convolutional structure outputs the deep feature map of the two-dimensional spectral scattering image of the grain tissue. The moisture detection network and the sugar content detection network have the same network structure. 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 feature maps of the three levels output by the task-shared network are input to the three attention mechanism structures of each detection network. The first attention mechanism structure of the detection network is input to the shallow feature map. The output of the first attention mechanism structure is concatenated with the middle feature map and then input to the second attention mechanism structure. The output of the second attention mechanism structure is concatenated with the deep feature map and then input to the third attention mechanism structure.

6. The method for detecting the quality of fresh corn according to claim 5, characterized in that, The first convolutional structure in the task-sharing network includes a first convolutional module, a second convolutional module, and a first max-pooling layer connected in sequence; the second convolutional structure includes a third convolutional module, a fourth convolutional module, and a second max-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 extracts shallow feature maps through the output of the second convolutional module, mid-level feature maps through the output of the fourth convolutional module, and deep feature maps through the output of the sixth convolutional module.

7. The method for detecting the quality of fresh corn according to claim 1, characterized in that, In the process of training a corn kernel quality detection model using fresh corn samples from the training sample set, the loss function used is... for: in, These are the kernel moisture test results of fresh sweet corn samples. Actual moisture content of grains The mean square error between them These are the results of kernel sugar content testing for fresh sweet corn samples. Measured sugar content of grains The mean square error between them and These are weight parameters; It is a detection correlation constraint loss. This represents the measured kernel moisture content of a fresh corn sample. Measured sugar content of grains The Pearson correlation coefficient between them This indicates the kernel moisture content of a fresh corn sample. And the results of grain sugar content test The Pearson correlation coefficient between them.