## 1 Introduction
Representative two-stage detectors like Fast R-CNN [32] and Mask R-CNN [33] follow a coarse-to-fine detection pipeline, i.e., first generating the rough object candidates and then using a region classifier to predict the classes and refine the localization of these proposed regions. They can achieve high detection accuracy, but are rarely used in engineering applications due to high computational complexity and poor real-time ability. To accelerate detection speed, some one-stage detectors only need one-step inference have been developed and can directly predict the coordinates of bounding boxes and their class probabilities, such as SSD [34], YOLO [35], and their variants [36; 37]. Due to their good inference speed and decent detection precision, and, thus, are widely used for quality inspection in several industrial fields. [PERSON] et al. [38] designed a model to detect surface mount defects on printed circuit boards, which consists of a MobileNetV2 and Feature Pyramid Network (FPN) to generate enhanced multi-scale features, followed by an SSD to locate the objects. [PERSON] et al. [39] adopted a YOLOv5 model for detecting Kiwifruit defects. A fast and accurate inspection model BV-Net based on the YOLOv4 is proposed in [40] for tubular solder joint detection. In [41], [PERSON] and [PERSON] integrated a Res-Head and Drop-CA into YOLOv5 to accurately detect the complex surface texture of the magnetic tile in real time. To achieve accurate inspection of tiny chip pads in semiconductor  
Figure 1: The example of (**a**) aviation plug and (**b**) defects of solder joints. manufacturing, an object convolution attention module is introduced into YOLOv5 [42]. Meanwhile, the presented design principle for the attention layer can yield a lightweight model. [PERSON] et al. [43] proposed an improved YOLOv5 model for the detection of laser welding defects in lithium battery poles and achieved a better result compared to the original YOLOv5. Table 1 gives a concise overview of the above two types of CNN-based detection methods and briefly discusses their advantages and disadvantages. It can be seen that YOLOv5 has become the most popular and reliable approach in a wide range of defect detection tasks due to its high efficiency, high accuracy, and strong generalization ability. Following this trend, we are attempting to use it for weld quality detection of aviation plugs. However, it is not appropriate to directly use existing YOLOv5 for solder joint quality inspection of aviation plugs for the following reasons. **Small solder joints in the complex background:** As shown in Figure 2, the solder joints are arranged in a regular, horizontally staggered pattern. While the appearance of the rear solder joints is inevitably obscured by the cables in the front solder joints. In addition, the aviation plug contains multiple small solder joints, and the positions to be welded are not fixed. Therefore, directly applying the YOLOv5 model to recognize these small solder joints from the complex background is difficult. **Difficulties with image collection:** YOLOv5 is a data-driven model that requires many images for training. Therefore, image collection is extremely critical and directly related to the final detection performance. However, because the solder joints in aviation plugs have a non-planar, layer-by-layer stack structure, they are at different object distances from the lens, meaning that the camera cannot directly capture a complete and clear image. As shown in Figure 2, only the intermediate region of the captured image is clear, while the ends are slightly blurred, which affects the assessment of the solder joint quality. To overcome the mentioned difficulties, in this paper, we propose an accurate and automated weld quality detection approach based on two fine-tuned YOLOv5 models and design the corresponding system for aviation plug welding production lines.