Research on mechanical automatic food packaging defect detection model based on improved YOLOv5 algorithm
Authors:
Open Access
- 24 April 2025
- journal article
- research article
- Published by Public Library of Science (PLoS) in PLOS ONE
- Vol. 20 (4) , e0321971
Abstract
With the rapid development of industrial automation, traditional manual detection methods are inefficient and error-prone, which cannot meet the needs of modern production for high efficiency and high precision. Therefore, it is particularly important to develop a mechanical automatic inspection system that can automatically identify food packaging defects. In this study, aiming at the limitations of existing technologies in identifying small targets and subtle defects, an enhanced YOLOv5-based model for detecting food packaging flaws is introduced. Firstly, we integrated a Convolutional Attention module (CBAM) to enhance the model’s attention on crucial image features. This mechanism prioritizes significant features by weighting the feature map in channel and spatial dimensions, which improves accuracy in detecting minor defects and small objects. Secondly, feature fusion across scales is achieved with pyramid and aggregation networks, so that the model can capture defects of different sizes at the same time, which enhances the recognition ability of diverse defects in food packaging. In addition, this study also optimizes the backbone network structure of YOLOv5. By integrating the streamlined YOLOv5s model and adding an Adaptive Spatial Feature Fusion module (ASFF), the model’s ability to blend features from different scales was enhanced. In this study, 7400 images with 512×512 resolutions were applied to develop the proposed model. The experimental results show that the improved model outperforms the original YOLOv5 model in terms of Accuracy (Ac), Recall (Re), and F1 score, with values of 0.96, 0.94, and 0.94, respectively, effectively improving the automation and accuracy of food packaging defect detection when compared with YOLOv5+ASFF (Ac=0.94, Re=0.95, and F1=0.94), original YOLOv5 (Ac=0.82, Re=0.85, and F1=0.88), and YOLOv5+CBAM (Ac=0.88, Re=0.9, and F1=0.89). Additionally, the present performance of an improved YOLOv5 model (CBAM+Fusion Pyramid Network (FPN)+Path Aggregation network (PANet)+ASFF) was significantly comparable to the related research works.Keywords
This publication has 29 references indexed in Scilit:
- YOLO-CXR: A Novel Detection Network for Locating Multiple Small Lesions in Chest X-Ray ImagesIEEE Access, 2024
- BFG&MSF-Net: Boundary Feature Guidance and Multi-Scale Fusion Network for Thyroid Nodule SegmentationIEEE Access, 2024
- Deep Convolutional Extreme Learning Machine with AlexNet-Based Bone Cancer Classification Using Whole-Body Scan Images2024
- Automatic Accident Detection System Using IoT Compared to the Systems that a Traffic Centre Uses for Accident DetectionProcedia Computer Science, 2024
- Convolutional Neural Network-Based Defect Detection Technique in FDM TechnologyProcedia Computer Science, 2024
- Classification of defects in wooden structures using pre-trained models of convolutional neural networkCase Studies in Construction Materials, 2023
- A YOLO-based Real-time Packaging Defect Detection SystemProcedia Computer Science, 2023
- Detection of Surface Defects in Ceramic Tiles With Complex TextureIEEE Access, 2021
- Densely Connected Convolutional Networks2017
- Going deeper with convolutions2015