Abstract:Laser measurement enables efficient non-contact real-time measurement and finds extensive application in the field of 3D printing. However, laser measurement is susceptible to interference from various factors such as measurement condition and the external environment, which are complex and difficult to quantify and analyze. Therefore, based on the principle of direct laser triangulation and an analysis of the factors affecting measurement accuracy, this paper proposes a 3D printing in-machine measurement error correction method integrating self-attention and residual neural network (SRNN). Firstly, the factors that affect measurement accuracy are used as input variables to collect laser measurement values and obtain a sample dataset. Then, residual network is employed to extract deep-level features from the sample data, and a self-attention mechanism is introduced to establish connections between influencing factors, resulting in weighted extracted features. Subsequently, the weighted features are learned through a fully connected network to obtain the predicted values of measurement errors. Based on this predicted value, the measurement errors are corrected. A laser in-machine measurement system is built, and experimental verification is conducted using three types of color cards (red, green, and purple) made of the same material. The results show that, compared to convolutional neural network (CNN) and self-attention neural network (SelfNN), the method proposed in this paper achieves the smallest mean squared error (MSE), root mean squared error (RMSE), and mean absolute error (MAE), exhibits the best stability, and yields correction results that are closest to the ground truth. After the laser measurement result is calibrated, the error is reduced from the original ±28 μm to below ±9 μm, significantly enhancing the accuracy and stability of 3D printing laser in-machine measurement.