Abstract:Objective To address the problems of a large number of parameters and complex calculation of the current real-time detection models for food packaging defects and their difficult deployment on terminal equipment, this study proposes a lightweight model SGHS-DETR based on improved real-time detection transformer (RT-DETR).Methods To reduce model parameters, the ultra-lightweight network StarNet is employed as the feature extraction backbone. Additionally, GELAN, an efficient aggregation module based on gradient path planning, is introduced for feature fusion and preservation of semantic and detail features. Furthermore, the lightweight Haar wavelet downsampling (HWD) module based on wavelet decomposition is adopted to minimize information loss in features. Moreover, ShapeIoU replaces the loss function to further enhance detection accuracy.Results On the biscuit packaging dataset, the average detection accuracy of the SGHS-DETR model reaches 92.6%. Compared to the baseline model, this approach reduces the number of parameters and computational complexity by 65.5% and 72.1%, respectively and also increases detection speed by 74.4%.Conclusion The SGHS-DETR model can rapidly and effectively detect appearance defects in biscuit packaging.