Transformer network distributed reasoning method for circuit board defect recognition based on IEC61499 standard
By decentralizing the computing requirements and adaptive mechanism of the Transformer network in the distributed system of the IEC61499 standard, the problem of insufficient computing resources and insufficient adaptive capabilities in circuit board defect identification is solved, achieving fast and accurate circuit board defect identification, and improving improve industrial production efficiency.
Patent Information
- Application Number
- CN202411106027.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2044-08-13
Smart Images

Figure CN118657177B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial Internet technology, and in particular to a Transformer network distributed reasoning method for circuit board defect recognition based on the IEC61499 standard. Background Art
[0002] The IEC61499 standard provides a model and design method for distributed industrial process measurement and control systems. The standard supports the reuse and distribution of modular software components, making the system more flexible and scalable. The standard supports the reuse and distribution of modular software components, making the system more flexible and scalable.
[0003] In recent years, deep learning technology, especially Transformer network, has attracted much attention due to its powerful feature extraction and ability to process sequence data. Transformer network was originally applied in the field of natural language processing, and has now been successfully extended to many fields such as image recognition and time series analysis.
[0004] In the task of circuit board defect recognition, the Transformer network can effectively capture the global dependencies in the image and focus on the associations between different parts of the image through the self-attention mechanism, which is particularly useful for identifying complex circuit board defects. However, there are certain challenges in directly applying the Transformer network to the distributed system of the IEC61499 standard. First, the Transformer network usually requires large computing resources, which may conflict with the limited resources of distributed edge devices. Secondly, due to the diversity of circuit board designs and defect types, the network needs to have a certain degree of adaptability to adapt to different application scenarios.
[0005] Therefore, a distributed reasoning method for transformer network based on IEC61499 standard for circuit board defect recognition is proposed. Taking advantage of the distributed architecture, the computing requirements of the transformer network are dispersed to multiple nodes, thereby optimizing the utilization of resources. At the same time, the distributed strategy is dynamically adjusted by introducing an adaptive mechanism. Summary of the invention
[0006] In order to effectively identify circuit board defects, a Transformer network distributed reasoning method for circuit board defect recognition based on IEC61499 standard is proposed. This method is based on the idea of segmented mapping of the overall design of the IEC61499 standard, and designs an adaptive distributed reasoning method for circuit board defect recognition Transformer network that complies with the standard.
[0007] The specific steps of the method are as follows:
[0008] Step 1: Load the Transformer network model on the host node and each edge node, and set split anchor points between each attention head;
[0009] Step 2. During the first run, the host assigns and saves the initial weight of each edge device to 1. The host loads the weight value of each edge device, calculates the cutting point of the Transformer multi-head attention according to the weight value, and calculates the cutting coordinates according to the coordinate calculation formula. After determining the cutting coordinates of the model of each edge node, the cutting point coordinates are sent to each edge node. The edge node verifies the transmitted coordinates and cuts the model according to the coordinates.
[0010] Step 3, after the edge node in Step 2 completes the segmentation operation of the model, the computer data is distributed to each edge node, and the input data of the edge node is preprocessed before data transmission;
[0011] Step 4: The edge node calculates the output of the attention head and its gradient value based on the received input data, and transmits these calculation results back to the host. Subsequently, the host node is responsible for summarizing the calculation results of all edge nodes, and updates and integrates the weight parameters of each edge node accordingly.
[0012] Preferably, the coordinate calculation formula in Step 2 is:
[0013]
[0014] in is the end point of the cutting interval of the i-th edge device model, is the starting point of the cutting interval, is the number of bulls in the bull attention, is the weight of the i-th edge device, 0.2 is the tolerance coefficient of the weight, and m is the total number of edge devices.
[0015] The tolerance factor introduced in this formula is intended to mitigate the impact of computational differences between different devices within the IEC61499 standard framework on the overall computational efficiency, so as to optimize computational performance.
[0016] Preferably, the data preprocessing formula in Step 3 is:
[0017]
[0018] in is the mean of the eigenvalues in the input matrix and 0.01 is the characteristic deviation value.
[0019] This formula calculates the distance between the feature and the feature mean to replace the original feature value. The relative distance between features is more robust than the original numerical features when representing data, especially in the face of environmental changes and disturbances.
[0020] Preferably, the calculation formula of the weight update parameter of Step 4 is:
[0021]
[0022] in, represents the weight of the i-th edge device, is the gradient information value returned by edge device i, 0.1 is the gradient balancing coefficient, It is the time difference between the time when the data is sent and the time when the calculation result is received.
[0023] Preferably, the Step 3 also includes a data distribution method, and the data distribution method is specifically:
[0024] The host uses a broadcast mechanism when distributing data to edge nodes to ensure synchronous reception of input data. After receiving the data, each edge node will first perform a data integrity check. If data is missing, the missing part will be filled with a value of 0.1, and then the calculation process will continue;
[0025] Preferably, the Step 4 also includes a data receiving method, and the data receiving method is specifically:
[0026] For the calculation results of the edge devices, the host sets up a data transfer pool with a size of m, where m represents the number of edge nodes. When each edge device transmits the calculation results back to the host, these results will first be stored in the data transfer pool. Once the data transfer pool is full, the host will read and clear the data in it, then perform a data integrity check, fill the missing feature values with 0, and finally integrate the data.
[0027] Beneficial effects;
[0028] The present invention uses the multi-head attention mechanism in the Transformer network as the key element of splitting, and sets split anchor points between different attention heads. The split point of the model is calculated by analyzing the weights of the edge nodes, thereby realizing collaborative computing in a distributed environment. Compared with the traditional method of performing multi-head attention calculations on a single machine, this method significantly reduces the inference time required to apply the Transformer network model in an industrial environment through adaptive model splitting and distributed collaboration, improves the speed of circuit board defect recognition without reducing recognition accuracy, and has a significant positive impact on improving the efficiency of industrial production. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is the overall flow chart of the present invention;
[0030] Figure 2 It is a schematic diagram of anchor point setting of the present invention;
[0031] Figure 3 It is a schematic diagram of the edge-cloud collaboration strategy of the present invention. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0033] Example:
[0034] like Figure 1-Figure 3 As shown, the present invention discloses a circuit board defect recognition method based on the IEC61499 standard
[0035] Transformer network distributed reasoning method, Figure 1 It is a flow chart of the present invention, and its specific steps are as follows:
[0036] Step 1: Load the Transformer network model on the host node and each edge node, such as Figure 2 As shown, split anchors are set between attention heads.
[0037] Step 2: During the first run, the host will assign an initial weight to each edge device and save it with a value of 1. The host loads the weight values of each edge device and calculates the cutting point of the Transformer multi-head attention based on the weight values. After determining the cutting coordinates of the model of each edge node, the cutting point coordinates are sent to each edge node. The edge node verifies the transmitted coordinates and cuts the model according to the coordinates.
[0038] The coordinate calculation formula is:
[0039]
[0040] in is the end point of the cutting interval of the i-th edge device model, is the starting point of the cutting interval, is the number of bulls in the bull attention, is the weight of the i-th edge device, 0.2 is the tolerance coefficient of the weight, and m is the total number of edge devices.
[0041] The tolerance factor introduced in this formula is intended to mitigate the impact of computational differences between different devices within the IEC61499 standard framework on the overall computational efficiency, so as to optimize computational performance.
[0042] Step 3. After the edge nodes complete the segmentation operation of the model, considering the need for high-speed computing, the edge nodes only perform data integrity verification when receiving data transmitted through the network, but do not perform strict verification of numerical accuracy. Therefore, before data transmission, appropriate preprocessing must be performed on the input data of the edge nodes to ensure that these nodes can adapt to and accommodate numerical errors caused by interference during network propagation.
[0043] The data processing formula is:
[0044]
[0045] in is the mean of the eigenvalues in the input matrix and 0.01 is the characteristic deviation value.
[0046] This formula calculates the distance between the feature and the feature mean to replace the original feature value. The relative distance between features is more robust than the original numerical features when representing data, especially in the face of environmental changes and disturbances.
[0047] like Figure 3 As shown in the figure, the data distribution method is as follows: the host uses a broadcast mechanism when distributing data to edge nodes to ensure synchronous reception of input data. After receiving the data, each edge node will first perform a data integrity check; if data is missing, the missing part will be filled with a value of 0.1, and then the calculation process will continue.
[0048] Step 4: The edge node calculates the output of the attention head and its gradient value based on the received input data, and transmits these calculation results back to the host. Subsequently, the host node is responsible for summarizing the calculation results of all edge nodes, and based on this, updates and integrates the weight parameters of each edge node.
[0049] like Figure 3 As shown in Figure 1, the data receiving method is as follows: for the calculation results of the edge device, the host sets a data transfer pool with a size of m, where m represents the number of edge nodes. When each edge device transmits the calculation results back to the host, these results will first be stored in the data transfer pool. Once the data transfer pool is full, the host will read and clear the data in it, then perform data integrity verification, fill the missing feature values with 0, and finally integrate the data.
[0050] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. Transformer network distributed reasoning method for circuit board defect recognition based on IEC61499 standard, It is characterized in that The specific steps of the method are as follows: Step 1: Load the Transformer network model on the host node and each edge node, and set split anchor points between each attention head; Step 2. During the first run, the host assigns and saves the initial weight of each edge device to 1. The host loads the weight value of each edge device, calculates the cutting point of the Transformer multi-head attention according to the weight value, and calculates the cutting coordinates according to the coordinate calculation formula. After determining the cutting coordinates of the model of each edge node, the cutting point coordinates are sent to each edge node. The edge node verifies the transmitted coordinates and cuts the model according to the coordinates. Step 3, after the edge node in Step 2 completes the segmentation operation of the model, the computer data is distributed to each edge node, and the input data of the edge node is preprocessed before data transmission; Step 4: The edge node calculates the output of the attention head and its gradient value based on the received input data, and transmits these calculation results back to the host. Subsequently, the host node is responsible for summarizing the calculation results of all edge nodes and updating and integrating the weight parameters of each edge node accordingly. The coordinate calculation formula in Step 2 is: ; in is the end point of the cutting interval of the i-th edge device model, is the starting point of the cutting interval, is the number of bulls in the bull attention, is the weight of the i-th edge device, 0.2 is the tolerance factor of the weight, and m is the total number of edge devices; The data preprocessing formula in Step 3 is: ; in is the mean of the eigenvalues in the input matrix, and 0.01 is the characteristic deviation value; The calculation formula of the weight update parameter of Step 4 is: ; in, represents the weight of the i-th edge device, is the gradient information value returned by edge device i, 0.1 is the gradient balancing coefficient, It is the time difference between the time when the data is sent and the time when the calculation result is received.
2. According to claim 1, the Transformer network distributed reasoning method for circuit board defect recognition based on the IEC61499 standard, Features: The Step 3 also includes a data distribution method, which is specifically: The host uses a broadcast mechanism when distributing data to edge nodes to ensure that input data is received synchronously. After receiving the data, each edge node will first perform a data integrity check. If data is missing, the value 0.1 will be used to fill the missing part, and then the calculation process will continue.
3. According to claim 2, the Transformer network distributed reasoning method for circuit board defect recognition based on the IEC61499 standard, Features: The Step 4 also includes a data receiving method, which is specifically: For the calculation results of the edge devices, the host sets up a data transfer pool with a size of m, where m represents the number of edge nodes. When each edge device transmits the calculation results back to the host, the results will first be stored in the data transfer pool. Once the data transfer pool is full, the host will read and clear the data in it, then perform a data integrity check, fill the missing feature values with 0, and finally integrate the data.
