Welcome to Smart Agriculture 中文

Smart Agriculture

   

MaMoNet-Based Detection Model for Moisture Content and Hardness of Fresh Corn Using Spatially Resolved Spectroscopy

XU Min1, ZHAO Xin1, CHEN Yanping2, ZHU Qibing1, HUANG Min1()   

  1. 1. Key Laboratory of Advanced Process Control for Light Industry (Ministry of Education), Jiangnan University, Wuxi 214122, China
    2. Institute of Food Crops, Jiangsu Academy of Agricultural Sciences, Nanjing 210014, China
  • Received:2025-12-26 Online:2026-03-13
  • Foundation items:Jiangsu Provincial Agricultural Science and Technology Independent Innovation Fund (CX [23] 3129)
  • About author:

    XU Min, E-mail:

  • corresponding author:
    HUANG Min, E-mail:

Abstract:

[Objective] Moisture content and kernel hardness are key indicators for evaluating the eating quality and harvest maturity of fresh corn. Accurate and simultaneous prediction of these parameters is essential for quality grading and post-harvest management. However, conventional near-infrared spectroscopy (NIRS) methods are mostly based on single-point measurements, which are easily affected by husk shielding and kernel heterogeneity, resulting in limited prediction accuracy, especially for multi-attribute estimation. Spatially resolved spectroscopy, by acquiring spectral information from multiple measurement channels, can better reflect internal quality differences of corn kernels. Nevertheless, the high dimensionality and strong correlation of spatially resolved spectral data, together with the heterogeneity between different prediction tasks, pose significant challenges to traditional modeling approaches. Therefore, the purpose is to develop an effective multi-task prediction model that can fully exploit spatially resolved spectral information while balancing feature sharing and task specificity for moisture content and kernel hardness prediction in husked fresh corn. [Methods] Husk-on Fresh corn samples were collected across different maturity stages to ensure sufficient variability in moisture content and kernel hardness. A multi-channel visible-near infrared spatially resolved spectroscopy system was constructed to acquire spectral signals from four spatial measurement channels at different source-detector distances. Each corn ear was segmented into multiple positions, and spectral data were collected from different spatial locations to comprehensively capture internal quality information. In total, 500 valid spectral samples were obtained and randomly divided into training, validation, and test sets at a ratio of 7:1:2. Before modeling, the raw spectral data were preprocessed using z-score standardization to eliminate scale differences among channels and wavelengths and to improve numerical stability during training. The proposed MaMoNet (Mamba-MMoE Network) model is composed of three main modules: a one-dimensional convolutional neural network (1D-CNN) for local feature extraction, a Mamba-based sequence modeling module for global dependency learning, and a Multi-gate Mixture-of-Experts (MMoE) module for task-adaptive feature allocation. First, the 1D-CNN module was employed to extract low-level local spectral patterns and reduce feature redundancy. The input spectral data were processed by two successive one-dimensional convolutional layers and down sampling was then applied to compress the spectral length, resulting in a more compact representation and reducing the computational burden for subsequent sequence modeling. Next, the compressed spectral features were fed into the Mamba module to capture long-range dependencies along the spectral dimension. Mamba is a selective state space model that enables efficient modeling of long spectral sequences by dynamically updating hidden states, allowing global spectral evolution patterns to be effectively learned with linear computational complexity. Finally, the output features of the Mamba module were input into an MMoE module to support multi-task learning of moisture content and kernel hardness. Multiple expert networks were shared across tasks, and task-specific gating networks were used to adaptively weight expert outputs, enabling flexible feature sharing and task-specific representation learning. The task-specific features were then passed to individual regression heads to generate the final predictions for moisture content and kernel hardness. To comprehensively evaluate the effectiveness of the proposed approach, MaMoNet was compared with several representative multi-task convolutional neural network models. In addition, ablation experiments were conducted by selectively removing the Mamba module or the MMoE module to analyze their individual contributions to overall performance. [Results and Discussions] Experimental results demonstrated that the proposed MaMoNet model consistently outperformed all comparison models on the test set for both prediction tasks. For moisture content prediction, MaMoNet achieved a coefficient of determination (R2) of 0.93, a root mean square error (RMSE) of 4.66%, and a residual predictive deviation (RPD) of 3.82, indicating excellent predictive accuracy and robustness. For kernel hardness prediction, the corresponding R², RMSE, and RPD values reached 0.86, 4.22 N, and 2.69, respectively, which also surpassed those of the benchmark models. The ablation study further verified the rationality of the proposed model design. Removing both the Mamba and MMoE modules resulted in the poorest performance, whereas introducing either module individually led to noticeable improvements. The best prediction results were achieved when both modules were jointly employed, indicating that their combination is critical for achieving optimal multi-task prediction performance. These results indicated that moisture content and kernel hardness, although correlated, emphasize different spectral characteristics. The flexible feature-sharing mechanism enabled by MMoE allows the model to balance information sharing and task specificity, while the Mamba module ensures effective utilization of long-range spectral information. Together, they contribute to improved generalization performance under limited sample conditions. [Conclusions] This study proposes a MaMoNet model that integrates Mamba-based state space modeling with an MMoE-based multi-task learning strategy for simultaneous prediction of moisture content and kernel hardness in husked fresh corn using spatially resolved spectroscopy. The proposed approach effectively overcomes the limitations of conventional single-point spectral analysis and rigid parameter-sharing multi-task models. Experimental comparisons and ablation analyses confirm that MaMoNet achieves improved accuracy, robustness, and generalization capability. The results demonstrate the potential of the proposed framework for rapid and non-destructive quality assessment of fresh corn and provide useful methodological insights for multi-attribute prediction based on high-dimensional spectral data.

Key words: fresh corn, multi-channel Vis-NIR spectroscopy, Mamba, multi-task learning, quality prediction

CLC Number: