The invention relates to a packaging defect detection method and
system, and the method comprises the steps: S1, obtaining the size information of packaging bags and the interval information of adjacent packaging bags through an area-array camera and a
photoelectric sensor in combination with a multi-scale
template matching method; s2,
delay time of a conveying belt is calculated, and it is ensured that the distance between adjacent packaging bags is larger than a set value; s3, triggering a
line scanning camera to
shoot an image of the packaging bag, and collecting the vibration frequency; s31, performing motion compensation correction on the image by adopting an improved
optical flow method; s32, inputting the corrected image into a
forward propagation network based on an improved OfficientViT model, wherein the model comprises a multi-scale linear attention module and an SPP-ELan module; s33, the images are classified, if the
classification result is that the bags are not packaged, the unpackaged bags are grabbed through a grabbing
robot, and if it is determined that the bags are not packaged based on a classification confidence coefficient threshold value, the unpackaged bags are removed; and S34, inputting the defect image into an improved ACGAN network for data enhancement, wherein the network comprises a CMFNet denoising module based on a U-Net architecture. The method and the
system can monitor and identify the packaging defects on the
production line in real time, improve the accuracy and the efficiency of inspection, and reduce the labor cost.