Self-adaptive control method and system for steel pipe welding seam scraping
By constructing a causal prediction neural network, the problem of accurately modeling the relationship between tool parameters and morphology changes during the scraping process of steel pipe welds was solved, achieving precise and interpretable adaptive control and supporting counterfactual reasoning and control strategy optimization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 陕西友发钢管有限公司
- Filing Date
- 2026-03-19
- Publication Date
- 2026-05-12
AI Technical Summary
Existing adaptive control methods are unable to accurately characterize the complex nonlinear coupling mechanism during the scraping process of steel pipe welds, and cannot support counterfactual reasoning, resulting in limited optimization space for control strategies.
A causal prediction neural network is constructed, including a temporal coding module, a differentiable causal graph module, and a counterfactual reasoning module. The network parameters are optimized through a meta-learning training framework to achieve accurate prediction of tool parameters and morphological changes.
It achieves precise and interpretable control of tool parameters and morphology changes during steel pipe weld scraping, supports optimization decision-making of adaptive control strategies, and has the ability to quickly adapt to steel pipes of different specifications.
Smart Images

Figure CN122021933A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to deep learning technology, and more particularly to an adaptive control method and system for scraping steel pipe welds. Background Technology
[0002] Weld scraping is a critical post-processing step in steel pipe production. Mechanical tools are used to remove protruding residual metal from the weld surface, ensuring the outer surface flatness of the steel pipe meets process requirements. However, existing adaptive control methods primarily rely on empirical formulas or traditional machine learning models to establish a mapping relationship between tool parameters and morphological changes, making it difficult to accurately characterize complex nonlinear coupling mechanisms. While deep learning methods can fit high-dimensional nonlinear relationships, they lack interpretability and do not fully consider the topological characteristics of the weld's annular continuity, easily leading to feature extraction biases at the circumferential start and end boundaries. More critically, existing methods can only predict morphological changes under the current tool parameters, failing to support counterfactual reasoning—that is, predicting the effects of intervention parameters not actually applied—limiting the optimization space of the control strategy.
[0003] Therefore, there is an urgent need to develop new modeling methods that integrate causal reasoning and deep learning to achieve precise and interpretable intelligent control of steel pipe weld scraping. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides an adaptive control method and system for scraping steel pipe welds, which can solve the problems in existing technologies.
[0005] A first aspect of the present invention provides an adaptive control method for scraping steel pipe welds, comprising: A training dataset was obtained from the scraping process of steel pipe welds, the training dataset including time-series observation samples of weld morphology, tool intervention parameter samples, and morphology change annotation samples; A causal prediction neural network is constructed, comprising a temporal encoding module incorporating periodic constraints, a differentiable causal graph module, and a counterfactual reasoning module. The temporal encoding module encodes the weld morphology temporal observation samples considering the ring continuity of the weld. The differentiable causal graph module represents the causal relationship between tool intervention parameters and weld residual height using a parameterized adjacency matrix. The counterfactual reasoning module predicts morphology changes under parameters without actual tool intervention based on the causal graph topology. The causal prediction neural network is trained using a meta-learning training framework. The training dataset is divided into multiple task subsets according to the specifications of the steel pipes. On each task subset, the network output is supervised by the morphological change annotation samples. Causal structure learning is performed on the differentiable causal graph module to construct a loss function with causal sparsity constraints to optimize the adjacency matrix parameters in order to identify the strength of causal effects. The network initialization parameters across tasks are learned through two-layer optimization to obtain the trained network model.
[0006] Optionally, the timing encoding module encodes the timing observation samples of weld morphology considering the annular continuity of the weld, including: The starting and ending measurement positions of the weld circumference are mapped to continuously connected boundary nodes in the topology, and a cyclically connected coding network is constructed. The coding state output of the ending measurement position is used as the input of the coding layer of the starting measurement position, forming a closed information flow path. In the cyclically connected coding network, a periodic index mapping strategy is used to identify the position of each measurement position in the weld morphology time-series observation sample, and a continuously changing periodic index value is assigned to the measurement position at the boundary of adjacent periods; The cyclically connected encoding network takes the measured position features mapped by periodic indexes as input for forward propagation and outputs a sequence of encoded vectors for the counterfactual reasoning module to generate baseline features of weld morphology.
[0007] Optionally, the steps for constructing a cyclically connected coding network include: A bidirectional recurrent convolutional coding network is constructed. In the forward propagation path, features are extracted sequentially from the starting measurement position to the ending measurement position along the circumference of the weld. In the backward propagation path, features are extracted in reverse from the ending measurement position to the starting measurement position. A cross-boundary connection channel is established between the starting and ending positions. The hidden state vector of the ending position is used as an additional input for the feature extraction of the starting position, and the hidden state vector of the starting position is used as an additional input for the feature extraction of the ending position, forming a closed-loop information flow topology. For each measurement position in the circumferential direction of the weld, a position encoding vector is generated by transforming its angular coordinates using sine and cosine transformations with a period equal to the complete circumferential angle of the weld. The periodic position encoding vector is concatenated with the numerical features of weld morphology observation and input into the bidirectional recurrent convolutional encoding network. The bidirectional recurrent convolutional encoding network outputs a feature vector sequence after passing the hidden state vectors of the start and end boundary positions through cross-boundary connection channels.
[0008] Optionally, the differentiable causal graph module represents the causal relationship between tool intervention parameters and weld residual height through a parameterized adjacency matrix, and the counterfactual reasoning module predicts morphological changes under parameters not actually applied based on the causal graph topology, including: Initialize the adjacency matrix. The row index corresponds to each dimension of the tool intervention parameters, and the column index corresponds to the value of the weld residual height at each measurement position in the circumferential direction. The value of the matrix elements represents the strength of the causal influence. The adjacency matrix parameters can be learned and optimized during training through gradient backpropagation. The counterfactual reasoning module receives the topology of the adjacency matrix. For a given hypothetical tool intervention parameter, it cuts off the causal paths in the adjacency matrix related to the actual observation tool parameters and activates the causal paths corresponding to the hypothetical tool parameters. It then performs forward propagation calculations along the activated paths to obtain the predicted weld residual height distribution under counterfactual conditions.
[0009] Optionally, the counterfactual reasoning module receives the topological structure of the adjacency matrix and, for a given hypothetical tool intervention parameter, performs forward propagation calculation along the activated path to obtain the predicted weld residual height distribution under counterfactual conditions by cutting off the causal paths in the adjacency matrix related to the actual observed tool parameters and activating the causal paths corresponding to the hypothetical tool parameters. Construct a causal path mask tensor. The row dimension corresponds to the tool intervention parameter dimension of the adjacency matrix, and the column dimension corresponds to the circumferential measurement position of the weld residual height. For the row corresponding to the actual observed tool intervention parameter, set the mask value to zero to cut off the causal propagation of the parameter. For the row corresponding to the hypothetical tool intervention parameter, set the mask value to one to activate the causal propagation of the parameter. The causal path mask tensor and the adjacency matrix are multiplied element-wise to obtain the causal graph structure after intervention. The connection weights from the hypothetical tool parameters to the weld residual height position are retained, while the influence of the actual observation tool parameters is blocked. The numerical vector of the hypothesis tool intervention parameters is multiplied by matrix multiplication with the causal graph structure after intervention. The cumulative value of the causal effect received at each weld residual height measurement position is calculated by aggregation operation of summing along the rows. Combined with the weld morphology baseline features provided by the time-series coding module, the residual height distribution prediction under counterfactual conditions is generated.
[0010] Optionally, causal structure learning is performed on the differentiable causal graph module to construct a loss function containing causal sparsity constraints to optimize the adjacency matrix parameters in order to identify the strength of causal effects, including: Construct a total loss function, which includes a prediction loss term and a sparsity regularization term. The prediction loss term measures the deviation between the predicted shape change output by the neural network used to predict shape changes and the shape change labeled samples. The sparsity regularization term penalizes the number of non-zero elements in the adjacency matrix. In each gradient update iteration, the gradient of the total loss function with respect to the network parameters and adjacency matrix parameters of the temporal coding module and the counterfactual reasoning module is calculated simultaneously, and the network parameters and adjacency matrix parameters are updated synchronously through gradient descent. After training, the significance threshold is adaptively determined based on the numerical distribution of the adjacency matrix elements. Elements in the adjacency matrix whose absolute values exceed the significance threshold are selected. The connection between the corresponding tool intervention parameters and the location of the weld residual height is determined as a causal relationship pair, and the magnitude of the absolute value of the element represents the strength of the causal effect.
[0011] Optionally, the application of the trained network model in adaptive control of steel pipe weld scraping includes: Real-time morphological observation data of the weld seam of the steel pipe to be processed is obtained and input into the trained network model. The counterfactual reasoning module is used to predict the evolution trend of weld seam morphology under several candidate tool intervention parameter combinations. The tool intervention parameter that optimizes the weld seam residual height uniformity index is selected as the control output to achieve adaptive and precise control of steel pipe weld seam scraping.
[0012] Secondly, an adaptive control system for scraping steel pipe welds is provided, including: The first unit is used to acquire a training dataset from the steel pipe weld scraping process. The training dataset includes time-series observation samples of weld morphology, tool intervention parameter samples, and morphology change annotation samples. The second unit is used to construct a causal prediction neural network, including a temporal encoding module that integrates periodic constraints, a differentiable causal graph module, and a counterfactual reasoning module. The temporal encoding module encodes the weld morphology temporal observation samples considering the ring continuity of the weld. The differentiable causal graph module represents the causal relationship between tool intervention parameters and weld residual height through a parameterized adjacency matrix. The counterfactual reasoning module predicts morphology changes under parameters that have not been actually applied, based on the causal graph topology. The third unit is used to train the causal prediction neural network using a meta-learning training framework. The training dataset is divided into multiple task subsets according to the specifications of the steel pipes. On each task subset, the network output is supervised by the morphological change annotation samples. Causal structure learning is performed on the differentiable causal graph module to construct a loss function containing causal sparsity constraints to optimize the adjacency matrix parameters in order to identify the strength of causal effects. The network initialization parameters across tasks are learned through two-layer optimization to obtain the trained network model.
[0013] Thirdly, a computer-readable storage medium is provided, having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0014] This invention solves the technical challenge of accurately modeling the relationship between tool parameters and morphology changes in steel pipe weld scraping by constructing a causal prediction neural network with integrated periodic constraints. The temporal coding module effectively captures the continuous ring-shaped features of the weld seam through a cyclically connected network structure and periodic positional encoding, avoiding discontinuous jumps in boundary position feature representation and improving the encoding quality of morphology temporal information. The differentiable causal graph module explicitly represents the causal relationship between tool intervention parameters and weld residual height using a parameterized adjacency matrix, and combines sparsity constraints to screen key causal paths, offering stronger interpretability and physical meaning compared to traditional black-box neural networks. The counterfactual reasoning module predicts the morphology evolution trend under unapplied tool parameters based on the causal graph topology, supporting optimized decision-making for adaptive control strategies. The meta-learning training framework divides tasks into subsets according to steel pipe specifications for cross-task learning, enabling the model to quickly adapt to generalization capabilities for different specifications of steel pipes and reducing debugging costs for new specifications. The overall method realizes a paradigm shift from data-driven to causal-driven modeling, providing accurate and reliable intelligent control technology support for steel pipe weld scraping. Attached Figure Description
[0015] Figure 1 This is a flowchart illustrating the adaptive control method for scraping steel pipe welds according to an embodiment of the present invention. Detailed Implementation
[0016] The technical solutions of the present invention will be described below with reference to the accompanying drawings. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0017] Figure 1 This is a flowchart illustrating the adaptive control method for scraping steel pipe welds according to the present invention. Figure 1 As shown, the method includes: A training dataset was obtained from the scraping process of steel pipe welds, the training dataset including time-series observation samples of weld morphology, tool intervention parameter samples, and morphology change annotation samples; A causal prediction neural network is constructed, comprising a temporal encoding module incorporating periodic constraints, a differentiable causal graph module, and a counterfactual reasoning module. The temporal encoding module encodes the weld morphology temporal observation samples considering the ring continuity of the weld. The differentiable causal graph module represents the causal relationship between tool intervention parameters and weld residual height using a parameterized adjacency matrix. The counterfactual reasoning module predicts morphology changes under parameters without actual tool intervention based on the causal graph topology. The causal prediction neural network is trained using a meta-learning training framework. The training dataset is divided into multiple task subsets according to the specifications of the steel pipes. On each task subset, the network output is supervised by the morphological change annotation samples. Causal structure learning is performed on the differentiable causal graph module to construct a loss function with causal sparsity constraints to optimize the adjacency matrix parameters in order to identify the strength of causal effects. The network initialization parameters across tasks are learned through two-layer optimization to obtain the trained network model.
[0018] For example, the training dataset is acquired by collecting raw data from the online monitoring system of the steel pipe weld scraping production line. The monitoring system includes a laser displacement sensor array and a tool parameter acquisition module installed at the scraping station. The laser displacement sensors are uniformly distributed along the circumference of the steel pipe, and the sampling frequency is set to acquire a complete circumferential profile once per second. Each profile contains 360 measurement points corresponding to the residual height value of 1 degree in the circumference of the steel pipe, with the value in millimeters and a measurement accuracy of 0.01 millimeters. The tool parameter acquisition module records in real time the parameters of four dimensions of the scraping tool: feed depth, rotational speed, tool angle, and axial feed speed. The feed depth ranges from 0.5 to 3 millimeters, the rotational speed ranges from 50 to 200 revolutions per minute, the tool angle ranges from 15 to 45 degrees, and the axial feed speed ranges from 0.1 to 0.5 meters per minute. The weld morphology time-series observation samples consist of multiple continuously acquired circumferential profiles. Each sample contains a continuous observation sequence with a time step of 5, that is, each sample corresponds to the morphology evolution process within 5 seconds. The tool intervention parameter sample records a 4D tool parameter vector corresponding to each time step, aligned with the topography observation sample by timestamp. Topography change annotation samples are obtained by calculating the difference in residual height between adjacent time steps; the difference value characterizes the amount of topography change caused by scraping, with positive values indicating a decrease in height and negative values indicating an increase in height. The training dataset is stored according to steel pipe specifications, with specification dimensions including outer diameter, wall thickness, and material grade. Each specification corresponds to an independent data subset, and each subset contains at least 500 complete observation-parameter-annotation triplet samples. During data acquisition, the timestamp, steel pipe batch number, and sensor calibration parameters of each sample are recorded to ensure data traceability and quality control.
[0019] The construction of the causal prediction neural network begins with defining the overall architecture. The network consists of three core modules connected in series, with the data flow sequentially as follows: temporal coding module, differentiable causal graph module, and counterfactual reasoning module. The network input interface is defined as a composite data structure containing temporal observation samples of morphology and tool intervention parameter samples. The tensor dimension of the temporal observation samples is 5×360, representing 360 circumferential measurement points per time step (5 time steps), while the tensor dimension of the tool intervention parameter samples is 5×4, representing 4 parameter dimensions per time step (5 time steps). The temporal coding module uses a recurrent neural network architecture to process the temporal observation samples of morphology. This module internally implements a recurrent connection mechanism for the circumferential boundary. Specifically, it establishes a feedback connection from the termination measurement position to the starting measurement position in the hidden state propagation path of the network. This ensures that the encoding calculation at the 0th degree of the starting position not only depends on the input features of the current position but also receives the hidden state vector at the 359th degree of the termination position as additional contextual information. Periodic constraints are implemented through positional encoding. The sine and cosine values of each circumferential angular coordinate are calculated as a 2D positional encoding vector. The period is set to 360 degrees, corresponding to the complete weld ring topology. The positional encoding vector is concatenated with the residual height observation value and input into each time step of the recurrent neural network. The output of the temporal encoding module is a sequence of encoded vectors, with a length equal to the number of circumferential measurement points (360). Each vector has a dimension of 128. This sequence of encoded vectors contains the spatial distribution characteristics and temporal evolution characteristics of the weld morphology. The encoded vector sequence is simultaneously transmitted to the differentiable causal graph module and the counterfactual inference module through the network's internal data channel. In the differentiable causal graph module, it is used to assist in the learning and optimization of the adjacency matrix. In the counterfactual inference module, it is used as the baseline feature of the weld morphology and fused with the causal effect vector.
[0020] The differentiable causal graph module explicitly models the causal relationship between tool intervention parameters and weld residual height using a parameterized adjacency matrix. The adjacency matrix is set to 4 rows and 360 columns, with row indices corresponding to the four tool intervention parameter dimensions and column indices corresponding to the residual height at the 360 circumferential measurement locations. Each element of the adjacency matrix is initialized as a normally distributed random value with a mean of 0 and a standard deviation of 0.01. The element value represents the causal influence strength of the corresponding tool parameter on the residual height at a specific circumferential location; positive values indicate a positive causal effect, and negative values indicate a negative causal effect. The adjacency matrix, as a learnable parameter of the network, is updated during training via gradient descent. Parameter updates employ an adaptive learning rate optimizer with an initial learning rate set to 0.001. The differentiable causal graph module receives the tool intervention parameter vector at the current time step. This vector, with a dimension of 4 corresponding to the four tool parameters, is multiplied by the adjacency matrix. The result is a 360-dimensional causal effect vector representing the direct causal effect of the tool parameter on the residual height at each circumferential location. The differentiable causal graph module simultaneously receives the encoded vector sequence from the temporal encoding module. It calculates the weight contribution of each feature in the encoded vector sequence to the learning of the adjacency matrix through an attention mechanism. These weights are used to adjust the magnitude of the gradient update of the adjacency matrix, enabling causal relationship learning to adapt to differences in parameter sensitivity under different morphological states. The causal effect vector is then output and passed to the counterfactual reasoning module as the basic representation of the intervention effect.
[0021] The counterfactual reasoning module predicts morphological changes under unapplied tool intervention parameters based on the causal graph topology. This module receives the encoded vector sequence output from the temporal coding module, the adjacency matrix from the differentiable causal graph module, and the hypothetical tool intervention parameter vector as input. Counterfactual reasoning is implemented by constructing a causal path mask to perform the intervention operation. The mask tensor has the same dimension as the adjacency matrix (4 rows, 360 columns). For row indices corresponding to actually observed tool parameters, the mask value is set to 0; for row indices corresponding to hypothetical counterfactual tool parameters, the mask value is set to 1. The mask tensor is multiplied element-wise with the adjacency matrix to obtain the post-intervention causal graph structure. This structure retains only the causal path from the hypothetical tool parameters to the residual height, cutting off the influence of the actually observed parameters. The hypothetical tool intervention parameter vector is multiplied by the post-intervention causal graph structure to obtain the counterfactual causal effect vector. This 360-dimensional vector corresponds to the counterfactual intervention effect received at each measurement location in the circumferential direction. The counterfactual causal effect vector and the encoded vector sequence provided by the temporal coding module are fused element-wise. Before the fusion operation, the 128-dimensional encoded vector needs to be mapped to the same dimension as the causal effect vector through a linear transformation layer. The mapped vector serves as the baseline feature representation of the weld morphology, reflecting the spatial distribution of the current morphology state. The counterfactual causal effect vector represents the incremental changes caused by the assumed tool parameters. The two are superimposed to form a complete counterfactual prediction feature. The fused feature vector is mapped through a two-layer fully connected neural network to output the predicted value of residual height change under counterfactual conditions. The output tensor has a dimension of 360, corresponding to the predicted morphology change at each circumferential position. The output of the counterfactual inference module is the final output of the entire causal prediction neural network. This output is used to calculate the loss with the morphology change labeled samples during the training phase and is used to evaluate the control effect of different tool parameter combinations during the application phase.
[0022] The implementation of the meta-learning training framework divides the training dataset into multiple task subsets according to steel pipe specifications, with each task subset corresponding to data for one specification of steel pipe. The training process employs a two-layer optimization structure: the inner layer performs fast adaptive updates on a single task subset, while the outer layer optimizes the network's initialization parameters across tasks. The inner layer optimization starts with the current network initialization parameters, calculating the prediction loss and performing gradient descent updates on the support set data of a single task subset. The support set contains 80% of the samples in that task subset, with 5 update steps and a learning rate of 0.01 per step. During the inner layer optimization, the network's forward propagation follows a complete data flow of temporal encoding, causal graph, and counterfactual inference, while backpropagation updates the parameters of all three modules and the adjacency matrix simultaneously. The updated network parameters are then evaluated for predictive performance on the query set data for that task, which contains the remaining 20% of the samples. The loss value on the query set serves as the objective function for the outer layer optimization. The outer layer optimization calculates the weighted average gradient of the loss across all task query sets for the network initialization parameters. The gradient calculation uses an automatic differentiation framework to implement backpropagation of the second derivative, tracking the dependency of the inner layer updates on the initialization parameters. The outer layer learning rate is set to 0.0001. Four task subsets are randomly sampled for each training batch for inner and outer layer optimization, and the total number of training batches is set to 10,000.
[0023] Causal structure learning optimizes the adjacency matrix by introducing a sparsity regularization term into the loss function. The total loss function is a weighted combination of the prediction loss term and the sparsity regularization term. The prediction loss term calculates the mean squared error between the predicted shape change value output by the network and the labeled shape change samples. The error is averaged across all circumferential measurement locations to obtain the scalar loss value. The sparsity regularization term calculates the sum of the absolute values of all elements in the adjacency matrix. This term penalizes the number of non-zero elements in the adjacency matrix, prompting the network to automatically identify key causal paths. The weight coefficient of the sparsity regularization term is set to 0.01. This coefficient controls the trade-off between the sparsity of causal relationships and prediction accuracy. An excessively large coefficient leads to excessive sparsity in the causal graph, resulting in the loss of important causal paths. An excessively small coefficient leads to redundancy in the adjacency matrix elements, reducing interpretability. During training, the gradient of the total loss function with respect to the network parameters of the temporal coding module, the counterfactual reasoning module, and the adjacency matrix parameters is calculated simultaneously for each batch. The gradient calculation traces the data dependencies between modules using the chain rule. The gradient of the adjacency matrix is constrained by both the prediction loss and the sparsity regularization term. After training, a significance threshold is determined based on the numerical distribution of the adjacency matrix elements. The threshold is calculated by taking the 90th percentile of the absolute values of all elements. Elements whose absolute values exceed the threshold are considered to have significant causal effects due to the connection between the tool parameter and the residual height position. The network initialization parameters obtained through two-layer optimization learning include the recurrent neural network weights of the temporal coding module, the adjacency matrix of the differentiable causal graph module, the weights of the fully connected layer of the counterfactual reasoning module, and the bias vector. These initialization parameters have the ability to generalize across steel pipe specifications and can quickly adapt to new specifications of steel pipe data with only a small number of samples.
[0024] Optionally, the timing encoding module encodes the timing observation samples of weld morphology considering the annular continuity of the weld, including: The starting and ending measurement positions of the weld circumference are mapped to continuously connected boundary nodes in the topology, and a cyclically connected coding network is constructed. The coding state output of the ending measurement position is used as the input of the coding layer of the starting measurement position, forming a closed information flow path. In the cyclically connected coding network, a periodic index mapping strategy is used to identify the position of each measurement position in the weld morphology time series observation sample. The measurement positions at the boundary of adjacent periods are assigned continuously changing periodic index values to avoid discontinuous jumps in the feature representation of the boundary positions. The cyclically connected encoding network takes the measured position features mapped by periodic indexes as input for forward propagation and outputs a sequence of encoded vectors for the counterfactual reasoning module to generate baseline features of weld morphology.
[0025] For example, the construction of the cyclically connected encoding network begins with defining the circumferential topology of the weld, mapping 360 circumferential measurement positions in the time-series observation samples of the weld morphology as a sequence of circular nodes. The starting measurement position corresponds to a circumferential angle of 0 degrees, and the ending measurement position corresponds to a circumferential angle of 359 degrees. These two positions are adjacent in physical space but separated in the linear data structure. The cyclic connection mechanism is implemented by establishing cross-boundary connections in the hidden state propagation path of the encoding network. Specifically, during the forward propagation of the recurrent neural network, the hidden state vector at the ending measurement position of 359 degrees is used as an additional input for the encoding calculation at the starting measurement position of 0 degrees. The encoding network adopts a bidirectional long short-term memory network architecture, including a forward propagation path and a backward propagation path. The forward path extracts features sequentially from 0 degrees to 359 degrees, and the backward path extracts features in reverse from 359 degrees to 0 degrees. In the forward path, the cross-boundary connection is implemented by mapping the forward hidden state vector at position 359 through a linear transformation layer and concatenating it with the input feature at position 0. The concatenated vector has the dimension of the original input feature plus the dimension of the hidden state vector, and serves as the input to the encoding unit at position 0. In the reverse path, the cross-boundary connection uses a symmetrical approach, mapping the reverse hidden state vector at position 0 and concatenating it with the input feature at position 359. The weight matrix of the linear transformation layer for the cross-boundary connection has a dimension of 128 rows and 128 columns, and the bias vector has a dimension of 128. The transformation layer parameters are updated synchronously with other parameters of the encoding network during training. The propagation of the hidden state vector is performed in the encoding computation at each time step, enabling the feature extraction at the boundary position to perceive the contextual information of the adjacent circumferential region, forming a closed information flow path.
[0026] A periodic index mapping strategy is used to identify the location of each measurement position in the time-series observation samples of weld morphology, avoiding discontinuous jumps in the representation of boundary position features. The position index is generated by a periodic function. For the circumferential angle coordinate theta, its sine value sin(theta) and cosine value cos(theta) are calculated to form a 2D position encoding vector. The period is set to 360 degrees, corresponding to the complete weld ring topology, so that the position encoding vector values at the 0th degree and the 360th degree are the same, ensuring the periodic continuity of the boundary positions. The calculation of the position encoding vector is completed in the data preprocessing stage. 360 2D position encoding vectors are calculated for each of the 360 measurement positions, and the vector values range from -1 to 1. The position encoding vectors are fused with the weld residual height observation values through a concatenation operation. The concatenated feature vector has a dimension of 3, where 1 dimension is the residual height value and 2 dimensions are the position encoding components. The time-series observation samples contain 5 time steps, each containing 360 measurement positions. Therefore, the complete input feature tensor has a dimension of 5×360×3. The periodic index mapping strategy ensures that the measured position encoding values change continuously at the boundaries of adjacent periods. For example, the sine encoding value at the 358th degree is sin(358°)≈-0.035, at the 359th degree it is sin(359°)≈-0.017, and at the 0th degree it is sin(0°)=0, with smooth numerical changes between the three without abrupt jumps. The cosine encoding value also maintains continuity at the boundaries: at the 358th degree it is cos(358°)≈0.999, at the 359th degree it is cos(359°)≈0.9998, and at the 0th degree it is cos(0°)=1. The position encoding vector is input to each encoding unit in the cyclically connected encoding network along with the residual height observations, enabling the network to simultaneously learn both numerical features of the topography and location topology features.
[0027] The cyclically connected encoding network uses the measured position features, mapped by a periodic index, as input for forward propagation. The output encoded vector sequence is used by the counterfactual reasoning module to generate baseline features for the weld morphology. The forward propagation process starts at position 0. The encoding unit receives the 3D input feature vector of the current position, including residual height and 2D position encoding, as well as the hidden state vector at position 359 provided by the cross-boundary connection. Internally, the encoding unit calculates the activation values of the input gate, forget gate, and output gate through a gating mechanism, updating the cell state and hidden state vector. The hidden state vector dimension is set to 128, and it is passed sequentially between positions in the circumferential direction: the hidden state vector at position 0 is passed to position 1, the hidden state vector at position 1 is passed to position 2, and so on up to position 359. The hidden state vector at position 359 is returned to position 0 through the cross-boundary connection, completing the closed loop of information flow in the entire circular topology. The backpropagation path of the bidirectional Long Short-Term Memory (LSTM) network is executed in reverse order, extracting features from the 359th degree to the 0th degree. The reverse hidden state vector at the 0th degree position is passed to the 359th degree position through a cross-boundary connection. The forward and reverse hidden state vectors are fused at each measurement position through a concatenation operation, resulting in a 256-dimensional vector, which serves as the final encoding vector for that position. The encoding vector sequence contains 360 256-dimensional vectors, each corresponding to a feature representation of a circumferential measurement position. The temporal observation samples contain 5 time steps. The encoding network calculates the encoding vector for each of the 360 measurement positions at each time step. The encoding vectors from the 5 time steps are aggregated through a time-dimensional pooling operation. Max pooling is used, taking the maximum value in each dimension of the corresponding encoding vectors at the 5 time steps to obtain the final sequence of 360 256-dimensional encoding vectors. After the encoded vector sequence is output, it is passed to the counterfactual reasoning module. In the counterfactual reasoning module, the sequence is mapped to a 360-dimensional weld morphology baseline feature vector through a linear transformation layer. The baseline feature vector represents the spatial distribution state of the current weld morphology. It is fused with the counterfactual causal effect vector to generate a morphology change prediction under counterfactual conditions.
[0028] This implementation effectively captures the annular continuity features of the weld seam through a cyclic connection mechanism and periodic position encoding, avoids discontinuous representation of boundary position features, improves the quality of the encoded vector sequence, and provides reliable morphological baseline features for counterfactual reasoning.
[0029] Optionally, the steps for constructing a cyclically connected coding network include: A bidirectional recurrent convolutional coding network is constructed. In the forward propagation path, features are extracted sequentially from the starting measurement position to the ending measurement position along the circumference of the weld. In the backward propagation path, features are extracted in reverse from the ending measurement position to the starting measurement position. A cross-boundary connection channel is established between the starting and ending positions. The hidden state vector of the ending position is used as an additional input for the feature extraction of the starting position, and the hidden state vector of the starting position is used as an additional input for the feature extraction of the ending position, forming a closed-loop information flow topology. For each measurement position in the circumferential direction of the weld, a position encoding vector is generated by transforming its angular coordinates using sine and cosine transformations with a period equal to the complete circumferential angle of the weld. The periodic position encoding vector is concatenated with the numerical features of weld morphology observation and input into the bidirectional recurrent convolutional encoding network. The bidirectional recurrent convolutional encoding network outputs a feature vector sequence after passing the hidden state vectors of the start and end boundary positions through cross-boundary connection channels.
[0030] For example, the construction of a bidirectional recurrent convolutional coding network begins with defining the network topology. The network contains two parallel feature extraction channels: a forward propagation path and a backward propagation path. The forward propagation path extracts features sequentially along the weld circumference from the starting measurement position (0 degrees) to the ending measurement position (359 degrees), while the backward propagation path extracts features in reverse order from the ending measurement position (359 degrees) back to the starting measurement position (0 degrees). The forward propagation path consists of 360 cascaded convolutional coding units, each corresponding to a circumferential measurement position. Each unit receives the input feature vector at the current position and the hidden state vector passed from the previous position. After extracting local spatial features through a one-dimensional convolution operation, it outputs the hidden state vector at the current position. The convolutional kernel size is set to 3, corresponding to the receptive field of the current position and its three adjacent measurement points (3 points in total). The number of convolutional kernels is 128, generating a 128-dimensional hidden state vector. The backpropagation path employs a symmetrical architecture, also containing 360 convolutional coding units. These units are concatenated in reverse order from the 359th degree position to the 0th degree position. Each unit receives the input features from the current position and the hidden state vector from the next position, with an output dimension of 128. The cross-boundary connection channel establishes a bidirectional information transfer path between the start and end positions. Specifically, in the forward propagation path, the hidden state vector at the 359th degree position is mapped through a linear transformation layer and used as additional input to the convolutional coding unit at the 0th degree position. In the backpropagation path, the hidden state vector at the 0th degree position is mapped through a linear transformation layer and used as additional input to the convolutional coding unit at the 359th degree position. The linear transformation layer's weight matrix has a dimension of 128 rows and 128 columns, and the bias vector has a dimension of 128. The hidden state vectors passed across the boundary are mapped to the same feature space as the input features at the current position and then concatenated. The convolutional coding unit at the 0-degree position of the forward path receives a 3D input feature vector and a 128-dimensional hidden state vector from the 359-degree position after linear transformation. These are concatenated to obtain a 131-dimensional vector, which serves as the input for the convolution operation. The convolution output, a 128-dimensional hidden state vector, is then passed to the 1-degree position. Similarly, the convolutional coding unit at the 359-degree position of the reverse path receives a 3D input feature vector and a 128-dimensional hidden state vector from the 0-degree position after linear transformation. These are also concatenated to obtain a 131-dimensional vector for convolution. This cross-boundary connection forms a closed-loop information flow topology, enabling feature extraction on the forward path to perceive the contextual information at the termination position, and feature extraction on the reverse path to perceive the contextual information at the starting position, thus eliminating information breaks at the loop boundaries.
[0031] The generation of periodic position encoding vectors is based on the angular coordinates of each measurement position along the weld circumference, ranging from 0 to 359 degrees, corresponding to 360 uniformly distributed circumferential measurement points. For the angular coordinate theta, sin(theta×2π / 360) is calculated using a sine transform with a period of 360 degrees, and cos(theta×2π / 360) is calculated using a cosine transform. These two transformed values constitute a 2D position encoding vector. Both the sine and cosine transforms have a period of 360 degrees, ensuring that the encoding values at the 0-degree and 360-degree positions are identical, satisfying the periodic constraint of the weld's annular topology. The position encoding vectors are calculated in batches during the data preprocessing stage, generating corresponding 2D encoding vectors for each of the 360 measurement positions, with vector values ranging from -1 to 1. The encoding vector for position 0 is (sin(0),cos(0))=(0,1), the encoding vector for position 90 is (sin(π / 2),cos(π / 2))=(1,0), the encoding vector for position 180 is (sin(π),cos(π))=(0,-1), the encoding vector for position 270 is (sin(3π / 2),cos(3π / 2))=(-1,0), and the encoding vector for position 359 is (sin(359×2π / 360),cos(359×2π / 360))≈(-0.017,0.9998). The position encoding vectors are concatenated with the weld morphology observation numerical features. The morphology observation numerical features are single-dimensional residual height measurements in millimeters, with a measurement accuracy of 0.01 millimeters and a value range of 0 to 5 millimeters. The concatenation operation merges the 1D residual height value and the 2D position encoding vector along the feature dimension to generate a 3D input feature vector. The first dimension of the vector is the residual height value, the second dimension is the sine encoding component, and the third dimension is the cosine encoding component. The weld morphology time-series observation sample contains 5 time steps, with 360 measurement positions at each time step. Therefore, the complete input feature tensor has a dimension of 5×360×3, which serves as the input data structure for a bidirectional recurrent convolutional coding network.
[0032] A bidirectional recurrent convolutional coding network outputs a sequence of feature vectors after cross-boundary connection channels that pass the hidden state vectors at the start and end boundary positions. When processing the input feature tensor, the network performs convolutional coding operations on both the forward and backward propagation paths at five time steps. The forward propagation path starts at position 0. The initial hidden state vector of the convolutional coding unit at position 0 is set to a vector of all zeros and a dimension of 128. The initial hidden state vector at position 359 is also a vector of all zeros. After a linear transformation, this vector is concatenated with the 3D input feature at position 0 to obtain a 131-dimensional vector, which is then input to the convolutional kernel at position 0 for convolution. The convolution operation uses one-dimensional convolution, and the kernel size of 3 means that features from three adjacent positions are processed simultaneously in the circumferential dimension. For position 0, the receptive field of the convolution operation is three positions: 359, 0, and 1. The position preceding position 0 is defined as position 359 through periodic boundary conditions. The convolutional kernel performs a weighted summation and bias on a 3×131-dimensional local feature window, then passes it through an activation function. The activation function uses a hyperbolic tangent function to limit the output value to the range of -1 to 1, generating a 128-dimensional hidden state vector at the 0-degree position. This hidden state vector is passed to the convolutional coding unit at the 1-degree position, which receives its own 3-dimensional input features and the 128-dimensional hidden state vector from the 0-degree position. After concatenation, a convolution operation is performed. The propagation process continues to the 359-degree position. The convolutional coding unit at the 359-degree position receives its input features, the hidden state vector from the 358-degree position, and the hidden state vector from the 0-degree position after a linear transformation across the boundary connection channels. The concatenated vector has a dimension of 3 + 128 + 128 = 259. The convolutional kernel is expanded to adapt to this dimension, and a convolution operation is performed, outputting a 128-dimensional hidden state vector at the 359-degree position. The backpropagation path is executed in the same manner, propagating backward from 359 degrees to 0 degrees. At 359 degrees, the hidden state vector from 0 degrees, transformed via a cross-boundary connection channel, is received as additional input. At 0 degrees, the hidden state vectors from 1 degrees and 359 degrees are received. Both the forward and reverse paths generate 128-dimensional hidden state vectors at each measurement location. These two vectors are concatenated to form a 256-dimensional feature vector, which serves as the final encoded output for that location. Each of the 360 measurement locations generates a 256-dimensional feature vector, forming a 360×256-dimensional feature vector sequence. The above encoding process is performed at each of the five time steps of the time-series observation samples, generating five sets of feature vector sequences. These sequences are then aggregated into a single 360×256-dimensional feature vector sequence through time-dimensional pooling. The pooling operation employs a max-pooling strategy, taking the maximum value in each dimension of the feature vectors at the corresponding locations across the five time steps to retain the most significant temporal features.After the feature vector sequence is output, it is passed to the subsequent counterfactual reasoning module as the original representation of the weld morphology baseline features. The 256-dimensional vector is reduced to 360 dimensions, the same as the number of circumferential measurement points, through a linear mapping layer to generate the weld morphology baseline feature vector. This vector is fused with the causal effect vector in the counterfactual reasoning module to predict morphology changes under different tool intervention parameters.
[0033] This implementation effectively models the ring topology of weld seams through a bidirectional recurrent convolutional architecture and cross-boundary connection channels. It utilizes periodic position encoding to eliminate boundary discontinuities and generate a high-quality feature vector sequence, providing reliable morphological baseline features for counterfactual inference and significantly improving the accuracy of causal prediction.
[0034] Optionally, the differentiable causal graph module represents the causal relationship between tool intervention parameters and weld residual height through a parameterized adjacency matrix, and the counterfactual reasoning module predicts morphological changes under parameters not actually applied based on the causal graph topology, including: Initialize the adjacency matrix. The row index corresponds to each dimension of the tool intervention parameters, and the column index corresponds to the value of the weld residual height at each measurement position in the circumferential direction. The value of the matrix elements represents the strength of the causal influence. The adjacency matrix parameters can be learned and optimized during training through gradient backpropagation. The counterfactual reasoning module receives the topology of the adjacency matrix. For a given hypothetical tool intervention parameter, it cuts off the causal paths in the adjacency matrix related to the actual observation tool parameters and activates the causal paths corresponding to the hypothetical tool parameters. It then performs forward propagation calculations along the activated paths to obtain the predicted weld residual height distribution under counterfactual conditions.
[0035] For example, the initialization of the adjacency matrix begins with defining the matrix dimensions. The row indices correspond to the various dimensions of the tool intervention parameters, which include four dimensions: depth of feed, rotational speed, tool angle, and axial feed rate. Therefore, the number of rows in the adjacency matrix is set to 4. The column indices correspond to the values of the weld residual height at each measurement position in the circumferential direction. There are a total of 360 circumferential measurement positions, corresponding to uniformly distributed measurement points from 0 degrees to 359 degrees. The number of columns in the adjacency matrix is set to 360. The adjacency matrix has a dimension of 4 rows and 360 columns, containing 1440 matrix elements. Each element represents the causal influence strength of a specific tool parameter dimension on the residual height at a specific circumferential position. The initial values of the matrix elements are generated using random sampling from a normal distribution, with the mean set to 0 and the standard deviation set to 0.01. The values of the initialized matrix elements mainly fall within the range of -0.03 to 0.03, with a few extreme values possibly reaching the range of -0.05 to 0.05. The numerical value of the matrix elements directly represents the strength of the causal influence. Positive values indicate that increasing the corresponding tool parameter will lead to an increase in the residual height at the corresponding position, while negative values indicate that increasing the tool parameter will lead to a decrease in the residual height. The larger the absolute value, the stronger the causal influence. The adjacency matrix, as a core parameter of the differentiable causal graph module, is registered as a learnable parameter in the neural network's parameter registry and participates in the gradient backpropagation optimization process. During training, the network's loss function calculates the partial derivative of each element of the adjacency matrix, tracking the dependency of the loss value on the matrix elements through an automatic differentiation framework. The loss function includes a prediction loss term and a sparsity regularization term. The prediction loss term is the mean squared error between the network's predicted shape change and the actual labeled value. The sparsity regularization term is the sum of the absolute values of all elements in the adjacency matrix multiplied by a regularization coefficient of 0.01. After gradient calculation, an adaptive moment estimation optimizer updates the adjacency matrix parameters. The optimizer maintains the first-order moment estimate and second-order moment estimate for each matrix element. The initial learning rate is set to 0.001, and the learning rate is dynamically adjusted according to the gradient history during training. The decay factors are set to 0.9 and 0.999. The adjacency matrix parameter update follows the gradient descent rule: new element value = current element value - (learning rate × gradient). The updated matrix element values have no upper or lower bounds, allowing for free adjustment during training to fit causal patterns in the data.
[0036] The differentiable causal graph module receives the tool intervention parameter vector at the current moment as input. This vector has a dimension of 4, corresponding to four parameter dimensions: feed depth, rotational speed, tool angle, and axial feed rate. The vector element values are the actual measured or set parameter values. The tool intervention parameter vector is multiplied by the adjacency matrix. This matrix multiplication multiplies the 4-dimensional parameter vector with a 4x360 adjacency matrix, resulting in a 360-dimensional causal effect vector. Each element of the vector corresponds to the cumulative causal effect value received at a circumferential measurement position. The i-th element of the causal effect vector is calculated by multiplying the element in the first row and i-th column of the adjacency matrix by the feed depth parameter value, adding the element in the second row and i-th column by the rotational speed parameter value, adding the element in the third row and i-th column by the tool angle parameter value, and adding the element in the fourth row and i-th column by the axial feed rate parameter value. The sum of these four terms constitutes the causal effect value at that circumferential position. After outputting the causal effect vector, it is passed as intermediate data to the counterfactual inference module. Simultaneously, the topological structure information of the adjacency matrix is also passed to the counterfactual inference module for selective activation of causal paths. The differentiable causal graph module also receives the encoded vector sequence from the temporal coding module. The encoded vector sequence has a dimension of 360×256. The weight contribution of the encoded vector to the learning of the adjacency matrix is calculated through an attention mechanism. The attention mechanism maps the encoded vector sequence to a 360×1 attention weight vector through a linear transformation layer. After softmax normalization, each element of the weight vector has a value between 0 and 1 and a sum of 1. The weight vector is weighted and modulated column by column with the gradient of the adjacency matrix. The circumferential position corresponding to the column with a larger weight receives a larger adjustment amplitude during gradient update, enabling the causal relationship learning to adapt to the differences in parameter sensitivity under different morphological states.
[0037] The counterfactual reasoning module receives the adjacency matrix topology and the hypothetical tool intervention parameter vector as input from the differentiable causal graph module. The hypothetical tool intervention parameter vector has a dimension of 4, representing the counterfactual intervention scheme to be evaluated. The vector element values may be the same as or different from the actual observed tool parameter values. Counterfactual reasoning is implemented by constructing a causal path mask to perform the intervention operation. The mask tensor has the same dimension as the adjacency matrix, 4 rows and 360 columns, and all initial values of the mask tensor are set to 0. For dimensions in the hypothetical tool intervention parameter vector where the values differ from the actual observed parameters, all elements in the corresponding row of the mask tensor are set to 1; for dimensions where the values are the same, the corresponding row remains 0. The mask tensor is multiplied element-wise with the adjacency matrix. The result is the post-intervention causal graph structure, which retains only the causal paths corresponding to the hypothetical tool parameters while setting the paths corresponding to the actual observed parameters to zero. This achieves the effect of cutting off the causal paths related to the actual observed tool parameters and activating the causal paths corresponding to the hypothetical tool parameters. The post-intervention causal graph structure is a 4x360 matrix. Only rows with a mask value of 1 retain the original adjacency matrix elements, while all other rows have elements of 0. The hypothetical tool intervention parameter vector is multiplied by the post-intervention causal graph structure using the same matrix multiplication method as the causal effect calculation in the differentiable causal graph module. Multiplying the 4-dimensional parameter vector by the 4x360 intervention causal graph yields a 360-dimensional counterfactual causal effect vector. The i-th element of the counterfactual causal effect vector is obtained solely by multiplying the hypothetical tool parameters by the corresponding row elements in the adjacency matrix; the causal contribution of the actual observed parameters is masked and not included in the calculation. The counterfactual causal effect vector represents the direct causal influence of the hypothetical tool parameters on the residual height at each circumferential location. This vector is fused with the encoded vector sequence provided by the time-series coding module to generate complete counterfactual prediction features. The encoded vector sequence has a dimension of 360×256. A linear transformation layer maps the 256-dimensional vector to a 1-dimensional value, resulting in a 360-dimensional vector, which serves as the baseline feature vector for weld morphology, reflecting the height distribution benchmark value of the current morphology at each circumferential position. The counterfactual causal effect vector is added element-wise to the weld morphology baseline feature vector. Each element of the 360-dimensional counterfactual effect vector is added to the corresponding element of the baseline feature vector. The result is a 360-dimensional fused feature vector, which simultaneously contains morphology benchmark information and incremental change information caused by the hypothetical intervention. The fused feature vector undergoes nonlinear mapping through a two-layer fully connected neural network. The first fully connected layer has an input dimension of 360 and an output dimension of 128, using a modified linear unit (MRU) activation function. The second layer has an input dimension of 128 and an output dimension of 360, using an identity mapping activation function. The output is the predicted value of the weld residual height distribution under counterfactual conditions. The predicted value is a 360-dimensional vector. Each element of the vector corresponds to a predicted residual height value at a circumferential measurement location under the assumption of tool parameter intervention, in millimeters, with a value range of 0 to 5 millimeters.
[0038] This implementation method explicitly models causal relationships using a learnable adjacency matrix and utilizes causal path masks to achieve counterfactual reasoning. It accurately predicts morphological changes under tool intervention parameters that have not been actually applied, providing a reliable decision-making basis for tool parameter optimization and significantly improving the scraping quality control effect.
[0039] Optionally, the counterfactual reasoning module receives the topological structure of the adjacency matrix and, for a given hypothetical tool intervention parameter, performs forward propagation calculation along the activated path to obtain the predicted weld residual height distribution under counterfactual conditions by cutting off the causal paths in the adjacency matrix related to the actual observed tool parameters and activating the causal paths corresponding to the hypothetical tool parameters. Construct a causal path mask tensor. The row dimension corresponds to the tool intervention parameter dimension of the adjacency matrix, and the column dimension corresponds to the circumferential measurement position of the weld residual height. For the row corresponding to the actual observed tool intervention parameter, set the mask value to zero to cut off the causal propagation of the parameter. For the row corresponding to the hypothetical tool intervention parameter, set the mask value to one to activate the causal propagation of the parameter. The causal path mask tensor and the adjacency matrix are multiplied element-wise to obtain the causal graph structure after intervention. The connection weights from the hypothetical tool parameters to the weld residual height position are retained, while the influence of the actual observation tool parameters is blocked. The numerical vector of the hypothesis tool intervention parameters is multiplied by matrix multiplication with the causal graph structure after intervention. The cumulative value of the causal effect received at each weld residual height measurement position is calculated by aggregation operation of summing along the rows. Combined with the weld morphology baseline features provided by the time-series coding module, the residual height distribution prediction under counterfactual conditions is generated.
[0040] For example, the construction of the causal path mask tensor begins with initializing the tensor dimensions. The row dimension of the tensor corresponds to the tool intervention parameter dimension of the adjacency matrix. The tool intervention parameters include four dimensions: feed depth, rotational speed, tool angle, and axial feed rate. Therefore, the number of rows in the mask tensor is set to 4. The column dimension corresponds to the circumferential measurement positions of the weld residual height. There are a total of 360 circumferential measurement positions, corresponding to uniformly distributed measurement points from 0 degrees to 359 degrees. The number of columns in the mask tensor is set to 360. The mask tensor has a dimension of 4 rows and 360 columns, containing 1440 mask elements. Each element has a value of 0 or 1, used to control the on / off state of the corresponding causal path. The assignment rule of the mask tensor is based on the comparison between the actual observed tool intervention parameters and the hypothetical tool intervention parameters. The actual observed parameters are the current tool settings collected from the production line, and the hypothetical parameters are the counterfactual intervention schemes to be evaluated. The counterfactual reasoning module receives the actual observed tool intervention parameter vector and the hypothetical tool intervention parameter vector as input. Both vectors have a dimension of 4, corresponding to the values of the four tool parameter dimensions. For rows corresponding to the observed tool intervention parameters, a dimensional comparison is used to determine which parameter dimensions remain unchanged in the hypothetical scheme. For dimensions with the same value, all 360 elements of the corresponding row of the mask tensor are set to 0, thus cutting off the causal propagation effect of that parameter. For rows corresponding to hypothetical tool intervention parameters, when the hypothetical parameter value of a certain dimension differs from the actual observed parameter value, all 360 elements of the corresponding row of the mask tensor are set to 1, thus activating the causal propagation effect of that parameter. Setting the mask value to 0 means that in subsequent element-wise multiplication operations, all weights of the corresponding row in the adjacency matrix are cleared to zero, blocking the causal influence of the tool parameter on each position of the residual height. Setting the mask value to 1 means that the weight value of the corresponding row in the adjacency matrix is retained, allowing the hypothetical tool parameter to act on each measurement position of the residual height through the causal relationship learned in the adjacency matrix. The assignment operation of the mask tensor is dynamically executed during each forward inference of the counterfactual reasoning module, generating a mask pattern in real time based on the difference between the input hypothetical parameters and the actual parameters, supporting flexible evaluation of different counterfactual intervention schemes.
[0041] The causal path mask tensor and adjacency matrix are multiplied element-wise to generate the post-intervention causal graph structure. The element-wise multiplication operation multiplies corresponding elements of the mask tensor and adjacency matrix one by one. Both tensors have a dimension of 4 rows and 360 columns, and the resulting tensor maintains the same dimension. In the post-intervention causal graph structure, all elements corresponding to rows with a mask value of 0 are set to zero, completely blocking the weight values of those rows in the original adjacency matrix. All elements corresponding to rows with a mask value of 1 retain the original weight values of the adjacency matrix; these weight values can be positive, negative, or close to zero. The intervention causal graph structure achieves the function of selectively preserving causal paths, retaining only the connection weights from the hypothesized tool parameters to the weld residual height position, while blocking the transmission of influence from the actual observed tool parameters. The weight distribution learned during training reflects the causal effect pattern of each tool parameter on the residual height at different circumferential positions. Through the selective masking of the mask tensor, the intervention causal graph only contains causal paths related to changes in the hypothesized parameters, eliminating interference from actual parameters and enabling counterfactual inference to independently evaluate the net effect of the hypothetical intervention. The causal graph structure after intervention is passed as an intermediate data structure to the subsequent matrix multiplication calculation. This data structure is stored in memory as a floating-point tensor. The tensor elements have a precision of 32-bit floating-point numbers and a value range between -5 and 5. The absolute value of most elements is less than 1.
[0042] Assume a matrix multiplication operation is performed between the numerical vector of the tool intervention parameters and the resulting causal graph structure. Assume the parameter vector has a dimension of 4, corresponding to assumed values for depth of feed, rotational speed, tool angle, and axial feed rate, with units of millimeters, revolutions per minute, degrees, and meters per minute, respectively. The intervention causal graph structure is a 4x360 matrix. Matrix multiplication multiplies the 4-dimensional vector with the 4x360 matrix. The operation rule is that the i-th element of the vector is multiplied by each element in the i-th row and column of the matrix, where i ranges from 1 to 4, traversing the four tool parameter dimensions. The intermediate result of the matrix multiplication is a 4x360 product matrix, where the element in the i-th row and j-th column of the product matrix equals the i-th element of the assumed parameter vector multiplied by the element in the i-th row and j-th column of the intervention causal graph. The row-wise summation aggregation operation accumulates along the column dimensions of the product matrix. For each column index j, the four elements from row 1, column j to row 4, column j of the product matrix are summed. The accumulated result is a single value, representing the cumulative causal effect received at the j-th circumferential measurement location. After performing row-wise summation aggregation on each of the 360 column indices, a 360-dimensional cumulative causal effect vector is generated. Each element of the vector corresponds to the cumulative causal effect value at a circumferential measurement location, with the value in millimeters, representing the expected change in residual height at that location caused by the combination of hypothetical tool parameters. A positive cumulative causal effect value indicates that the hypothetical parameters will lead to an increase in residual height at that location, while a negative value indicates a decrease in residual height. The absolute value reflects the magnitude of the change. The cumulative causal effect vector, combined with the weld morphology baseline features provided by the temporal coding module, generates a counterfactual prediction of the residual height distribution. The temporal coding module outputs a 360×256 dimensional encoded vector sequence, which is mapped to a 360-dimensional weld morphology baseline feature vector through a linear transformation layer. The weight matrix of the linear transformation layer has a dimension of 1 row and 256 columns, and the bias vector has a dimension of 1. After performing a linear transformation on each row of the encoded vector sequence, a scalar value is output. The 360 rows are transformed to obtain 360-dimensional baseline feature vectors. The weld morphology baseline feature vector represents the baseline state of the residual height at each circumferential position of the current weld, with the numerical unit being millimeters, reflecting the morphology distribution under conditions without any tool intervention. The cumulative causal effect vector is added element-wise to the weld morphology baseline feature vector. Each element of the 360-dimensional effect vector is added to the corresponding element of the baseline vector. The result of the addition is a 360-dimensional fused feature vector, which simultaneously contains morphology baseline information and incremental change information caused by the assumed intervention, representing the expected residual height state at each circumferential position under the assumed tool parameters.The fused feature vector undergoes a nonlinear transformation via a multilayer perceptron network. The multilayer perceptron consists of two fully connected layers. The first layer has an input dimension of 360 and an output dimension of 128. The weight matrix has a dimension of 128 rows and 360 columns, and the bias vector has a dimension of 128. The activation function is a modified linear unit (MRU). The second layer also has an input dimension of 128 and an output dimension of 360. The weight matrix has a dimension of 360 rows and 128 columns, and the bias vector has a dimension of 360. The activation function uses an identity mapping to preserve the linearity of the output value. The output of the multilayer perceptron network is the residual height distribution prediction vector under counterfactual conditions. The vector has a dimension of 360, and each element corresponds to a predicted residual height value at a circumferential measurement location under the assumed tool parameters. The unit of measurement is millimeters, ranging from 0 to 5 millimeters, with an accuracy of 0.01 millimeters.
[0043] This implementation precisely controls the causal propagation path through the causal path mask tensor, calculates counterfactual causal effects using matrix multiplication and row summation aggregation, and generates accurate residual height distribution predictions by combining topographic baseline features. This provides reliable counterfactual evaluation capabilities for tool parameter optimization and significantly reduces trial-and-error costs.
[0044] Optionally, causal structure learning is performed on the differentiable causal graph module to construct a loss function containing causal sparsity constraints to optimize the adjacency matrix parameters in order to identify the strength of causal effects, including: Construct a total loss function, which includes a prediction loss term and a sparsity regularization term. The prediction loss term measures the deviation between the predicted shape change output by the neural network used to predict shape changes and the shape change labeled samples. The sparsity regularization term penalizes the number of non-zero elements in the adjacency matrix. In each gradient update iteration, the gradient of the total loss function with respect to the network parameters and adjacency matrix parameters of the temporal coding module and the counterfactual reasoning module is calculated simultaneously, and the network parameters and adjacency matrix parameters are updated synchronously through gradient descent. After training, the significance threshold is adaptively determined based on the numerical distribution of the adjacency matrix elements. Elements in the adjacency matrix whose absolute values exceed the significance threshold are selected. The connection between the corresponding tool intervention parameters and the location of the weld residual height is determined as a causal relationship pair, and the magnitude of the absolute value of the element represents the strength of the causal effect.
[0045] Exemplary, detailed implementation The construction of the total loss function begins with defining the prediction loss term, which measures the deviation between the predicted topography change output by the neural network used to predict topography changes and the topography change annotation samples. The complete forward propagation process of the neural network includes a temporal encoding module extracting features from the temporal observation samples of the weld topography, a differentiable causal graph module calculating the causal effect vector of the tool intervention parameters based on the adjacency matrix, and a counterfactual reasoning module fusing the causal effect vector and topography baseline features to generate a prediction of the residual height distribution. The predicted topography change output by the network is a 360-dimensional vector, with each element corresponding to the predicted change in residual height at a circumferential measurement position, in millimeters. The predicted change represents the increment or decrease in residual height at that position relative to the current state under the given tool parameters. The topography change annotation samples are also 360-dimensional vectors, obtained by calculating the difference in residual height between adjacent time steps in the training dataset. The difference value characterizes the actual topography change caused by the scraping action; positive values indicate a decrease in height, and negative values indicate an increase in height, with a value range between -2 and 2 millimeters. The prediction loss term uses mean squared error as a metric. It calculates the sum of squared differences between corresponding elements of the predicted and labeled vectors, and averages this sum across 360 measurement locations to obtain the scalar loss value. The formula for calculating the prediction loss term is to sum the sums of all circumferential position indices i from 0 to 359, with each term being the squared difference between the predicted and labeled values. The sum is divided by 360 to obtain the mean squared error. A smaller loss value indicates higher prediction accuracy. The sparsity regularization term penalizes the number of non-zero elements in the adjacency matrix, prompting the network to automatically shrink the weights of insignificant causal relationships in the adjacency matrix to near zero during training, while preserving key causal paths. The sparsity regularization term calculates the sum of the absolute values of all elements in the adjacency matrix. The adjacency matrix has dimensions of 4 rows and 360 columns, containing 1440 elements. The absolute value of each element is taken and summed to obtain the L1 norm, which serves as the basic metric for the sparsity regularization term. The sparsity regularization term and the prediction loss term are combined using weighted coefficients to form the total loss function. The total loss function equals the prediction loss term plus the sparsity regularization term multiplied by the regularization coefficient, which is set to 0.01. This coefficient controls the trade-off between causal sparsity and prediction accuracy. An excessively large regularization coefficient leads to excessive sparsity in the adjacency matrix, resulting in the loss of important causal paths and reduced prediction accuracy. An excessively small coefficient leads to redundancy in the adjacency matrix elements, making it difficult to identify key causal relationships and reducing interpretability. The total loss function is calculated once per training batch and serves as the optimization objective for gradient backpropagation. Gradient calculation traces the dependency of the loss value on the parameters of each network layer and the adjacency matrix parameters.
[0046] Gradient updates are iterated in each training batch, simultaneously calculating the gradient of the total loss function with respect to the network parameters of the temporal coding module, the counterfactual inference module, and the adjacency matrix parameters. The network parameters of the temporal coding module include the kernel weights, bias vectors, and linear transformation layer weights of the bidirectional recurrent convolutional coding network, totaling approximately 500,000 parameters, all data types being 32-bit floating-point numbers. The network parameters of the counterfactual inference module include the weight matrix and bias vectors of a two-layer fully connected neural network. The first layer's weight matrix has a dimension of 128 rows and 360 columns, and the second layer's weight matrix has a dimension of 360 rows and 128 columns, totaling approximately 90,000 parameters. The adjacency matrix parameters have a dimension of 4 rows and 360 columns, containing 1440 learnable elements, the values of which are dynamically adjusted during training based on the gradient of the total loss function. Gradient calculation is implemented using an automatic differentiation framework. During forward propagation, the framework records all computational operations involving all parameters and their dependencies, constructing a computational graph topology. During backpropagation, the gradient is propagated layer by layer from the total loss function to the input layer according to the chain rule. The gradient of the total loss function with respect to the element in the i-th row and j-th column of the adjacency matrix comprises two contributions. The first part comes from the prediction loss term, calculated by tracing the element's role in the causal effect vector calculation and the influence of the causal effect vector on the predicted output, thus determining the partial derivative of the prediction error with respect to this element. The second part comes from the sparsity regularization term; the gradient of the absolute value of this element with respect to the L1 norm is the element's sign value multiplied by the regularization coefficient 0.01. Gradient descent synchronously updates the network parameters and the adjacency matrix parameters. The update rule is that the new value of each parameter = current value - (learning rate × gradient). The learning rate is dynamically adjusted using an adaptive moment estimation optimizer, with an initial learning rate set to 0.001. The optimizer maintains first-order and second-order moment estimates for each parameter. The first-order moment is the exponential moving average of the gradient, and the second-order moment is the exponential moving average of the squared gradient, with decay factors set to 0.9 and 0.999, respectively. During parameter updates, the learning rate is scaled based on the square root of the second moment. This results in smaller update step sizes for parameters with drastic gradient changes and larger update step sizes for parameters with stable gradient changes, improving training stability and convergence speed. The training process employs a mini-batch gradient descent strategy. Each batch contains 32 training samples, each sample including triplet data of weld morphology time-series observations, tool intervention parameters, and morphology change annotations. The average loss values of samples within a batch are used as the total loss for that batch, and the gradient is also averaged over samples within a batch before being used for parameter updates. The total number of training batches is set to 10,000, corresponding to the traversal of approximately 320,000 training samples. The training time on a computing platform equipped with a graphics processing unit is approximately 8 hours.
[0047] After training, a significance threshold is adaptively determined based on the numerical distribution of the adjacency matrix elements. This threshold is used to filter significant causal relationships and quantify the strength of causal effects. After 10,000 batches of training, the adjacency matrix converges, and the numerical distribution of the 1440 elements exhibits a long-tail characteristic: most elements have absolute values less than 0.1, a small number have absolute values exceeding 0.5, and a very small number have absolute values exceeding 1.0. The significance threshold is determined using the percentile method. The 90th percentile of the absolute values of all adjacency matrix elements is calculated as the threshold. The 90th percentile means that 90% of the elements have absolute values below the threshold, and 10% have absolute values above the threshold. The threshold calculation process involves sorting the absolute values of the 1440 elements from smallest to largest, and taking the absolute value of the element at position 1440 × 0.9 = 1296 after sorting as the significance threshold. The percentile threshold can be adjusted according to specific application needs. A percentile of 80 indicates that 20% of strong causal relationships are retained, while a percentile of 95 indicates that only 5% of the strongest causal relationships are retained. Higher percentiles result in higher thresholds and sparser causal graphs. Elements in the adjacency matrix whose absolute values exceed the significance threshold are selected. Elements with absolute values below the threshold are considered to have weak or no causal relationships. Elements with absolute values exceeding the threshold retain their row and column indices as identifiers of causal relationship pairs. The row index corresponds to the dimension of the tool intervention parameter, and the column index corresponds to the circumferential measurement position of the weld residual height. The absolute value of the element represents the strength of the causal effect, and the element sign represents the direction of the causal effect. The connection between the tool intervention parameter corresponding to the element with an absolute value exceeding the threshold and the weld residual height position is determined as a causal relationship pair. The number of relationship pairs is equal to the number of elements exceeding the threshold, accounting for approximately 10% of the total number of elements in the adjacency matrix, i.e., 144 relationship pairs. Causal relationship pairs are sorted from largest to smallest absolute value. The relationship pair with the largest absolute value represents the strongest causal effect and is given priority in guiding tool parameter optimization decisions. The visualization of causal pairs is presented using a bipartite graph. One side of the graph has nodes representing four tool parameter dimensions, while the other side has nodes representing 360 circumferential measurement positions. The thickness of the connecting edges is proportional to the absolute value of the elements, and the color of the connecting edges represents the symbol: red indicates a positive causal effect, and blue indicates a negative causal effect.
[0048] This implementation optimizes the adjacency matrix parameters through a total loss function that includes a sparse regularization term, synchronously updates network parameters and causal structure using gradient descent, and adaptively determines a significance threshold based on element distribution after training to screen key causal pairs, thereby achieving precise quantification and visualization of causal effect strength. This provides an interpretable causal basis for tool parameter optimization and significantly improves the scientificity and reliability of control decisions.
[0049] Optionally, the application of the trained network model in adaptive control of steel pipe weld scraping includes: Real-time morphological observation data of the weld seam of the steel pipe to be processed is obtained and input into the trained network model. The counterfactual reasoning module is used to predict the evolution trend of weld seam morphology under several candidate tool intervention parameter combinations. The tool intervention parameter that optimizes the weld seam residual height uniformity index is selected as the control output to achieve adaptive and precise control of steel pipe weld seam scraping.
[0050] For example, real-time morphological observation data of the weld seam of the steel pipe to be processed is acquired through a laser displacement sensor array installed at the scraping station. The sensor array is uniformly distributed along the circumference of the steel pipe and contains 360 laser displacement sensors. Each sensor corresponds to a circumferential angular position, measuring the residual height value of the weld seam at that position. The sensor sampling frequency is set to acquire a complete circumferential contour once per second, and a single acquisition obtains the residual height values of 360 measurement points. The unit of the values is millimeters, the measurement accuracy is 0.01 millimeters, and the measurement range is 0 to 10 millimeters. The real-time morphological observation data acquisition module reads the measurement data of the current moment and the previous 5 consecutive time steps from the sensor array, forming a 5-frame 360-point time-series observation sequence. The tensor dimension of the time-series observation sequence is 5×360, and each element is the residual height value. The data acquisition module preprocesses the raw sensor readings, including removing outliers outside the measurement range. The criteria for judging outliers are values less than 0 or greater than 10 millimeters. Outliers are replaced with the average value of adjacent measurement points. The average value is calculated by the arithmetic mean of the three normal measurement points before and after the outlier. The preprocessed time-series observation sequence is passed to the trained network model through a data interface. The data interface uses a memory-sharing mechanism to achieve real-time data flow, with an interface latency of less than 10 milliseconds, meeting the real-time requirements of online control. Before being input into the network model, the time-series observation sequence needs to be concatenated with a periodic position encoding vector. The position encoding vector is pre-calculated and cached during the system initialization phase. The sine and cosine values of the 360 circumferential angle coordinates are calculated to form a 2D encoding vector. The encoding vector is concatenated with the residual height value to form a 3D input feature vector. The complete input feature tensor has a dimension of 5×360×3.
[0051] After receiving real-time topographic observation data, the trained network model extracts spatiotemporal features of the topography through a temporal coding module to generate a sequence of encoded vectors. This sequence has a dimension of 360×256, representing the feature representations of each circumferential position. The network model loads the optimal parameter checkpoints saved during training. The checkpoint file contains the weights of the bidirectional recurrent convolutional coding network from the temporal coding module, the adjacency matrix parameters from the differentiable causal graph module, and the weights of the fully connected network from the counterfactual inference module. The total number of parameters is approximately 600,000, and the checkpoint file size is approximately 2.4 megabytes, stored in a binary floating-point array format. The model inference runtime environment is deployed on an edge computing device. The device configuration includes a 4-core central processing unit, 8 gigabytes of memory, and a graphics processing unit (GPU) acceleration module. The GPU contains 256 parallel computing cores for accelerating matrix multiplication and convolution operations. With this hardware configuration, the model inference latency for a single forward propagation is approximately 50 milliseconds, meeting the real-time requirement of a 1-second control cycle. Up to 20 model inferences can be performed within the control cycle for candidate parameter evaluation. The counterfactual reasoning module receives the current encoded vector sequence and the adjacency matrix topology, and performs counterfactual prediction calculations on several candidate tool intervention parameter combinations respectively.
[0052] Candidate tool intervention parameter combinations are generated through parameter space sampling. The tool intervention parameters include four dimensions: depth of feed, rotational speed, tool angle, and axial feed rate. Each dimension defines a feasible value range and sampling step size. The feasible range for depth of feed is 0.5 to 3 mm, with a sampling step size of 0.5 mm, resulting in 6 candidate values after discretization. The feasible range for rotational speed is 50 to 200 rpm, with a sampling step size of 25 rpm, resulting in 7 candidate values. The feasible range for tool angle is 15 to 45 degrees, with a sampling step size of 5 degrees, resulting in 7 candidate values. The feasible range for axial feed rate is 0.1 to 0.5 m / min, with a sampling step size of 0.1 m / min, resulting in 5 candidate values. The number of candidate values for the four dimensions are 6, 7, 7, and 5 respectively, resulting in a total of 6 × 7 × 7 × 5 = 1470 complete Cartesian product combinations. Complete enumeration involves a large computational burden. The parameter combination sampling adopts a stratified sampling strategy, uniformly selecting three representative values for each dimension's candidate values. Feed depths are selected as 0.5, 1.75, and 3 mm; rotational speeds as 50, 125, and 200 rpm; tool angles as 15, 30, and 45 degrees; and axial feed speeds as 0.1, 0.3, and 0.5 m / min. The Cartesian product of the three values selected from each of the four dimensions yields 81 candidate tool intervention parameter combinations. For the currently observed real-time tool parameters, additional candidate combinations are generated through dense sampling within their neighborhood. The neighborhood is defined as the interval between the current value of each dimension and one sampling step. Three values are sampled for each dimension within the neighborhood, generating an additional 81 candidate combinations. The total number of candidate combinations is controlled within 162. The total inference calculation time is approximately 162 × 50 milliseconds = 8.1 seconds. Parallel inference compresses the time to less than 1 second to meet the control cycle requirements.
[0053] The counterfactual reasoning module performs forward propagation calculations for each candidate tool intervention parameter combination, constructing a causal path mask tensor. This mask tensor has 4 rows and 360 columns. For dimensions in the candidate parameter vector that differ from the current actual parameter values, all elements in the corresponding row of the mask tensor are set to 1; for dimensions with the same values, they are set to 0. The mask tensor is multiplied element-wise with the adjacency matrix to obtain the post-intervention causal graph structure. The candidate parameter vector is then multiplied by the intervention causal graph, and the results are summed along the rows to obtain a 360-dimensional counterfactual causal effect vector. The counterfactual causal effect vector is element-wise added to the weld morphology baseline feature vector obtained by linear transformation of the encoded vector sequence. The fused feature vector is then mapped through a two-layer fully connected network to output a 360-dimensional residual height distribution prediction vector. The prediction vector represents the expected residual height value at each circumferential position under the influence of the candidate parameter. The prediction vector is used to calculate the weld residual height uniformity index. The uniformity index is measured by the standard deviation of the 360 elements of the prediction vector; a smaller standard deviation indicates a more uniform circumferential residual height distribution and better scraping quality. For each of the 162 candidate parameter combinations, the standard deviation of the predicted residual height distribution was calculated. The standard deviation values ranged from 0.05 to 0.8 mm. The candidate parameter combination with the minimum standard deviation was selected as the optimal control output. The selection process iterated through the standard deviation values of all candidate combinations, recorded the minimum standard deviation and its corresponding parameter combination index, and the optimal parameter combination contained specific values in four dimensions, which were then issued as control commands to the scraping actuator.
[0054] The control output is transmitted to the scraping actuator via an industrial fieldbus protocol. The actuator includes a servo motor for depth of feed adjustment, a frequency converter for rotational speed control, a stepper motor for tool angle adjustment, and a hydraulic system for axial feed speed control. The control command data structure contains four floating-point numbers, corresponding to the target setpoints for four tool parameter dimensions. The data frame header includes the device address, command type, and checksum, and the total data frame length is 32 bytes. Control commands are broadcast via the fieldbus at a communication rate of 1 megabit per second, with a single frame transmission time of approximately 0.25 milliseconds. After receiving the control command, each subsystem parses the corresponding parameter fields and initiates the adjustment action. The response time for the depth of feed servo motor is approximately 0.2 seconds, for the rotational speed frequency converter approximately 0.5 seconds, for the tool angle stepper motor approximately 0.3 seconds, and for the axial feed speed hydraulic system approximately 0.4 seconds. During the adjustment process of the actuator, the laser displacement sensor array continuously collects weld morphology data to form a closed-loop feedback control. In the next control cycle, the real-time data acquisition, model inference and parameter optimization process are repeated to achieve dynamic adaptive adjustment.
[0055] This implementation method utilizes a trained network model to perform counterfactual predictions on the combination of intervention parameters for candidate tools. By selecting the parameters with the best residual height uniformity index, it achieves adaptive and precise control, significantly improving the quality of weld scraping, reducing manual debugging costs, and providing reliable technical support for intelligent steel pipe production.
[0056] Secondly, an adaptive control system for scraping steel pipe welds is provided, including: The first unit is used to acquire a training dataset from the steel pipe weld scraping process. The training dataset includes time-series observation samples of weld morphology, tool intervention parameter samples, and morphology change annotation samples. The second unit is used to construct a causal prediction neural network, including a temporal encoding module that integrates periodic constraints, a differentiable causal graph module, and a counterfactual reasoning module. The temporal encoding module encodes the weld morphology temporal observation samples considering the ring continuity of the weld. The differentiable causal graph module represents the causal relationship between tool intervention parameters and weld residual height through a parameterized adjacency matrix. The counterfactual reasoning module predicts morphology changes under parameters that have not been actually applied, based on the causal graph topology. The third unit is used to train the causal prediction neural network using a meta-learning training framework. The training dataset is divided into multiple task subsets according to the specifications of the steel pipes. On each task subset, the network output is supervised by the morphological change annotation samples. Causal structure learning is performed on the differentiable causal graph module to construct a loss function containing causal sparsity constraints to optimize the adjacency matrix parameters in order to identify the strength of causal effects. The network initialization parameters across tasks are learned through two-layer optimization to obtain the trained network model.
[0057] Thirdly, a computer-readable storage medium is provided, having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
Claims
1. An adaptive control method for scraping steel pipe welds, characterized in that, include: A training dataset was obtained from the scraping process of steel pipe welds, the training dataset including time-series observation samples of weld morphology, tool intervention parameter samples, and morphology change annotation samples; A causal prediction neural network is constructed, comprising a temporal encoding module incorporating periodic constraints, a differentiable causal graph module, and a counterfactual reasoning module. The temporal encoding module encodes the weld morphology temporal observation samples considering the ring continuity of the weld. The differentiable causal graph module represents the causal relationship between tool intervention parameters and weld residual height using a parameterized adjacency matrix. The counterfactual reasoning module predicts morphology changes under parameters without actual tool intervention based on the causal graph topology. The causal prediction neural network is trained using a meta-learning training framework. The training dataset is divided into multiple task subsets according to the specifications of the steel pipes. On each task subset, the network output is supervised by the morphological change annotation samples. Causal structure learning is performed on the differentiable causal graph module to construct a loss function with causal sparsity constraints to optimize the adjacency matrix parameters in order to identify the strength of causal effects. The network initialization parameters across tasks are learned through two-layer optimization to obtain the trained network model.
2. The method according to claim 1, characterized in that, The timing coding module considers the annular continuity of the weld seam and encodes the timing observation samples of the weld seam morphology, including: The starting and ending measurement positions of the weld circumference are mapped to continuously connected boundary nodes in the topology, and a cyclically connected coding network is constructed. The coding state output of the ending measurement position is used as the input of the coding layer of the starting measurement position, forming a closed information flow path. In the cyclically connected coding network, a periodic index mapping strategy is used to identify the position of each measurement position in the weld morphology time-series observation sample, and a continuously changing periodic index value is assigned to the measurement position at the boundary of adjacent periods. The cyclically connected encoding network takes the measured position features mapped by periodic indexes as input for forward propagation and outputs a sequence of encoded vectors for the counterfactual reasoning module to generate baseline features of weld morphology.
3. The method according to claim 2, characterized in that, The steps for constructing a cyclically connected coding network include: A bidirectional recurrent convolutional coding network is constructed. In the forward propagation path, features are extracted sequentially from the starting measurement position to the ending measurement position along the circumference of the weld. In the backward propagation path, features are extracted in reverse from the ending measurement position to the starting measurement position. A cross-boundary connection channel is established between the starting and ending positions. The hidden state vector of the ending position is used as an additional input for the feature extraction of the starting position, and the hidden state vector of the starting position is used as an additional input for the feature extraction of the ending position, forming a closed-loop information flow topology. For each measurement position in the circumferential direction of the weld, a position encoding vector is generated by transforming its angular coordinates using sine and cosine transformations with a period equal to the complete circumferential angle of the weld. The periodic position encoding vector is concatenated with the numerical features of weld morphology observation and input into the bidirectional recurrent convolutional encoding network. The bidirectional recurrent convolutional encoding network outputs a feature vector sequence after passing the hidden state vectors of the start and end boundary positions through cross-boundary connection channels.
4. The method according to claim 1, characterized in that, The differentiable causal graph module represents the causal relationship between tool intervention parameters and weld residual height using a parameterized adjacency matrix. The counterfactual reasoning module predicts morphological changes under parameters not actually applied, based on the causal graph topology, including: Initialize the adjacency matrix. The row index corresponds to each dimension of the tool intervention parameters, and the column index corresponds to the value of the weld residual height at each measurement position in the circumferential direction. The value of the matrix elements represents the strength of the causal influence. The adjacency matrix parameters can be learned and optimized during training through gradient backpropagation. The counterfactual reasoning module receives the topology of the adjacency matrix. For a given hypothetical tool intervention parameter, it cuts off the causal paths in the adjacency matrix related to the actual observation tool parameters and activates the causal paths corresponding to the hypothetical tool parameters. It then performs forward propagation calculations along the activated paths to obtain the predicted weld residual height distribution under counterfactual conditions.
5. The method according to claim 4, characterized in that, The counterfactual reasoning module receives the topological structure of the adjacency matrix, and for a given hypothetical tool intervention parameter, obtains the predicted weld residual height distribution under counterfactual conditions by cutting off the causal paths in the adjacency matrix related to the actual observed tool parameters and activating the causal paths corresponding to the hypothetical tool parameters, and then performing forward propagation calculations along the activated paths. Construct a causal path mask tensor. The row dimension corresponds to the tool intervention parameter dimension of the adjacency matrix, and the column dimension corresponds to the circumferential measurement position of the weld residual height. For the row corresponding to the actual observed tool intervention parameter, set the mask value to zero to cut off the causal propagation of the parameter. For the row corresponding to the hypothetical tool intervention parameter, set the mask value to one to activate the causal propagation of the parameter. The causal path mask tensor and the adjacency matrix are multiplied element-wise to obtain the causal graph structure after intervention. The connection weights from the hypothetical tool parameters to the weld residual height position are retained, while the influence of the actual observation tool parameters is blocked. The numerical vector of the hypothesis tool intervention parameters is multiplied by matrix multiplication with the causal graph structure after intervention. The cumulative value of the causal effect received at each weld residual height measurement position is calculated by aggregation operation of summing along the rows. Combined with the weld morphology baseline features provided by the time-series coding module, the residual height distribution prediction under counterfactual conditions is generated.
6. The method according to claim 1, characterized in that, The differentiable causal graph module is subjected to causal structure learning, and a loss function containing causal sparsity constraints is constructed to optimize the adjacency matrix parameters to identify the strength of causal effects, including: Construct a total loss function, which includes a prediction loss term and a sparsity regularization term. The prediction loss term measures the deviation between the predicted shape change output by the neural network used to predict shape changes and the shape change labeled samples. The sparsity regularization term penalizes the number of non-zero elements in the adjacency matrix. In each gradient update iteration, the gradient of the total loss function with respect to the network parameters and adjacency matrix parameters of the temporal coding module and the counterfactual reasoning module is calculated simultaneously, and the network parameters and adjacency matrix parameters are updated synchronously through gradient descent. After training, the significance threshold is adaptively determined based on the numerical distribution of the adjacency matrix elements. Elements in the adjacency matrix whose absolute values exceed the significance threshold are selected. The connection between the corresponding tool intervention parameters and the location of the weld residual height is determined as a causal relationship pair, and the magnitude of the absolute value of the element represents the strength of the causal effect.
7. The method according to claim 1, characterized in that, The application of the trained network model in adaptive control of steel pipe weld scraping includes: Real-time morphological observation data of the weld seam of the steel pipe to be processed is obtained and input into the trained network model. The counterfactual reasoning module is used to predict the evolution trend of weld seam morphology under several candidate tool intervention parameter combinations. The tool intervention parameter that optimizes the weld seam residual height uniformity index is selected as the control output to achieve adaptive and precise control of steel pipe weld seam scraping.
8. An adaptive control system for scraping weld seams in steel pipes, used to implement the method described in any one of claims 1-7, characterized in that, include: The first unit is used to acquire a training dataset from the steel pipe weld scraping process. The training dataset includes time-series observation samples of weld morphology, tool intervention parameter samples, and morphology change annotation samples. The second unit is used to construct a causal prediction neural network, including a temporal encoding module that integrates periodic constraints, a differentiable causal graph module, and a counterfactual reasoning module. The temporal encoding module encodes the weld morphology temporal observation samples considering the ring continuity of the weld. The differentiable causal graph module represents the causal relationship between tool intervention parameters and weld residual height through a parameterized adjacency matrix. The counterfactual reasoning module predicts morphology changes under parameters that have not been actually applied, based on the causal graph topology. The third unit is used to train the causal prediction neural network using a meta-learning training framework. The training dataset is divided into multiple task subsets according to the specifications of the steel pipes. On each task subset, the network output is supervised by the morphological change annotation samples. Causal structure learning is performed on the differentiable causal graph module to construct a loss function containing causal sparsity constraints to optimize the adjacency matrix parameters in order to identify the strength of causal effects. The network initialization parameters across tasks are learned through two-layer optimization to obtain the trained network model.
9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 7.