Abstract:To overcome the limitations of existing inspection methods of camera modules, proposed a camera modules defect detection method based on improved YOLOv5s and DeepLabV3+, designed to meet the requirements for appearance and functionality inspection in industrial production. To tackle the challenges of surface defect detection in camera modules, including high complexity, small target sizes, and diverse defect types, an improved YOLOv5s-based qualitative appearance inspection method is introduced. The method incorporates a Multimodal Co-Attention (MCA) mechanism and an optimized loss function based on Normalized Wasserstein Distance (NWD), significantly enhancing the model's ability to detect small targets. Experimental results show that the improved YOLOv5s achieves a mean Average Precision (mAP) of 95.7%, an 8.5% improvement over the original model, with a frames per Second (FPS) of 38.5, meeting the requirements for real-time industrial inspection. Additionally, for components requiring quantitative analysis, such as the neck glue area, a DeepLabV3+based quantitative analysis method is proposed. By extracting region boundaries and calculating area and aspect ratio features, this method effectively evaluates assembly quality and identifies potential functional defects. Compared to traditional methods, the proposed approach achieves simultaneous inspection of appearance and functionality while ensuring both accuracy and speed. It provides valuable insights for quality control and defect detection in other industrial fields, demonstrating significant application potential.