With the expanding market demand for new energy power batteries, the industrial requirement for detecting laser welding defects of lithium battery’s pole are also increasing. Since the traditional machine vision defect detection has the problems of low detection accuracy and slow speed, this paper proposes a laser welding defect detection model based on the improved YOLOv5 algorithm to meet the requirements of industrial production. First, all C3 modules of the backbone was substituted for the newly proposed PConv module, which not only reduces the amount of redundant computation, improves the detection speed, but also increases the feature extraction efficiency of the backbone network for input images; second, we add the attention mechanism SE to the penultimate layer of the backbone network, which enhances the useful features of the backbone network for input images without additionally increasing the computation. This approach enhances the backbone network's ability to extract useful features from the input images and improves the accuracy of the model. The experimental results show that the improved model improves the average detection accuracy by 1.1% to 97% compared with the original YOLOv5 model. The FPS reaches 333, which can meet the current industrial demand for real-time defect detection.