Infrared image defect identification method and system based on improved YOLOv11n
By introducing the SMAttention attention mechanism in the YOLOv11n model, the problems of low contrast and high noise in infrared images are solved, and the accuracy and efficiency of defect detection are improved, which is suitable for real-time applications of resource-constrained devices.
Patent Information
- Application Number
- CN202411799888.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-12-09
AI Technical Summary
The traditional YOLOv11 algorithm faces problems such as low contrast and high noise when processing infrared images, resulting in low detection accuracy and difficulty in effectively identifying defects in infrared images.
By adding the SMAttention attention mechanism to the Neck part of the YOLOv11n model, the YOLOv11n-SMAttention model is formed, which is used for feature recalibration and enhance the model's attention to defective areas in infrared images.
It improves the accuracy of infrared image defect detection, reduces missed detection and false detection rates, and maintains efficient computing performance, making it suitable for real-time application on resource-constrained devices.
Smart Images

Figure CN119693654A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of infrared image defect recognition, and in particular to an infrared image defect recognition method and system based on improved YOLOv11n. Background Art
[0002] With the rapid development of infrared imaging technology, infrared images are increasingly used in military, security, medical and other fields. However, due to the low resolution, high noise, low contrast and other problems of infrared images, traditional image recognition algorithms are difficult to achieve ideal results. In recent years, the YOLO series of algorithms have made remarkable achievements in the field of visible light images with the advantages of end-to-end architecture, real-time processing and efficient target detection.
[0003] The latest YOLOv11 algorithm further optimizes the detection accuracy and speed, significantly improving the performance of the model. However, when directly applying the YOLOv11 algorithm to infrared images, it still faces many technical difficulties and still needs further improvement and optimization. Summary of the invention
[0004] In view of the above defects, the purpose of the present invention is to propose an infrared image defect recognition method and system based on improved YOLOv11n. By improving the YOLOv11n algorithm, it is more suitable for the detection of low-contrast targets in infrared images, more effectively extracts the features of infrared images, and reduces the missed detection rate. While maintaining the detection capability of the large-scale model, it does not increase the computational burden.
[0005] To achieve this object, the present invention adopts the following technical solutions:
[0006] An infrared image defect recognition method based on improved YOLOv11n, the infrared image defect recognition method comprising the following steps:
[0007] S1: Acquire an infrared image with defects;
[0008] S2: Add the SMAttention mechanism to the Neck part of the YOLOv11n model to obtain the YOLOv11n-SMAttention model. The SMAttention mechanism is used to recalibrate the feature map of the infrared image with defects.
[0009] S3: Input the infrared image with defects into the YOLOv11n-SMAttention model to detect the defect features of the infrared image and obtain the defect recognition result of the infrared image.
[0010] Preferably, the YOLOv11n model includes a first Backbone structure, a first Neck structure and a first Head structure;
[0011] The first Backbone structure includes a first Conv module, a second Conv module, a first C3k2 module, a third Conv module, a second C3k2 module, a fourth Conv module, a third C3k2 module, a fifth Conv module, a fourth C3k2 module, an SPPF module and a C2PSA module which are arranged in sequence;
[0012] The first Neck structure includes the fifth to eighth C3k2 modules, the first to fourth Concat modules, the first Upsample module, the second Upsample module, the sixth Conv module and the seventh Conv module;
[0013] The output result of the second C3k2 module is also used as the input of the second Concat module, the output result of the third C3k2 module is also used as the input of the first Concat module, the output result of the C2PSA module is also used as the input of the first Upsample module and the fourth Concat module, the first Upsample module, the first Concat module, the fifth C3k2 module, the second Upsample module, the second Concat module and the sixth C3k2 module are arranged in sequence, the output result of the sixth C3k2 module is also used as the input of the sixth Conv module, the sixth Conv module, the third Concat module, the seventh C3k2 module, the seventh Conv module, the fourth Concat module and the eighth C3k2 module are arranged in sequence, and the output result of the first Concat module is also used as another input of the seventh C3k2 module;
[0014] The first Head structure includes a first Detect module, a second Detect module and a third Detect module. The output result of the sixth C3k2 module is also used as the input of the first Detect module, the output result of the seventh C3k2 module is also used as the input of the second Detect module, and the output result of the eighth C3k2 module is also used as the input of the third Detect module.
[0015] Preferably, in step S2, the SMAttention mechanism is used to recalibrate the feature map of the infrared image with defects, including:
[0016] Performing full average pooling and local average pooling on the feature map to obtain global features and local features of the feature map respectively;
[0017] After sequentially performing deformation and permutation operations and a first convolution operation on the local features, weighted processing is performed on the processed local features to obtain a local attention weight;
[0018] After sequentially performing a dimension transformation operation and a second convolution operation on the global features, weighting the processed global features to obtain a global attention weight;
[0019] Using an activation function to activate and output the local attention weights to obtain a first result, using an activation function to activate and output the local attention weights, and performing an adaptive pooling operation to obtain a second result;
[0020] The first result and the second result are feature-fused, and are element-by-element multiplied with the original features of the infrared image with defects acquired in step S1 to obtain a feature map after recalibration.
[0021] Furthermore, in step S2, a three-layer SMAttention mechanism is added to the Neck part of the YOLOv11n model.
[0022] Furthermore, the YOLOv11n-SMAttention model includes a second Backbone structure, a second Neck structure and a second Head structure;
[0023] The second Backbone structure includes a first Conv module, a second Conv module, a first C3k2 module, a third Conv module, a second C3k2 module, a fourth Conv module, a third C3k2 module, a fifth Conv module, a fourth C3k2 module, an SPPF module and a C2PSA module which are arranged in sequence;
[0024] The second Neck structure includes the first to third SMAttention modules, the fifth to eighth C3k2 modules, the first to fourth Concat modules, the first Upsample module, the second Upsample module, the sixth Conv module and the seventh Conv module;
[0025] The output result of the second C3k2 module is also used as the input of the second Concat module, the output result of the third C3k2 module is also used as the input of the first Concat module, the output result of the C2PSA module is also used as the input of the first Upsample module and the fourth Concat module, the first Upsample module, the first Concat module, the fifth C3k2 module, the second Upsample module, the second Concat module and the sixth C3k2 module are arranged in sequence, the output result of the sixth C3k2 module is also used as the input of the first SMAttention module, the first SMAttention module, the sixth Conv module, the third Concat module, the seventh C3k2 module, the second SMAttention module, the seventh Conv module, the fourth Concat module, the eighth C3k2 module and the third SMAttention module are arranged in sequence, and the output result of the fifth C3k2 module is also used as another input of the third Concat module;
[0026] The second Head structure includes a first Detect module, a second Detect module and a third Detect module. The output result of the sixth C3k2 module is also used as the input of the first Detect module, the output result of the seventh C3k2 module is also used as the input of the second Detect module, and the output result of the third SMAttention module is also used as the input of the third Detect module.
[0027] Furthermore, the sixth C3k2 module inputs different feature maps corresponding to the defective infrared image to the first SMAttention module, the seventh C3k2 module inputs different feature maps to the second SMAttention module, and the eighth C3k2 module inputs different feature maps to the third SMAttention module.
[0028] An infrared image defect recognition system based on improved YOLOv11n, the infrared image defect recognition system applies the infrared image defect recognition method as described above, and the infrared image defect recognition system includes:
[0029] An image acquisition module, used for acquiring an infrared image with defects;
[0030] A model improvement module is used to add the SMAttention mechanism to the Neck part of the YOLOv11n model to obtain a YOLOv11n-SMAttention model. The SMAttention mechanism is used to recalibrate the feature map of the infrared image with defects.
[0031] The defect detection module is used to input the infrared image with defects into the YOLOv11n-SMAttention model to detect the defect features of the infrared image and obtain the defect recognition result of the infrared image.
[0032] One of the above technical solutions has the following advantages or beneficial effects:
[0033] The present invention improves the YOLOv11n algorithm. SMAttention can filter out background noise and unimportant information through the attention mechanism, and focus the model's attention on key areas, thereby reducing missed detection rate and false detection rate; the YOLOv11n-SMAttention model improves the detection accuracy by strengthening the focus area of the image, especially the defect area; the YOLOv11n algorithm has the smallest model calculation amount in the YOLOv11 algorithm and is the most suitable algorithm for hardware deployment. It has high efficiency and does not increase excessive calculation burden while greatly improving the model detection capability, and improves the real-time application capability of the model on resource-constrained devices; adding SMAttention to the Neck structure of the YOLOv11n algorithm can optimize the algorithm structure, so that it can more effectively extract the features of infrared images and make full use of spectrum information to improve detection performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0035] Figure 1 is a flow chart of an infrared image defect recognition method provided by an embodiment of the present invention;
[0036] Figure 2 1 is a schematic diagram of the structure of the original YOLOv11n model of the infrared image defect recognition method provided by an embodiment of the present invention;
[0037] Figure 3It is a structural schematic diagram of a YOLOv11n-SMAttention model improved based on a YOLOv11n model in an infrared image defect recognition method provided by an embodiment of the present invention;
[0038] Figure 4 It is an infrared image defect recognition effect diagram of the original YOLOv11n model of the infrared image defect recognition method provided by an embodiment of the present invention;
[0039] Figure 5 It is an infrared image defect recognition effect diagram of the YOLOv11n-SMAttention model improved based on the YOLOv11n model of the infrared image defect recognition method provided by an embodiment of the present invention;
[0040] Figure 6 It is an experimental data diagram of the original YOLOv11n model of the infrared image defect recognition method provided by an embodiment of the present invention and the improved YOLOv11n-SMAttention model based on the YOLOv11n model;
[0041] Figure 7 Schematic diagram of the structure of the SMAttention module of the infrared image defect recognition method provided by an embodiment of the present invention;
[0042] Figure 8 It is a structural schematic diagram of an infrared image defect recognition system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0043] Embodiments of the present invention are described in detail below, examples of which 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 only used to explain the present invention, and cannot be understood as limiting the present invention.
[0044] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0045] With the rapid development of infrared imaging technology, infrared images are increasingly used in military, security, medical and other fields. However, due to the low resolution, high noise, low contrast and other problems of infrared images, traditional image recognition algorithms are difficult to achieve ideal results. In recent years, the YOLO series of algorithms have made remarkable achievements in the field of visible light images with the advantages of end-to-end architecture, real-time processing and efficient target detection.
[0046] The latest YOLOv11 algorithm further optimizes the detection accuracy and speed, significantly improving the performance of the model. However, when directly applying the YOLOv11 algorithm to infrared images, it still faces many technical difficulties and still needs further improvement and optimization.
[0047] Therefore, a method for infrared image defect recognition based on improved YOLOv11n is proposed. Figure 1 As shown, in a preferred embodiment of the present invention, the infrared image defect recognition method comprises the following steps:
[0048] S1: Acquire an infrared image with defects;
[0049] S2: Add the SMAttention mechanism to the Neck part of the YOLOv11n model to obtain the YOLOv11n-SMAttention model. The SMAttention mechanism is used to recalibrate the feature map of the infrared image with defects.
[0050] S3: Input the infrared image with defects into the YOLOv11n-SMAttention model to detect the defect features of the infrared image and obtain the defect recognition result of the infrared image.
[0051] Among them, infrared imaging technology generates images by detecting infrared radiation (mainly thermal radiation) emitted by objects. These images usually reflect the temperature distribution of objects. In infrared images, areas with higher temperatures appear as brighter colors, while areas with lower temperatures appear as darker colors. Unlike visible light images, infrared images usually have lower resolution, more noise, and lower contrast, which makes it difficult to express details and features. Acquiring infrared images with defects means that images with certain defects (such as cracks, temperature anomalies, or structural damage) need to be captured from infrared cameras or thermal imaging equipment. These defective areas can be manifested as abnormal temperature distribution, surface cracks, or local heating. The quality of the image (such as noise, resolution) directly affects the subsequent defect detection performance.
[0052] The YOLO (You Only Look Once) algorithm is a deep learning model widely used for target detection. It detects targets by dividing images into multiple grids. In the YOLOv11n version, the Neck part is responsible for further processing the features extracted by the Backbone so as to locate and classify the target in the Head part. The role of the Neck part is to further optimize and integrate the key information in the image so that the model can effectively identify the target. However, the traditional YOLO model performs poorly when processing low-contrast or high-noise infrared images, because the features of these images are often not obvious and are easily disturbed by noise. In order to enhance the performance of YOLOv11n when processing infrared images, the SMAttention (Spatial-ModalAttention) attention mechanism can be introduced into the Neck part of YOLOv11n. The SMAttention attention mechanism recalibrates the input feature map in a weighted manner, aiming to increase the attention to important areas and suppress the interference of irrelevant areas. Specifically, the SMAttention mechanism first extracts local and global features of the image, and uses different weighting strategies to give different "importances" to the features of different regions, so as to highlight the features of defective areas in infrared images. For example, the SMAttention mechanism weights the low-contrast areas in the image to enhance the model's sensitivity to these areas and improve its performance in infrared images. After adding SMAttention, the Neck part of YOLOv11n can better identify subtle differences in infrared images, making the model more accurate in defect detection.
[0053] In step S3, the infrared image with defects is input into the YOLOv11n model enhanced by SMAttention for defect detection. The core of this process is to use the feature extraction and target detection capabilities of the YOLOv11n model, and recalibrate the image through the SMAttention mechanism, so that the features of the defective area are enhanced, thereby improving the accuracy of detection. The YOLOv11n model can accurately locate the defective area in the image through its structured prediction method, and classify and locate the detected targets through the Head part of the network, and finally output the recognition result.
[0054] Due to the characteristics of infrared images, such as low contrast and high noise, directly applying traditional target detection algorithms may lead to missed detection or false detection. The SMAttention mechanism improves YOLOv11n's attention to defective areas in infrared images by weighting and feature recalibration, so that the model can better capture tiny defects in the image, which may appear as abnormal temperature changes, surface cracks or other structural damage. In this process, the YOLOv11n-SMAttention model can not only output the location of the defective area (marked by a bounding box), but also information such as the defect type and the confidence of the model. Through these output results, users can further perform subsequent analysis, processing or decision-making.
[0055] like Figure 4 , Figure 5 and Figure 6 As shown in the figure, compared with the YOLOv11n algorithm, the YOLOv11n-SMAttention model effectively improves the model detection accuracy, Map@0.5 is increased to 93.5%, and indicators such as Precision, Recall, and Map50-95 are all improved. The model achieves high accuracy on the Map@0.5 indicator. Compared with the original model YOLOv11n, the accuracy is greatly improved, and GFLOPs is only increased by 0.1, without increasing the computational burden too much, ensuring the model's operating efficiency in resource-constrained environments. The YOLOv11n-SMAttention model not only has higher detection performance, but can also run efficiently on mobile devices, solving the shortcomings of the traditional YOLOv11n model in infrared image recognition.
[0056] The present invention improves the YOLOv11n algorithm. SMAttention can filter out background noise and unimportant information through the attention mechanism, and focus the model's attention on key areas, thereby reducing missed detection rate and false detection rate; the YOLOv11n-SMAttention model improves the detection accuracy by strengthening the focus area of the image, especially the defect area; the YOLOv11n algorithm has the smallest model calculation amount in the YOLOv11 algorithm and is the most suitable algorithm for hardware deployment. It has high efficiency and does not increase excessive calculation burden while greatly improving the model detection capability, and improves the real-time application capability of the model on resource-constrained devices; adding SMAttention to the Neck structure of the YOLOv11n algorithm can optimize the algorithm structure, so that it can more effectively extract the features of infrared images and make full use of spectrum information to improve detection performance.
[0057] Preferably, the YOLOv11n model includes a first Backbone structure, a first Neck structure and a first Head structure;
[0058] The first Backbone structure includes a first Conv module, a second Conv module, a first C3k2 module, a third Conv module, a second C3k2 module, a fourth Conv module, a third C3k2 module, a fifth Conv module, a fourth C3k2 module, an SPPF module and a C2PSA module which are arranged in sequence;
[0059] The first Neck structure includes the fifth to eighth C3k2 modules, the first to fourth Concat modules, the first Upsample module, the second Upsample module, the sixth Conv module and the seventh Conv module;
[0060] The output result of the second C3k2 module is also used as the input of the second Concat module, the output result of the third C3k2 module is also used as the input of the first Concat module, the output result of the C2PSA module is also used as the input of the first Upsample module and the fourth Concat module, the first Upsample module, the first Concat module, the fifth C3k2 module, the second Upsample module, the second Concat module and the sixth C3k2 module are arranged in sequence, the output result of the sixth C3k2 module is also used as the input of the sixth Conv module, the sixth Conv module, the third Concat module, the seventh C3k2 module, the seventh Conv module, the fourth Concat module and the eighth C3k2 module are arranged in sequence, and the output result of the first Concat module is also used as another input of the seventh C3k2 module;
[0061] The first Head structure includes a first Detect module, a second Detect module and a third Detect module. The output result of the sixth C3k2 module is also used as the input of the first Detect module, the output result of the seventh C3k2 module is also used as the input of the second Detect module, and the output result of the eighth C3k2 module is also used as the input of the third Detect module.
[0062] Among them, Figure 2 As shown in the figure, the first Backbone structure in the YOLOv11n model gradually extracts image features through multiple convolutions and C3k2 modules, the first Neck structure fuses and enhances features through Concat and Upsample modules to improve the model's perception of objects of different scales, and the first Head structure achieves accurate target classification and positioning through multiple Detect modules.
[0063] Traditional target detection methods, such as convolutional neural networks (CNN) or HOG+SVM based on artificial features, often require complex feature engineering and long training. YOLOv11n automatically extracts image features through deep learning, eliminating the complexity of manually designed features and can better deal with low contrast, high noise and blurred boundary problems in infrared images. It can automatically identify and extract key target features in infrared images, thereby significantly improving detection accuracy.
[0064] Compared with previous versions of YOLO, YOLOv11n has further optimized the network architecture, introduced more efficient feature extraction and multi-scale fusion strategies, and improved the detection capabilities of small targets, long-distance targets, and targets in complex backgrounds. For example, compared with versions such as YOLOv4 or YOLOv5, YOLOv11n can maintain higher accuracy and stability in low-light, blurred or noisy infrared images. Therefore, improving the YOLOv11n model is more advantageous than improving the models of previous versions of YOLO.
[0065] Preferably, in step S2, the SMAttention mechanism is used to recalibrate the feature map of the infrared image with defects, including:
[0066] Performing full average pooling and local average pooling on the feature map to obtain global features and local features of the feature map respectively;
[0067] After sequentially performing deformation and permutation operations and a first convolution operation on the local features, weighted processing is performed on the processed local features to obtain a local attention weight;
[0068] After sequentially performing a dimension transformation operation and a second convolution operation on the global features, weighting the processed global features to obtain a global attention weight;
[0069] Using an activation function to activate and output the local attention weights to obtain a first result, using an activation function to activate and output the local attention weights, and performing an adaptive pooling operation to obtain a second result;
[0070] The first result and the second result are feature-fused, and are element-by-element multiplied with the original features of the infrared image with defects acquired in step S1 to obtain a feature map after recalibration.
[0071] like Figure 7 As shown, Figure 7The module diagram of the SMAttention mechanism. Taking the infrared image detection of power switchgear as an example, SMAttention first performs a local average pooling (local_arv_pool) operation on the input feature map to generate local features. This operation focuses on small areas of the input image and aims to capture detailed information in the image. For example, the unique shape and mark of a specific component in the power switchgear will be effectively expressed through local features. The features (local_arv) formed by local average pooling contain detailed information about the small area and can identify local details such as morphology and texture. Global feature extraction is performed through a global average pooling (global_arv_pool) operation. This process aims to capture the overall contextual information of the image, which is crucial for understanding the relationship between different components in the image. The global feature (global_arv) contains the global information of the image, allowing the model to identify the association between various parts of the image during the detection process.
[0072] After extraction, local features and global features are processed differently to enhance their expressiveness. Local features are processed by "deformation and transposition" to reshape or rearrange feature maps to enhance their expressiveness. This operation helps capture complex local patterns, especially in complex backgrounds or different viewing angles. Deformation can help the network better understand the correlation between different regions and improve the model's recognition accuracy of details. Global features are processed by "dimensional transformation" to adjust the shape and size of feature maps to adapt to subsequent convolution operations. Through dimensional transformation, the model can ensure that the number of channels and size of feature maps meet the input requirements of the network, thereby avoiding errors caused by size mismatch and improving the processing efficiency of the model. After these processes, local features are processed by a special local convolution layer (Conv_local), while global features are processed by a standard convolution operation (Conv). Local convolution operations help capture local details, while global convolution operations help extract complex global features.
[0073] When processing local and global features, the SMAttention mechanism calculates weights through the attention mechanism in order to focus on important features. For global features, the calculated global attention weight (y_global) can reflect the importance of the overall structure of the image. The global attention weight helps the model identify the relationship between different parts of the image, so that the model can comprehensively consider the connection between each part during the detection process, rather than just the individual details. For the image of the power switch cabinet, the global feature can help identify the overall layout of the components and the spatial relationship between them, and improve the understanding of the switch cabinet structure. On the other hand, the local attention weight (y_local) weights the local features through the attention mechanism to indicate the relevance of certain local areas in the image to the task. The local attention weight can highlight the detailed features in the image, such as the shape, texture or color of the electrical components, and help the model identify the target components more accurately. The weighted calculation of local and global features enables the model to pay attention to the details and global structure of the image at the same time, thereby improving the accuracy of detection.
[0074] After the local and global features are weighted by attention, feature fusion and recalibration will be performed. Feature fusion combines the features weighted by global attention (y_global) and the features weighted by local attention (y_local) through addition operations, which can retain the advantages of global and local information, making the model's understanding of the input image more comprehensive. By fusing features at different levels, the model can better identify and understand the key information in the image and improve the ability to detect targets. In addition, after feature fusion, the model combines the weighted local and global features with the original features by element-by-element multiplication, which can better utilize the advantages of the three and help the model retain detail information that may be ignored in the feature extraction process, while avoiding the interference of redundant information, further enhancing the expression ability of the model. This series of steps ultimately obtains a recalibrated feature map, which helps to improve the ability to focus on key information in defect images, thereby helping the model to more accurately detect and identify targets.
[0075] In step S2, a three-layer SMAttention mechanism is added to the Neck part of the YOLOv11n model.
[0076] The purpose of applying the SMAttention mechanism multiple times is to strengthen the attention to important features at different levels, so that the model can better extract and integrate features in multi-level and complex backgrounds, and improve detection accuracy and robustness. Another purpose is to strengthen the attention to important features at multiple levels and different scales, reduce background noise interference, and improve the integration ability of complex features. It allows the model to maintain a stable focus on key features in multi-level and multi-scale feature processing, thereby achieving high-precision and robust target detection in infrared images with complex backgrounds.
[0077] Furthermore, the YOLOv11n-SMAttention model includes a second Backbone structure, a second Neck structure and a second Head structure;
[0078] The second Backbone structure includes a first Conv module, a second Conv module, a first C3k2 module, a third Conv module, a second C3k2 module, a fourth Conv module, a third C3k2 module, a fifth Conv module, a fourth C3k2 module, an SPPF module and a C2PSA module which are arranged in sequence;
[0079] The second Neck structure includes the first to third SMAttention modules, the fifth to eighth C3k2 modules, the first to fourth Concat modules, the first Upsample module, the second Upsample module, the sixth Conv module and the seventh Conv module;
[0080] The output result of the second C3k2 module is also used as the input of the second Concat module, the output result of the third C3k2 module is also used as the input of the first Concat module, the output result of the C2PSA module is also used as the input of the first Upsample module and the fourth Concat module, the first Upsample module, the first Concat module, the fifth C3k2 module, the second Upsample module, the second Concat module and the sixth C3k2 module are arranged in sequence, the output result of the sixth C3k2 module is also used as the input of the first SMAttention module, the first SMAttention module, the sixth Conv module, the third Concat module, the seventh C3k2 module, the second SMAttention module, the seventh Conv module, the fourth Concat module, the eighth C3k2 module and the third SMAttention module are arranged in sequence, and the output result of the fifth C3k2 module is also used as another input of the third Concat module;
[0081] The second Head structure includes a first Detect module, a second Detect module and a third Detect module. The output result of the sixth C3k2 module is also used as the input of the first Detect module, the output result of the seventh C3k2 module is also used as the input of the second Detect module, and the output result of the third SMAttention module is also used as the input of the third Detect module.
[0082] like Figure 3As shown in the figure, the sixth to eighth C3k2 modules are placed at the back end of the Neck structure of the YOLOv11n-SMAttention model, mainly to enhance the feature extraction and representation capabilities. Through these modules, the model can better fuse multi-scale features and improve the recognition ability of objects of different sizes. At the same time, the output of these modules provides deeper feature support for the SMAttention module, so that the attention mechanism can be weighted on higher-level semantic information and optimize the expression of features. By combining these modules with operations such as Concat and Upsample, the model can more effectively fuse features at different levels and further improve the accuracy of target detection. In addition, the output of the sixth to eighth C3k2 modules also provides diversified feature inputs for each Detect module in the Head structure, helping to improve the accuracy and robustness of target detection. The SMAttention module helps the model focus more on important local and global information by adaptively weighting these features, thereby improving the accuracy of target detection. By adding SMAttention after these modules, the model can better fuse and optimize features from different scales, improve the understanding of complex targets and backgrounds, enhance the ability to extract important information, and reduce the interference of irrelevant features, further improving computational efficiency and detection accuracy.
[0083] Furthermore, the sixth C3k2 module inputs different feature maps corresponding to the defective infrared image to the first SMAttention module, the seventh C3k2 module inputs different feature maps to the second SMAttention module, and the eighth C3k2 module inputs different feature maps to the third SMAttention module.
[0084] The sixth C3k2 module inputs different feature maps corresponding to the infrared image with defects to the first SMAttention module, the seventh C3k2 module inputs different feature maps to the second SMAttention module, and the eighth C3k2 module inputs different feature maps to the third SMAttention module. By inputting these feature maps of different levels into the corresponding SMAttention modules, each SMAttention module can automatically adjust the weight of important areas according to the specific information of its input feature map, optimize the focus on defective areas, and thus improve the detection accuracy of defects in infrared images. The SMAttention module can effectively guide the network to focus on defective areas while suppressing the interference of irrelevant backgrounds, thereby enhancing the performance of the model in processing defect detection tasks in infrared images.
[0085] An infrared image defect recognition system based on improved YOLOv11n, such as Figure 8As shown, the infrared image defect recognition system applies the infrared image defect recognition method as described above, and the infrared image defect recognition system includes:
[0086] An image acquisition module 1 is used to acquire an infrared image with defects;
[0087] Model improvement module 2, used for adding the SMAttention mechanism to the Neck part of the YOLOv11n model to obtain the YOLOv11n-SMAttention model, wherein the SMAttention mechanism is used for recalibrating the feature map of the infrared image with defects;
[0088] The defect detection module 3 is used to input the infrared image with defects into the YOLOv11n-SMAttention model to detect the defect features of the infrared image and obtain the defect recognition result of the infrared image.
[0089] This embodiment implements an infrared image defect recognition method and implementation process based on improved YOLOv11n. Please refer to the above embodiments and will not be described one by one here.
[0090] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0091] Although the 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 claims and their equivalents.
Claims
1. A method for infrared image defect recognition based on improved YOLOv11n, characterized in that: The infrared image defect recognition method comprises the following steps: S1: Acquire an infrared image with defects; S2: Add the SMAttention mechanism to the Neck part of the YOLOv11n model to obtain the YOLOv11n-SMAttention model. The SMAttention mechanism is used to recalibrate the feature map of the infrared image with defects. S3: Input the infrared image with defects into the YOLOv11n-SMAttention model to detect the defect features of the infrared image and obtain the defect recognition result of the infrared image.
2. The infrared image defect recognition method according to claim 1, characterized in that: The YOLOv11n model includes a first Backbone structure, a first Neck structure and a first Head structure; The first Backbone structure includes a first Conv module, a second Conv module, a first C3k2 module, a third Conv module, a second C3k2 module, a fourth Conv module, a third C3k2 module, a fifth Conv module, a fourth C3k2 module, an SPPF module and a C2PSA module which are arranged in sequence; The first Neck structure includes the fifth to eighth C3k2 modules, the first to fourth Concat modules, the first Upsample module, the second Upsample module, the sixth Conv module and the seventh Conv module; The output result of the second C3k2 module is also used as the input of the second Concat module, the output result of the third C3k2 module is also used as the input of the first Concat module, the output result of the C2PSA module is also used as the input of the first Upsample module and the fourth Concat module, the first Upsample module, the first Concat module, the fifth C3k2 module, the second Upsample module, the second Concat module and the sixth C3k2 module are arranged in sequence, the output result of the sixth C3k2 module is also used as the input of the sixth Conv module, the sixth Conv module, the third Concat module, the seventh C3k2 module, the seventh Conv module, the fourth Concat module and the eighth C3k2 module are arranged in sequence, and the output result of the first Concat module is also used as another input of the seventh C3k2 module; The first Head structure includes a first Detect module, a second Detect module and a third Detect module. The output result of the sixth C3k2 module is also used as the input of the first Detect module, the output result of the seventh C3k2 module is also used as the input of the second Detect module, and the output result of the eighth C3k2 module is also used as the input of the third Detect module.
3. The infrared image defect recognition method according to claim 1, characterized in that: In step S2, the SMAttention mechanism is used to recalibrate the feature map of the infrared image with defects, including: Performing full average pooling and local average pooling on the feature map to obtain global features and local features of the feature map respectively; After sequentially performing deformation and permutation operations and a first convolution operation on the local features, weighted processing is performed on the processed local features to obtain a local attention weight; After sequentially performing a dimension transformation operation and a second convolution operation on the global features, weighting the processed global features to obtain a global attention weight; Using an activation function to activate and output the local attention weights to obtain a first result, using an activation function to activate and output the local attention weights, and performing an adaptive pooling operation to obtain a second result; The first result and the second result are feature-fused, and are element-by-element multiplied with the original features of the infrared image with defects acquired in step S1 to obtain a feature map after recalibration.
4. The infrared image defect recognition method according to claim 3, characterized in that: In step S2, a three-layer SMAttention mechanism is added to the Neck part of the YOLOv11n model.
5. The infrared image defect recognition method according to claim 4, characterized in that: The YOLOv11n-SMAttention model includes a second Backbone structure, a second Neck structure and a second Head structure; The second Backbone structure includes a first Conv module, a second Conv module, a first C3k2 module, a third Conv module, a second C3k2 module, a fourth Conv module, a third C3k2 module, a fifth Conv module, a fourth C3k2 module, an SPPF module and a C2PSA module which are arranged in sequence; The second Neck structure includes the first to third SMAttention modules, the fifth to eighth C3k2 modules, the first to fourth Concat modules, the first Upsample module, the second Upsample module, the sixth Conv module and the seventh Conv module; The output result of the second C3k2 module is also used as the input of the second Concat module, the output result of the third C3k2 module is also used as the input of the first Concat module, the output result of the C2PSA module is also used as the input of the first Upsample module and the fourth Concat module, the first Upsample module, the first Concat module, the fifth C3k2 module, the second Upsample module, the second Concat module and the sixth C3k2 module are arranged in sequence, the output result of the sixth C3k2 module is also used as the input of the first SMAttention module, the first SMAttention module, the sixth Conv module, the third Concat module, the seventh C3k2 module, the second SMAttention module, the seventh Conv module, the fourth Concat module, the eighth C3k2 module and the third SMAttention module are arranged in sequence, and the output result of the fifth C3k2 module is also used as another input of the third Concat module; The second Head structure includes a first Detect module, a second Detect module and a third Detect module. The output result of the sixth C3k2 module is also used as the input of the first Detect module, the output result of the seventh C3k2 module is also used as the input of the second Detect module, and the output result of the third SMAttention module is also used as the input of the third Detect module.
6. The infrared image defect recognition method according to claim 5, characterized in that: The sixth C3k2 module inputs different feature maps corresponding to the defective infrared image to the first SMAttention module, the seventh C3k2 module inputs different feature maps to the second SMAttention module, and the eighth C3k2 module inputs different feature maps to the third SMAttention module.
7. An infrared image defect recognition system based on improved YOLOv11n, the infrared image defect recognition system applying the infrared image defect recognition method according to any one of claims 1 to 6, characterized in that: The infrared image defect recognition system comprises: An image acquisition module, used for acquiring an infrared image with defects; A model improvement module is used to add the SMAttention mechanism to the Neck part of the YOLOv11n model to obtain the YOLOv11n-SMAttention model. The SMAttention mechanism is used to recalibrate the feature map of the infrared image with defects. The defect detection module is used to input the infrared image with defects into the YOLOv11n-SMAttention model to detect the defect features of the infrared image and obtain the defect recognition result of the infrared image.
Citation Information
Patent Citations
Hyperspectral image preprocessing method based on channel attention
CN118196364A
Underwater moving target detection method and system based on lightweight improved Yolov8
CN118968274A
Object-level infrared-and-visible-light image fusion method based on fully convolutional neural network
WO2024174488A1
Cited By
Lightweight fabric defect multi-scale detection method and system
CN121810668A
A lightweight fabric defect multi-scale detection method and system
CN121810668B