Abstract:
Egg cooking degree detection is essential for the standardized grading and industrial processing of egg products. Traditional non-destructive detection methods, including optical perspective, acoustic detection and density testing, rely heavily on manual sensory judgment, featuring cumbersome operation, low efficiency, low accuracy and poor stability, which failed to adapt to large-scale modern industrial production. Meanwhile, the original visible/near-infrared spectral data of eggs contain substantial environmental noise and redundant band information. The conventional one-dimensional convolutional neural network showed weak anti-interference ability for invalid spectral information and could not effectively extract key characteristic bands reflecting protein denaturation and water state changes in cooked eggs, restricting its application in egg cooking degree classification. To solve the above problems, this study developed an improved CC-1D-CNN model by embedding the convolutional block attention module (CBAM) and channel context attention module (CCA) into the basic 1D-CNN structure. Without relying on complex spectral preprocessing, the proposed model directly utilized original egg visible/near-infrared spectra to achieve rapid and accurate multi-class detection of egg cooking degrees, which greatly simplified the detection process. Systematic experiments were performed to validate the model’s feasibility and superiority. Original spectral analysis results indicated that the spectral differences of eggs with three cooking degrees were mainly concentrated in the 700~1 100 nm band, corresponding to the overtone and combination vibration absorption of N-H and O-H chemical bonds. This band effectively reflected the physicochemical changes of internal moisture and protein during egg thermal processing, providing a theoretical basis for spectral feature identification of egg cooking grades. Ablation experiments verified the effectiveness of the dual-attention collaborative improvement strategy. Single CBAM or CCA only realized one-dimensional feature optimization with limited ability to capture critical spectral features, whereas the combination of CBAM and CCA achieved dual screening of channel and context features, suppressed spectral noise and redundant interference, enhanced the model’s effective feature perception capability, and significantly improved the feature extraction performance of the original 1D-CNN model. Comparative tests with multiple mainstream time-series spectral models confirmed that the CC-1D-CNN model exhibited the best comprehensive performance, with an average single-sample detection time of 46.5 ms, meeting the real-time detection requirements of industrial production lines. Confusion matrix results demonstrated the model’s outstanding classification accuracy and stability: the recognition accuracy for large soft-boiled eggs, small soft-boiled eggs and fully cooked eggs was 98.65%, 96% and 91.89%, respectively. The overall three-classification accuracy of the test set reached 95.52%, and the binary classification accuracy for soft-boiled and fully cooked eggs was up to 99.55%. No obvious under-fitting or over-fitting occurred during model training and iteration, proving its favorable generalization and robustness. The established CC-1D-CNN model realized efficient and intelligent non-destructive detection of egg cooking degrees, avoiding spectral preprocessing and balancing high accuracy and fast detection speed. It effectively overcame the deficiencies of traditional detection methods and single neural network models, providing a feasible technical scheme for industrial automatic grading of cooked eggs and laying a foundation for the subsequent development of portable spectral detection equipment for egg cooking degree detection. Future research will expand the dataset of eggs with different sizes, freshness and growth conditions to optimize model parameters, improve the model’s universality in complex industrial scenarios, and promote the industrial application of egg cooking degree non-destructive detection technology.