Complex product quality prediction method based on causal temporal graph attention network
Patent Information
- Application Number
- CN202611295831.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-25
- Publication Date
- 2026-10-30
AI Technical Summary
[0003]然而,当前基于深度学习的质量预测方法主要聚焦于仅生产一种产品、加工方式固定的装配线
本申请提供了一种基于因果时序图注意力网络的复杂产品质量预测方法,在该方法中,首先通过获取待测产品在各加工站点的工艺参数和/或测量参数以及产品工艺流程知识,并对其进行预处理和知识转化,以充分利用工业生产过程中易于采集的加工数据与工艺流程先验知识;继而将处理后的数据输入预先训练好的质量预测模型,该模型首先通过质量特征图结构编码模块基于加工过程信息构建规格统一的图结构数据,从而将多耦合、异构的复杂制造过程准确表征为可计算的图结构,解决了多产品、多形式加工条件下数据异质性强、难以统一建模的问题;在此基础上,由时空特征挖掘模块中虚拟节点图注意力网络通过引入虚拟节点机制,对各产品实际经过的有效站点进行并行化自适应聚合,在提取各站点间复杂空间交互信息的同时显著提升计算效率,再由因果掩码时间注意力网络按照加工时序筛选、排序并提取各有效站点间的多尺度时间依赖关系,有效保障了时序建模的因果性与保序性,从而突破了对过程状态表征能力不足的技术瓶颈;最后通过注意力融合解码模块以虚拟节点特征为查询、时序特征为键值进行注意力融合,使模型聚焦于与质量强相关的关键时空特征,实现精准解码预测,综合提升了复杂制造场景下产品质量预测的准确性、鲁棒性与计算效率。
Smart Images

Figure CN123014329A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of product quality prediction technology, and in particular to a complex product quality prediction method based on causal time-series graph attention networks. Background Technology
[0002] In modern industrial production, quality monitoring and control are crucial for manufacturing enterprises. Accurate quality prediction technology can ensure the safe, stable, and efficient operation of industrial processes. With the rapid development of the Internet of Things and the advancement of data processing technology, data-driven quality prediction methods can perform quality predictions by analyzing large amounts of industrial process data without relying on prior physical and mathematical knowledge. Deep learning, in particular, can quickly process massive amounts of data, adaptively filter hidden features, and extract complex patterns, greatly improving training efficiency and robustness, and therefore has been widely used.
[0003] However, current deep learning-based quality prediction methods primarily focus on assembly lines that produce only one product with fixed processing methods. With the development of the manufacturing industry, multiple products may be processed in different ways on the same assembly line. Even products of the same type may pass through different workstations due to flexible scheduling. Most existing methods ignore the variations brought about by multiple products and complex processing methods. At the same time, there are complex situations where multiple workstations process the same product in parallel or across workstations. This makes the dependencies between workstations complex and highly coupled. These potentially complex relationships can significantly affect product quality variations. Most existing methods do not consider the spatiotemporal interactions between workstations, thus limiting the accuracy and robustness of the models.
[0004] Therefore, how to comprehensively and accurately consider the spatiotemporal interaction information in multi-coupled complex process data to achieve efficient quality prediction of complex products is a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0005] The purpose of this application is to provide a method for predicting the quality of complex products based on causal temporal graph attention networks, which can comprehensively and accurately consider the spatial and temporal interaction information between various processing stations in the manufacturing process of complex products, thereby improving the accuracy and robustness of product quality prediction.
[0006] To achieve the above objectives, this application provides the following solution: A method for predicting complex product quality based on causal temporal graph attention networks includes the following steps: Obtain the processing feature dataset and product process flow knowledge of the product under test. The processing feature dataset includes the process parameters and / or measurement parameters of the product under test at each processing station; the product process flow knowledge includes the product attributes of the product under test and the processing methods of the product under test during the production process.
[0007] The processing feature dataset is preprocessed, and the product process knowledge is transformed into a processing process information set.
[0008] The preprocessed processing feature dataset and processing information set are input into a pre-trained quality prediction model to obtain product quality prediction results. The quality prediction model includes a quality feature graph structure encoding module, a spatiotemporal feature mining module, and an attention fusion decoding module. The quality feature graph structure encoding module constructs graph structure data based on the preprocessed processing feature dataset and processing information set. The spatiotemporal feature mining module uses a virtual node graph attention network to extract spatial interaction information from the graph structure data, obtaining spatial features and virtual node features for each processing station. After filtering and sorting the spatial features by time dimension based on the processing information set and mask matrix, a causal mask temporal attention network is used to extract temporal features between effective processing stations. The attention fusion decoding module uses virtual node features as the query matrix and temporal features as the key and value matrices for attention fusion to obtain fused features. The fused features are then decoded to obtain the product quality prediction results.
[0009] Optionally, the training process for the quality prediction model includes: Obtain historical sample sets; historical sample sets include several sets of processing feature datasets labeled with real quality parameters and corresponding product process flow knowledge.
[0010] The historical sample set is preprocessed, and the corresponding product process knowledge is transformed into a processing information set.
[0011] The preprocessed historical samples are input into the quality prediction model, and the loss value is calculated based on the output of the quality prediction model and the true quality parameters; the loss value is cross-entropy loss, focus loss or mean squared error loss.
[0012] Based on the loss value, the parameters of the quality feature map structure encoding module, spatiotemporal feature mining module, and attention fusion decoding module are updated using the backpropagation algorithm.
[0013] Repeat the above model training process until the model converges.
[0014] Optionally, the historical sample set is preprocessed, including at least one of the following: The historical sample set is subjected to sample balancing and resampling, and then divided into training set, validation set and test set.
[0015] Outlier detection and removal are performed on each input feature in the training set according to a preset threshold.
[0016] The missing values of each input feature in the training set are counted, and the missing values are filled by means or by prediction based on machine learning regression model according to the ratio of the number of missing values to the total number of products.
[0017] The data in the training set is standardized, and the parameters from the training set preprocessing are applied to the preprocessing of the validation and test sets.
[0018] Optionally, the quality feature map structure encoding module includes a processing embedding pool unit and a prior knowledge analysis unit.
[0019] The processing embedding pool unit is used to divide the processing feature dataset into corresponding feature subsets according to the processing site, and to encode each feature subset using the encoding unit corresponding to each processing site to obtain the site features of each processing site; wherein, each site feature has a unified feature dimension.
[0020] The prior knowledge analysis unit is used to: calculate the correlation between each processing station based on the processing process information set; determine the dependency relationship between each processing station based on the correlation and generate an adjacency matrix; generate a mask matrix based on the processing stations that each product passes through in the processing process information set; and construct a directed mask graph as graph structure data based on the characteristics of each station, the adjacency matrix, and the mask matrix, with each node of the graph structure data corresponding to a processing station.
[0021] Optionally, the encoding unit corresponding to each processing station is a feedforward neural network, a convolutional neural network, or a recurrent neural network. The processing embedding pool unit is represented as follows: in, The total number of processing stations, For the first One processing site, For processing sites The corresponding encoding unit, the encoding process is represented as follows: in, It belongs to the processing site All original features, These are the encoded site features.
[0022] Optionally, the virtual node graph attention network includes multiple GATv2 network layers, with one virtual node in each GATv2 network layer; the spatial interaction information of the graph structure data is extracted using the virtual node graph attention network to obtain the spatial features of each processing station and the features of the virtual nodes, specifically including the following steps: The graph structure data is input into the virtual node graph attention network, and the attention weights between each processing station are calculated through the multi-head attention mechanism in each layer of the GATv2 network.
[0023] Forward and backward processing information are extracted using a forward GATv2 network and a backward GATv2 network, respectively. The forward and backward processing information are then fused to obtain the spatial features of each processing station.
[0024] By aggregating the valid node information of each processing station through virtual nodes, the characteristics of the virtual nodes are obtained.
[0025] Optionally, the attention weights are as follows: in, , For a trainable weight matrix, and The first Layer nodes and nodes Features For nodes The set of neighboring nodes, where || represents the vector concatenation operation.
[0026] The characteristics of a virtual node are shown in the following formula: in, The characteristics of the virtual nodes in the l-th layer are... , For a valid set of nodes, for the product i , M is the mask matrix. For the first Layer nodes Features For a trainable weight matrix, This is the activation function.
[0027] Optionally, after filtering and sorting the spatial features in the temporal dimension based on the processing information set and the mask matrix, a causal masked temporal attention network is used to extract the temporal features between each effective processing station. This specifically includes the following steps: Based on the processing information set and mask matrix, the spatial features of valid stations are selected from the spatial features of each processing station, and then sorted in both forward and reverse order according to processing time, resulting in the sorted forward and reverse sequences of valid station features. During sorting, spatial features with the same processing time are averaged and merged.
[0028] The forward and reverse sequences of valid site features are filled to ensure that the lengths of the forward and reverse sequences of valid site features for all products are uniformly set to the preset length.
[0029] The positive and negative sequences of the padded effective site features are input into the causal mask temporal attention network. The positive and negative outputs of the last local window are merged to form the temporal features. The causal mask temporal attention network consists of multiple layers of non-overlapping local windows, with the window width of each layer increasing progressively. Multi-head self-attention mechanism computation between covered sites is performed within each local window. The attention computation in the multi-head self-attention mechanism is selectively expressed using a causal mask matrix.
[0030] Optionally, the multi-head self-attention mechanism within each local window of the causal masked temporal attention network is calculated as follows: in, For the site features covered by a partial window X, For local windows Length, For the number of attention heads, , , , , , The parameters are learnable; the causal mask matrix is a lower triangular matrix, with the elements in the upper triangular position having a value of negative infinity, and the elements in the lower triangular and diagonal positions having a value of 0. The attention is calculated by summing the causal mask matrix and the window attention matrix, and the attention calculation only focuses on the information of the sites before the current site.
[0031] Optionally, attention fusion is performed using virtual node features as the query matrix and time-series features as the key and value matrices to obtain fused features. The fused features are then decoded to obtain the product quality prediction result, specifically including the following steps: The virtual node features are mapped using the query weight matrix to form the query matrix. The time-series features are mapped using the key weight matrix and value weight matrix, respectively, to form the key matrix and value matrix. Attention is then calculated according to the following formula: in, The virtual node features output by the last layer of the virtual node graph attention network. As a time series feature, , , The weight matrix is a learnable matrix. This is a feature of fusion.
[0032] The fused features are input into the final processing module, and the corresponding output network is selected according to the prediction task type to obtain the product quality prediction result.
[0033] According to the specific embodiments provided in this application, the following technical effects are disclosed: This application provides a method for predicting the quality of complex products based on causal temporal graph attention networks. This method first acquires the process parameters and / or measurement parameters of the product at each processing station, as well as product process flow knowledge, and preprocesses and transforms this data to fully utilize easily collectable processing data and prior knowledge of the process flow in industrial production. Then, the processed data is input into a pre-trained quality prediction model. This model first constructs a standardized graph structure data based on processing information using a quality feature graph structure encoding module, thereby accurately representing the complex, multi-coupled, heterogeneous manufacturing process as a computable graph structure. This solves the problem of strong data heterogeneity and difficulty in unified modeling under multi-product, multi-form processing conditions. Based on this, spatiotemporal feature mining... The virtual node graph attention network in the module introduces a virtual node mechanism to perform parallel adaptive aggregation of the effective stations actually traversed by each product. This significantly improves computational efficiency while extracting complex spatial interaction information between stations. Then, the causal mask temporal attention network filters, sorts, and extracts multi-scale temporal dependencies between effective stations according to the processing time sequence, effectively ensuring the causality and order preservation of the temporal modeling, thereby overcoming the technical bottleneck of insufficient representation of process states. Finally, the attention fusion decoding module performs attention fusion using virtual node features as queries and temporal features as keys, enabling the model to focus on key spatiotemporal features strongly correlated with quality, achieving accurate decoding and prediction. This comprehensively improves the accuracy, robustness, and computational efficiency of product quality prediction in complex manufacturing scenarios. Attached Figure Description
[0034] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0035] Figure 1 This is a flowchart illustrating a complex product quality prediction method based on a causal temporal graph attention network, provided as an embodiment of this application.
[0036] Figure 2 This is a schematic diagram of the structure of a quality prediction model in a complex product quality prediction method based on a causal temporal graph attention network, provided as an embodiment of this application.
[0037] Figure 3 This is a schematic diagram of the structure of the quality feature graph structure encoding module in a complex product quality prediction method based on a causal temporal graph attention network, provided in an embodiment of this application.
[0038] Figure 4 This is a schematic diagram of the spatiotemporal feature mining module in a complex product quality prediction method based on a causal temporal graph attention network, provided in an embodiment of this application.
[0039] Figure 5 This is a schematic diagram of the structure of the attention fusion decoding module in a complex product quality prediction method based on a causal temporal graph attention network, provided in an embodiment of this application.
[0040] Figure 6 This is a flowchart illustrating the model training process in a complex product quality prediction method based on a causal temporal graph attention network, provided as an embodiment of this application. Detailed Implementation
[0041] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0042] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0043] This application provides a method for predicting complex product quality based on a causal temporal graph attention network. In one exemplary embodiment, such as... Figure 1 As shown, the method includes the following steps: A1. Obtain the processing feature dataset and product process flow knowledge of the product to be tested.
[0044] The machining feature dataset includes the process parameters and / or measurement parameters of the product under test at each machining station. As an example, machining features may include cutting speed, feed rate, tool speed, tool path, tool selection, machining path, workpiece coordinates, running time, part surface roughness, ambient temperature, humidity, lighting, dustfall, etc. The process parameters and measurement parameters corresponding to the machining features at each station are not entirely the same.
[0045] Product process flow knowledge includes the product attributes of the product under test and the processing methods of the product during production. As an example, the product attributes include product type and related properties; the specific processing methods include the processing stations the product passes through, the processing time and methods at each station (such as multi-station parallel processing, cross-step processing), etc.
[0046] A2. Preprocess the processing feature dataset and transform the product process flow knowledge into a processing process information set. In this embodiment, the preprocessing of the processing feature dataset includes at least one of the following: (1) Outlier handling: Based on the preset threshold, outlier values are detected and removed from each input feature in the processing feature dataset.
[0047] This addresses the issue of outlier data that may arise during data acquisition due to human error or measurement equipment malfunction. Therefore, a threshold benchmark is first established based on domain knowledge. For each input feature in the processing feature dataset, the input features are compared to the threshold benchmark, and outliers are filtered and removed, resulting in the outlier-processed processing feature dataset.
[0048] Specifically, the upper bound UB = 75th quantile + (75th quantile - 25th quantile) × 1.5 and the lower bound LB = 25th quantile - (75th quantile - 25th quantile) × 1.5 can be calculated for each feature. If a feature in a dataset is outside the bounds, it is judged as an outlier and deleted.
[0049] (2) Missing value processing: The missing values of each input feature in the processing feature dataset are statistically analyzed, and the missing values are filled by means or prediction based on machine learning regression model according to the ratio of the number of missing values to the total number of products.
[0050] For each input feature in the processing feature dataset after outlier processing, the corresponding missing values are counted, and then the following judgments are made: If the number of products with a certain feature that is missing is less than 30% of the total number of products, the missing feature in all products containing this missing feature is filled with the mean of this feature in other products; If the number of products with a missing feature is not less than 30% of the total number of products, for all products containing this missing feature, machine learning regression analysis or classification models such as ridge regression, decision tree, and support vector machine are constructed based on the key information in the processing process information set. Other features of the processing station where the missing input feature is located are used as input, and the predicted value is obtained after repeated training and optimization of the model before filling.
[0051] (3) Standardization: Standardize the data in the processing feature dataset. In this embodiment, standardization can be performed using methods such as Min-Max normalization.
[0052] Regarding the transformation of product process flow knowledge, as mentioned earlier, this knowledge records information closely related to product quality, such as the specific processing method for each product, processing time at different sites, product category, and relevant attributes of different product categories. This step aims to transform unstructured or semi-structured product process flow knowledge into a structured processing process information set that can be recognized and computed by computers.
[0053] First, the complete processing record of the product type is retrieved from the product process flow knowledge base, including product identification and category information, processing station information, processing time characteristics, and product attribute information. Second, based on the timestamps of the product passing through processing stations, the product processing process is sorted by time, with corresponding markings for branching, merging, and cross-step processing flows. After removing obvious data noise, a serialized model is created as a processing process information set. Finally, the product information in the processing process information set is matched with the products in the processing feature dataset using the product's unique ID.
[0054] A3. Input the preprocessed processing feature dataset and processing information set into the pre-trained quality prediction model to obtain the product quality prediction results.
[0055] like Figure 2 The model structure shown in this application includes a quality feature graph structure encoding module, a spatiotemporal feature mining module, and an attention fusion decoding module. The quality feature graph structure encoding module is used to construct graph structure data based on the preprocessed processing feature dataset and the processing information set.
[0056] In one exemplary embodiment, such as Figure 3 As shown, the quality feature map structure encoding module includes a Processing Embedding Pool Module (PEP) and a Prior Knowledge Analysis Unit (PKAU).
[0057] The processing embedding pool unit is used to divide the processing feature dataset into corresponding feature subsets according to processing stations, and encode each feature subset using the encoding unit corresponding to each processing station to obtain the station features of each processing station; where each station feature has a unified feature dimension. Specifically, this unit receives the processing process information set T to be input, divides the processing feature dataset X to be input into corresponding feature subsets according to processing stations, and then encodes each feature subset separately; using the processing process information set T as prior knowledge, the adjacency matrix A and the mask matrix M are obtained through analysis and processing. Then, these are combined with the features output by the processing embedding pool unit to construct a masked directed graph G = (V, E, A) as graph structure data. Here, V is the graph node set, each graph node corresponds to a processing station, and the total number of nodes is N; E represents the set of edges between nodes.
[0058] The processing embedding pool consists of a set of coding units corresponding to the number of processing stations, represented as: in, The total number of processing stations, For the first One processing site, For processing sites The corresponding coding unit, when encoding a batch of samples, refers to the samples belonging to the processing station within that batch. All raw features are input in parallel to the corresponding coding units. In Chinese, the encoding process is represented as: in, It belongs to the processing site All original features, For the encoded site features, . Indicates batch size, For processing sites The original feature dimension, This refers to the unified feature dimension after encoding.
[0059] Through the aforementioned encoding pool structure, process parameters from different sites are mapped to the same feature space, thereby supporting the construction of subsequent graph structure data and cross-site information transfer. Depending on the type of processing dataset, the encoding unit can employ a feedforward neural network (FNN), a convolutional neural network (CNN), a recurrent neural network (RNN), or other suitable network models.
[0060] The prior knowledge analysis unit treats each processing station as a node in the graph. By reading and analyzing product process knowledge and combining it with data from the processing information set, it calculates the correlation between variables and determines the connection status between nodes based on preset thresholds.
[0061] Specifically, if the correlation coefficient between two nodes is greater than a preset threshold, a connection is determined to exist between the two nodes; otherwise, no connection exists. This determines the dependencies between nodes, generating a highly interpretable adjacency matrix A and a mask matrix M. Finally, these matrices are combined with the output of the processing embedding pool unit to construct a consistent graph structure data, accurately representing the dependencies between processing stations in the manufacturing process of complex products.
[0062] The spatiotemporal feature mining module is used to extract spatial interaction information of graph structure data using a virtual node graph attention network, obtain spatial features and virtual node features of each processing station, and after filtering and sorting the spatial features in the time dimension according to the processing information set and mask matrix, the temporal features between each effective processing station are extracted using a causal mask temporal attention network.
[0063] like Figure 4 As shown, the spatiotemporal feature mining module consists of a Virtual Node Graph Attention Network (VNGAT) and a Causally-Masked Temporal Attention Network (CMTAT) connected sequentially.
[0064] The virtual node graph attention network consists of multiple GATv2 network layers, each containing a virtual node. The graph structure data output by the quality feature graph structure encoding module first passes through a graph network layer composed of multiple multi-head GATv2 layers to extract complex workstation interaction relationships. Each layer has a virtual node used to aggregate valid node information. Subsequently, the output of the graph network layer is concatenated to the input of the causal mask temporal attention network to further capture the temporal dependencies of sequential data.
[0065] Specifically, the attention weights of the GATv2 network in the virtual node graph attention network are calculated as follows: in, , For a trainable weight matrix, and The first Layer nodes and nodes Features For nodes The set of neighboring nodes is denoted by ||, where || represents the vector concatenation operation. By modifying the order of operations on the activation function and weight matrix, the model can better handle complex problems requiring dynamic node selection.
[0066] use Representing the Multi-head GATv2 network of layers, in which , It is the identity matrix. This is the adjacency matrix. To account for information from both processing directions, a reverse GATv2 network is also constructed. At this point, considering the forward and backward processing information, the graph network layer calculation is as follows: in, This represents the output of the l-th layer graph network. is a trainable weight matrix.
[0067] To aggregate the feature information of each product's effective processing sites and facilitate subsequent spatiotemporal information fusion calculations, this invention adds a virtual node v to each layer of the GATv2 network. The information acquisition mechanism of the virtual node is as follows: in, The characteristics of the virtual nodes in the l-th layer are... , For a valid set of nodes, for the product i , M is the mask matrix. For the first Layer nodes Features For a trainable weight matrix, The activation function is denoted by M. By utilizing the mask matrix M and combining it with an attention mechanism, virtual nodes can adaptively identify key sites affecting product quality and integrate information based on the differentiated processing flows of different products. This enables parallel processing while effectively adapting to product quality prediction tasks in complex manufacturing processes.
[0068] Causal masked temporal attention networks are used to receive the output of virtual node graph attention networks. ,in, The total number of stations, Output for virtual nodes. First, based on the processing information set... With products mask matrix The valid site outputs are filtered and sorted in both forward and reverse order according to processing time. The forward sorting process is shown in the following formula: in, For products The number of valid stations passed through is ,like but If parallel processing exists, that is Then only one of them will be kept. The values are then averaged and merged, and the site output is filled according to the following formula: in, To maximize the number of valid sites for all products, a population operation was performed to unify all product feature dimensions to the maximum value. .
[0069] The padded forward and reverse sequence features are then input into a causal mask temporal attention network, which consists of multiple layers of non-overlapping local windows. As the number of layers increases, the window width increases proportionally. In each window, a multi-head self-attention mechanism is calculated between the covered sites, as shown in the following equation: in, For the site features covered by a partial window X, For local windows Length, For the number of attention heads, , , , , , These are learnable parameters. To ensure the causality of the time series, a mask matrix is needed to selectively represent the window attention matrix A during attention calculation. The causal mask matrix is a lower triangular matrix, where the elements in the upper triangular positions are negative infinity, and the elements in the lower triangular and diagonal positions are 0. Assuming the length of the local window X is 3, the causal mask matrix is as follows: Attention is calculated using the following formula: in, The vector dimension represents the query and key. By stacking multiple local windows of different lengths, the causal mask temporal attention network can extract multi-scale temporal interaction information between sites, achieving effective modeling of multi-scale temporal dependencies in the production process.
[0070] The attention fusion decoding module is used to perform attention fusion with virtual node features as the query matrix and time series features as the key and value matrices to obtain fused features. The fused features are then decoded to obtain the product quality prediction results.
[0071] like Figure 5 As shown, the attention fusion decoding module uses the output of the virtual nodes in the last layer of the graph attention network. As the query matrix, it is the combined forward and reverse output of the last layer of the causal mask temporal attention network. The product feature data, presented as a key and value matrix, is shown below: in, The virtual node features output by the last layer of the virtual node graph attention network. As a time series feature, , , The weight matrix is a learnable matrix. To integrate features, we can fully consider the local interaction information and global dependencies of the product, and enhance the key quality information contained in the feature data.
[0072] Finally, the fused features are input into the final processing module, which selects the appropriate output network based on the prediction task type to obtain the product quality prediction result. The final processing module selects a suitable network to obtain the final output y based on the different quality prediction tasks. If the prediction task is a classification problem with a balanced number of positive and negative samples, the cross-entropy loss function is selected; if there is an imbalance in the number of positive and negative samples, the focus loss function is selected; if it is a regression problem, the mean squared error loss function is selected. y is input into the loss function, the error is calculated, and backpropagation is performed.
[0073] In this embodiment, as Figure 6 The flowchart shown illustrates how the quality prediction model is pre-trained: B1. Obtain historical sample sets; historical sample sets include several sets of processing feature datasets labeled with real quality parameters and corresponding product process flow knowledge.
[0074] B2. Preprocess the historical sample set and transform the corresponding product process knowledge into a processing information set.
[0075] B3. Input the preprocessed historical samples into the quality prediction model, and calculate the loss value based on the output of the quality prediction model and the true quality parameters; the loss value is cross-entropy loss, focus loss or mean squared error loss.
[0076] B4. Update the parameters of the quality feature map structure encoding module, spatiotemporal feature mining module, and attention fusion decoding module based on the loss value using the backpropagation algorithm.
[0077] Repeat the above model training process until the model converges.
[0078] During the training of the model, the historical sample set is preprocessed, specifically including: Imbalanced Dataset Random Resampling and Sample Set Partitioning: In the product manufacturing and assembly process, the number of defective products is often far less than the number of qualified products, exhibiting a highly imbalanced dataset. This also results in a highly imbalanced number of products across different processing methods. A process flow product-balanced random resampling algorithm is used to process the historical sample set. Then, a random sampling method is used to divide the historical sample set after sample-balanced resampling into a training set, a validation set, and a test set. The partitioning ratio depends on the dataset and task requirements. Next, the training set undergoes outlier removal, missing value imputation, and standardization as described in step A2. Finally, the parameters from the training set preprocessing are applied to the preprocessing of the validation and test sets.
[0079] During model training, the Adam optimizer is used for parameter learning, and L2 regularization is used to avoid overfitting. The validation set is used for early stopping and hyperparameter tuning. In the prediction process, a threshold is set to predict whether the final product quality is up to standard; this threshold is determined by the largest MCC (Matthews Correlation Coefficient) on the validation set.
[0080] The following uses the Bosch assembly line dataset as an example to illustrate the specific implementation process of the method provided in this application. The Bosch assembly line dataset is a publicly available dataset updated by Robert Bosch GmbH in a Kaggle competition in 2016. This dataset contains 4 production lines, 52 processing stations, and a total of 968 numerical features as initial input feature data. In this dataset, the stations traversed by each product have complex relationships and different temporal sequences, and there is parallel processing, meaning that a product may be processed simultaneously by multiple stations at a given time. In the original processing feature data, the initial input feature data for each product consists of continuous numerical features, discrete categorical features, and features representing the time points of the processing steps. Some product data is shown in Table 1: Table 1. Data set of processing characteristics for some products on the Bosch assembly line.
[0081] In Table 1, the first column represents the part number, and "Lx_Sx_Fx" represents the feature number of the part. For example, "L3_S29_F3315" means that the feature with feature number 3315 is located at step 29 of the 3rd production line. Response is a user-defined quality parameter that can characterize the quality of the product. If the value of Response is 1, it means that the product has not passed the quality inspection. If the value of Response is 0, it means that the product has passed the quality inspection.
[0082] In addition, the Bosch assembly line dataset also provides product process flow knowledge, with some product information shown in Table 2: Table 2. Process Flow Knowledge Set for Some Products on the Bosch Assembly Line
[0083] Each station record contains the time code of a different product passing through that station. If the value is empty, it means that the product has not been processed through this station.
[0084] In this dataset, the stations each product passes through have complex relationships and different temporal sequences. Parallel processing exists, meaning a product may be processed by multiple stations at a given time. The initial input feature data for each product in the original processing feature data consists of continuous numerical features, discrete categorical features, and features based on the time points of each processing step. After obtaining this dataset, the following preprocessing steps are performed sequentially: constructing the processing information set, balanced random resampling, dataset partitioning, outlier handling, missing value handling, and dataset standardization.
[0085] Construction of the processing information set: First, the timecode data of each product passing through the stations in the Bosch assembly line process knowledge set is read, and a processing station list is created for each product. If a product has a timecode at a certain station, that station is added to the processing station list for that product. Based on the size of the timecode data, the stations in each product's processing station list are sorted. If a product has multiple stations with the same timecode, the corresponding stations are organized into a parallel station list and then stored in the product's processing station list. Finally, the processing station lists are organized into a processing information set T. The product information in the processing information set is matched with the products in the processing feature dataset using the product's unique ID. Some product processing information sets are shown in Table 3. Table 3. Information Set of Processing Procedures for Selected Products on the Bosch Assembly Line
[0086] In Table 3, in the "Specific Processing Information" column, each number represents a workstation number, and the sequence from left to right indicates the processing order. Numbers within the same brackets indicate parallel processing workstations.
[0087] Sample Balanced Resampling Processing: The proportion of samples with a Response value of 0 and samples with a Response value of 1 in this dataset is unbalanced. The multi-label random resampling algorithm is used to perform balanced random resampling processing on the positive and negative samples of the dataset.
[0088] Dataset partitioning: Cross-validation was used to evaluate the performance of the current quality prediction model on unknown data under a certain hyperparameter or complexity. The ratio of the training set to the validation set was selected to be 7:3. Subsequently, the feature data in the training set was standardized, and the standardized parameters on the training set were used to standardize the validation set and the test set.
[0089] Outlier handling: Calculate the upper bound UB = 75th percentile + (75th percentile - 25th percentile) × 1.5 and the lower bound LB = 25th percentile - (75th percentile - 25th percentile) × 1.5 for each feature in the training set. If a feature in a dataset is outside the bounds, it is judged as an outlier and removed.
[0090] Missing value handling: According to statistics, the number of products with missing features in the training set is less than 30% of the total number of products. Therefore, for all products with missing features, the mean of the feature in all products is used to fill in the missing features.
[0091] Standardization: The feature data in the training set is standardized. The preprocessing parameters obtained during the training set preprocessing are then applied to the preprocessing of the validation and test sets.
[0092] After preprocessing, a quality prediction model is constructed. In this example, the Bosch assembly line dataset has 52 processing stations. Therefore, 52 processing station embedding units are constructed in the quality feature map structure encoding module. Based on the processing information set, the Bosch assembly line processing feature dataset is divided into corresponding feature subsets, and each processing station embedding unit encodes the corresponding feature subset. The prior knowledge analysis unit generates a corresponding adjacency matrix and mask matrix for each product based on the processing information set of different products passing through the stations. The adjacency matrix A represents the processing method of different products, and the mask matrix M transforms the input feature data corresponding to stations that the product has not passed through into an all-zero vector.
[0093] A spatiotemporal feature mining module was established based on the processed Bosch assembly line dataset. This module uses a 3-layer virtual node graph attention network with a total of 52 station graph nodes and 1 virtual node. Each graph node corresponds to the encoded features of its respective station. The virtual node is initially set to an all-zero vector. Valid nodes in both the forward and backward networks—i.e., the stations the product actually traverses—point to the virtual node. All products share the bidirectional graph attention network parameters. The output of the quality feature graph structure encoding module is then used. e Input the site number into the corresponding graph node, and then use the adjacency matrix. A Multi-head attention mechanism computation is performed, and finally the feature output is obtained by aggregation. ,in, Output for virtual nodes. The causal masked temporal attention network is set to 4 layers, with a window size of [3, 6, 12, 24] for each layer, utilizing the process information set. T and mask matrix M After extracting the output of all valid product nodes, the product features are sorted according to processing time sequence and padded with time sequence length up to 24, consistent with the window length of the last layer of the causal mask temporal attention network. Finally, the padded features are input into the network to obtain the output that integrates multi-scale temporal interaction information between various sites. .
[0094] Subsequently, an attention fusion decoding module is constructed, in which the attention network outputs virtual nodes from the last layer of the virtual node graph attention network. The final output of the causal mask temporal attention network is the query matrix. As the key matrix and value matrix, the fused features are obtained through attention fusion. This is used as input to the final processing prediction module to obtain the category features that determine whether the final product quality is qualified. .
[0095] Next, model training is performed. Since the prediction objective of this dataset is a classification problem, a multi-layer feedforward neural network is constructed in the final processing module, and the sigmoid function is chosen as the activation function for the last layer of the final processing module, with the focus loss function used as the loss function. Bosch assembly line product data, along with pre-labeled quality tags, are input into the quality prediction model for optimal parameter optimization training. The Adam optimizer is used for parameter learning, and L2 regularization is used to avoid overfitting. Backpropagation is used to update the model parameters of the quality feature map structure encoding module, the spatiotemporal feature mining module, and the attention fusion decoding module.
[0096] Finally, new sample quality prediction is performed. The test set is input into the trained and optimized model to obtain the quality detection results. The classification threshold is set to 0.50, meaning that when the model output is greater than or equal to 0.50, the product's quality detection result is determined to be unqualified, i.e., the output is 1; otherwise, the product's quality detection result is determined to be qualified, i.e., the output is 0.
[0097] To verify the effectiveness of the method in this application, seven comparative algorithms were selected for experiments: MLP, A-Bi-SP-LSTM, HAGCN, PDA-LSTM, KRHGraph, FC-STGNN, and TVCFormer. MLP is a classic feedforward artificial neural network model, consisting of an input layer, one or more hidden layers, and an output layer. A-Bi-SP-LSTM dynamically handles the information transmission problem along the time dimension of parallel processes according to different product processing modes through an interaction module, and uses an adversarial focus function as the loss function. HAGCN uses a hierarchical graph representation layer to model the spatial dependence of sensors and uses a bidirectional long short-term memory network to capture the temporal dependence of sensor measurements. PDA-LSTM constructs a two-layer long short-term memory network module to evaluate the importance of different input variables and different time steps. KRHGraph aggregates the graph structure features of each product through a multi-layer graph convolutional network and a graph attention network, and then uses a long short-term memory network module for quality prediction. FC-STGNN designs a decay graph that connects sensors with different timestamps according to the temporal distance of the sensors, enabling the model to fully capture the spatiotemporal dependence of the data. TVCFormer treats local window-level subsequences as nodes and explicitly simulates the dependencies between local variables. Its structure is dynamic and adaptively generated, which can effectively represent valuable interval local correlation patterns for specific tasks, while eliminating irrelevant patterns.
[0098] This application selected three widely used evaluation metrics (mean ± standard deviation) in quality prediction: AUC, F1 score, and MCC. Models corresponding to all methods were run on the same test set and hardware environment. Experimental results show that the proposed method achieves 87.53% ± 0.28% on the AUC metric, 75.20% ± 0.57% on the F1 score metric, and 58.71% ± 0.87% on the MCC metric, all outperforming all compared methods and demonstrating superior overall performance. Specific comparison results are shown in Table 4. Table 4 shows the performance of different classification task methods on the Bosch dataset test set.
[0099] The above embodiments demonstrate that the product quality prediction method based on causal temporal graph attention network proposed in this application encodes the features of each processing station into graph structure data of a unified dimension through a quality feature graph structure encoding module, extracts spatial and temporal interaction information through a spatiotemporal feature mining module, and fuses and decodes the information through an attention fusion decoding module. This method can comprehensively and accurately consider the spatiotemporal interaction information in multi-coupled complex process data, exhibits excellent prediction performance and robustness in complex manufacturing scenarios, and can be effectively applied to product quality prediction tasks in actual industrial production.
[0100] Based on the same inventive concept, this application also provides an apparatus for implementing the complex product quality prediction method based on causal temporal graph attention networks described above. The solution provided by this apparatus is similar to the implementation described in the above method, and will not be repeated here.
[0101] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0102] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0103] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0104] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with relevant regulations and be authorized by the owner of the corresponding device.
[0105] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
[0106] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0107] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0108] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for predicting the quality of complex products based on causal temporal graph attention networks, characterized in that, include: Acquire the processing feature dataset and product process flow knowledge of the product under test; the processing feature dataset includes the process parameters and / or measurement parameters of the product under test at each processing station; the product process flow knowledge includes the product attributes of the product under test and the processing form information of the product under test in the production and processing process; The processing feature dataset is preprocessed, and the product process knowledge is transformed into a processing process information set; The preprocessed processing feature dataset and the processing information set are input into a pre-trained quality prediction model to obtain product quality prediction results. The quality prediction model includes a quality feature graph structure encoding module, a spatiotemporal feature mining module, and an attention fusion decoding module. The quality feature graph structure encoding module is used to construct graph structure data based on the preprocessed processing feature dataset and the processing information set. The spatiotemporal feature mining module is used to extract spatial interaction information of the graph structure data using a virtual node graph attention network to obtain spatial features and virtual node features of each processing station. After filtering and sorting the spatial features in terms of time dimension based on the processing information set and the mask matrix, the temporal features between each effective processing station are extracted using a causal mask temporal attention network. The attention fusion decoding module is used to perform attention fusion with the virtual node features as the query matrix and the temporal features as the key matrix and value matrix to obtain fused features. The fused features are then decoded to obtain product quality prediction results.
2. The complex product quality prediction method based on causal temporal graph attention network according to claim 1, characterized in that, The training process of the quality prediction model includes: Obtain historical sample sets; the historical sample sets include several sets of processing feature datasets labeled with real quality parameters and corresponding product process flow knowledge; The historical sample set is preprocessed, and the corresponding product process knowledge is transformed into a processing information set. The preprocessed historical samples are input into the quality prediction model, and the loss value is calculated based on the output of the quality prediction model and the true quality parameters; the loss value is cross-entropy loss, focus loss, or mean squared error loss. The parameters of the quality feature map structure encoding module, the spatiotemporal feature mining module, and the attention fusion decoding module are updated using the backpropagation algorithm based on the loss value. Repeat the above model training process until the model converges.
3. The complex product quality prediction method based on causal temporal graph attention network according to claim 2, characterized in that, The historical sample set is preprocessed, including at least one of the following: The historical sample set is subjected to sample balancing and resampling, and then divided into training set, validation set and test set; Outlier detection and removal are performed on each input feature in the training set according to a preset threshold. The missing values of each input feature in the training set are counted, and the missing values are filled by means or prediction based on machine learning regression model according to the ratio of the number of missing values to the total number of products. The data in the training set is standardized, and the parameters from the training set preprocessing are applied to the preprocessing of the validation and test sets.
4. The complex product quality prediction method based on causal temporal graph attention network according to claim 1, characterized in that, The quality feature map structure encoding module includes a processing embedding pool unit and a prior knowledge analysis unit; The processing embedding pool unit is used to divide the processing feature dataset into corresponding feature subsets according to the processing stations, and to encode each feature subset using the encoding unit corresponding to each processing station to obtain the station features of each processing station; wherein, each station feature has a unified feature dimension. The prior knowledge analysis unit is used to: calculate the correlation between each processing station based on the processing process information set; determine the dependency relationship between each processing station based on the correlation and generate an adjacency matrix; generate a mask matrix based on the processing stations passed through by each product in the processing process information set; and construct a masked directed graph as the graph structure data based on the characteristics of each station, the adjacency matrix, and the mask matrix, wherein the nodes of the graph structure data correspond one-to-one with the processing stations.
5. The complex product quality prediction method based on causal temporal graph attention network according to claim 4, characterized in that, The encoding unit corresponding to each processing station is a feedforward neural network, a convolutional neural network, or a recurrent neural network; the processing embedding pool unit is represented as: in, The total number of processing stations, For the first One processing site, For processing sites The corresponding encoding unit, the encoding process is represented as follows: in, It belongs to the processing site All original features, These are the encoded site features.
6. The method for predicting complex product quality based on causal temporal graph attention networks according to claim 1, characterized in that, The virtual node graph attention network comprises multiple GATv2 network layers, with one virtual node in each GATv2 network layer. The virtual node graph attention network is used to extract spatial interaction information from the graph structure data, obtaining spatial features of each processing station and virtual node features, specifically including: The graph structure data is input into the virtual node graph attention network, and the attention weights between each processing station are calculated through the multi-head attention mechanism in each layer of the GATv2 network. Forward and backward processing information are extracted using forward and backward GATv2 networks respectively, and the forward and backward processing information are fused to obtain the spatial features of each processing station. The virtual node features are obtained by aggregating the valid node information of each processing station through the virtual node.
7. The method for predicting complex product quality based on causal temporal graph attention networks according to claim 6, characterized in that, The attention weights are shown in the following formula: in, , For a trainable weight matrix, and The first Layer nodes and nodes Features For nodes The set of neighboring nodes, where || represents the vector concatenation operation; The characteristics of the virtual node are shown in the following formula: in, The characteristics of the virtual nodes in the l-th layer are... , For a valid set of nodes, for the product i , M is the mask matrix. For the first Layer nodes Features For a trainable weight matrix, This is the activation function.
8. The method for predicting complex product quality based on causal temporal graph attention networks according to claim 6, characterized in that, After filtering and sorting the spatial features according to the time dimension based on the processing information set and the mask matrix, a causal masked temporal attention network is used to extract the temporal features between each effective processing station, specifically including: Based on the processing information set and the mask matrix, the spatial features of valid stations are selected from the spatial features of each processing station, and sorted in both forward and reverse order according to the processing time to obtain the sorted forward and reverse sequences of valid station features; during sorting, if there are spatial features with the same processing time, the average value is taken and they are merged. The forward and reverse sequences of the valid site features are padded to make the lengths of the forward and reverse sequences of the valid site features of all products uniform to a preset length; The positive and negative sequences of the filled effective site features are input into the causal mask temporal attention network. The positive and negative outputs of the last local window are merged and used as the temporal features. The causal mask temporal attention network consists of multiple layers of non-overlapping local windows. The window width of each local window increases progressively. Multi-head self-attention mechanism calculation between covered sites is performed within each local window. The attention calculation in the multi-head self-attention mechanism is selectively expressed using a causal mask matrix.
9. The method for predicting complex product quality based on causal temporal graph attention networks according to claim 1, characterized in that, The multi-head self-attention mechanism within each local window of the causal masked temporal attention network is calculated as follows: in, For the site features covered by a partial window X, For local windows Length, For the number of attention heads, , , , , , The parameters are learnable; the causal mask matrix is a lower triangular matrix, in which the elements at the upper triangular positions are negative infinity, and the elements at the lower triangular and diagonal positions are 0. The causal mask matrix is summed with the window attention matrix, and the attention calculation only focuses on the information of the sites before the current site.
10. The method for predicting complex product quality based on causal temporal graph attention networks according to claim 1, characterized in that, Using the virtual node features as the query matrix and the time-series features as the key and value matrices, attention fusion is performed to obtain fused features. These fused features are then decoded to obtain the product quality prediction result, specifically including: The virtual node features are mapped using the query weight matrix to form the query matrix. The time-series features are mapped using the key weight matrix and value weight matrix, respectively, to form the key matrix and value matrix. Attention is then calculated according to the following formula: in, The virtual node features output by the last layer of the virtual node graph attention network. For the aforementioned time-series features, , , The weight matrix is a learnable matrix. The fusion feature; The fused features are input into the final processing module, and the corresponding output network is selected according to the prediction task type to obtain the product quality prediction result.
