Solenoid connectors play important role in electronic stability system design, with the features of small size, low cost, fast response time and high reliability. The main production process challenge for solenoid connectors is the accurate detection of defects, which is closely related to safe driving. Both faultless and defective products have similar color and shape at the defect location, making proper inspection challenging. To address these issues, we proposed a defect detection model called PO-YOLOv5 to achieve accurate defect detection for solenoid connectors. First, an additional prediction head was added to enable the model to acquire more semantic information to detect larger-scale defective features. Second, we introduced dynamic convolution to learn complementary connections between the four dimensions of the convolution kernel by utilizing its multidimensional attention mechanism. Replacing conventional convolution with dynamic convolution enhances the detection accuracy of the model and reduces the inference time. Finally, we validated PO-YOLOv5 versus the state-of-the-art object detection methods on the same solenoid connectors dataset. Experiments revealed that our proposed approach exhibited higher accuracy. The mAP (mean Average Precision) result of PO-YOLOv5 was found to be about 90.1%. Compared with the original YOLOv5, PO-YOLOv5 exhibited improved precision by about 3%.