A two-stage hierarchical support vector machine framework detects roasted coffee adulterants through principal component analysis of hyperspectral imaging data
摘要
Economically motivated adulteration (EMA) of roasted coffee presents a critical challenge to global market integrity and consumer safety, specifically regarding the surreptitious inclusion of high-risk allergens like barley and soybeans. The detection of such contaminants is historically hindered by the Maillard reaction, a thermal convergence during roasting that renders adulterants visually and spectrally indistinguishable from the coffee matrix. To address this forensic gap, this study presents a targeted hyperspectral imaging (HSI) framework (400–1000 nm) integrated with a two-stage hierarchical Support Vector Machine (SVM) designed to decouple detection from specific biological diagnosis. A core contribution of this methodology is the implementation of Principal Component Analysis (PCA) to resolve spectral redundancy across the 128-band hypercube. By distilling the data into two primary components capturing over 92% of the cumulative variance, the framework establishes a “spectrochemical bridge” that isolates hidden chromatic and biochemical variances invisible to traditional RGB sensors. This high-significance feature space allows the SVM to overcome the “Euclidean trap” inherent in unsupervised clustering, which frequently suffers from “class collapse” in roasted materials. Experimental results demonstrate that the hierarchical pipeline achieves an optimal overall accuracy of 88.6% and a Kappa coefficient of 0.378. The system attained high reliability during the Stage-1 binary screening, achieving an F1-score of 0.922 to protect the primary coffee matrix, while the Stage-2 multi-class model successfully mapped the spatial distribution of the highly camouflaged allergens. By providing pixel-wise, automated risk assessments, this work establishes a data-driven proof-of-concept for ‘Smart Food Safety’ systems, highlighting the potential for forensic authentication in future industrial quality control environments.