Power transmission line small target image quality recognition method based on self-attention mechanism
By constructing a self-attention mechanism for image quality recognition of small targets in power transmission lines, this method solves the problem of low accuracy in image recognition of small components in power transmission lines, achieves efficient and accurate image quality recognition, and improves the safety of power transmission lines.
Patent Information
- Application Number
- CN202211100957.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-09
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2042-09-09
AI Technical Summary
In existing technologies, the image recognition accuracy of small components of transmission lines is low, manual inspection is time-consuming, and traditional methods have low recognition accuracy, which affects the safety of transmission lines.
A method for quality recognition of small targets in transmission line images is constructed using a self-attention mechanism. This method combines image patch processing, local self-attention calculation, and global self-attention calculation with Transformer for feature extraction and classification, while ignoring image noise and irrelevant features.
It significantly improves the recognition accuracy of small target images of power transmission lines, enhances the generalization and accuracy of recognition, and reduces the need for manual inspection.
Smart Images

Figure CN116168285B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image recognition technology, specifically relating to a method for quality recognition of small targets in power transmission lines based on a self-attention mechanism. Background Technology
[0002] Identifying defects in small components of power transmission lines is a method for detecting defects in power transmission lines. Defects in small components refer to missing bolts, washers, nuts, pins, improper installation, corrosion, etc.
[0003] Defects in small components pose a significant safety hazard to power transmission lines, potentially causing major safety and economic accidents. Issues such as inaccurate focusing, excessively bright or dim lighting, and obstruction by connecting parts in small component images greatly affect the accuracy of defect identification. Current methods for identifying the quality of small component images of power transmission line bolts have the following shortcomings: (1) Manual inspection consumes a large amount of manpower. (2) Traditional image processing methods have low accuracy. Summary of the Invention
[0004] This invention provides a method for image quality recognition of small targets in power transmission lines based on a self-attention mechanism. By using the self-attention mechanism, the method focuses on image quality-related features during the image encoding stage and ignores image noise and features unrelated to image quality, which greatly improves the accuracy of image quality recognition and solves the technical problems of low recognition accuracy for images of small components in power transmission lines in the prior art.
[0005] This invention is achieved through the following technical solution:
[0006] A method for quality recognition of small targets in transmission line images based on a self-attention mechanism, the method comprising the following steps:
[0007] S1: Construct a self-attention mechanism encoder for small target images of power transmission lines;
[0008] S2: Construct a quality classifier for small target images of power transmission lines;
[0009] S3: Image quality classifier and inference for small targets on power transmission lines.
[0010] Optionally, in step S1, the specific method for constructing the self-attention mechanism encoder for small target images of transmission lines is to obtain small target images of transmission lines and sequentially perform image block processing, local self-attention calculation processing of image block images, and global image self-attention calculation on the small target images of transmission lines.
[0011] Optionally, in step S2, the specific method for constructing the image quality classifier for small targets of transmission lines is as follows: the feature vectors obtained by the encoder of small targets of transmission lines in step S1 are sequentially used for classifier calculation, objective function calculation, and optimizer calculation.
[0012] Optionally, in step S3, the specific operations of the transmission line small target image quality classifier and inference are as follows: create a labeled transmission line small target quality detection dataset, then train the transmission line small target quality detection dataset, and classify the transmission line small target images according to their quality to perform defect detection.
[0013] Optionally, the method for image block processing of the small target image of the transmission line is to fill the small target image of the transmission line with squares whose side length is an integer multiple of 64, and then divide it into continuous rectangular blocks of different sizes in groups.
[0014] Optionally, the image patch local self-attention calculation processing method is to perform local self-attention system learning on rectangular blocks of different sizes, use three convolution kernels to perform convolution calculation on the rectangular block image, and perform bitwise multiplication between the numerical tensor before convolution and the tensor after convolution to achieve the self-attention function.
[0015] Optionally, the global image self-attention calculation method for image patch images is as follows: project each group of rectangular patch images that have undergone local self-attention calculation into a vector of fixed length and feed it into the Transformer, and use multi-head attention to perform global attention calculation on the sequence of rectangular patch images.
[0016] Optionally, the feature vectors obtained by the small target encoder of the transmission line in step S1 are used for classification calculation of the quality detection of the small target image of the transmission line through convolution calculation and softmax regression classification.
[0017] Optionally, the method for calculating the objective function using the feature vector obtained by the small target encoder of the transmission line in step S1 is to calculate the target difference between the prediction result and the label data using the cross-entropy loss function based on the softmax regression calculation result and the labeled data.
[0018] Optionally, the specific method for creating a labeled transmission line small target quality detection dataset in step S3 is as follows: create a supervised learning dataset including a training set, a validation set, and a test set, and add image quality labels to the images of small targets on transmission lines.
[0019] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0020] 1) This technical solution provides a method for image quality recognition of small targets in transmission lines based on a self-attention mechanism. By using the self-attention mechanism, image quality-related features are focused on during the image encoding stage, while image noise and features unrelated to image quality are ignored, which greatly improves the accuracy of image quality recognition.
[0021] 2) In the image quality recognition method for small targets in transmission lines based on self-attention mechanism described in this technical solution, deep neural networks are used to improve the generalization of recognition, and self-attention mechanism is adopted to obtain global or local fuzzy features more accurately. Attached Figure Description
[0022] Figure 1 This is a schematic block diagram illustrating the process structure of the present invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the embodiments. The illustrative embodiments and descriptions of this invention are only used to explain this invention and are not intended to limit this invention. Example
[0024] like Figure 1 As shown, a method for quality recognition of small targets in transmission line images based on a self-attention mechanism includes the following steps:
[0025] S1: Construct a self-attention mechanism encoder for small target images of power transmission lines;
[0026] In step S1, the specific method for constructing the self-attention mechanism encoder for small target images of transmission lines is as follows: A small target image of the transmission line is obtained, and the image is then processed sequentially into image blocks, local self-attention calculations for each image block, and global self-attention calculations. The method for processing the image blocks involves filling the small target image with squares whose side length is an integer multiple of 64, and then dividing it into groups of continuous rectangular blocks of different sizes, such as 16x16, 32x32, and 64x64. These smaller blocks are used to obtain attention from different receptive fields.
[0027] The image patch local self-attention calculation method involves learning a local self-attention mechanism for rectangular blocks of different sizes. This local self-attention mechanism can uncover more detailed information in small objects within the image.
[0028] Three convolution kernels are used to perform convolution calculations on each rectangular block image. The numerical tensor before convolution and the tensor after convolution are multiplied bitwise to achieve self-attention function.
[0029] Three convolution kernels are used to perform convolution calculations on each rectangular block image, with the three kernels having k / d values respectively. k / d convolution kernel, (2d-1) (2d-1) dilated convolution kernel, 1 1. Convolution kernel.
[0030]
[0031] Where k is the side length of the rectangle in the patch image, d is the interval of the dilated convolution kernel, and Conv k xk k / d k / d convolution kernel, Convd is (2d-1) (2d-1) convolution kernel, f patch ɛ h xw xd For the feature map of the patch rectangle, attention patch ɛ h xw xd Let h, w, and d be the attention features of the patch rectangle, where h, w, and d are the length, width, and feature length of the feature map, respectively.
[0032] Perform a bitwise multiplication between the numerical tensor before convolution and the tensor after convolution.
[0033]
[0034] In the formula, f is added. patch The patch rectangular block feature map after attention is obtained. This method is used to calculate a layer of local attention and to perform deep local self-attention learning through multi-layer concatenation.
[0035] The global image self-attention calculation method for image patch images is as follows: each group of rectangular patch images that has undergone local self-attention calculation is projected into a vector of fixed length and fed into the Transformer, and multi-head attention is used to perform global attention calculation on the sequence of rectangular patch images.
[0036]
[0037] In the formula, attention full For global attention.
[0038] In step S1, the feature vectors obtained by the small target encoder of the transmission line are classified by convolution calculation and softmax regression to perform quality detection calculation on the small target image of the transmission line.
[0039]
[0040] In the formula: z is the class probability calculated by convolution, and N is the number of classification categories.
[0041] Specifically, in step S1, the feature vectors obtained by the small target encoder of the transmission line are sequentially processed by the classifier, the objective function, and the optimizer. The method for calculating the objective function from the feature vectors obtained by the small target encoder of the transmission line in step S1 is as follows: the softmax regression result and the labeled data are compared using the cross-entropy loss function to calculate the target difference between the predicted result and the labeled data.
[0042] S2: Construct a quality classifier for small target images of power transmission lines;
[0043] Specifically, the method for constructing a quality classifier for small target images of transmission lines includes: a classifier calculation method, an objective function calculation method, and an optimizer calculation method. The specific operation is as follows: the small target images of transmission lines to be identified are processed through local and global attention mechanisms to extract feature maps, and then the feature vectors are input into the classifier for classification. For example, N input small target images of transmission lines are processed through a self-attention encoder to extract feature maps, resulting in N feature maps [N, D, H, W], where D is the feature dimension of the feature map, and H and W are the sizes of the feature maps after downsampling by the encoder.
[0044] The classifier is calculated as follows: the classifier is a fully connected neural network, the input is a feature map with shape [N, D, H, W], and the output is a classification result with shape [N, C], where C is the number of classification categories.
[0045] Objective function calculation method;
[0046] The target loss function is the cross-entropy loss function, which calculates the difference between the classifier's output class and the actual class of the image.
[0047] Optimizer calculation method;
[0048] The optimizer uses gradient descent to continuously update and optimize the parameters of the neural network model based on the loss calculated from the objective loss function, so that the loss of the objective function gradually decreases.
[0049] S3: Image quality classifier and inference for small targets on power transmission lines.
[0050] In step S3, the specific operations of the transmission line small target image quality classifier and inference are as follows: create a labeled transmission line small target quality detection dataset, then train the transmission line small target quality detection dataset, and classify the transmission line small target images according to their quality to detect defects.
[0051] The specific method for creating a labeled transmission line small target quality detection dataset in step S3 is as follows: A supervised learning dataset is created, including a training set, a validation set, and a test set. Image quality labels are added to the images of small transmission line components. The image quality of small transmission line components is categorized into five types: blurred focus, low light, strong light, occlusion, and sharpness. This dataset will be used to train and optimize the classifier.
[0052] The training method mainly uses a labeled training dataset. Through continuous optimization and iteration of the encoder and classifier, the loss between the prediction and the true value is reduced, and the model is continuously optimized until the model loss value converges, thus completing the model training.
[0053] Among them, the inference method is mainly used to classify the image quality of small components such as bolts of power transmission lines using the trained model, and then apply the classification results to the defect detection task of small components to improve the defect detection accuracy.
[0054] The transmission line image quality recognition method based on the self-attention mechanism described in this embodiment divides the small target image of the transmission line to be identified into small blocks. For each small block, feature maps are extracted using the local attention mechanism of a convolutional neural network. The extracted features are then extracted using the global attention mechanism of a Transformer. Finally, the extracted feature maps are classified through a fully connected layer. Compared with traditional image processing methods, this method greatly improves the accuracy of image quality recognition, thereby solving the technical problems of low accuracy in obtaining local or global blurred features in images of small components of transmission lines in the prior art.
[0055] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for image quality recognition of small targets in power transmission lines based on a self-attention mechanism, characterized in that: The method includes the following steps: S1: Construct a self-attention mechanism encoder for small target images of transmission lines. Specifically, obtain small target images of transmission lines and sequentially perform image block processing, local self-attention calculation processing of image block images, and global image self-attention calculation on the small target images of transmission lines. S2: Construct a quality classifier for small target images of power transmission lines; S3: Image quality classifier and inference for small targets on power transmission lines; The image patch local self-attention calculation processing method is to learn the local self-attention system for rectangular blocks of different sizes, use three convolution kernels to perform convolution calculation on the rectangular block image, and perform bitwise multiplication between the numerical tensor before convolution and the tensor after convolution to realize the self-attention function. Three convolution kernels are used to perform convolution calculations on each rectangular block image. The three convolution kernels are respectively... convolution kernel, Expanding the convolution kernel, Convolution kernel; ; in, for The side length of the image rectangle. To expand the spacing of the convolution kernels, for convolution kernel, for Convolution kernel, for Feature map of a rectangular block. Attention features for rectangular blocks; Perform a bitwise multiplication between the numerical tensor before convolution and the tensor after convolution. ; In the formula, The method is used to calculate a layer of local attention for the patch rectangular block feature map after attention is added, and deep local self-attention learning is performed through multi-layer concatenation.
2. The method for image quality recognition of small targets in transmission lines based on self-attention mechanism according to claim 1, characterized in that: In step S2, the specific method for constructing the image quality classifier for small targets of transmission lines is as follows: the feature vectors obtained by the encoder of small targets of transmission lines in step S1 are sequentially used for classifier calculation, objective function calculation, and optimizer calculation.
3. The image quality recognition method for small targets in transmission lines based on self-attention mechanism according to claim 2, characterized in that: In step S3, the specific operations of the transmission line small target image quality classifier and inference are as follows: create a labeled transmission line small target quality detection dataset, then train the transmission line small target quality detection dataset, and classify the transmission line small target images according to their quality to perform defect detection.
4. The image quality recognition method for small targets in transmission lines based on self-attention mechanism according to claim 3, characterized in that: The method for image block processing of the small target image of the transmission line is to fill the small target image of the transmission line with squares whose side length is an integer multiple of 64, and then divide it into continuous rectangular blocks of different sizes in groups.
5. The image quality recognition method for small targets in transmission lines based on self-attention mechanism according to claim 4, characterized in that: The global image self-attention calculation method for image patch images is as follows: each group of rectangular patch images that has undergone local self-attention calculation is projected into a vector of fixed length and fed into the Transformer, and multi-head attention is used to perform global attention calculation on the sequence of rectangular patch images.
6. The image quality recognition method for small targets in transmission lines based on self-attention mechanism according to claim 5, characterized in that: In step S1, the feature vectors obtained by the small target encoder of the transmission line are classified by convolution calculation and softmax regression to perform quality detection calculation on the small target image of the transmission line.
7. The image quality recognition method for small targets in transmission lines based on a self-attention mechanism according to claim 6, characterized in that: In step S1, the method for calculating the objective function using the feature vector obtained by the small target encoder of the transmission line is as follows: the target difference between the prediction result and the label data is calculated using the cross-entropy loss function based on the softmax regression calculation result and the labeled data.
8. The image quality recognition method for small targets in transmission lines based on self-attention mechanism according to claim 7, characterized in that: The specific method for creating a labeled transmission line small target quality detection dataset in step S3 is as follows: create a supervised learning dataset including a training set, a validation set, and a test set, and add image quality labels to the images of small targets on transmission lines.
Citation Information
Patent Citations
Image quality evaluation method and system, computer equipment and storage medium
CN112766351A
Texture recognition method based on deep self-attention network and local feature coding
CN113674334A