Detection and localization system for surface defects of automotive forgings based on machine vision
摘要
Timely detection and localization of defects on the surface of forgings are crucial for ensuring forging quality. Acquiring the three-dimensional positions of defects relies on accurate 2D pixel coordinates, which are difficult to obtain due to the complex morphology of crack defects on forging surfaces. However, the intricate morphology of crack defects on the surface of forgings presents significant challenges for visual inspection. Some of the shallow micro-cracks form extremely fine magnetic traces with low contrast to the background due to the weak magnetic leakage signal, and the visual features are not significant. These fine and low-contrast magnetic traces are frequently obscured by the dominant background, making them difficult to capture and extract effectively using traditional segmentation methods. To address these challenges, a cascade framework that integrates object detection and image segmentation is proposed. The YOLOv5 object detection model is employed to localize surface defects, with its feature extraction capability enhanced through the integration of an attention mechanism to improve detection performance for multi-scale, low-contrast magnetic scars. Following defect localization, the original image is cropped using the detected bounding box as the center point. The cropped region is then processed by a U-Net-based segmentation model to perform precise semantic segmentation of the defect area. The segmented cracks are fused with the original captured image, and the resulting fused image is utilized as the input for binocular vision reconstruction. This process enables the reconstruction of the defect-containing region in the forging and facilitates the extraction of the three-dimensional coordinates of the defects. The results show that the improved model effectively enhances the mAP@0.5:0.95 to 84.3%, while the recall increases to 99.7%. The incorporation of an attention mechanism into the U-Net model enhances the MIoU to 91.68%. The 3D reconstruction demonstrated high fidelity, with dimensional errors of reconstructed defects maintained below 4% relative to ground truth measurements.