The surface flatness of traditional large-size weld beads was measured by cutting the weld area of the workpiece, then manually calculating the ratio of weld width to reinforcement height, which was time-consuming and inaccurate. This work combined a machine vision system with deep learning technology to reduce calculation errors and improve adaptability. A new network model, UG-Net, was proposed for analyzing laser stripe images of weld beads in complex backgrounds, achieving 93.69% mean intersection over union (mIoU). The Steger algorithm was used to extract the centerline from the identified laser stripes, which was segmented into feature and baseline sections. The feature section underwent cubic spline curve interpolation, while the baseline section was processed using straight-line fitting based on random sample consensus. The feature curve of the weld bead was derived to obtain extreme points. The 3D coordinates of extreme points and corresponding feature points on the baseline were determined using structured light triangulation. Finally, the difference between the feature points on the baseline and the extreme points was calculated to obtain the maximum and minimum weld bead heights, representing the surface flatness. Testing three sample sets with different welding parameters, the relative errors between the proposed algorithm's results, and manual measurements following wire-electrode cutting were 1.132, 1.067, and 1.039%, respectively. These results proved the reliability of the proposed algorithm and introduced a new approach for fast and accurate measurement of large-size weld beads' surface flatness.