Abstract
Plastic and paper foreign materials in tobacco shreds mainly originate from tobacco processing and packaging. These materials are highly similar to tobacco shreds in color and size, making them difficult for traditional machine vision systems to detect, thus posing a significant risk to product quality and safety. To address this issue, this study proposes a method combining hyperspectral imaging (HSI) and machine learning. After segmenting and denoising hyperspectral images to extract pixel-level spectral data, principal component analysis (PCA) is used to construct classification models of support vector machine (SVM), linear discriminant analysis (LDA), and random forest (RF). The PCA dimensionality reduction results show that SVM accuracy decreased by 0.08%, LDA by 2.67%, while RF maintained a 100% accuracy rate. The LDA model trained with full spectral bands achieved 100% accuracy, demonstrating better robustness and generalization ability. The final classification results are mapped back to the original hyperspectral images for visual classification and detection of foreign materials. This method can reliably detect partially obscured foreign materials. This study overcomes the limitations of detection based on color and size, providing a solution for real-time quality control in the food and pharmaceutical industries.