节点文献
基于深度学习的联排塑料瓶缺陷检测算法研究
Research on Defect Detection Algorithm of Row Plastic Bottles Based on Deep Learning
【作者】 李鑫;
【导师】 任德均;
【作者基本信息】 四川大学 , 机械工程, 2022, 硕士
【摘要】 近年来,随着塑料瓶生产技术的日益成熟,药用玻璃瓶被逐步替代。由于生产工艺和制造环境的问题,部分医用联排塑料瓶存在一些质量缺陷,这些缺陷对产品的外观和使用安全造成重大影响。因此,对医药联排塑料瓶进行缺陷检测是制药企业进行生产加工过程中的重要环节。传统的人工灯检由于工作强度大、检测效率低、准确性不稳定等缺点已不再适用于现今的高速生产需求。于是为了解决医用联排塑料瓶产品的缺陷检测需求,本文利用了深度学习的相关算法可以通过神经网络自动从图像中提取缺陷特征的优势,开展了将深度学习算法应用于医用联排塑料瓶缺陷检测的研究。鉴于联排塑料瓶缺陷的多样性,采用了不同的深度学习算法进行针对性的检测。本文的主要工作如下:1.针对联排塑料瓶瓶身轮廓缺陷的检测,本文提出一种基于改进的STDC-Seg的瓶身轮廓缺陷检测算法。通过对瓶身轮廓缺陷的检测难点进行分析,综合考虑检测精度以及检测速度,选择STDC-Seg作为瓶身轮廓缺陷检测算法。实验发现,原始算法在检测精度上满足检测需求,但在检测速度上有待提高。因此本文首先对STDC-Seg网络进行了优化,在保有较高的检测精度的情况下,显著降低了网络的运算量。使用Resnet的Basic Block组建轻量级的骨干网络,通过空间金字塔池化模块SPP和自注意力机制模块Co Tx有效地提高了网络的特征提取能力,在联排塑料瓶瓶身数据集上进行测试,本文算法的瓶身轮廓分割m IOU达到98.78%,推理时间为8.4ms。然后通过先对分割轮廓求取最大外轮廓和最大内轮廓,再与设定的阈值相比较的方式来判断瓶身轮廓是否合格,以及瓶身是否存在超过允许值的内部割裂变形缺陷。2.针对联排塑料瓶瓶身缺陷的检测,本文提出一种基于改进的Retinanet的瓶身缺陷检测算法。通过对瓶身缺陷检测的难点进行分析,综合考虑检测精度以及检测速度等指标,选择Retinanet作为瓶身缺陷检测算法。首先针对图像数据的增强,提出基于改进的STDC-Seg的前景提取与水平矫正算法,提出基于改进的Cycle GAN的缺陷图像扩充算法,通过目标检测算法验证了缺陷图像扩充算法的有效性。接着通过实验发现,原始目标检测算法在检测速度上满足检测需求,但在检测精度上有待提高。因此本文首先对Retinanet网络进行了优化,在使用轻量级骨干网络的情况下,达到了较高的检测精度。使用Resnet18作为骨干网络,通过可变形卷积DCN、空间金字塔池化模块SPP、多尺度特征融合模块PAN、自注意力机制模块Co Tx、IOU Loss和IOU Aware Loss,有效地提高了网络的特征提取能力。在联排塑料瓶瓶身数据集上进行测试,本文算法的F1-Score达到90.87%,推理时间为179ms。3.针对联排塑料瓶瓶头瓶尾变形缺陷的检测,本文提出一种基于Resnet的瓶头瓶尾变形缺陷检测算法。通过对变形缺陷检测的难点分析,综合考虑检测精度以及检测速度等指标,选择Resnet作为瓶头瓶尾变形缺陷检测算法。实验发现,使用Res2net残差块构建的Resnet50网络,在联排塑料瓶瓶头瓶尾数据集上进行测试,F1-score达到98.73%和96.87%,推理时间为13ms。
【Abstract】 In recent years,as plastic bottle production technology has been growing in leaps and bounds,medicinal glass bottles have gradually given way to alternatives.Some medical plastic bottles have a defect in quality to some extent resulting from production process and manufacturing surroundings,exerting considerable impacts on the appearance and safety of the products.Therefore,defect detection of plastic bottles in pharmaceutical row is a must for the production and processing of pharmaceutical enterprises.The traditional artificial lamp inspection is no longer applicable to today’s high-speed production on account of its disadvantages such as high working intensity,low detection efficiency and unstable accuracy.Therefore,in order to satisfy the defect detection requirements of medical row plastic bottle products,this paper utilizes the advantage that the relevant algorithms of deep learning can automatically extract defect features from images through neural network,and conducts the research of applying the deep learning algorithm to defect detection of medical row plastic bottle products.Given the variety of defects in row plastic bottles,different deep learning algorithms are used for targeted detection.The main work of this paper is as follows:1.In view of the detection of bottle contour defect of row plastic bottles,this paper puts forward a bottle contour defect detection algorithm on the strength of improved STDC-Seg.STDC-Seg is selected as the bottle contour defect detection algorithm by analyzing the detection difficulties of bottle contour defects and taking the detection accuracy and detection speed into account comprehensively.Experimental results unfold that the original algorithm meets the detection requirements in terms of detection accuracy,but finds the detection speed wanting.Consequently,in the first place,this paper optimizes the STDC-Seg network so that the computation of the network is significantly reduced while maintaining high detection accuracy.Resnet Basic Block is put to use to build a lightweight backbone network,and the feature extraction capability of the network is effectively improved through pyramid pooling module SPP and self-attention mechanism module Co Tx.The m IOU of the proposed algorithm amounts to 98.78% when tested on the data set of plastic bottle body with the inference time reaching 8.4ms.The next step is to calculate the maximum outer contour and the maximum inner contour of the segmented contour,and then compare with the stated threshold value to judge whether the bottle body contour is qualified,and whether the bottle body has the internal fragmentation deformation defect exceeding the allowed value.2.In this paper,an improved Retinanet detection algorithm is proposed for the detection of bottle body defects in row plastic bottles.Via the analysis of the difficult points of the bottle defect detection and holistic meditation on the detection accuracy and speed,Retinanet is regarded as the bottle defect detection algorithm.To start with,the improved STDC-Seg algorithm for foreground extraction and image straightener is proposed,and the improved Cycle GAN algorithm for defect image expansion is raised for image data enhancement.The effectiveness of the defect image expansion algorithm is verified by the target detection algorithm.Subsequently,experiments discover that the original target detection algorithm can meet the detection requirements in the detection speed,but there is still some room for improvement when it comes to the detection accuracy.As a result,the essay updates the Retinanet network and achieves high detection accuracy in the case of using lightweight backbone network.Resnet18 is employed functioning as the backbone network to availably boost the feature extraction capability of the network by means of deformable convolution DCN,pyramid pooling module SPP,multi-scale feature fusion module PAN,self-attention mechanism module CoTx,IOU Loss and IOU Aware Loss.The f1-Score of the proposed algorithm tops90.87% and the inference time stands at 179 ms.3.In allusion to the detection of the deformation defect of row plastic bottles head and tail,this paper brings forward a resnet-based algorithm for detecting the deformation defect of the head and tail of plastic bottles.The analysis of the difficulties in the detection of deformation defects and integrated ponderation on detection accuracy and speed offer a perspective that Resnet is elected as the detection algorithm for deformation defects of bottle head and tail.Experimental results manifest that the Resnet50 network constructed by Res2 net residual blocks can achieve 98.73% and 96.87% f1-score on the data set of row plastic bottles head and tail,and the inference time is 13ms.
【Key words】 Defect detection; Semantic segmentation; Data extension; Target detection; Self-attention mechanism;
- 【网络出版投稿人】 四川大学 【网络出版年期】2025年 03期
- 【分类号】TQ460.69;TP18