Based on the enhanced YOLOv5, a deep learning defect detection technique is presented to deal with the problem of inadequate effectiveness in manually detecting problems on the surface of filter screens. In the last layer of the backbone network, the method combines the squeeze-and-excitation attention mechanism module, the method assigns weights to image locations based on the channel domain perspective to obtain more feature information. It also compares the results with a simple, parameter-free attention model (SimAM), which is an attention mechanism without the channel domain, and the results are higher than SimAM 0.7%. In addition, the neck network replaces the basic PANet structure with the bi-directional feature pyramid network module, which introduces multi-scale feature fusion. The experimental results show that the improved YOLOv5 algorithm has an average defect detection accuracy of 97.7% on the dataset, which is 11.3%, 12.8%, 2%, 7.8%, 5.1%, and 1.3% higher than YOLOv3, faster R-CNN, YOLOv5, SSD, YOLOv7, and YOLOv8, respectively. It can quickly and accurately identify various defects on the surface of the filter, which has an outstanding contribution to the filter manufacturing industry.