This invention discloses a method and
system for detecting surface defects in stainless steel pipes, comprising: S1, acquiring
line scan images of stainless steel pipes under dark and bright illumination; S2, stitching the
line scan images into dark and bright cylindrical unfolded images, and performing brightness
equalization and reflection suppression
processing; S3, performing pixel-
level fusion of the dark and bright cylindrical unfolded images according to set weights; S4, inputting the fused cylindrical unfolded image into the backbone of a YOLO network integrating a Swing
Transformer module to extract multi-scale feature maps; S5, performing
feature fusion and bounding box prediction, and outputting the bounding box,
confidence score, and category
label of the defect; S6, performing semantic segmentation and
grayscale segmentation in the detection box region and weighted fusion to generate a final defect
mask; S7, calculating the area, length, width, and
centroid coordinates of the defect, and converting them into actual dimensions and spatial positions. This invention improves the accuracy and stability of stainless steel
pipe surface defect identification.