针对铝型材表面缺陷种类多、尺度差异大、小目标容易漏检等问题,提出了KCC-YOLOv5——一种基于YOLOv5s改进的铝型材表面小缺陷检测模型。首先利用IoU(intersection over union)-K-means++算法代替K-means算法聚类锚框,获得最贴合铝型材表面缺陷的锚框,提高小目标锚框的质量;其次,提出全局注意力模块C3C2F,并引入主干层,在减少参数量的同时增强小目标的语义信息和全局感知能力;最后将颈部最近邻插值上采样方式换为轻量级上采样算子CARAFE(content-aware reassembly of features),充分保留上采样特征图的小目标信息。实验结果表明,改进模型KCC-YOLOv5的均值平均精度为94。6%,相比于YOLOv5s提高了2。8个百分点,小目标漆泡和脏点的平均精度分别提高了5。2和12。4个百分点。KCC-YOLOv5模型在保持大目标检测精度小幅度提升的同时显著提升了小目标的检测精度。
Defect Detection on Aluminum Profile Surface Based on KCC-YOLOv5
To address the issue of various types and large-scale differences of surface defects in aluminum profiles,as well as the tendency for small targets to be missed,we suggest an improved detection model for small defects on the surface of aluminum profiles based on YOLOv5s,called KCC-YOLOv5 model.First,the IoU(intersection over union)-K-means++ algorithm is used to cluster anchor frames in place of the K-means algorithm,aiming to obtain the anchor frames that best fit the surface defects of aluminum profiles and improve the quality of small target anchor frames.Second,a global attention module C3C2F is proposed and introduced into the backbone layer to enhance the semantic information and global perception of small targets while reducing the number of parameters.Finally,the neck nearest neighbor interpolation upsampling method is replaced by a lightweight upsampling operator CARAFE(content-aware reassembly of features),which fully retains the small target information of the upsampled feature map.The experimental results show that the mean average precision of the improved KCC-YOLOv5 model is 94.6%,which represents 2.8 percentage points improvement compared to YOLOv5s.Furthermore,the average precision for small targets,such as bubbles and spots,are increased by 5.2 and 12.4 percentage points,respectively.Overall,the KCC-YOLOv5 model significantly enhances the detection accuracy of small targets while maintaining a small improvement in the detection accuracy of large targets.