This study addresses the challenge of accurately discriminating the origin of Wuyi Rock Tea due to dynamic changes in its compound composition during storage. A novel intelligent discrimination method based on a time-spectral dual-dimensional dynamic model is proposed. By integrating Near-Infrared (NIR) spectroscopy with machine learning techniques, Principal Component Analysis (PCA) combined with Isolation Forest (iForest) was employed to eliminate anomalous samples, while 12 single preprocessing methods and 6 hybrid combinations were introduced to enhance data quality. The performance of four traceability models—K-Nearest Neighbors (KNN), Support Vector Machine (SVM), Random Forest (RF), and Transformer—was evaluated, with a focus on optimizing the Transformer model through input dimension screening. The term ’time-spectral dual-dimensional’ denotes the fusion of storage time and spectral (NIR) data via the Transformer’s self-attention mechanism, capturing spectral evolution over time without employing time-series architectures. Results demonstrated that the optimized Transformer model combined with first-order derivative (1D) preprocessing (O-1D-Transformer) achieved the highest performance, with test set accuracy, Macro-F1, and G-mean values of 98.05%, 97.11%, and 98.41%, respectively. By dynamically modulating inter-band correlations via self-attention, this model captures storage-induced chemical patterns, distinguishing origin signals from chronological noise and thereby overcoming the time-blindness of static models. This research provides a new paradigm for intelligent traceability of time-sensitive food products, validating the synergistic advantages of NIR spectroscopy and deep learning, with significant implications for tea quality regulation and brand protection.
扫码关注我们
求助内容:
应助结果提醒方式:
