Automobile part detection method based on super-resolution Transformer
By using super-resolution Transformer combined with cross-modal attention CMA and category-content multi-head attention module CCMSA in auto parts detection, the balance problem between computational complexity and accuracy of single-image super-resolution technology is solved. It achieves more efficient and accurate detection, and improves the robustness and generalization ability of the model.
Patent Information
- Application Number
- CN202411017290.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-07-29
AI Technical Summary
Existing single-image super-resolution technology is difficult to strike a balance between improving detection accuracy and managing computational complexity, resulting in reduced computing load and performance, affecting the efficiency and accuracy of automotive parts detection.
The auto parts detection method based on super-resolution Transformer is adopted, combined with the cross-modal attention CMA and the category-content multi-head attention module CCMSA, to improve the model robustness and generalization by fusing different modal information and establishing global feature connections. Ability to enhance processing of incomplete or noisy data.
It improves the accuracy and efficiency of auto parts inspection, reduces errors caused by human factors, realizes the automation and intelligence of the inspection process, and enhances the stability and accuracy of the model when processing incomplete or noisy data.
Smart Images

Figure CN118552956A
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of image recognition, and in particular relates to an automobile parts detection method based on super-resolution Transformer. Background Art
[0002] In vehicle inspection, parts inspection is a key link in vehicle qualification. Using cross-modal attention CMA and category-content multi-head attention module CCMSA to inspect vehicle parts can not only accurately capture the subtle features of vehicle parts and improve the accuracy of inspection, but also its non-contact and non-destructive inspection method ensures the integrity of the sample. At the same time, the rapid inspection of cross-modal attention CMA and category-content multi-head attention module CCMSA technology provides a guarantee for whether the vehicle inspection is qualified. The application of this technology not only improves the efficiency and accuracy of vehicle parts inspection, but also injects new vitality into the innovative development of vehicle inspection.
[0003] Using super-resolution technology to replace manual detection of cross-modal attention CMA and category-content multi-head attention module CCMSA detection not only greatly improves detection efficiency and accuracy, reduces errors caused by human factors, but also realizes automation and intelligence of the detection process, reducing labor costs. With the continuous advancement of technology, this alternative method will bring more comprehensive and accurate support to the field of vehicle detection and promote the innovative development of vehicle detection.
[0004] Cross-modal attention (CMA) and category-content multi-head attention module (CCMSA) detection aim to recover high-resolution images from low-resolution images. However, the currently popular single image super-resolution has limitations in balancing accuracy and managing increased computational complexity, which leads to computational load and reduces the performance of single image super-resolution. Summary of the invention
[0005] The present invention provides an automobile parts detection method based on super-resolution Transformer, aiming to propose cross-modal attention CMA and category-content multi-head attention module CCMSA. The cross-modal attention CMA can effectively fuse information from different modalities to construct a richer and more comprehensive feature representation, improve the robustness and generalization ability of the model, and enhance the stability and accuracy of the model when processing incomplete or noisy data. The category-content multi-head attention module CCMSA can enhance input features by using tokens that are far apart but similar, and pay attention to them in each category, and then pay attention to them by content classification, which goes beyond the limitation of local windows, establishes global connections between similar features, and improves the accuracy and efficiency of automobile parts detection.
[0006] The present invention aims to improve on the basis of single image super-resolution and provide an automobile parts detection method based on super-resolution Transformer, comprising the following steps: S1. Preparation of automobile parts image dataset: Use industrial cameras to take photos of automobile parts to obtain automobile parts images, mark the positions that need to be detected, and mark other objects as irrelevant targets. After the marking is completed, the automobile parts image dataset is obtained; S2, build convolutional layers, including 3×3 convolutions; S3. Construct an attention layer, which includes L Transformer modules. Input image features to the attention layer, and the image features are calculated through L Transformer modules. The Transformer modules include a cross-modal attention module CMA and a category-content multi-head self-attention module CCMSA. S4, construct a cross-modal attention module CMA, including linear transformation, calculation of attention weights, calculation of attention outputs, and fusion of enhanced features; S5. Construct the category-content multi-head attention module CCMSA, including Classify, MSA, and UnClassify; S6. Build an upsampling convolution module, including 3×3 convolution and upsampling.
[0007] Preferably, in step S2, for the convolutional layer, the input image , extract features and , and , , and Represents input features and The height, width and channels of the convolutional layer can extract abstract features and transmit them to the next module, thereby enhancing the representation ability of the image.
[0008] Preferably, in step S4, for the cross-modal attention module CMA, the modality features and ,Will and Through linear transformation, they are mapped to Query, Key, and Value respectively. , , ,in, , , is the weight matrix of the linear transformation, , , is the bias vector, and then use and Calculate the attention weights, usually using the dot product attention mechanism, ,in, yes The dimension is used to scale the dot product result and apply the attention weight to , get the output of cross-modal attention CMA, , combine the cross-modal attention CMA output with the modal original features Fusion is performed to generate enhanced features. ,in, and It is the learned weight used to balance the attention output and the original features, and output the enhanced features.
[0009] Preferably, in step S5, for the category-content multi-head attention module CCMSA, the input features obtained by CMA are used And the enhanced features , the category information of each pixel is implicitly fused. In order to classify the input features, we divide each pixel into Different categories, by integrating the category information of each pixel, classifying the input features according to the most similar enhanced features, ,in is the enhanced feature obtained, is the characteristic number, is the atomic number, exist is the maximum value, pixel Included in the collection , which means With enhanced features The labels belong to the same category. Therefore, each category is regarded as an irregularly shaped window containing the same category label. First, a multi-head self-attention mechanism is applied to extract important features and enhance them. , , , and then perform multi-head self-attention calculation, , in each category, in order to combine local and global information, the calculated category Further divided into categories according to content , , , where category Include Each content is flattened and connected to form , and then divide into subcategories , after division, all subcategories have the same fixed size , using a multi-head attention mechanism within each category to identify content-specific features, , , , and then perform multi-head self-attention calculation, ; The procedure for the category-content multi-head attention module CCMSA can be expressed as , , , ,in, Operation is and , The combination of input features Divided into different categories and further divided into sub-category collections , then we can convert each As an attention group, and perform multi-head self-attention calculations in each group. Finally, we use The operation puts each pixel back to its original position in the feature map, since and The sorting operation involves a random shuffle, so each Can be considered a category A random sample of The tokens in can still be distributed throughout the feature map, thereby maintaining the global receptive field, and finally a 3×3 convolution operation and upsampling operation are performed to output the image.
[0010] Compared with the prior art, the present invention has the following technical effects: The technical solution provided by the present invention proposes cross-modal attention CMA and category-content multi-head attention module CCMSA. The cross-modal attention can effectively fuse information from different modalities to construct a richer and more comprehensive feature representation, improve the robustness and generalization ability of the model, and enhance the stability and accuracy of the model when processing incomplete or noisy data. The category-content multi-head attention module CCMSA can use tokens that are far apart but similar to enhance input features, pay attention to them in each category, and then pay attention to them by content classification, transcending the limitations of local windows, establishing global connections between similar features, and improving the accuracy and efficiency of automobile parts detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 The present invention provides an automobile parts detection flow chart.
[0012] Figure 2 This is the attention layer structure diagram provided by the present invention.
[0013] Figure 3 This is a structural diagram of the cross-modal attention module CMA provided by the present invention.
[0014] Figure 4 This is the structure diagram of the category-content multi-head attention module CCMSA provided by the present invention. DETAILED DESCRIPTION
[0015] The present invention aims to propose a method for automobile parts detection based on super-resolution Transformer, and proposes cross-modal attention CMA and category-content multi-head attention module CCMSA. The cross-modal attention CMA can effectively fuse information from different modalities to construct a richer and more comprehensive feature representation, improve the robustness and generalization ability of the model, and enhance the stability and accuracy of the model when processing incomplete or noisy data. The category-content multi-head attention module CCMSA can use tokens that are far apart but similar to enhance input features, pay attention to them in each category, and then pay attention to them by content classification, which goes beyond the limitation of local windows, establishes global connections between similar features, and improves the accuracy and efficiency of automobile parts detection.
[0016] See also Figure 1 As shown, a method for detecting automobile parts based on super-resolution Transformer in an example of this application: S1. Production of automobile parts image dataset: Use industrial cameras to take photos of vehicle parts to obtain 3,000 images of vehicle parts. Label the rim welds in the automobile parts and mark other objects as irrelevant targets. After labeling, perform Mixup data enhancement to obtain a vehicle parts image dataset with a total of 5,000 images. The dataset and validation set are divided into 7 to 3. S2, build a convolution layer, including a 3×3 convolution; S3. Construct an attention layer, which includes L Transformer modules. Input image features to the attention layer, and the image features are calculated through L Transformer modules. The Transformer modules include a cross-modal attention module CMA and a category-content multi-head attention module CCMSA. S4, construct a cross-modal attention module CMA, including linear transformation, calculation of attention weights, calculation of attention outputs, and fusion of enhanced features; S5. Construct the category-content multi-head attention module CCMSA, including Classify, MSA, and UnClassify; S6. Build an upsampling convolution module, including a 3×3 convolution and 1 upsampling; The image is input into the convolution layer, image features are extracted for training, and the image features are input into the Transformer layer. Information of different modalities is fused through the cross-modal attention module CMA. The input features and the features enhanced by the cross-modal attention CMA are input into the category-content multi-head attention module CCMSA, and attention is paid to each category. Then attention is paid to the content classification, and a global connection between similar features is established. The output image enters the upsampling convolution module for convolution and upsampling. Finally, the final image is output.
[0017] Further, in step S2, for the convolutional layer, the input image , extract features and , and , , and Represents input features and The height, width, and channels of the network are both 640, and the number of channels is 224. The convolutional layer can extract abstract features and transmit them to the next module, thereby enhancing the image representation capability.
[0018] Further, in step S4, for the cross-modal attention module CMA, its structure is as follows Figure 3 As shown, the modal characteristics and ,Will and Through linear transformation, they are mapped to Query, Key, and Value respectively. , , ,in, , , is the weight matrix of the linear transformation, , , is the bias vector, and then use and Calculate the attention weights, usually using the dot product attention mechanism, ,in, yes The dimension is used to scale the dot product result and apply the attention weight to , get the output of cross-modal attention CMA, , this calculation is consistent with Figure 2 In Correspondingly, the cross-modal attention CMA output is combined with the original features of the modality Fusion is performed to generate enhanced features. , this calculation is consistent with Figure 2 In Corresponding to, among which, and It is the learned weight used to balance the attention output and the original features, and output the enhanced features.
[0019] Furthermore, in step S5, for the category-content multi-head attention module CCMSA, the input features obtained by CMA are used And the enhanced features , the category information of each pixel is implicitly fused. In order to classify the input features, we divide each pixel into Different categories, by integrating the category information of each pixel, classifying the input features according to the most similar enhanced features, ,in is the enhanced feature obtained, is the characteristic number, is the atomic number, exist is the maximum value, pixel Included in the collection , which means With enhanced features The labels belong to the same category. Therefore, each category is regarded as an irregularly shaped window containing the same category label. First, a multi-head self-attention mechanism is applied to extract important features and enhance them. , , , and then perform multi-head self-attention calculation, , in each category, in order to combine local and global information, the calculated category Further divided into categories according to content , , , where category Include Each content is flattened and connected to form , and then divide into subcategories , after division, all subcategories have the same fixed size , using a multi-head attention mechanism within each category to identify content-specific features, , , , and then perform multi-head self-attention calculation, ; The procedure for the category-content multi-head attention module CCMSA can be expressed as , this calculation is consistent with Figure 4 In correspond, , , these two calculations are Figure 4 correspond, , this calculation is consistent with Figure 4 Corresponding to, among which, Operation is and , The combination of input features Divided into different categories and further divided into sub-category collections , then we can convert each As an attention group, and perform multi-head self-attention calculations in each group. Finally, we use The operation puts each pixel back to its original position in the feature map, since and The sorting operation involves a random shuffle, so each Can be considered a category A random sample of The tokens in can still be distributed throughout the feature map, thereby maintaining the global receptive field, and finally a 3×3 convolution operation and upsampling operation are performed to output the image.
[0020] The above are only preferred embodiments of the present invention. It should be pointed out that a person skilled in the art can make several modifications and improvements without departing from the inventive concept of the present invention, and these all fall within the protection scope of the present invention.
Claims
1. A super-resolution Transformer-based automobile parts detection method, characterized in that: The following steps are involved: S1. Preparation of automobile parts image dataset: Use industrial cameras to take photos of automobile parts to obtain automobile parts images, mark the positions that need to be detected, and mark other objects as irrelevant targets. After the marking is completed, the automobile parts image dataset is obtained; S2, build convolutional layers, including 3×3 convolutions; S3. Construct an attention layer, which includes L Transformer modules. Input image features to the attention layer, and the image features are calculated through L Transformer modules. The Transformer modules include a cross-modal attention module CMA and a category-content multi-head attention module CCMSA. S4, construct a cross-modal attention module CMA, including linear transformation, calculation of attention weights, calculation of attention outputs, and fusion of enhanced features; S5. Construct the category-content multi-head attention module CCMSA, including Classify, MSA, and UnClassify; S6. Build an upsampling convolution module, including 3×3 convolution and upsampling.
2. The automobile parts detection method based on super-resolution Transformer according to claim 1 is characterized in that: In step S2, for the convolution module, the input image , extract features and , and , , and Represents input features and The height, width and channels of the convolutional layer can extract abstract features and transmit them to the next module, thereby enhancing the representation ability of the image.
3. The automobile parts detection method based on super-resolution Transformer according to claim 1 is characterized in that: In step S4, for the cross-modal attention module CMA, the modality features and ,Will and Through linear transformation, they are mapped to Query, Key, and Value respectively. , , ,in, , , is the weight matrix of the linear transformation, , , is the bias vector, and then use and Calculate the attention weights, usually using the dot product attention mechanism, ,in, yes The dimension is used to scale the dot product result and apply the attention weight to , get the output of cross-modal attention CMA, , combine the cross-modal attention CMA output with the modal original features Fusion is performed to generate enhanced features. ,in, and It is the learned weight used to balance the attention output and the original features, and output the enhanced features.
4. The automobile parts detection method based on super-resolution Transformer according to claim 1 is characterized in that: In step S5, for the category-content multi-head attention module CCMSA, the input features obtained by CMA are used And the enhanced features , the category information of each pixel is implicitly fused. In order to classify the input features, we divide each pixel into Different categories, by integrating the category information of each pixel, classifying the input features according to the most similar enhanced features, ,in is the enhanced feature obtained, is the characteristic number, is the atomic number, exist is the maximum value, pixel Included in the collection , which means With enhanced features The labels belong to the same category. Therefore, each category is regarded as an irregularly shaped window containing the same category label. First, a multi-head self-attention mechanism is applied to extract important features and enhance them. , , , and then perform multi-head self-attention calculation, , in each category, in order to combine local and global information, the calculated category Further divided into categories according to content , , , where category Include Each content is flattened and connected to form , and then divide into subcategories , after division, all subcategories have the same fixed size , using a multi-head attention mechanism within each category to identify content-specific features, , , , and then perform multi-head self-attention calculation, ; The procedure for the category-content multi-head attention module CCMSA can be expressed as , , , ,in, Operation is and , The combination of input features Divided into different categories and further divided into sub-category collections , then we can convert each As an attention group, and perform multi-head self-attention calculations in each group. Finally, we use The operation puts each pixel back to its original position in the feature map, since and The sorting operation involves a random shuffle, so each Can be considered a category A random sample of The tokens in can still be distributed throughout the feature map, thereby maintaining the global receptive field, and finally a 3×3 convolution operation and upsampling operation are performed to output the image.
Citation Information
Patent Citations
Dual-modal target detection method and system based on cross-modal attention mechanism fusion
CN117422971A
Hyperspectral image classification method based on mixed covariance attention and cross-layer fusion Transform
CN117576473A
Multi-modal saliency target detection method based on fine-grained decision-making mechanism
CN117765236A
Image target detection method based on multi-source information fusion
CN117830788A
Zero sample image processing system and processing method for cross-modal semantic alignment
CN117911814A
