Inverter shell defect detection method based on multi-scale feature interaction network

By using a multi-scale feature interaction network detection method, the problems of low efficiency of manual inspection and limitations of machine learning in inverter casing defect detection are solved, achieving efficient and accurate defect detection and improving the model's adaptability and detection accuracy.

CN121724947APending Publication Date: 2026-03-24CHONGQING UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-17
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing methods for detecting inverter housing defects rely on manual inspection, which is inefficient and susceptible to subjective factors. Machine learning methods have limitations in localization capabilities and robustness, while deep learning methods suffer from limited receptive fields and insufficient multi-scale feature interactions, making it difficult to effectively detect complex and irregular defects in inverter housings.

Method used

A detection method based on a multi-scale feature interaction network is adopted. By introducing a global edge information transmission module, a multi-scale edge information selection module, and a multi-scale attention mechanism module, the focus on the edge information of the inverter casing and the feature fusion capability are enhanced, thereby improving the detection accuracy and adaptability.

Benefits of technology

It achieves efficient and accurate detection of inverter housing defects, improves the model's adaptability and generalization ability, and can better understand target features in complex scenarios, thereby improving detection accuracy and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121724947A_ABST
    Figure CN121724947A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of deep learning, in particular to an inverter shell defect detection method based on a multi-scale feature interaction network, and the method comprises the steps: inputting a to-be-detected inverter shell image into a defect detection model, and outputting an inverter shell defect detection result; the defect detection model introduces a global edge information transfer module into the backbone network, generates edge information feature maps of multiple scales by using a shallow feature layer of the network, and puts the edge information feature maps into the scales of the backbone network for feature fusion; a multi-scale edge information selection module is introduced, and features with higher task correlation are adaptively screened from multi-scale features; a multi-scale attention mechanism module is introduced into the neck network, and the feature fusion capability of the neck network is enhanced through multi-scale feature extraction, an attention mechanism, grouping normalization and convolution operation; and performing target classification and positioning through the detection head to obtain a bounding box, a category label and confidence of the shell defect. According to the invention, the accuracy and adaptive capacity of inverter shell defect detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of deep learning technology, specifically to a method for detecting inverter housing defects based on a multi-scale feature interaction network. Background Technology

[0002] Inverters, as important power conversion devices, can convert direct current (DC) energy into alternating current (AC) energy with fixed frequency and voltage or adjustable frequency and voltage. They are widely used in aerospace, rail transportation, new energy power generation, automobiles, ships, CNC machine tools, industry, and defense, among other fields. As a die-cast housing, an inverter inevitably exhibits numerous defects, with porosity being the most frequent. Therefore, defect detection of the inverter housing is of great significance. Effective defect detection can promptly identify various defects, including porosity, providing a basis for subsequent repairs or treatments, thereby ensuring the safe and stable operation of the inverter.

[0003] Traditional surface defect detection methods rely primarily on manual visual inspection, which is susceptible to significant subjective factors and operator fatigue, often resulting in the omission of small but important defects. This method is costly in terms of manpower and resources, has low efficiency, and produces poor results, limiting its application to random sampling; therefore, it has been gradually abandoned. Currently, manufacturers prefer automated, non-contact inspection.

[0004] The rapid development of image processing technology and machine learning has introduced innovative techniques for the automatic detection of defects on steel surfaces. Machine learning methods involve manually formulating feature extraction rules and applying image processing techniques and classification algorithms to classify defects. Therefore, feature extraction rules play a crucial role in these methods. However, many machine learning-based defect detection techniques are limited in their ability to perform localization and cannot constitute a comprehensive defect detection process. Furthermore, heavy reliance on manually constructed feature extraction rules often leads to limitations in robustness and scalability. The introduction of deep learning technology provides more automated feature extraction and classification capabilities for surface defect detection, overcoming the limitations of traditional machine learning methods. However, existing deep learning-based methods suffer from problems such as limited receptive fields and insufficient multi-scale feature interactions.

[0005] In summary, traditional surface defect detection methods have shortcomings, and while machine learning methods have improved upon them, they still have limitations. Deep learning technology has driven significant breakthroughs in surface defect detection. The YOLO series performs well in target detection, but it also has limitations. Many researchers have proposed innovative methods based on Transformer and multi-branch feature fusion to address the complexity and diversity of various surface defects and improve detection performance. However, these methods still fall short in detecting surface defects on inverter housings that are irregular in shape, vary greatly in size, and are difficult to detect under lighting conditions. Summary of the Invention

[0006] To address the shortcomings of the existing technologies, the technical problem to be solved by this invention is: how to provide a method for detecting inverter housing defects based on a multi-scale feature interaction network. This method enhances the attention to edge information of the inverter housing by introducing a global edge information transmission module, efficiently selects key features of the inverter housing by using a multi-scale edge information selection module, and enhances multi-scale feature fusion by using a multi-scale attention mechanism module, thereby improving the accuracy and adaptability of inverter housing defect detection.

[0007] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:

[0008] A method for detecting inverter housing defects based on multi-scale feature interaction networks includes:

[0009] S1: Obtain an image of the inverter housing to be inspected;

[0010] S2: Input the image of the inverter housing to be detected into the trained defect detection model, and output the corresponding inverter housing defect detection result;

[0011] The processing steps of the defect detection model include:

[0012] S201: Multi-scale feature extraction is performed on the input inverter housing image through the backbone network to obtain features at multiple scales; in the backbone network, a global edge information transmission module is introduced to generate edge information feature maps at multiple scales using the shallow feature layers of the network and project them into various scales of the backbone network for feature fusion; a multi-scale edge information selection module is introduced to adaptively select features with higher task relevance from the multi-scale features.

[0013] S202: Feature fusion and enhancement of features at multiple scales are performed through the neck network to obtain fused and enhanced features at multiple scales;

[0014] In the neck network, a multi-scale attention mechanism module is introduced to enhance the feature fusion capability of the neck network;

[0015] S203: The target is classified and located by the detection head based on the fusion enhancement features of multiple scales, and the bounding box, category label and confidence of the casing defect are obtained as the output of the defect detection model as the inverter casing defect detection result.

[0016] Preferably, in step S201, the backbone network includes a cascaded first convolutional layer, a second convolutional layer, a first multi-scale edge information selection module, a third convolutional layer, a second multi-scale edge information selection module, a first feature fusion module, a fourth convolutional layer, a third multi-scale edge information selection module, a second feature fusion module, a fifth convolutional layer, a fourth multi-scale edge information selection module, a third feature fusion module, an SPPF module, and a C2PSA module;

[0017] The output of the first multi-scale edge information selection module is connected to the multi-scale edge information generator; the output of the multi-scale edge information generator is respectively input to the first feature fusion module, the second feature fusion module and the third feature fusion module.

[0018] The outputs of the first feature fusion module, the second feature fusion module, and the C2PSA module serve as the features of the backbone network output at three scales.

[0019] The multi-scale edge information generator and various feature fusion modules together form the global edge information transmission module.

[0020] Preferably, the processing steps of the multi-scale edge information generator include:

[0021] Edge features of the input features are calculated using a convolution module based on the Sobel operator;

[0022] Multi-scale edge features are obtained by performing multiple max pooling operations on the edge features through cascaded max pooling layers.

[0023] By adjusting the number of channels for edge features at each scale through 1×1 convolution, a multi-scale edge feature set output by the multi-scale edge information generator is obtained.

[0024] The calculation formula for the multi-scale edge information generator is expressed as follows:

[0025] ;

[0026] In the formula: Represents a multi-scale edge feature set; Indicates the first Edge features at various scales; Indicates the number of scales.

[0027] Preferably, the processing steps of the convolution module based on the Sobel operator include:

[0028] Expand the dimensions of the input features;

[0029] The horizontal edge information is obtained by extracting edge information from the expanded features using the horizontal square kernel of the Sobel operator;

[0030] The horizontal square kernel of the Sobel operator is represented as:

[0031] ;

[0032] The vertical edge information is obtained by extracting edge information from the expanded features using the vertical square kernel of the Sobel operator;

[0033] The vertical square kernel of the Sobel operator is represented as:

[0034] ;

[0035] The horizontal and vertical edge information are added together to obtain the edge features of the input feature;

[0036] The formula is expressed as:

[0037] ;

[0038] In the formula: Representing input features Edge features; and These represent horizontal edge information and vertical edge information, respectively.

[0039] Preferably, the processing steps of the feature fusion module include:

[0040] The multi-scale edge feature set output by the multi-scale edge information generator and the feature to be fused are concatenated along the channel dimension to obtain the initial fused feature;

[0041] The initial fused features are input into a cascaded 1×1 convolutional layer, a 3×3 convolutional layer, and a 1×1 convolutional layer to obtain the edge fused features output by the feature fusion module.

[0042] Preferably, the processing steps of the multi-scale edge information selection module include:

[0043] The input features are fed into a cascaded adaptive average pooling layer, a 1×1 convolutional layer, a 3×3 depthwise separable convolutional layer, an upsampling module, and an edge enhancement module to obtain edge enhancement features.

[0044] The input features are fed into a 3×3 convolutional layer and then concatenated with the edge enhancement features to obtain the concatenated features.

[0045] The stitching features are input into the DSM module to obtain enhanced stitching features;

[0046] The enhanced splicing features are input into the convolutional layer and the number of channels is adjusted to obtain the edge fusion enhancement features output by the multi-scale edge information selection module.

[0047] Preferably, the processing steps of the edge enhancement module include:

[0048] Obtain the number of channels for the input features;

[0049] The input features are fed into the average pooling layer to obtain local background information;

[0050] Edge information is obtained by subtracting local background information from input features;

[0051] After the edge information is input into the convolutional layer and nonlinearly adjusted, the output of the convolutional layer is added to the input features to obtain the edge enhancement features output by the edge enhancement module.

[0052] Preferably, in step 202, the neck network includes a cascaded first upsampling module, a first connection layer, a first C3k2 module, a second upsampling module, a second connection layer, a second C3k2 module, a first multi-scale attention mechanism module, a first convolutional layer, a third connection layer, a third C3k2 module, a second multi-scale attention mechanism module, a second convolutional layer, a fourth connection layer, a fourth C3k2 module, and a third multi-scale attention mechanism module;

[0053] In the backbone network, the features at three scales output by the first feature fusion module, the second feature fusion module, and the C2PSA module are respectively input to the first connection layer, the second connection layer, and the fourth connection layer; the output of the first C3k2 module is input to the third connection layer.

[0054] The outputs of the first, second, and third multi-scale attention mechanism modules serve as fusion enhancement features of the three scales of the neck network output.

[0055] Preferably, the processing steps of the multi-scale attention mechanism module include:

[0056] The input features are reshaped to obtain the reshaped features;

[0057] After performing horizontal and vertical global average pooling on the reshaped features, the outputs of the horizontal and vertical global average pooling are concatenated along the spatial dimension and then fused through a 1x1 convolutional layer to obtain the fused features.

[0058] After inputting the fused features into the Sigmoid activation function layer and the grouping normalization layer, the Softmax function and global average pooling are applied respectively to obtain the first feature map and the second feature map.

[0059] After the reshaped features are input into a 3×3 convolutional layer, they are processed by the Softmax function and global average pooling respectively to obtain the third feature map and the fourth feature map.

[0060] Perform matrix multiplication on the first feature map and the fourth feature map to obtain the first spatial feature map;

[0061] Perform matrix multiplication on the second feature map and the third feature map to obtain the second spatial feature map;

[0062] The attention weights are obtained by adding the first spatial feature map and the second spatial feature map element by element.

[0063] The attention weights are non-linearly adjusted using the Sigmoid function and then multiplied with the reshaped features to obtain the weighted features. The weighted features are then reshaped back to the shape of the input features to obtain the multi-scale attention enhancement features output by the multi-scale attention mechanism module.

[0064] The preferred formula for horizontal global average pooling is as follows:

[0065] ;

[0066] The formula for vertical global average pooling is expressed as:

[0067] ;

[0068] The formula for global average pooling is expressed as:

[0069] ;

[0070] In the formula: This indicates that the horizontal average pooling is applied across the width of the target area. Location feature values; This indicates vertical average pooling at height. Location feature values; The eigenvalues ​​represent the features of global average pooling; Indicates the input feature map; Indicates the height of the feature map; Indicates the width of the feature map; The index representing the height during vertical pooling; The index representing the width during horizontal pooling.

[0071] Compared with existing technologies, the inverter housing defect detection method based on multi-scale feature interaction network in this invention has the following advantages:

[0072] The Global Edge Information Transfer (GEIT) module of this invention combines a Sobel-based convolution module (Sobel Conv) with a multi-scale edge information generator (MutilScale EdgeInfo Genetator) to extract edge information from the inverter housing surface at different scales. This allows for a more comprehensive capture of the inverter housing's shape and structural features. This multi-scale feature extraction approach helps the model better understand the details of the target, improving its ability to detect inverter housing targets in complex scenes. Simultaneously, by designing a feature fusion module (Conv Edge Fusion) within the GEIT module, the model effectively integrates features from different sources using convolution operations. This enhances the model's comprehensive understanding of the inverter housing features, enabling it to make more accurate judgments when detecting targets, thereby improving the accuracy of inverter housing defect detection.

[0073] This invention employs a Multi-Scale Edge Information Select module, which downsamples input features to different scales through adaptive pooling. An Edge Enhancer module further processes features at each scale, and a Dual Domain Selection (DSM) module selectively fuses multi-scale features to generate more discriminative feature representations. This achieves efficient selection of key features highly relevant to the target task from multi-scale edge information, helping the model better understand the details of the target. Specifically, the Edge Enhancer module extracts local background information and highlights edge features, further enhancing edge information through nonlinear adjustments. This also improves the model's comprehensive understanding of target features, enabling more accurate judgments when detecting targets. Furthermore, the design of the Multi-Scale Edge Information Select module allows for the integration of multi-scale edge information enhancement mechanisms at different stages and layers, enabling the model to adaptively adjust and optimize according to specific task requirements. This improves the model's scalability and adaptability to inverter housing defect detection.

[0074] The Efficient Multi-scale Attention (EMA) module of this invention improves model performance through multi-scale feature extraction, attention mechanisms, grouping normalization, and efficient convolutional operations. Specifically, it captures global information of feature maps at different scales through horizontal and vertical pooling operations, weights attention weights calculated using the Softmax function and matrix multiplication to perform weighted fusion of features, enhancing the representation ability of important features, reducing the correlation between different channels through grouping normalization, improving the model's generalization ability, and adjusting the number of feature channels and capturing local features through 1×1 and 3×3 convolutions, thus reducing computational complexity. Furthermore, the multi-scale attention mechanism module achieves performance improvement with only a slight increase in the number of parameters and computational complexity. The grouping convolution strategy effectively reduces resource overhead, ensuring practical deployment capability on resource-constrained devices, thereby further improving the adaptability of inverter casing defect detection. Attached Figure Description

[0075] To make the objectives, technical solutions, and advantages of the invention clearer, the invention will now be described in further detail with reference to the accompanying drawings, wherein:

[0076] Figure 1 This is a logic block diagram of an inverter housing defect detection method based on a multi-scale feature interaction network.

[0077] Figure 2 This is a network structure diagram of the Global Edge Information Transfer (GEIT) module.

[0078] Figure 3 This is a network structure diagram of the Edge Enhancer module.

[0079] Figure 4 This is a network structure diagram for the Multi Scale Edge Information Select module.

[0080] Figure 5 This is a network structure diagram of the Efficient Multi-scale Attention (EMA) module.

[0081] Figure 6 This is a diagram of the pore sample used in the experiment.

[0082] Figure 7 The diagram shows the thermal effects of different models in the experiment. Detailed Implementation

[0083] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but only to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0084] The following detailed explanation illustrates the specific implementation methods:

[0085] Example:

[0086] This embodiment discloses a method for detecting inverter housing defects based on a multi-scale feature interaction network.

[0087] like Figure 1 As shown, the inverter housing defect detection method based on multi-scale feature interaction network includes:

[0088] S1: Obtain an image of the inverter housing to be inspected;

[0089] S2: Input the image of the inverter housing to be detected into the trained defect detection model, and output the corresponding inverter housing defect detection result;

[0090] The processing steps of the defect detection model include:

[0091] S201: Multi-scale feature extraction is performed on the input inverter housing image through the backbone network to obtain features at multiple scales;

[0092] In the backbone network, a Global Edge Information Transfer (GEIT) module is introduced to generate edge information feature maps at multiple scales using the shallow feature layers of the network and project them into various scales of the backbone network for feature fusion; a multi-scale edge information selection module is introduced to adaptively select features with higher task relevance from multi-scale features.

[0093] S202: Feature fusion and enhancement of features at multiple scales are performed through the neck network to obtain fused and enhanced features at multiple scales;

[0094] In the neck network, a multi-scale attention mechanism module is introduced to enhance the feature fusion capability of the neck network through multi-scale feature extraction, attention mechanism, group normalization and convolution operation;

[0095] S203: The target is classified and located by the detection head based on the fusion enhancement features of multiple scales, and the bounding box, category label and confidence of the casing defect are obtained as the output of the defect detection model as the inverter casing defect detection result.

[0096] To better illustrate the technical solution of the present invention, this embodiment is described in the following parts.

[0097] I. Backbone Network

[0098] like Figure 1 As shown, the backbone network includes a cascaded first convolutional layer, a second convolutional layer, a first multi-scale edge information selection module, a third convolutional layer, a second multi-scale edge information selection module, a first feature fusion module, a fourth convolutional layer, a third multi-scale edge information selection module, a second feature fusion module, a fifth convolutional layer, a fourth multi-scale edge information selection module, a third feature fusion module, an SPPF module, and a C2PSA module.

[0099] The output of the first multi-scale edge information selection module is connected to the multi-scale edge information generator; the output of the multi-scale edge information generator is respectively input to the first feature fusion module, the second feature fusion module and the third feature fusion module.

[0100] The outputs of the first feature fusion module, the second feature fusion module, and the C2PSA module serve as the features of the backbone network output at three scales.

[0101] The multi-scale edge information generator and various feature fusion modules together form the global edge information transmission module.

[0102] In this embodiment, the SPPF (Spatial Pyramid Pooling - Fast) module refers to the fast spatial pyramid pooling module, and the C2PSA (Cross Stage Partial + Parallel Spatial Attention) module refers to the cross-stage local parallel spatial attention module. Both of them adopt existing mature modules.

[0103] II. Global Edge Information Transfer (GEIT) Module

[0104] To address the challenge of accurately capturing multi-scale changes in shape and scale for targets with significant multi-scale features, this invention introduces, for example, [missing information - likely related to network architecture]. Figure 2 The Global Edge Information Transfer (GEIT) module shown in the diagram extracts edge features from the shell surface and combines them with multi-scale analysis to achieve efficient detection and localization of pores.

[0105] 1. Convolution module based on Sobel operator (Sobel Conv)

[0106] To extract edge information from the inverter housing surface, a convolution module based on the Sobel operator was designed. The Sobel operator is a classic edge detection algorithm that can effectively calculate the horizontal and vertical gradients of an image. Specifically, two 3×3 convolution kernels are defined, corresponding to the horizontal and vertical kernels of the Sobel operator, as follows:

[0107] ;

[0108] ;

[0109] These two convolutional kernels are used to compute edge information in the horizontal and vertical directions, respectively. Through a 3×3 convolution operation, the dimension of the input feature x is expanded to [B, C, 1, H, W], and the aforementioned convolutional kernels are applied to extract edge information. Finally, the edge information from both directions is added together to obtain the fused edge features.

[0110] ;

[0111] In the formula: Representing input features Edge features; and These represent horizontal and vertical edge information, respectively. To maintain the accuracy of edge detection, the weights of the Sobel Conv module remain fixed during training.

[0112] Specifically, the processing steps of the convolution module based on the Sobel operator include:

[0113] Expand the dimensions of the input feature x to [B,C,1,H,W];

[0114] The horizontal edge information is obtained by extracting edge information from the expanded features using the horizontal square kernel of the Sobel operator;

[0115] The vertical edge information is obtained by extracting edge information from the expanded features using the vertical square kernel of the Sobel operator;

[0116] The horizontal and vertical edge information are added together to obtain the edge features of the input feature.

[0117] 2. Multiscale Edge Info Generator

[0118] Since the original image contains a lot of background information, directly extracting edge information from the original image and passing it to the entire backbone will introduce noise into the network's learning. Moreover, shallow convolutional layers help filter out unnecessary background information. Therefore, this invention chooses to develop a multi-scale edge information generator in the shallow layers of the network. It will use the shallow feature layers of the network to generate edge information feature maps of multiple scales and put them into the various scales of the backbone for fusion.

[0119] The multi-scale edge information generator downsamples edge features through max pooling and adjusts the number of channels using 1×1 convolutions to generate edge features at different scales. Specifically, the input feature x first calculates edge features using the Sobel Conv module, then generates multi-scale edge features through multiple max pooling operations. Each scale's features are adjusted for channel counts using 1×1 convolutions, ultimately outputting a list containing multi-scale edge features—the multi-scale edge feature set.

[0120] ;

[0121] In the formula: Represents a multi-scale edge feature set; Indicates the first Edge features at various scales; Indicates the number of scales.

[0122] Specifically, the processing steps of the multi-scale edge information generator include:

[0123] Edge features of the input features are calculated using a convolution module based on the Sobel operator;

[0124] Multi-scale edge features are obtained by performing multiple max pooling operations on the edge features through cascaded max pooling layers.

[0125] By adjusting the number of channels for edge features at each scale using 1×1 convolution, a multi-scale edge feature set output by the multi-scale edge information generator is obtained.

[0126] 3. Feature Fusion Module (Conv Edge Fusion)

[0127] To fuse the multi-scale edge feature set with the original features to be fused, a feature fusion module was designed. The feature fusion module first concatenates the input multi-scale edge features with the original features along the channel dimension, and then fuses the channel information through a 1×1 convolution. To further extract features, this invention introduces a 3×3 convolutional layer for extracting the fused features. Finally, another 1×1 convolution is used to adjust the number of channels, generating the enhanced features.

[0128] The formula is expressed as:

[0129] ;

[0130] in, This indicates a concatenation operation at the channel dimension.

[0131] Specifically, the processing steps of the feature fusion module include:

[0132] The multi-scale edge feature set output by the multi-scale edge information generator and the feature to be fused are concatenated along the channel dimension to obtain the initial fused feature;

[0133] The initial fused features are input into a cascaded 1×1 convolutional layer, a 3×3 convolutional layer, and a 1×1 convolutional layer to obtain the edge fused features output by the feature fusion module.

[0134] The Global Edge Information Transfer (GEIT) module of this invention combines a Sobel-based convolution module (Sobel Conv) with a multi-scale edge information generator (MutilScale EdgeInfo Genetator) to extract edge information from the inverter housing surface at different scales. This allows for a more comprehensive capture of the inverter housing's shape and structural features. This multi-scale feature extraction approach helps the model better understand the details of the target, improving its ability to detect inverter housing targets in complex scenes. Simultaneously, by designing a feature fusion module (Conv Edge Fusion) within the GEIT module, the model effectively integrates features from different sources using convolution operations. This enhances the model's comprehensive understanding of the inverter housing features, enabling it to make more accurate judgments when detecting targets, thereby improving the accuracy of inverter housing defect detection.

[0135] III. Multi-Scale Edge Information Select Module

[0136] To efficiently select key features highly relevant to the target task from multi-scale edge information, a multi-scale edge information selection module, C3K2-M, was designed. To achieve this, this invention introduces a Dual-Domain Selection Mechanism (DSM) module with the ability to focus on more important regions. This mechanism adaptively filters features with higher task relevance from multi-scale features by focusing on more important regions in the image (such as complex edges and high-frequency signal regions), thereby significantly improving the accuracy of feature selection and overall model performance.

[0137] 1. Edge Enhancer Module

[0138] To enhance the edge information of the input features, an edge enhancement module was designed. This module extracts local background information and highlights edge features, further enhancing the edge information through non-linear adjustments. The edge enhancement module accepts the number of channels of the input features as a parameter and defines a convolutional layer with a sigmoid activation function for non-linear adjustment. In addition, the edge enhancement module also defines an average pooling layer to extract local background information.

[0139] The input features are first passed through an average pooling layer to obtain local background information. Then, edge information is calculated by subtracting the local background information from the input features, and this edge information is fed into a convolutional layer for non-linear adjustment. Finally, the adjusted edge information is added to the original features to obtain the edge-enhanced features.

[0140] Combination Figure 3 As shown, the processing steps of the edge enhancement module include:

[0141] Obtain the number of channels for the input features;

[0142] The input features are fed into the average pooling layer to obtain local background information;

[0143] Edge information is obtained by subtracting local background information from input features;

[0144] After the edge information is input into the convolutional layer and nonlinearly adjusted, the output of the convolutional layer is added to the input features to obtain the edge enhancement features output by the edge enhancement module.

[0145] 2. Multi-Scale Edge Information Select Module

[0146] To further enhance the model's ability to perceive multi-scale features, this invention designs a multi-scale edge information selection module. This module downsamples the input features to different scales through adaptive pooling operations, and further processes the features at each scale through an edge enhancement module. Finally, a dual-domain selection mechanism (DSM) is used to selectively fuse multi-scale features to generate a more discriminative feature representation.

[0147] The multi-scale edge information selection module accepts the number of channels of the input features and a list of multi-scale target sizes as parameters. For each scale, the module defines a feature extraction path, including an adaptive average pooling layer, a 1×1 convolutional layer, and a 3×3 depthwise separable convolutional layer. Additionally, the module defines a list of edge enhancement modules to enhance the features at each scale. Finally, the module processes the original features through a 3×3 convolutional layer and fuses the multi-scale features with the final convolutional layer using a dual-domain selection mechanism. The input features are first processed to obtain an enhanced representation of the original features. Subsequently, the module performs downsampling, feature extraction, and edge enhancement operations on the features at each scale, and upsamples the features to their original size using bilinear interpolation. Features from all scales are selectively fused using a dual-domain selection mechanism, and the final fused features are generated by adjusting the number of channels.

[0148] Combination Figure 4 As shown, the processing steps of the multi-scale edge information selection module include:

[0149] The input features are fed into a cascaded adaptive average pooling layer, a 1×1 convolutional layer, a 3×3 depthwise separable convolutional layer, an upsampling module, and an edge enhancement module to obtain edge enhancement features.

[0150] The input features are fed into a 3×3 convolutional layer and then concatenated with the edge enhancement features to obtain the concatenated features.

[0151] The stitching features are input into the DSM module to obtain enhanced stitching features;

[0152] The enhanced splicing features are input into the convolutional layer and the number of channels is adjusted to obtain the edge fusion enhancement features output by the multi-scale edge information selection module.

[0153] In this embodiment, the Dual-Domain Selection Mechanism (DSM) module uses an existing mature module.

[0154] 3. Integration of multi-scale edge information selection module

[0155] To integrate the multi-scale edge information select module into existing deep learning architectures, this invention designs two improved modules: C3k_M and C3k2_M. These two modules inherit from C3k and C3k2 respectively, and enhance feature extraction capabilities by embedding the multi-scale edge information select module.

[0156] C3k_M: This module further enhances the edge information and multi-scale perception capabilities of features by embedding a multi-scale edge information selection module on top of C3k.

[0157] C3k2_M (Module used in this invention): This module further expands the functionality of C3k2, supports more flexible network configuration, and adapts to different application scenarios by selectively using C3k_M or the multi-scale edge information selection module.

[0158] This invention employs a Multi-Scale Edge Information Select module, which downsamples input features to different scales through adaptive pooling. An Edge Enhancer module further processes features at each scale, and a Dual Domain Selection (DSM) module selectively fuses multi-scale features to generate more discriminative feature representations. This achieves efficient selection of key features highly relevant to the target task from multi-scale edge information, helping the model better understand the details of the target. Specifically, the Edge Enhancer module extracts local background information and highlights edge features, further enhancing edge information through nonlinear adjustments. This also improves the model's comprehensive understanding of target features, enabling more accurate judgments when detecting targets. Furthermore, the design of the Multi-Scale Edge Information Select module allows for the integration of multi-scale edge information enhancement mechanisms at different stages and layers, enabling the model to adaptively adjust and optimize according to specific task requirements. This improves the model's scalability and adaptability to inverter housing defect detection.

[0159] This invention further extracts edge information from the inverter housing surface at different scales through a multi-scale edge information selection module, capturing the shape and structural features of the inverter housing, which helps the model better understand the details of the target. Simultaneously, by introducing an edge enhancer module and a DSM module into the multi-scale edge information selection module to integrate features at different scales, it also enhances the model's comprehensive understanding of target features, enabling the model to make more accurate judgments when detecting targets. Furthermore, the design of the multi-scale edge information selection module allows for the integration of multi-scale edge information enhancement mechanisms at different stages and layers, enabling the model to adaptively adjust and optimize according to specific task requirements, thereby improving the model's scalability and adaptability to inverter housing defect detection.

[0160] IV. Neck Network

[0161] like Figure 1As shown, the neck network includes a cascaded first upsampling module, a first connection layer, a first C3k2 module, a second upsampling module, a second connection layer, a second C3k2 module, a first multi-scale attention mechanism module, a first convolutional layer, a third connection layer, a third C3k2 module, a second multi-scale attention mechanism module, a second convolutional layer, a fourth connection layer, a fourth C3k2 module, and a third multi-scale attention mechanism module.

[0162] In the backbone network, the features at three scales output by the first feature fusion module, the second feature fusion module, and the C2PSA module are respectively input to the first connection layer, the second connection layer, and the fourth connection layer; the output of the first C3k2 module is input to the third connection layer.

[0163] The outputs of the first, second, and third multi-scale attention mechanism modules serve as fusion enhancement features of the three scales of the neck network output.

[0164] In this embodiment, the C3k2 module refers to a module with a C3 kernel size of 2 or a C3 module with dual convolution kernels, and it uses an existing mature module.

[0165] V. Efficient Multi-scale Attention (EMA) Module

[0166] To enhance the multi-scale perception capability of features and thus improve the performance of the model, this invention introduces an efficient multi-scale attention mechanism, the EMA module.

[0167] The EMA module enhances model performance through multi-scale feature extraction, attention mechanisms, grouping normalization, and efficient convolutional operations. It captures global information from feature maps at different scales through horizontal and vertical pooling operations, and calculates attention weights using Softmax and matrix multiplication to weightedly fuse features, enhancing the representation of important features. Grouping normalization reduces correlation between different channels, improving the model's generalization ability, while 1×1 and 3×3 convolutions adjust the number of channels in the features and capture local features, reducing computational complexity.

[0168] like Figure 5 As shown, the processing steps of the multi-scale attention mechanism module include:

[0169] The input features are reshaped to obtain the reshaped features (b × self.groups, c / / self.groups, h, w);

[0170] After performing horizontal and vertical global average pooling on the reshaped features, the outputs of the horizontal and vertical global average pooling are concatenated along the spatial dimension and fused through a 1x1 convolutional layer to obtain the fused features; wherein, the features of the vertical global average pooling are transposed to match the shape of the features of the horizontal global average pooling.

[0171] After inputting the fused features into the Sigmoid activation function layer and the grouping normalization layer, the Softmax function and global average pooling are applied respectively to obtain the first feature map and the second feature map.

[0172] After the reshaped features are input into a 3×3 convolutional layer, they are processed by the Softmax function and global average pooling respectively to obtain the third feature map and the fourth feature map.

[0173] Perform matrix multiplication on the first feature map and the fourth feature map to obtain the first spatial feature map;

[0174] Perform matrix multiplication on the second feature map and the third feature map to obtain the second spatial feature map;

[0175] The attention weights are obtained by adding the first spatial feature map and the second spatial feature map element by element.

[0176] The attention weights are non-linearly adjusted using the Sigmoid function and then multiplied with the reshaped features to obtain the weighted features. The weighted features are then reshaped back to the shape (b, c, h, w) of the input features to obtain the multi-scale attention enhancement features output by the multi-scale attention mechanism module.

[0177] in:

[0178] The formula for horizontal global average pooling is expressed as:

[0179] ;

[0180] The formula for vertical global average pooling is expressed as:

[0181] ;

[0182] The formula for global average pooling is expressed as:

[0183] ;

[0184] In the formula: This indicates that the horizontal average pooling is applied across the width of the target area. Location feature values; This indicates vertical average pooling at height. Location feature values; The eigenvalues ​​represent the features of global average pooling; Indicates the input feature map; Indicates the height of the feature map; Indicates the width of the feature map; The index representing the height during vertical pooling; The index representing the width during horizontal pooling.

[0185] The Efficient Multi-scale Attention (EMA) module of this invention improves model performance through multi-scale feature extraction, attention mechanisms, grouping normalization, and efficient convolutional operations. Specifically, it captures global information of feature maps at different scales through horizontal and vertical pooling operations, weights attention weights calculated using the Softmax function and matrix multiplication to perform weighted fusion of features, enhancing the representation ability of important features, reducing the correlation between different channels through grouping normalization, improving the model's generalization ability, and adjusting the number of feature channels and capturing local features through 1×1 and 3×3 convolutions, thus reducing computational complexity. Furthermore, the multi-scale attention mechanism module achieves performance improvement with only a slight increase in the number of parameters and computational complexity. The grouping convolution strategy effectively reduces resource overhead, ensuring practical deployment capability on resource-constrained devices, thereby further improving the adaptability of inverter casing defect detection.

[0186] VI. Experimental Instructions

[0187] To better illustrate the advantages of the technical solution of the present invention, the following experiment is disclosed in this embodiment.

[0188] 1. Dataset Construction

[0189] To verify the accuracy of the proposed model, a dataset of inverter casing vents was constructed in collaboration with a company. Specific samples are shown below. Figure 6 As shown. A total of 812 images of original pore defects were collected in the experiment. After data augmentation, the original defects were expanded to a total of 2000 images. To avoid data overlap, the data were divided into training set, validation set and test set in a ratio of 18:1:1, with sample sizes of 1786, 107 and 107 respectively.

[0190] 2. Model training parameters

[0191] The deep learning experimental environment for this experiment was configured as follows: CPU: 12th Gen Intel(R) Core(TM) i5-12400F; GPU: NVIDIA GeForce RTX 4060; compiler: Python 3.10.15; deep learning framework: PyTorch 2.2.1; acceleration module: CUDA 12.1. The hyperparameters configured during the experiment were as follows: Epochs: 200; Batch size: 16; Optimizer: SGD; Ir: 0.01; Momentum: 0.937.

[0192] 3. Evaluation Indicators

[0193] To quantitatively analyze the detection performance of different target models, three metrics are typically used to evaluate the models: precision (P), recall (R), and mean average precision (mAP). The definitions of P, R, and mAP are shown in the formulas below:

[0194] ;

[0195] ;

[0196] ;

[0197] Where P represents the percentage of real samples that are correctly identified, R represents the percentage of identified samples out of the total samples, mAP represents the mean of the average precision of all samples, TP represents the number of correctly classified positive examples, FN and FP represent the number of misclassified positive and negative examples, respectively, AP represents the detection precision of the model for different categories, and K represents the number of detection categories.

[0198] 4. Experimental Analysis

[0199] 4.1 Effectiveness Analysis of the Global Edge Information Transfer (GEIT) Module

[0200] To verify the effectiveness of the improved backbone network, the module proposed in this invention was compared with various improved backbone modules, such as: efficientViT, fasternet, timm, convnextv2, and Lsknet. The experimental results are as follows.

[0201] Table 1 Comparative experimental results of different trunk improvements

[0202]

[0203] Under the same conditions, the GEIT module designed in this invention performs best, outperforming other backbone improvement modules. The GEIT module has an accuracy of 0.828, which is 13.3 percentage points higher than the Lsknet module with the lowest accuracy; its mAP50 value is 0.856, surpassing all modules. The previously proposed efficientViT module has an mAP50 value of only 0.846, which is 0.9 percentage points lower than the module proposed in this invention; its mAP50-95 value is 0.395, surpassing all other improvement modules and leading the Lsknet module by 1.9 percentage points.

[0204] The GEIT module, by combining Sobel Conv with the MultiScale Edge Info Genetator, extracts edge information from different scales, capturing the shape and structural features of targets more comprehensively. This multi-scale feature extraction approach helps the model better understand the details of targets and improves the ability to detect targets in complex scenes. The ConvEdgeFusion design effectively integrates features from different sources through convolutional operations, enhancing the model's comprehensive understanding of target features and enabling the model to make more accurate judgments when detecting targets. Therefore, in comparisons with various backbone improvement modules, the GEIT module consistently outperforms in several key metrics.

[0205] 4.2 Effectiveness Analysis of Multi-Scale Edge Information Selection

[0206] To verify the effectiveness of the C3K2-M improvement, the module proposed in this invention was compared with several improved C3K2 modules, such as C3k2-AdditiveBlock-CGLU, C3k2-AdditiveBlock, and C3k2-Mutil Scale EdgeInformation Enhance (C3k2-MSEIE). The experimental results are as follows.

[0207] Table 2 Comparative experimental results of different module improvements

[0208]

[0209] Under the same conditions, the C3k2-M model designed in this invention performs best, outperforming other improved C3K2 modules. The C3k2-M model has an accuracy of 0.799, which is 2.2 percentage points higher than the Lskne module with the lowest accuracy. Its mAP50 value is 0.872, surpassing all other modules. The earliest proposed C3k2-AdditiveBlock-CGLU module has an mAP50 value of only 0.965, 0.7 percentage points lower than the module proposed in this invention. Its mAP50-95 value is 0.393, surpassing all other improved modules and leading the C3k2-MSEIE module by 1.7 percentage points.

[0210] The C3k2-M module, through its Multi Scale Edge Information Select component, extracts edge information from different scales, capturing the shape and structural features of targets more comprehensively. This multi-scale feature extraction approach helps the model better understand the details of targets, improving its ability to detect targets in complex scenes. The design of the Edge Enhancer and Dual Domain Selection Mechanism effectively integrates features from different sources through convolutional operations, enhancing the model's comprehensive understanding of target features and enabling it to make more accurate judgments when detecting targets. The design of the C3k2-M module allows for the integration of multi-scale edge information enhancement mechanisms at different stages and layers. This flexibility allows the model to be adjusted and optimized according to specific task requirements, improving its scalability. Therefore, in comparisons with various improved C3K2 modules, the C3k2-M module consistently outperforms in several key metrics.

[0211] 4.3 Effectiveness Analysis of the Efficient Multi-scale Attention (EMA) Module

[0212] To verify the effectiveness of the attention improvement, the module proposed in this invention was compared with various attention improvement modules, such as Simam, TripletAttention, Cpca, mpca, SegNext_Attention, DAttention, and MLCA. The experimental results are as follows.

[0213] Table 3 Comparative experimental results of different attention mechanisms

[0214]

[0215] Under the same conditions, the EMA module designed in this invention exhibits the best attention performance, outperforming other improved attention modules. The EMA model's accuracy is 0.932, 11.6 percentage points higher than the Simam module with the lowest accuracy; its mAP50 value is 0.859, surpassing all modules, while the initially proposed Simam module has an mAP50 value of only 0.78, 7.9 percentage points lower than the module proposed in this invention; its mAP50-95 value is 0.396, surpassing all other improved modules and leading the MLCA module by 0.2 percentage points.

[0216] The EMA module extracts horizontal and vertical information from feature maps through adaptive average pooling. This spatial information is then processed by parallel 1×1 and 3×3 convolutional layers to capture multi-scale features hierarchically, enhancing the model's understanding of target shape and structural features. Next, channel dependencies are optimized through group normalization and scaled sigmoid activation functions, while spatial attention weights are computed using softmax operations. This synergistic integration of channel and spatial mechanisms significantly improves feature representation capabilities. Finally, matrix multiplication fuses the optimized channel and spatial features to generate enhanced representations, improving the model's adaptability to complex scenes. Notably, EMA achieves performance improvements with only a small increase in the number of parameters and computational complexity. The group convolution strategy effectively reduces resource overhead, ensuring practical deployment capabilities on resource-constrained devices. Therefore, in comparative evaluations with various enhanced attention mechanisms, the EMA module consistently demonstrates superior performance on key metrics.

[0217] 4.4 Comparative Experiment

[0218] To further verify the effectiveness of the model proposed in this invention, we compared it with mainstream object detection algorithms such as Faster-RCNN, TOOD, Cascad-RCNN, ATSS, YOLOv5, and YOLOv8. Experiments were conducted using this dataset under the same environment, and the comparison results are shown in the table below.

[0219] Table 4 Comparison of experimental results of the model

[0220]

[0221] The proposed model outperforms the comparison models in terms of detection accuracy, number of parameters, and inference speed, demonstrating superior accuracy and efficiency in resource-constrained inverter casing defect detection scenarios. The model achieves an mAP50 value of 0.879, a 4.6 percentage point improvement over the baseline model. Compared to Faster-RCNN, Cascad-RCNN, TOOD, ATSS, RetinaNet, Rtmdet, CenterNet, YOLOv5, and YOLOv8, the mAP50 values ​​are 7.6, 9.4, 0.4, 7, 8, 4.7, 3.9, and 0.1 percentage points, respectively. This indicates that the proposed model significantly improves performance by combining input features from different subspaces through element-wise multiplication, creating a large number of interaction terms. Increasing the feature space dimension effectively captures complex image features and delineates more precise decision boundaries; the mAP50-95 value reaches 0.398, an improvement of 3.2 percentage points compared to the baseline model, and outperforms Faster-RCNN, Cascad-RCNN, TOOD, ATSS, RetinaNet, Rtmdet, CenterNet, YOLOv5, and YOLOv8 by 6.7, 6.6, 0.4, 5.9, 4.1, 2.7, 2.2, and 3.2 percentage points respectively. This demonstrates that the overall performance and detection effect of the proposed model are superior to other algorithms.

[0222] Therefore, by combining input features from different subspaces through element-wise multiplication to create a large number of interaction terms, the dimensionality of the feature space is significantly improved. This innovative feature combination method enables the model to more effectively capture the complex features of images. In inverter housing defect detection, the model can accurately delineate the outline of defects and effectively distinguish defects from normal areas. For example, the model can clearly identify the boundaries of pores and accurately locate and classify defects even against complex backgrounds. This high-precision detection capability is crucial for the quality control of inverter housings, as it helps manufacturers to promptly identify and correct potential quality problems during production, thereby improving product reliability and lifespan. Furthermore, the model's advantages in inference speed and number of parameters also make it perform well in resource-constrained environments, providing an efficient and economical solution for practical applications. In summary, the model proposed in this invention is not only theoretically innovative but also demonstrates excellent performance and practicality in real-world applications.

[0223] 4.5 Ablation Test

[0224] To verify the performance advantages of the design module of this invention, ablation experiments were conducted on three modules: the GEIT module, the C3K2-M module, and the EMA module. The experimental results are shown below.

[0225] Table 5 Comparison Results of Ablation Experiments

[0226]

[0227] By integrating the GEIT module, the model recall reached 0.828, an improvement of 2.3 percentage points compared to the benchmark model. The mAP50 and mAP50-95 values ​​reached 0.856 and 0.395, respectively, improvements of 0.9 and 1.3 percentage points compared to the benchmark model. This indicates that the model can better learn the features and patterns of the target when processing data, thus enabling it to complete the target detection task more accurately and comprehensively in practical applications.

[0228] By integrating the C3K2-M module, the model recall reached 0.799, a decrease of 0.6 percentage points compared to the baseline model. However, the mAP50 and mAP50-95 values ​​reached 0.872 and 0.393, respectively, an improvement of 2.5 and 1.1 percentage points compared to the baseline model. This indicates that when dealing with more complex scenarios with large changes in target scale, this improvement helps the model better capture the key information of the target, improve its localization accuracy and adaptability to targets of different scales.

[0229] By incorporating the EMA module, the model recall reached 83.2%, an improvement of 2.7 percentage points over the baseline model. However, the mAP50 and mAP50-95 values ​​reached 0.859 and 0.396, respectively, an improvement of 1.2 and 1.4 percentage points over the baseline model. This indicates that focusing on enhancing the model's ability to focus on and extract target features during model design and improvement is a correct direction and helps to improve the overall performance of the model.

[0230] The combination of the GEIT and C3K2-M modules achieved a recall of 0.87, a 6.5 percentage point improvement over the baseline model. The mAP50 and mAP50-95 values ​​reached 0.875 and 0.408, respectively, representing improvements of 2.8 and 2.6 percentage points over the baseline model. This demonstrates that the combination of G1 and multi-scale edge information selection fully leverages their respective advantages. Multi-scale edge information selection helps the model better capture the boundary and detailed features of the target, while G1 may further optimize the model's ability to locate and recognize targets, enabling more accurate target localization and recognition, thus improving detection accuracy and recall. This combination enhances the model's ability to represent target features, allowing it to more accurately capture key target information, especially under conditions of significant target scale variations and complex backgrounds, effectively improving the model's detection performance.

[0231] By combining the GEIT and C3K2-M modules and further integrating the EMA module, the model's recall reached 0.827, a 2.2 percentage point improvement over the baseline model. The mAP50 and mAP50-95 values ​​reached 0.893 and 0.414, respectively, representing improvements of 4.6 and 3.2 percentage points over the baseline model. This demonstrates that, building upon G1 and multi-scale edge information selection, the integration of the EMA module further enhances the model's performance. Furthermore, the EMA module, building upon the model's existing feature extraction capabilities, better optimizes feature focus, allowing the model to concentrate more on the target's key regions, thereby further improving detection accuracy and recall. This result proves the effectiveness of the optimization method that integrates the GEIT, C3K2-M, and EMA modules. By combining these three modules, the overall model performance is significantly improved, providing strong support for further model optimization.

[0232] 5. Visual verification

[0233] In the visualization and validation of YOLO models, heatmaps play a crucial role. By visually demonstrating the model's focus on different regions of an image through color intensity, heatmaps provide a deeper understanding of the model. Specifically, heatmaps clearly indicate the key feature regions the model relies on when detecting targets, thus verifying whether the model correctly focuses on salient parts of the target object, such as defects in an inverter casing, a human face, or the outline of a vehicle. Furthermore, by comparing heatmaps generated by different models, the degree of focus on target features and detection accuracy of each model can be evaluated and compared, providing a direct basis for model optimization and improvement. During the model debugging phase, heatmaps can quickly locate scenes or samples where the model performs poorly, aiding in the analysis of error sources and allowing for targeted adjustments to the model structure or training strategy.

[0234] To verify the superior detection performance of the model proposed in this invention, this experiment generated a heatmap for each detection target to visualize the model's detection effect on weld defects. For example... Figure 7 As shown, in detection (1) and (2), all models can successfully detect defects, but the proposed model generates a heatmap with a darker color and a larger range, indicating that the model can delineate a more accurate decision boundary and has a higher recognition of the defect location; in addition, the YOLOv8 algorithm misidentifies the background as a defect in detection (1) and the YOLOv11 algorithm misidentifies the background as a defect in detection (2), and the dark areas of the v5, v8 and v11 algorithms fall around the defect and do not focus on the weld itself. The dark area of ​​the proposed model accurately covers the original location of the defect, and has a stronger ability to identify defects; in detection (3), the other algorithms miss a small defect, while the proposed model detects all defects, indicating that the model has a stronger feature extraction ability and can better notice small target defects that are not easy to identify.

[0235] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit the technical solutions. Those skilled in the art should understand that any modifications or equivalent substitutions to the technical solutions of the present invention without departing from the spirit and scope of the present invention should be covered within the scope of the claims of the present invention.

Claims

1. A method for detecting inverter housing defects based on multi-scale feature interaction networks, characterized in that, include: S1: Obtain an image of the inverter housing to be inspected; S2: Input the image of the inverter housing to be detected into the trained defect detection model, and output the corresponding inverter housing defect detection result; The processing steps of the defect detection model include: S201: Multi-scale feature extraction is performed on the input inverter housing image through the backbone network to obtain features at multiple scales; in the backbone network, a global edge information transmission module is introduced to generate edge information feature maps at multiple scales using the shallow feature layers of the network and project them into various scales of the backbone network for feature fusion; a multi-scale edge information selection module is introduced to adaptively select features with higher task relevance from the multi-scale features. S202: Feature fusion and enhancement of features at multiple scales are performed through the neck network to obtain fused and enhanced features at multiple scales; In the neck network, a multi-scale attention mechanism module is introduced to enhance the feature fusion capability of the neck network; S203: The target is classified and located by the detection head based on the fusion enhancement features of multiple scales, and the bounding box, category label and confidence of the casing defect are obtained as the output of the defect detection model as the inverter casing defect detection result.

2. The inverter housing defect detection method based on multi-scale feature interaction network as described in claim 1, characterized in that: In step S201, the backbone network includes a cascaded first convolutional layer, a second convolutional layer, a first multi-scale edge information selection module, a third convolutional layer, a second multi-scale edge information selection module, a first feature fusion module, a fourth convolutional layer, a third multi-scale edge information selection module, a second feature fusion module, a fifth convolutional layer, a fourth multi-scale edge information selection module, a third feature fusion module, an SPPF module, and a C2PSA module. The output of the first multi-scale edge information selection module is connected to the multi-scale edge information generator; the output of the multi-scale edge information generator is respectively input to the first feature fusion module, the second feature fusion module and the third feature fusion module. The outputs of the first feature fusion module, the second feature fusion module, and the C2PSA module serve as the features of the backbone network output at three scales. The multi-scale edge information generator and various feature fusion modules together form the global edge information transmission module.

3. The inverter housing defect detection method based on multi-scale feature interaction network as described in claim 2, characterized in that: The processing steps of the multi-scale edge information generator include: Edge features of the input features are calculated using a convolution module based on the Sobel operator; Multi-scale edge features are obtained by performing multiple max pooling operations on the edge features through cascaded max pooling layers. By adjusting the number of channels for edge features at each scale through 1×1 convolution, a multi-scale edge feature set output by the multi-scale edge information generator is obtained. The calculation formula for the multi-scale edge information generator is expressed as follows: ; In the formula: Represents a multi-scale edge feature set; Indicates the first Edge features at various scales; Indicates the number of scales.

4. The inverter housing defect detection method based on multi-scale feature interaction network as described in claim 3, characterized in that: The processing steps of the convolution module based on the Sobel operator include: Expand the dimensions of the input features; The horizontal edge information is obtained by extracting edge information from the expanded features using the horizontal square kernel of the Sobel operator; The horizontal square kernel of the Sobel operator is represented as: ; The vertical edge information is obtained by extracting edge information from the expanded features using the vertical square kernel of the Sobel operator; The vertical square kernel of the Sobel operator is represented as: ; The horizontal and vertical edge information are added together to obtain the edge features of the input feature; The formula is expressed as: ; In the formula: Representing input features Edge features; and These represent horizontal edge information and vertical edge information, respectively.

5. The inverter housing defect detection method based on multi-scale feature interaction network as described in claim 2, characterized in that: Feature fusion The module's processing steps include: The multi-scale edge feature set output by the multi-scale edge information generator and the feature to be fused are concatenated along the channel dimension to obtain the initial fused feature; The initial fused features are input into a cascaded 1×1 convolutional layer, a 3×3 convolutional layer, and a 1×1 convolutional layer to obtain the edge fused features output by the feature fusion module.

6. The inverter housing defect detection method based on multi-scale feature interaction network as described in claim 2, characterized in that: The processing steps of the multi-scale edge information selection module include: The input features are fed into a cascaded adaptive average pooling layer, a 1×1 convolutional layer, a 3×3 depthwise separable convolutional layer, an upsampling module, and an edge enhancement module to obtain edge enhancement features. The input features are fed into a 3×3 convolutional layer and then concatenated with the edge enhancement features to obtain the concatenated features. The stitching features are input into the DSM module to obtain enhanced stitching features; The enhanced splicing features are input into the convolutional layer and the number of channels is adjusted to obtain the edge fusion enhancement features output by the multi-scale edge information selection module.

7. The inverter housing defect detection method based on multi-scale feature interaction network as described in claim 6, characterized in that: The processing steps of the edge enhancement module include: Obtain the number of channels for the input features; The input features are fed into the average pooling layer to obtain local background information; Edge information is obtained by subtracting local background information from input features; After the edge information is input into the convolutional layer and nonlinearly adjusted, the output of the convolutional layer is added to the input features to obtain the edge enhancement features output by the edge enhancement module.

8. The inverter housing defect detection method based on multi-scale feature interaction network as described in claim 2, characterized in that: In step 202, the neck network includes a cascaded first upsampling module, a first connection layer, a first C3k2 module, a second upsampling module, a second connection layer, a second C3k2 module, a first multi-scale attention mechanism module, a first convolutional layer, a third connection layer, a third C3k2 module, a second multi-scale attention mechanism module, a second convolutional layer, a fourth connection layer, a fourth C3k2 module, and a third multi-scale attention mechanism module; In the backbone network, the features at three scales output by the first feature fusion module, the second feature fusion module, and the C2PSA module are respectively input to the first connection layer, the second connection layer, and the fourth connection layer; the output of the first C3k2 module is input to the third connection layer. The outputs of the first, second, and third multi-scale attention mechanism modules serve as fusion enhancement features of the three scales of the neck network output.

9. The inverter housing defect detection method based on multi-scale feature interaction network as described in claim 8, characterized in that: The processing steps of the multi-scale attention mechanism module include: The input features are reshaped to obtain the reshaped features; After performing horizontal and vertical global average pooling on the reshaped features, the outputs of the horizontal and vertical global average pooling are concatenated along the spatial dimension and then fused through a 1x1 convolutional layer to obtain the fused features. After inputting the fused features into the Sigmoid activation function layer and the grouping normalization layer, the Softmax function and global average pooling are applied respectively to obtain the first feature map and the second feature map. After the reshaped features are input into a 3×3 convolutional layer, they are processed by the Softmax function and global average pooling respectively to obtain the third feature map and the fourth feature map. Perform matrix multiplication on the first feature map and the fourth feature map to obtain the first spatial feature map; Perform matrix multiplication on the second feature map and the third feature map to obtain the second spatial feature map; The attention weights are obtained by adding the first spatial feature map and the second spatial feature map element by element. The attention weights are non-linearly adjusted using the Sigmoid function and then multiplied with the reshaped features to obtain the weighted features. The weighted features are then reshaped back to the shape of the input features to obtain the multi-scale attention enhancement features output by the multi-scale attention mechanism module.

10. The inverter housing defect detection method based on multi-scale feature interaction network as described in claim 9, characterized in that: The formula for horizontal global average pooling is expressed as: ; The formula for vertical global average pooling is expressed as: ; The formula for global average pooling is expressed as: ; In the formula: This indicates that the horizontal average pooling is applied across the width of the target area. Location feature values; This indicates vertical average pooling at height. Location feature values; The eigenvalues ​​represent the features of global average pooling; Indicates the input feature map; Indicates the height of the feature map; Indicates the width of the feature map; The index representing the height during vertical pooling; The index representing the width during horizontal pooling.