The Application of YOLOv5s with SA Attention Mechanism in Surface Defect Detection of Oil Pipes
In view of the problems of low detection accuracy,slow speed,and complex models in the surface defect detection of oil pipes in oil plants,a SA-YOLO algorithm was proposed.Based on the YOLOv5s model,the original dataset was preprocessed,then the partial convolution of the Backbone feature backbone was replaced with the BoTNet Transformer structure,and directly the convolutional layer was replaced with multi-head self-attention(MHSA),to reduce network layers and improve the ability of obtaining global infor-mation.Finally,the Shuffle Attention mechanism was integrated into the C3 structure,and attention weights were obtained by the impor-tance of each position,thereby improving the generalization ability and computational efficiency of the model,and reducing runtime.The experimental results show that the mean average precision(mAP)of the SA-YOLO algorithm on the dataset collected by the oil plant reaches 93%,which is 3.3%higher than the original YOLOv5s algorithm,the detection speed and accuracy are significantly improved.