PCB drilling machine process state recognition method based on self-attention mutual information feature extraction
Through the self-attention mutual information feature extraction method, the process status of the PCB drilling machine is automatically identified, which solves the problem of low efficiency of manual judgment in the existing technology and realizes the intelligence and efficiency of PCB drilling machine production detection.
Patent Information
- Application Number
- CN202311101440.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-29
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2043-08-29
AI Technical Summary
In the existing technology, the process status identification of PCB drilling machines relies on manual judgment, resulting in low production inspection efficiency and inability to effectively utilize the structured data provided by its own data interface.
A method based on self-attention mutual information feature extraction is adopted to extract feature fields from the structured data of PCB drilling rigs. The process status is automatically identified through self-attention encoding and classifier. The self-attention encoder and classifier are used to perform feature dimensionality increase and decrease to achieve automatic identification of process status.
It improves the automation level of PCB drilling rig production inspection, realizes intelligent identification and classification of process status, and improves the efficiency and accuracy of production inspection.
Smart Images

Figure CN117218584B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of PCB manufacturing, and in particular to a PCB drilling rig process state recognition method based on self-attention mutual information feature extraction. Background Art
[0002] In a highly automated production model, industrial production relies on mechanical processing equipment to save manpower and improve production efficiency. The drilling process is a crucial link in PCB manufacturing in the integrated circuit industry, requiring large PCB drilling machines to run for several hours to complete.
[0003] During operation, PCB drilling rigs experience various process states, such as running and shutting down. These states play a crucial role in production line control and optimization. However, the PCB drilling rig's built-in data interface only captures structured data such as timestamps, status codes, and error codes. This data cannot directly reflect the process status, requiring manual judgment by experienced personnel. This results in relatively low production inspection efficiency for PCB drilling rigs. Summary of the Invention
[0004] The present invention aims to address at least one of the technical problems existing in the prior art. To this end, the present invention proposes a PCB drilling rig process status recognition method based on self-attention mutual information feature extraction. This method can automatically identify process status based on the structured data of the PCB drilling rig, improve data processing efficiency, and enhance the production and inspection efficiency of the PCB drilling rig.
[0005] In a first aspect, an embodiment of the present invention provides a method for identifying a PCB drilling rig process state based on self-attention mutual information feature extraction, comprising:
[0006] Acquire current structured data from a data interface of the PCB drill rig, and based on a plurality of preset characteristic attributes, acquire a characteristic field corresponding to each of the characteristic attributes from the current structured data, wherein each of the characteristic attributes indicates a different parameter type of the PCB drill rig;
[0007] Based on the preset coding dimensions corresponding to each of the characteristic attributes, the corresponding characteristic fields are dimensionalized to obtain corresponding multi-dimensional coding features;
[0008] Combining all of the multidimensional coding features into an input feature sequence, and inputting the input feature sequence into a pre-trained target recognition model, wherein the sequence elements of the input feature sequence are the coding values of each dimension of the multidimensional coding features, and the target recognition model includes an encoder and a classifier;
[0009] Converting each of the encoding values of the input feature sequence into a self-attention encoding by the encoder to obtain a self-attention feature sequence consisting of a plurality of the self-attention codes, wherein the self-attention feature is used to indicate the correlation between the corresponding encoding value and other encoding values of the input feature sequence;
[0010] The self-attention feature sequence is dimensionality reduced to obtain a low-dimensional feature sequence, the low-dimensional feature sequence is input into the classifier for classification and recognition, and the result of the classification and recognition is determined as the process state recognition result, wherein the mutual information between the reconstructed feature sequence of the low-dimensional feature sequence and the input feature sequence meets a preset distance threshold, and the reconstructed feature sequence has the same number of elements as the input feature sequence.
[0011] According to some embodiments of the present invention, the step of performing dimension-up encoding on the corresponding feature field based on the preset encoding dimension corresponding to each feature attribute to obtain the corresponding multi-dimensional encoding feature includes:
[0012] When the feature field is a discrete string field, performing one-hot encoding on the feature field according to the preset encoding dimension to obtain the corresponding multi-dimensional encoding feature;
[0013] Alternatively, when the feature field is a continuous integer field, the feature field is bucket-encoded according to the preset encoding dimension to obtain the corresponding multi-dimensional encoding feature.
[0014] According to some embodiments of the present invention, converting each of the encoded values of the input feature sequence into a self-attention encoding by the encoder includes:
[0015] determining a query vector, a key vector, and a value vector for the encoded value;
[0016] determining an attention score for the encoded value based on the query vector and the key vector;
[0017] determining an attention weight for the encoded value based on the attention score;
[0018] The attention weight and the value vector are weightedly summed to obtain the self-attention code.
[0019] According to some embodiments of the present invention, the step of training the target recognition model includes:
[0020] Obtaining a sample data set, wherein the sample data set is derived from historical structured data of the PCB drilling rig, the sample data set including a plurality of pre-labeled sample input features and corresponding sample labels, the dimensions of the sample input features being the same as the multi-dimensional coding features, and the sample labels being determined according to a preset process state;
[0021] After one-hot encoding the sample labels, the sample dataset is divided into a training set and a test set;
[0022] Acquire and initialize an initial recognition model, wherein the initial recognition model includes the encoder, the decoder, and the classifier;
[0023] Inputting the training set into the initial recognition model for training, and calculating the model loss function during the training process;
[0024] When the model loss function converges and the initial recognition model passes the test on the test set, the decoder is deleted from the initial recognition model to obtain the target recognition model.
[0025] According to some embodiments of the present invention, inputting the training set into the initial recognition model for training, and calculating the model loss function during the training process, includes:
[0026] Inputting the sample input features into the encoder to obtain low-dimensional sample features, and inputting the low-dimensional sample features into the decoder for dimensionality increase reconstruction to obtain reconstructed sample features;
[0027] Determining feature mutual information between the sample input feature and the reconstructed sample feature, and when the feature mutual information reaches a maximum value, inputting the sample input feature into the classifier to obtain a training recognition result;
[0028] The reconstructed sample features and the training recognition results are input into the model loss function for calculation.
[0029] According to some embodiments of the present invention, determining the feature mutual information between the sample input feature and the reconstructed sample feature includes:
[0030] Determining the feature entropy and KL divergence of the sample input feature;
[0031] Convert the KL divergence into the JS divergence of the sample input feature;
[0032] The difference between the feature entropy and the JS divergence is determined as the feature mutual information.
[0033] According to some embodiments of the present invention, after determining the difference between the feature entropy and the JS divergence as the feature mutual information, the method further includes:
[0034] Determining a JS divergence term according to the JS divergence of all the sample input features;
[0035] The model loss function is determined according to the sum of the JS divergence term and the preset cross entropy loss.
[0036] In a second aspect, an embodiment of the present invention provides a PCB drilling rig process status identification device based on self-attention mutual information feature extraction, comprising at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the PCB drilling rig process status identification method based on self-attention mutual information feature extraction as described in the first aspect above.
[0037] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a PCB drilling rig process status recognition device based on self-attention mutual information feature extraction as described in the second aspect above.
[0038] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the PCB drilling machine process state recognition method based on self-attention mutual information feature extraction as described in the first aspect above.
[0039] According to the PCB drilling machine process state recognition method based on self-attention mutual information feature extraction according to the embodiment of the present invention, there are at least the following beneficial effects: obtaining current structured data from the PCB drilling machine's own data interface, and obtaining feature fields corresponding to each feature attribute from the current structured data based on multiple preset feature attributes, wherein the parameter types of the PCB drilling machine indicated by each feature attribute are different; based on the preset coding dimensions corresponding to each feature attribute, performing dimension-up coding on the corresponding feature field to obtain corresponding multidimensional coding features; combining all the multidimensional coding features into an input feature sequence, and inputting the input feature sequence into a pre-trained target recognition model, wherein the sequence element of the input feature sequence is each element of the multidimensional coding feature. The target recognition model includes an encoder and a classifier; each encoding value of the input feature sequence is converted into a self-attention encoding by the encoder to obtain a self-attention feature sequence composed of multiple self-attention encodings, wherein the self-attention feature is used to indicate the correlation between the corresponding encoding value and other encoding values of the input feature sequence; the self-attention feature sequence is reduced in dimension to obtain a low-dimensional feature sequence, the low-dimensional feature sequence is input into the classifier for classification and recognition, and the result of the classification and recognition is determined as the process state recognition result, wherein the mutual information between the reconstructed feature sequence of the low-dimensional feature sequence and the input feature sequence meets the preset distance threshold, and the number of elements of the reconstructed feature sequence is the same as that of the input feature sequence. According to the technical solution of the embodiment of the present invention, the feature fields extracted from the structured data can be subjected to feature dimensionality increase, and then feature dimensionality reduction can be performed through the self-attention mutual information network, and the correlation between the feature fields can be used to classify and identify the process state of the PCB drilling machine, thereby realizing automatic recognition of the PCB process state. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 This is a flow chart of a method for identifying PCB drilling machine process status based on self-attention mutual information feature extraction provided by one embodiment of the present invention;
[0041] Figure 2 is a flowchart of encoding a feature field provided by another embodiment of the present invention;
[0042] Figure 3 is a flow chart of lake area self-attention encoding provided by another embodiment of the present invention;
[0043] Figure 4 is a flowchart of a training model provided by another embodiment of the present invention;
[0044] Figure 5 is a structural diagram of an initial recognition model provided by another embodiment of the present invention;
[0045] Figure 6 is a flowchart of loss calculation provided by another embodiment of the present invention;
[0046] Figure 7 is a flow chart of determining feature mutual information provided by another embodiment of the present invention;
[0047] Figure 8 is a flowchart of determining a loss function provided by another embodiment of the present invention;
[0048] Figure 9 This is a structural diagram of a PCB drilling machine process status recognition device based on self-attention mutual information feature extraction provided by another embodiment of the present invention. DETAILED DESCRIPTION
[0049] The following describes embodiments of the present invention in detail. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended only to explain the present invention and are not to be construed as limiting the present invention.
[0050] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, they cannot be understood as limitations on the present invention.
[0051] In the description of the present invention, "several" means one or more, "many" means more than two, "greater than," "less than," and "exceed" are understood to exclude the number itself, while "above," "below," and "within" are understood to include the number itself. The use of "first" and "second" in the description is solely for the purpose of distinguishing technical features and should not be construed as indicating or implying relative importance, implicitly specifying the number of the indicated technical features, or implicitly specifying the order of the indicated technical features.
[0052] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, and connecting should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.
[0053] An embodiment of the present invention provides a PCB drilling rig process state recognition method based on self-attention mutual information feature extraction, wherein the PCB drilling rig process state recognition method based on self-attention mutual information feature extraction includes: obtaining current structured data from the PCB drilling rig's own data interface, and based on multiple preset feature attributes, obtaining feature fields corresponding to each feature attribute from the current structured data, wherein each feature attribute indicates a different parameter type of the PCB drilling rig; based on the preset coding dimension corresponding to each feature attribute, performing dimension-up encoding on the corresponding feature field to obtain a corresponding multi-dimensional coding feature; combining all the multi-dimensional coding features into an input feature sequence, and inputting the input feature sequence into a pre-trained target recognition model, wherein the sequence element of the input feature sequence The element is the encoding value of each dimension of the multidimensional encoding feature, and the target recognition model includes an encoder and a classifier; each encoding value of the input feature sequence is converted into a self-attention encoding by the encoder to obtain a self-attention feature sequence composed of multiple self-attention encodings, wherein the self-attention feature is used to indicate the correlation between the corresponding encoding value and other encoding values of the input feature sequence; the self-attention feature sequence is reduced in dimension to obtain a low-dimensional feature sequence, and the low-dimensional feature sequence is input into the classifier for classification and recognition, and the result of the classification and recognition is determined as the process state recognition result, wherein the mutual information between the reconstructed feature sequence of the low-dimensional feature sequence and the input feature sequence meets the preset distance threshold, and the number of elements of the reconstructed feature sequence is the same as that of the input feature sequence. According to the technical solution of the embodiment of the present invention, after the feature fields extracted from the structured data are subjected to feature dimensionality increase, feature dimensionality reduction is performed through the self-attention mutual information network, and the correlation between the feature fields is used to classify and identify the process state of the PCB drilling machine, thereby realizing automatic recognition of the PCB process state.
[0054] The following is an explanation of some of the terms in this application:
[0055] Feature embedding is a machine learning technique that converts features in input data into low-dimensional vector representations. These vectors, often referred to as "embeddings," capture the key characteristics of the input data and can be used for various machine learning tasks, such as classification, clustering, recommendations, and speech recognition. In deep learning, embedding layers are often used for feature embedding. They map high-dimensional feature vectors into a low-dimensional space while preserving key feature information. Embedded vectors typically have a more compact representation than the original feature vectors, thus reducing the number of parameters in the model and improving the model's generalization ability.
[0056] Unsupervised feature engineering is a method for automatically discovering features from data. It does not require manually annotated labels or target variables, but instead discovers useful features based on the inherent structure or patterns of the data. The process includes the following steps: data preprocessing, feature selection, feature extraction, feature dimensionality reduction, and feature reconstruction. An autoencoder is typically used to perform the feature processing step. An autoencoder consists of an encoder and a decoder. The encoder performs feature extraction and dimensionality reduction, while the decoder performs feature reconstruction. The optimization goal is to maximize the "correlation" between the input and the decoder output. Finally, the low-dimensional features output by the encoder are used to complete the desired task.
[0057] Mutual Information: is an information measurement method used to measure the relationship between two random variables. Given two discrete random variables X and Y, their mutual information can be defined as the difference between their joint distribution and their respective marginal distributions, that is: in, yes and The joint probability distribution of and yes and Mutual information measures the degree of dependence between two variables. If two variables are completely independent, their mutual information is 0; if they are completely correlated, their mutual information equals the sum of their entropies. Mutual information can also be used for feature selection. By calculating the mutual information between each feature and the output, we can select features that are highly correlated with the output for modeling or classification.
[0058] Cross-entropy: A metric used to measure the predictive performance of a classification model across multiple categories. In multi-classification problems, the model output is a probability distribution vector representing the probability of each class. Cross-entropy measures the difference between this predicted probability distribution and the true label.
[0059] JS divergence represents the penalty term of mutual information, that is, when two probability distributions are very similar, their JS divergence will be small, and their mutual information will be large. Conversely, when two probability distributions are very dissimilar, their JS divergence will be large, and their mutual information will be small.
[0060] One-Hot Encoding (IHE) is a method for converting discrete features into a vector form that is easier for machine learning algorithms to process. It maps a discrete feature with n possible values into an n-dimensional vector, where only one dimension has a value of 1 and all other dimensions have values of 0. This dimension with a value of 1 corresponds to the category to which the sample belongs. For example, suppose there is a discrete feature "color" with three possible values: red, green, and blue. We can map each value into a 3-dimensional vector, where red corresponds to [1, 0, 0], green corresponds to [0, 1, 0], and blue corresponds to [0, 0, 1]. This converts the "color" feature into a vector form that is easier for machine learning algorithms to process. When performing IHE, the following considerations apply: Missing value handling: If there are missing values in the original data, they need to be handled. A common approach is to separate missing values into their own category or fill them with the mean or median. Sparsity: For large discrete features, IHE results in high-dimensional, sparse vectors, which consumes a lot of memory and computing resources. You can use sparse matrix storage to reduce memory usage, or use other dimensionality reduction methods.
[0061] Bucket encoding is a method for converting continuous numeric features (such as age and income) into discrete features. This method divides continuous values within a certain range into intervals and assigns a coded value to each interval, thereby converting the continuous feature into a discrete one. For example, if we want to convert the age feature into a discrete feature, we can divide age into several intervals, such as [0, 20), [20, 30), [30, 40), and assign a coded value to each interval, such as 0, 1, 2. This converts the original continuous age feature into a discrete age range feature, facilitating machine learning model training. When performing bucket encoding, the following issues should be considered: Interval selection: Choose appropriate intervals based on the data distribution and business requirements to ensure a relatively even distribution of data within each interval. Encoding method: The encoding method can be selected based on the actual situation, such as numeric encoding or one-hot encoding. Missing value handling: If there are missing values in the original data, they need to be handled. A common approach is to separate missing values into a separate category or fill them with the mean or median.
[0062] The control method of the embodiment of the present invention is further described below based on the accompanying drawings.
[0063] Reference Figure 1 , Figure 1A flowchart of a method for identifying a PCB drilling rig process state based on self-attention mutual information feature extraction is provided in an embodiment of the present invention. The method for identifying a PCB drilling rig process state based on self-attention mutual information feature extraction includes but is not limited to the following steps:
[0064] S11, obtaining current structured data from the PCB drill's own data interface, and obtaining, based on a plurality of preset characteristic attributes, characteristic fields corresponding to each characteristic attribute from the current structured data, wherein each characteristic attribute indicates a different parameter type of the PCB drill;
[0065] S12, based on the preset coding dimensions corresponding to each feature attribute, performing dimension-upgrading coding on the corresponding feature field to obtain a corresponding multi-dimensional coding feature;
[0066] S13, combining all the multidimensional coding features into an input feature sequence, and inputting the input feature sequence into a pre-trained target recognition model, wherein the sequence elements of the input feature sequence are the coding values of each dimension of the multidimensional coding features, and the target recognition model includes an encoder and a classifier;
[0067] S14, converting each code value of the input feature sequence into a self-attention code through an encoder to obtain a self-attention feature sequence composed of multiple self-attention codes, wherein the self-attention feature is used to indicate the correlation between the corresponding code value and other code values of the input feature sequence;
[0068] S15, reduce the dimension of the self-attention feature sequence to obtain a low-dimensional feature sequence, input the low-dimensional feature sequence into the classifier for classification and recognition, and determine the result of the classification and recognition as the process state recognition result, wherein the mutual information between the reconstructed feature sequence of the low-dimensional feature sequence and the input feature sequence meets the preset distance threshold, and the number of elements of the reconstructed feature sequence is the same as that of the input feature sequence.
[0069] It should be noted that structured data includes various parameters of PCB drill rig operation. Usually, characteristic attributes are pre-set for each parameter to facilitate identification by maintenance personnel. The characteristic attributes can be error code (Error Type), drill rig status (Status), timestamp (Time), drill rig operation status (Operate State), error status (Error State), number of blocks produced (Blocks Produced) and number of blocks planned to be produced (Blocks in Plan). The characteristic field of each characteristic attribute can be of different data types, such as string or integer, and the value range can also be adjusted according to the actual situation of the PCB drill rig. Specific examples of characteristic attributes can be referred to Table 1.
[0070]
[0071] Table 1 Example table of characteristic attributes
[0072] It should be noted that the error codes in Table 1 may be pre-set based on errors that may occur during the operation of the PCB drill. For specific settings, see Table 2. The Status field, Operate State field, and ErrorState field may also be set based on the actual operating status of the PCB drill. For details, see Table 3. The process status of the PCB drill can be divided into operating status and fault status. For details, see Table 4. Those skilled in the art may also add or reduce specific code types based on actual needs, and this embodiment does not limit this.
[0073]
[0074] Table 2 Error type field error code example table
[0075]
[0076] Table 3 Example table of characteristic field parameters
[0077]
[0078] Table 4 PCB drilling machine process status example table
[0079] It should be noted that the encoding dimension of each feature attribute can be pre-set. For example, as shown in Table 1, the preset encoding dimension of the error code (Error Type) is 21 dimensions. After obtaining the feature field of Error Type, it can be encoded into a 21-dimensional multi-dimensional encoding feature by dimension upgrading. The same is true for other feature fields, which will not be repeated here.
[0080] It should be noted that after obtaining multiple multidimensional coding features, they can be combined into an input feature sequence. For example, the Error Type field, Status field, Operate State field, and Error State field are up-coded to obtain 21-dimensional, 4-dimensional, 7-dimensional, and 2-dimensional multidimensional coding features respectively. The time field is up-coded to obtain a 168-dimensional multidimensional coding feature, and the Blocks Produced field and the Blocks in Plan field are jointly up-coded to obtain a 200-dimensional multidimensional coding feature. The final input feature sequence is a 402-dimensional feature sequence.
[0081] It should be noted that the target recognition model of this embodiment can be a self-attention unsupervised mutual information feature extraction network, which uses the self-attention mechanism to determine the correlation between the encoding value of each dimension and the encoding value of other dimensions. After obtaining the self-attention feature sequence, dimensionality reduction is performed to obtain a low-dimensional feature sequence, so that each feature of the low-dimensional feature sequence can carry the correlation between features, that is, it can reflect the correlation of parameter fields. The PCB drill rig parameter characteristics represented by the low-dimensional feature sequence are classified by a classifier to determine the current process status recognition result of the PCB drill rig.
[0082] It should be noted that this embodiment uses the mutual information of the reconstructed sequence as a judgment basis when training the target recognition model to ensure that after the low-dimensional feature sequence extracted by the trained target recognition model, the mutual information between the reconstructed feature sequence corresponding to the low-dimensional feature sequence and the input feature sequence meets the preset distance threshold. The greater the distance of the mutual information, the more correlated the two features. In this embodiment, it is necessary to ensure that the mutual information is greater than the preset distance threshold to ensure that the low-dimensional feature sequence can correctly characterize the feature correlation of the high-dimensional self-attention feature sequence with low-dimensional features, thereby improving the accuracy of recognition.
[0083] Through the technical solution of this embodiment, the high-dimensional state attribute data and process status required for identifying drilling rig processes are first defined, and the PCB drilling rig process classification task is standardized through data preprocessing. Secondly, to address the issues of sparse and similar drilling rig sample data, this embodiment uses a self-attention unsupervised mutual information feature extraction neural network to transform the raw data into features that better represent potential data issues and differences, thereby improving the accuracy of PCB drilling rig process status classification. Through intelligent identification of PCB drilling rig process status, the production inspection process of PCB drilling rigs is made more detailed, transparent, and intelligent.
[0084] In addition, in one embodiment, referring to Figure 2 , Figure 1 Step S12 shown also includes but is not limited to the following steps:
[0085] S21, when the feature field is a discrete string field, the feature field is one-hot encoded according to the preset encoding dimension to obtain the corresponding multi-dimensional encoding feature;
[0086] S22: When the feature field is a continuous integer field, bucket encoding is performed on the feature field according to a preset encoding dimension to obtain corresponding multi-dimensional encoding features.
[0087] It should be noted that, as shown in Table 1, the data types of different feature fields can be different, and different dimensionality-enhancing encoding methods can be used for fields of different data types. For example, the Error Type, Status, Operate State, and Error State fields in Table 1 are typically discrete fields, so one-hot encoding can be used for dimensionality-enhancing. For another example, the Time, Blocks Produced, and Blocks in Plan fields are continuous integer fields, so bucket encoding can be used for dimensionality-enhancing.
[0088] For example, for the Time field, the original data is an integer timestamp type with the unit being seconds. First, it is converted as follows: Time=Time%(60*60*24*7), where % is a modulo operation. Through the above operation, a cycle can be represented in seconds. The converted Time value range is between 0 and 604800. By bucketing it by hour, 168 data buckets can be obtained, that is, a 168-dimensional multi-dimensional encoding feature.
[0089] For example, the following operation is performed on the Blocks Produced field and the Blocks in Plan field to obtain the production progress: , Progress is a floating point value between 0 and 1. It is divided into 200 data buckets at every 0.005 (0.5%), that is, a 200-dimensional multidimensional encoding feature.
[0090] It should be noted that, as shown in Table 4, in order to better train the model, the process status can also be one-hot encoded to obtain 8-dimensional data. The specific dimension can be adjusted according to actual training requirements.
[0091] In addition, in one embodiment, referring to Figure 3 , Figure 1 Step S14 shown also includes but is not limited to the following steps:
[0092] S31, determining the query vector, key vector and value vector of the encoded value;
[0093] S32, determining an attention score for the encoded value based on the query vector and the key vector;
[0094] S33, determining the attention weight of the encoding value according to the attention score;
[0095] S34, perform weighted summation of the attention weight and the value vector to obtain the self-attention code.
[0096] It should be noted that the input feature sequence has multiple dimensions of encoded values. To obtain the self-attention encoding for each dimension, the self-attention parameters can be determined by calculating the query vector, key vector, and value vector. The attention score and attention weight are then calculated, and the weighted sum is used to determine the correlation with the encoding values of other dimensions. The following proposes the calculation of the self-attention encoding of one dimension. For the feature values of multiple dimensions of the input feature sequence, the following steps can be repeated multiple times:
[0097] First, for the input features , the first The value of the dimension is , calculate the query vector , key vector Sum vector , the expression is: , , ,in , , is a learnable parameter matrix.
[0098] Then, the attention score between the value of the j-th dimension is calculated , the expression is: , where T represents the transpose operation;
[0099] Then, the attention weights between the values of the j-th dimension are calculated , the expression is: .
[0100] Finally, the attention weight and the corresponding Perform weighted summation to obtain feature vectors Self-attention representation ,in, , Calculation method reference That's it.
[0101] In addition, in one embodiment, referring to Figure 4 , the training steps of the target recognition model include:
[0102] S41, obtaining a sample data set, wherein the sample data set comes from historical structured data of a PCB drilling machine, and the sample data set includes a plurality of pre-labeled sample input features and corresponding sample labels, the dimensions of the sample input features are the same as the multi-dimensional encoding features, and the sample labels are determined according to a preset process state;
[0103] S42, after one-hot encoding the sample labels, the sample dataset is divided into a training set and a test set;
[0104] S43, obtaining and initializing an initial recognition model, the initial recognition model including an encoder, a decoder, and a classifier;
[0105] S44, inputting the training set into the initial recognition model for training, and calculating the model loss function during the training process;
[0106] S45, when the model loss function converges and the initial recognition model passes the test on the test set, the decoder is deleted from the initial recognition model to obtain the target recognition model.
[0107] It should be noted that the sample input features of the sample data set can refer to the above-mentioned method of obtaining multi-dimensional coding features, which will not be repeated here. The sample label can be an 8-dimensional code obtained by one-hot encoding according to the process status.
[0108] For example, data is collected from the free interface of the PCB drill, and each piece of data collected is processed into a 402-dimensional input vector according to the above data definition and structured method. Based on experience, the data is manually labeled according to the 8 process states in Table 4, and the labeled labels are uniquely encoded. Assume that the acquired data set is , and divided into training set and validation set .in It is 402 dimension. It is 8-dimensional.
[0109] It should be noted that, after obtaining the sample input features, the encoder can Figure 3 Self-attention encoding is obtained in the manner shown. In order to ensure the relevance of the low-dimensional feature sequence output by the trained encoder, this embodiment reconstructs the low-dimensional features output by the encoder through the decoder during training, and determines whether the encoder training is completed by maximizing the mutual information between the reconstructed features and the sample input features.
[0110] It should be noted that when the model is actually applied, it is not necessary to seriously reconstruct the features. Therefore, after completing the training of the initial recognition model, this embodiment uses the model obtained after deleting the decoder as the target recognition model.
[0111] In addition, in one embodiment, referring to Figure 6 , Figure 4 Step S44 shown also includes but is not limited to the following steps:
[0112] S61, inputting the sample input features into the encoder to obtain low-dimensional sample features, and inputting the low-dimensional sample features into the decoder for dimensionality increase and reconstruction to obtain reconstructed sample features;
[0113] S62, determining the feature mutual information between the sample input feature and the reconstructed sample feature, and when the feature mutual information reaches a maximum value, inputting the sample input feature into the classifier to obtain a training recognition result;
[0114] S63, inputting the reconstructed sample features and the training recognition results into the model loss function for calculation.
[0115] It should be noted that the structure of the initial recognition model of this embodiment is as follows Figure 5 As shown, it includes encoder, decoder and classifier. Figure 1 Taking the input 402 as an example, the structure of the encoder can include attention unit (402 dimensions), fully connected layer (2048 dimensions), ReLU, fully connected layer (512 dimensions), ReLU, fully connected layer (32 dimensions), ReLU in sequence. The encoder takes the 402-dimensional sample input feature X as input and outputs a 32-dimensional low-dimensional feature F; the structure of the decoder can include a fully connected layer (128 dimensions), ReLU, fully connected layer (256 dimensions), ReLU, fully connected layer (402 dimensions), ReLU in sequence. The input of the decoder is the 32-dimensional low-dimensional feature F, and the output is the reconstructed feature R; the structure of the classifier can be a fully connected layer (512 dimensions), ReLU, fully connected layer (128 dimensions), ReLU, fully connected layer (8 dimensions), Sigmoid in sequence. The input of the classifier is the 32-dimensional low-dimensional feature F, and the output is the process status recognition result.
[0116] It should be noted that the calculation formula for feature mutual information in this embodiment is: , where X is the sample input feature and R is the reconstructed sample feature. , They belong to , A random variable, represents the joint probability distribution, represents the original distribution of the input data, and represent marginal probability distributions, express about The posterior probability distribution of .
[0117] In addition, in one embodiment, referring to Figure 7 , Figure 6 Step S62 shown also includes but is not limited to the following steps:
[0118] S71, determining the feature entropy and KL divergence of the sample input feature;
[0119] S72, converting the KL divergence into the JS divergence of the sample input feature;
[0120] S73: Determine the difference between the feature entropy and the JS divergence as the feature mutual information.
[0121] It should be noted that this embodiment converts the feature mutual information into Divergence: , yes The entropy of . Maximizing the mutual information of features is to widen and The distance between them, since KL divergence is unbounded, it is easy to cause overflow during the maximization process. Since the JS divergence has an upper limit of ln2 and the distribution limit is similar to that of KL divergence, this embodiment uses JS divergence instead of KL divergence. The conversion formula is:
[0122] in, It is an average distribution, and finally the JS divergence is applied to the loss function of the training step.
[0123] In addition, in one embodiment, referring to Figure 8 After executing Figure 7 After step S73, the following steps are also included but not limited to:
[0124] S81, determining a JS divergence term according to the JS divergence of all sample input features;
[0125] S82, determining the model loss function according to the sum of the JS divergence term and the preset cross entropy loss.
[0126] It should be noted that the network The loss function of the data as follows: Among them, the loss function consists of two parts: represents the cross entropy loss, which penalizes the difference between the result and the true label; , Represents two vectors in The values in the dimensions. Represents the JS divergence term, which penalizes the feature extraction ability of the autoencoder based on the mutual information between the reconstructed features and the input features. The effects of cross entropy and JS divergence on the loss function are controlled separately. To avoid the complex integral term when calculating JS divergence, stochastic gradient descent is used as the network optimization method. Only a single sample is used for training in each iteration. The JS divergence term can be simplified to the following formula, where μ and σ are the feature mean and variance, respectively: , the final loss function is transformed into: .
[0127] like Figure 9 As shown, Figure 9This is a structural diagram of a PCB drilling machine process state recognition device based on self-attention mutual information feature extraction provided by one embodiment of the present invention. The present invention also provides a PCB drilling machine process state recognition device based on self-attention mutual information feature extraction, comprising:
[0128] The processor 901 can be implemented as a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0129] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902 and is called by the processor 901 to execute the PCB drilling machine process state recognition method based on self-attention mutual information feature extraction according to the embodiments of this application.
[0130] Input / output interface 903, used to implement information input and output;
[0131] Communication interface 904, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WiFi, Bluetooth, etc.);
[0132] Bus 905 , which transmits information between various components of the device (e.g., processor 901 , memory 902 , input / output interface 903 , and communication interface 904 );
[0133] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0134] An embodiment of the present application also provides an electronic device, including the PCB drilling machine process status recognition device based on self-attention mutual information feature extraction as described above.
[0135] An embodiment of the present application also provides a storage medium, which is a computer-readable storage medium. The storage medium stores a computer program, and when the computer program is executed by a processor, it implements the above-mentioned PCB drilling machine process status recognition method based on self-attention mutual information feature extraction.
[0136] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory optionally includes a memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of the above-mentioned networks include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof. The device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and are located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0137] Those skilled in the art will appreciate that all or some of the steps and systems disclosed above can be implemented as software, firmware, hardware, or any suitable combination thereof. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on computer-readable media, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is well known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVDs) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. Furthermore, as is well known to those skilled in the art, communication media typically includes computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0138] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above implementation. Those skilled in the art can also make various equivalent modifications or substitutions under the shared conditions that do not violate the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. A PCB drilling rig process state recognition method based on self-attention mutual information feature extraction, characterized in that: include: Acquire current structured data from a data interface of the PCB drill rig, and based on a plurality of preset characteristic attributes, acquire a characteristic field corresponding to each of the characteristic attributes from the current structured data, wherein each of the characteristic attributes indicates a different parameter type of the PCB drill rig; Based on the preset coding dimensions corresponding to each of the characteristic attributes, the corresponding characteristic fields are dimensionalized to obtain corresponding multi-dimensional coding features; Combining all of the multidimensional coding features into an input feature sequence, and inputting the input feature sequence into a pre-trained target recognition model, wherein the sequence elements of the input feature sequence are the coding values of each dimension of the multidimensional coding features, and the target recognition model includes an encoder and a classifier; Converting each of the encoding values of the input feature sequence into a self-attention encoding by the encoder to obtain a self-attention feature sequence consisting of a plurality of the self-attention codes, wherein the self-attention feature is used to indicate the correlation between the corresponding encoding value and other encoding values of the input feature sequence; Performing dimensionality reduction on the self-attention feature sequence to obtain a low-dimensional feature sequence, inputting the low-dimensional feature sequence into the classifier for classification and recognition, and determining the classification and recognition result as the process state recognition result, wherein the mutual information between the reconstructed feature sequence of the low-dimensional feature sequence and the input feature sequence satisfies a preset distance threshold, and the reconstructed feature sequence has the same number of elements as the input feature sequence; The step of converting each of the encoded values of the input feature sequence into a self-attention encoding by the encoder comprises: determining a query vector, a key vector, and a value vector for the encoded value; determining an attention score for the encoded value based on the query vector and the key vector; determining an attention weight for the encoded value based on the attention score; The attention weight and the value vector are weightedly summed to obtain the self-attention code.
2. The PCB drilling rig process state recognition method based on self-attention mutual information feature extraction according to claim 1 is characterized in that: The step of performing up-dimensional coding on the corresponding feature field based on the preset coding dimension corresponding to each feature attribute to obtain the corresponding multi-dimensional coding feature includes: When the feature field is a discrete string field, performing one-hot encoding on the feature field according to the preset encoding dimension to obtain the corresponding multi-dimensional encoding feature; Alternatively, when the feature field is a continuous integer field, the feature field is bucket-encoded according to the preset encoding dimension to obtain the corresponding multi-dimensional encoding feature.
3. The PCB drilling rig process state recognition method based on self-attention mutual information feature extraction according to claim 2 is characterized in that: The training steps of the target recognition model include: Obtaining a sample data set, wherein the sample data set is derived from historical structured data of the PCB drilling rig, the sample data set including a plurality of pre-labeled sample input features and corresponding sample labels, the dimensions of the sample input features being the same as the multi-dimensional coding features, and the sample labels being determined according to a preset process state; After one-hot encoding the sample labels, the sample dataset is divided into a training set and a test set; Acquire and initialize an initial recognition model, wherein the initial recognition model includes the encoder, the decoder, and the classifier; Inputting the training set into the initial recognition model for training, and calculating the model loss function during the training process; When the model loss function converges and the initial recognition model passes the test on the test set, the decoder is deleted from the initial recognition model to obtain the target recognition model.
4. The PCB drilling rig process state recognition method based on self-attention mutual information feature extraction according to claim 3 is characterized in that: Inputting the training set into the initial recognition model for training, and calculating the model loss function during the training process, includes: Inputting the sample input features into the encoder to obtain low-dimensional sample features, and inputting the low-dimensional sample features into the decoder for dimensionality increase reconstruction to obtain reconstructed sample features; Determining feature mutual information between the sample input feature and the reconstructed sample feature, and when the feature mutual information reaches a maximum value, inputting the sample input feature into the classifier to obtain a training recognition result; The reconstructed sample features and the training recognition results are input into the model loss function for calculation.
5. The PCB drilling rig process state recognition method based on self-attention mutual information feature extraction according to claim 4 is characterized in that: The determining of the feature mutual information between the sample input feature and the reconstructed sample feature includes: Determining the feature entropy and KL divergence of the sample input feature; Convert the KL divergence into the JS divergence of the sample input feature; The difference between the feature entropy and the JS divergence is determined as the feature mutual information.
6. The PCB drilling rig process state recognition method based on self-attention mutual information feature extraction according to claim 5 is characterized in that: After determining the difference between the feature entropy and the JS divergence as the feature mutual information, the method further includes: Determining a JS divergence term according to the JS divergence of all the sample input features; The model loss function is determined according to the sum of the JS divergence term and the preset cross entropy loss.
7. A PCB drilling machine process state recognition device based on self-attention mutual information feature extraction, characterized in that: It includes at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor to enable the at least one control processor to execute the PCB drilling machine process state recognition method based on self-attention mutual information feature extraction as described in any one of claims 1 to 6.
8. An electronic device, characterized in that: It includes the PCB drilling machine process status recognition device based on self-attention mutual information feature extraction as described in claim 7.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the PCB drilling machine process state recognition method based on self-attention mutual information feature extraction as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Fault classification method based on context attention dynamic feature extractor
CN114298220A
Text recognition method and device, model training method and device and electronic equipment
CN114693904A