Foreign plastic objects (FPOs) in poultry products present significant food safety risks and cause economic losses for the industry. Conventional detection methods, including X-rays and color imaging, often struggle to identify small or low-density plastics. Hyperspectral imaging (HSI) offers both spatial and spectral information but suffers from high computational cost when applied for FPO identification in industrial environments. This study introduces a parameter-efficient and computationally efficient spatial–spectral transformer framework for pixel-level classification of FPOs on broiler meat using NIR-HSI (1000–1700 nm). The framework integrates three innovations: (1) center-focused linear attention (CFLA) to reduce computational complexity from O(n2) to O(n); (2) patch-local mixed-axis 2D rotary position embedding to preserve geometric relationships within hyperspectral patches; and (3) low-rank factorized projection (LRP) matrices to reduce parameters by approximately 50% within projection weight matrices. The framework was trained and evaluated on a dataset of 52 chicken fillets, comprising 295,340 labeled target hyperspectral pixels from 12 common polymer types and 1 fillet class. The model achieved 99.39% overall accuracy, 99.57% average accuracy, and a 99.31 Kappa coefficient across 248,540 test pixels. Per-class precision, recall, and F1-score exceeded 98.05%, 98.59%, and 98.76%, respectively, across all classes. Efficiency analyses showed an 83% reduction in multiply–accumulate operations (MACs), a 22% reduction in trainable parameters, and a model size reduction from 1.72 MB to 1.35 MB relative to the baseline configuration. These gains also translated into practical inference benefits, with the final model achieving a throughput of 212,971.5 hyperspectral patch cubes/s and a 4.19× speedup over the baseline. These results demonstrate that the proposed framework combines strong classification performance with high efficiency, supporting high-throughput inference for real-time monitoring and enabling contamination source traceability and preventive quality control in industrial poultry processing. The approach provides a benchmark for applying transformer-based models to food safety inspection tasks.
Khan et al. (Thu,) studied this question.