Battery liquid cooling plate surface defect detection method based on SMA-YOLO
By using the improved SMA-YOLO model, the problems of complex background and unbalanced defect types in the detection of surface defects of liquid cooling plates are solved, and high-precision detection and efficient identification of diverse defects are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-16
- Publication Date
- 2026-04-10
AI Technical Summary
Existing methods for detecting surface defects in liquid-cooled plates are difficult to accurately locate and identify in complex backgrounds with few defect areas, and the number of defect types is unbalanced, resulting in low versatility of the detection models.
An instance segmentation model based on SMA-YOLO is adopted, and the feature extraction capability is enhanced by SEP, SPAM and C2PSA-IEMA modules. Combined with the BiFPN network improvement and detection head design, accurate detection of defects of different sizes can be achieved.
It improves the detection accuracy and efficiency of surface defects in liquid cooling plates, effectively identifies diverse defects, reduces model computation, and adapts to imbalanced datasets in industrial production.
Smart Images

Figure CN121527092B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of image processing, and particularly relates to a battery liquid cooling plate surface defect detection method based on SMA-YOLO. BACKGROUND
[0002] New energy vehicles are the development direction of the automobile industry, and their advantages are not only related to travel, but also involve energy strategy and environmental protection, which are of great significance to China's energy transformation and "double carbon" goals. The power battery is the core component of the new energy vehicle, directly affecting the reliability and safety of the mechanical structure of the vehicle. The liquid cooling plate is a key component of the power battery thermal management system. The flow of the cooling liquid in the micro-channel inside the liquid cooling plate exchanges heat with each part of the battery in a conductive manner, avoiding thermal runaway of each level of battery cell, and thus ensuring the safe operation of the battery under various working conditions. The liquid cooling plate is mainly made of metals such as aluminum alloy with excellent thermal conductivity, and is manufactured through processes such as welding and stamping, which have high requirements for shape accuracy and surface quality.
[0003] During the production process of the liquid cooling plate, the forming process, equipment precision and process transfer process cause defects such as pits, scratches and black spots on the surface of the liquid cooling plate. These defects will cause the liquid cooling plate to leak under the long-term action of pressure and thermal shock, and thus cause thermal runaway, battery short circuit and even explosion, ultimately causing serious safety accidents. Therefore, defect detection in the manufacturing process is an important process for risk prevention.
[0004] The surface defects of the liquid cooling plate are currently mainly detected by manual inspection and traditional machine vision detection. Long manual detection time can reduce the attention of employees, reduce detection efficiency and may cause missed detection and false detection. Traditional machine vision detection methods such as histogram of oriented gradients (HOG), local binary pattern (LBP) and other technologies combined with classifiers. However, the traditional visual detection method mainly relies on manual feature design, and has insufficient generalization ability for defects with diverse shapes and complex backgrounds. SUMMARY
[0005] In view of the above deficiencies in the prior art, the battery liquid cooling plate surface defect detection method based on SMA-YOLO provided by the present application solves the problem that the existing defect detection method has low generalization of the existing detection model when applied to battery liquid cooling plate detection, because the liquid cooling plate defect occupies a small area in the image and the image background is complex, and the existing method is difficult to accurately locate and identify the defect target, and the frequency of defects on the surface of the liquid cooling plate is low, and the number of samples of some defect types is insufficient, resulting in imbalance in the number of each defect type, and thus the generalization of the existing detection model is low.
[0006] In order to achieve the above-mentioned application purpose, the technical scheme adopted by the present application is as follows: a battery liquid cooling plate surface defect detection method based on SMA-YOLO, comprising the following steps:
[0007] S100, collect battery liquid cooling plate surface defect data, and perform data enhancement processing to construct a battery liquid cooling plate defect data set;
[0008] S200, based on the battery liquid cooling plate defect data set, constructing and training an instance segmentation model SMA-YOLO for battery liquid cooling plate surface defect detection;
[0009] The instance segmentation model SMA-YOLO includes a backbone network, a neck network, and a detection head.
[0010] The backbone network is provided with a SEP module, a SPAM module, and a C2PSA-IEMA module; the SEP module performs down-sampling on input features through a parallel maximum pooling layer and a SET channel attention mechanism; the SPAM module extracts large-scale defect features through a 2d average pooling layer, extracts defect edge and texture features through a 2d maximum pooling layer, and focuses on defect feature regions through a SimAM attention mechanism; the C2PSA-IEMA module detects defects of different sizes through enhanced information interaction capability, multi-scale feature extraction mechanism, and dynamic feature weight calculation.
[0011] The neck network is improved based on a BiFPN network, and the output features of the backbone network are processed through channel dimension reduction to reduce the model calculation amount.
[0012] The detection head includes four detection heads for outputting micro, small, medium, and large target defects.
[0013] S300, using the instance segmentation model SMA-YOLO to detect defects on the surface of the battery liquid cooling plate to be detected.
[0014] Further, in the S100, the defect types of the battery liquid cooling plate surface defect data include pits, scratches, black spots, roll marks, and oil stains.
[0015] The data enhancement processing includes adding noise, changing brightness, adding pixel points, and mirroring.
[0016] Further, the backbone network includes a first convolutional layer, a second convolutional layer, a first C3k2 module, a first SEP module, a second C3k2 module, a second SEP module, a third C3k2 module, a third convolutional layer, a fourth C3k2 module, a SPAM module, and a C2PSA-IEMA module connected in sequence.
[0017] Further, the neck network includes a fourth convolutional layer, a fifth convolutional layer, a sixth convolutional layer, and a seventh convolutional layer.
[0018] The input end of the fourth convolutional layer is connected with the output end of the C2PSA-IEMA module, and the output end of the fourth convolutional layer is sequentially connected with a first up-sampling layer, a first BiFPN module, a fifth C3k2 module, an eighth convolutional layer, a second up-sampling layer, a second BiFPN module, a ninth convolutional layer, a third BiFPN module, a third up-sampling layer, a fourth BiFPN module and a ninth C3k2 module; the output end of the fourth convolutional layer is also connected with the input end of a fifth BiFPN module; and the output end of the eighth convolutional layer is also connected with the input end of a sixth BiFPN module.
[0019] The input end of the fifth convolutional layer is connected with the output end of the third C3k2 module, and the output end of the fifth convolutional layer is connected with the input end of the first BiFPN module and the input end of the sixth BiFPN module respectively.
[0020] The input end of the sixth convolutional layer is connected with the output end of the second C3k2 module, and the output end of the sixth convolutional layer is sequentially connected with the second BiFPN module, an eighth C3k2 module, an eleventh convolutional layer, the sixth BiFPN module, a seventh C3k2 module, a tenth convolutional layer, the fifth BiFPN module and a sixth C3k2 module; the output end of the sixth convolutional layer and the output end of the eighth C3k2 module are also connected with the input end of the third BiFPN module.
[0021] The input end of the seventh convolutional layer is connected with the output end of the first convolutional layer, and the output end of the seventh convolutional layer is connected with the input end of the fourth BiFPN module.
[0022] Further, in the detection head:
[0023] The output end of the ninth C3k2 module is connected with a first detection head for outputting micro target defects, the output end of the eighth C3k2 module is connected with a second detection head for outputting small target defects, the output end of the seventh C3k2 module is connected with a third detection head for outputting medium target defects, and the output end of the sixth C3k2 module is connected with a fourth detection head for outputting large target defects.
[0024] Further, the first SEP module and the second SEP module are structurally identical, and each includes a first average pooling layer.
[0025] The output end of the first average pooling layer is connected with the input end of a channel division layer.
[0026] The first output end of the channel division layer is sequentially connected with a first maximum pooling layer, a first SET attention unit and a first multiplier, and the output end of the first maximum pooling layer is also connected with the input end of the first multiplier.
[0027] The second output end of the channel layer is sequentially connected with a second max pooling layer, a second SET attention unit and a second multiplier, and the output end of the second max pooling layer is also connected with the input end of the second multiplier;
[0028] The output end of the first multiplier and the output end of the second multiplier are connected with a channel splicing layer.
[0029] Further, the first SET attention unit and the second SET attention unit are the same in structure, and each includes a second average pooling layer;
[0030] The output end of the second average pooling layer is connected with the input end of a first linear layer and the input end of a second linear layer respectively, the output end of the first linear layer is connected with the input end of a second channel splicing layer through a first ReLU activation function, the output end of the second linear layer is connected with the input end of the second channel splicing layer through a second ReLU activation function, and the output end of the second channel splicing layer is sequentially connected with a third linear layer, a first Sigmoid activation function and a third multiplier, and the input end of the third multiplier is also connected with the input end of the second average pooling layer.
[0031] Further, the C2PSA-IEMA module includes a twelfth convolutional layer, a Spilt layer, a first Concat layer and a thirteenth convolutional layer connected in sequence, and the output end of the Spilt layer is also sequentially connected with a first PSA-IEMA unit, a second PSA-IEMA unit and a first Concat layer;
[0032] The first PSA-IEMA unit and the second PSA-IEMA unit are the same in structure, and each includes an IEMA unit, a first adder, a fourteenth convolutional layer, a fifteenth convolutional layer and a second adder connected in sequence, the input end of the IEMA unit is also connected with the input end of the first adder, and the output end of the first adder is also connected with the input end of the second adder;
[0033] The IEMA unit includes a normalization layer, an EMA unit, a third adder, a sixteenth convolutional layer, a regularization layer and a fourth adder connected in sequence, the input end of the normalization layer is also connected with the input end of the fourth adder, and the output end of the EMA unit is sequentially connected with a depth separable convolution, an SE block and the input end of the third adder;
[0034] The EMA unit is used to extract multi-scale features of micro targets.
[0035] Further, the SPAM module includes a seventeenth convolutional layer, a first 2d average pooling layer, a second 2d average pooling layer, a first 2d max pooling layer and a second 2d max pooling layer arranged side by side;
[0036] The output ends of the seventeenth convolutional layer, the first 2d average pooling layer, the second 2d average pooling layer, the first 2d maximum pooling layer and the second 2d maximum pooling layer are connected with a second Concat layer, an eighteenth convolutional layer and a SimAM unit in sequence.
[0037] The SimAM unit generates three-dimensional attention weights by establishing an energy function for calculating weights, thereby enhancing the features of the input feature map without introducing additional parameters.
[0038] Further, when the SimAM unit generates the three-dimensional attention weights, the calculation formula of the minimum energy value is:
[0039]
[0040] In the formula, E represents the energy value of the target neuron, represents the mean value of all neurons in a single channel, represents the variance of all neurons in a single channel, represents a regularization coefficient, represents the target neuron, represents the target neuron adjacent to the i-th neuron, represents the number of neurons contained in each channel, and the subscript i represents the neuron index.
[0041] In view of the problems that the surface defect morphology of the battery liquid cooling plate is various, the edge is blurred, the size is small, the background information is complex, and the defect feature extraction is difficult, the battery liquid cooling plate surface defect detection method beneficial to industrial high-precision detection is provided; compared with the prior art, the SMA-YOLO model for realizing defect detection provided by the present application has the following beneficial effects:
[0042] 1) In the downsampling part, the SEP module is first proposed to realize downsampling, the maximum pooling layer is used for downsampling operation, and the SET double-path channel attention mechanism is designed to enhance the weight distribution of key feature channels, which can effectively reduce the loss of detailed feature information of the deep network, and further improve the sensitivity and retention capacity of the liquid cooling plate defect features.
[0043] 2) In the neck network part, the YBFPN feature pyramid network is designed, the number of upsampling is increased, the P2 detection head is added, and the YTW small target feature extraction structure is designed, so that the extraction ability of the network to the P2 small target feature layer information is improved, and further the detection ability of the model to the tiny defect target of the liquid cooling plate is improved.
[0044] 3) Design C2PSA-IEMA module, combine iRMB inverted residual structure with EMA attention mechanism to design IEAM attention module, and replace the original self-attention mechanism, C2PSA-IEMA module has multi-scale feature interaction ability and dynamic weight distribution ability, and can adaptively process liquid cooling plate defects of different sizes.
[0045] 4) Design SPAM module, through multiple use of average pooling layer and maximum pooling layer and fusion of SimAM parameter-free attention mechanism, further enhance the model's capture effect of liquid cooling plate defect features of different scales. BRIEF DESCRIPTION OF DRAWINGS
[0046] Figure 1 The battery liquid cooling plate surface defect detection method flow chart based on SMA-YOLO provided by the present application.
[0047] Figure 2 The instance segmentation model SMA-YOLO structure diagram provided by the present application.
[0048] Figure 3 The first SEP module and the second SEP module structure diagram provided by the present application.
[0049] Figure 4 The first SET unit and the second SET unit structure diagram provided by the present application.
[0050] Figure 5 The C2PSA-IEMA module structure diagram provided by the present application.
[0051] Figure 6 The first PSA-IEMA unit and the second PSA-IEMA unit structure diagram provided by the present application.
[0052] Figure 7 The IEMA unit structure diagram provided by the present application.
[0053] Figure 8 The EMA unit structure diagram provided by the present application.
[0054] Figure 9 The SPAM module structure diagram provided by the present application.
[0055] Figure 10 The SimAM unit schematic diagram provided by the present application.
[0056] Figure 11 The improved detection effect comparison diagram provided by the present application. DETAILED DESCRIPTION
[0057] The specific embodiments of the present application are described below to facilitate the understanding of the present application for those skilled in the art, but it should be clear that the present application is not limited to the scope of the specific embodiments, and for those skilled in the art, it is obvious that all the inventions utilizing the concept of the present application are within the scope of the present application as long as various changes are within the spirit and scope of the present application defined and determined by the appended claims.
[0058] The embodiment of the present application provides a battery liquid cooling plate surface defect detection method based on SMA-YOLO, which optimizes three key difficulties of battery liquid cooling plate surface defect detection, specifically including:
[0059] 1. The liquid cooling plate surface defect occupies a small area in the image, and the image background is complex. The traditional target detection model is difficult to effectively locate the defect target in the complex and diverse background image. The present application uses YOLO instance segmentation algorithm, uses the characteristics of individual instance distinction of target detection and the characteristics of object pixel classification of semantic segmentation to realize accurate detection of defect target.
[0060] 2. In view of the problems of large size difference, small target, blurred edge and various forms of liquid cooling plate surface defects, the present application improves the structure of the traditional instance segmentation network to form a new instance segmentation model SMA-YOLO, which not only weights the accurate segmentation ability of each pixel in the image, but also accurately locates and identifies the defects.
[0061] 3. In actual industrial production, the frequency of liquid cooling plate surface defects is low, and the number of samples of some defect types is insufficient, resulting in unbalanced number of various defect types. The unbalanced data set will cause the model to overfit and reduce the generality of the model. The present application balances the number of various defect types by adding noise, changing brightness, adding pixels and mirroring to enhance the number of defects with less number.
[0062] Reference Figure 1 The battery liquid cooling plate surface defect detection method based on SMA-YOLO includes the following steps:
[0063] S100, collect battery liquid cooling plate surface defect data and perform data enhancement processing to construct a battery liquid cooling plate defect data set;
[0064] S200, based on the battery liquid cooling plate defect data set, construct and train an instance segmentation model SMA-YOLO for battery liquid cooling plate surface defect detection;
[0065] The instance segmentation model SMA-YOLO includes a backbone network, a neck network and a detection head.
[0066] The backbone network is provided with a SEP module, a SPAM module and a C2PSA-IEMA module; the SEP module performs down-sampling on input features through a parallel maximum pooling layer and a SET channel attention mechanism; the SPAM module extracts large-scale defect features through a 2d average pooling layer, extracts defect edge and texture features through a 2d maximum pooling layer, and focuses on a defect feature area through a SimAM attention mechanism; the C2PSA-IEMA module detects defects of different sizes through enhanced information interaction capability, a multi-scale feature extraction mechanism and dynamic feature weight calculation.
[0067] The neck network is improved based on a BiFPN network, and the output features of the backbone network are processed through channel dimension reduction to reduce the calculation amount of the model.
[0068] The detection head includes four detection heads for outputting micro target, small target, medium target and large target defects.
[0069] S300, using the instance segmentation model SMA-YOLO to detect defects on the surface of the battery liquid cooling plate.
[0070] In step S100 of the embodiment, when constructing the battery liquid cooling plate defect data set, the defect types of the battery liquid cooling plate surface defect data include pits, scratches, black spots, roll marks and oil spots; the data enhancement processing includes adding noise, changing brightness, adding pixel points and mirroring.
[0071] Specifically, an industrial camera is used to collect defects from three types of liquid cooling plates, namely, a stamping type liquid cooling plate, an extrusion type liquid cooling plate and a harmonica tube type liquid cooling plate, according to the production workshop of the enterprise; wherein the stamping type liquid cooling plate uses a stamping process to form a complex and flexible cooling liquid channel on an aluminum plate, the extrusion type liquid cooling plate is formed by extruding an aluminum alloy profile, and the feature is that the front and back surfaces are flat, and the feature of the harmonica tube type liquid cooling plate is that the flow channel presents a harmonica shape. The surface defect distribution area of each type of liquid cooling plate is the flat plate area of the stamping type liquid cooling plate, the flat plate area and the flow channel area of the extrusion type liquid cooling plate, and the flow channel area of the harmonica tube type liquid cooling plate.
[0072] Five types of defects, pits, scratches, black spots, roll marks and oil spots, are collected in the defect distribution area of the three types of liquid cooling plates, a total of 2500 images are collected and manually labeled using the labelme software.
[0073] The battery liquid cooling plate defect data set is specifically composed of 700 scratches, 800 pits, 600 roll marks, 200 black spots and 200 oil spots. Due to the small number of black spot and oil spot pictures, the number of pictures of various types in the data set is unbalanced, which cannot meet the training requirements. By adding noise, changing brightness, adding pixel points and mirroring, the data set is enhanced to 3700 pictures to balance the number of various defects.
[0074] In S200 of the embodiment, the instance segmentation model SMA-YOLO for battery liquid cold plate surface defect detection is improved on the basis of the YOLOv11 model, and the model has the characteristics of small volume and high detection accuracy.
[0075] In Figure 2 In the instance segmentation model SMA-YOLO shown in the figure, the input feature map is divided into P1-P5 (corresponding to 1 / 2, 1 / 4, 1 / 8, 1 / 16, and 1 / 32) five levels according to the spatial compression ratio, and P1-P5 are labeled after the different module structures in the figure, and further, Figure 2 The 0-32 labeled after the different module structures in the figure correspond to different network structure layers of the instance segmentation model SMA-YOLO from shallow to deep.
[0076] In the instance segmentation model SMA-YOLO, the backbone network includes a first convolutional layer, a second convolutional layer, a first C3k2 module, a first SEP module, a second C3k2 module, a second SEP module, a third C3k2 module, a third convolutional layer, a fourth C3k2 module, a SPAM module, and a C2PSA-IEMA module connected in sequence.
[0077] As Figure 2 shown, the neck network YBFPN of the instance segmentation model SMA-YOLO is redesigned on the basis of the BiFPN pyramid network. The traditional BiFPN pyramid network adds a skip connection on the basis of the PAN-FPN and introduces a unique weighted feature fusion method. The fast normalization weighted feature fusion method is used to distinguish and fuse the input features of different levels. The BiFPN pyramid network strengthens the focusing ability of the model on key feature regions by dynamically calculating and assigning weights to different feature layers.
[0078] However, after multiple downsampling operations, image detail features are gradually lost. Although the BiFPN pyramid network alleviates the loss of detail information caused by multiple pooling and convolution operations by adding a skip connection between the input and output nodes of the same level, for small defect targets on the surface of the liquid cold plate, if five downsampling processes are performed and only two upsampling processes are performed, the recovery degree of small target detail feature information is insufficient.
[0079] Based on this, when improving the neck network, the embodiment first performs channel dimension reduction processing on the second layer output feature map P2, the fourth layer output feature map P3, the sixth layer output feature map P4, and the tenth layer output feature map P5 of the backbone network through a 1x1 convolution, and changes the channel number of all modules of the neck network to 64. This operation can significantly reduce the network calculation amount.
[0080] Specifically, as Figure 2As shown, the neck network comprises a fourth convolutional layer, a fifth convolutional layer, a sixth convolutional layer and a seventh convolutional layer;
[0081] The input end of the fourth convolutional layer is connected with the output end of the C2PSA-IEMA module, and the output end of the fourth convolutional layer is sequentially connected with the first up-sampling layer, the first BiFPN module, the fifth C3k2 module, the eighth convolutional layer, the second up-sampling layer, the second BiFPN module, the ninth convolutional layer, the third BiFPN module, the third up-sampling layer, the fourth BiFPN module and the ninth C3k2 module; the output end of the fourth convolutional layer is also connected with the input end of the fifth BiFPN module; the output end of the eighth convolutional layer is also connected with the input end of the sixth BiFPN module;
[0082] The input end of the fifth convolutional layer is connected with the output end of the third C3k2 module, and the output end of the fifth convolutional layer is connected with the input end of the first BiFPN module and the input end of the sixth BiFPN module respectively;
[0083] The input end of the sixth convolutional layer is connected with the output end of the second C3k2 module, and the output end of the sixth convolutional layer is sequentially connected with the second BiFPN module, the eighth C3k2 module, the eleventh convolutional layer, the sixth BiFPN module, the seventh C3k2 module, the tenth convolutional layer, the fifth BiFPN module and the sixth C3k2 module; the output end of the sixth convolutional layer and the output end of the eighth C3k2 module are also connected with the input end of the third BiFPN module;
[0084] The input end of the seventh convolutional layer is connected with the output end of the first convolutional layer, and the output end of the seventh convolutional layer is connected with the input end of the fourth BiFPN module.
[0085] In the embodiment, in the structure design process of the neck network, the BiFPN module is used to replace the concat fusion module in the traditional YOLO network, the BiFPN module is used to replace all the concat modules in the YOLO network, and an additional jump connection is added, which is called BiPFN, so that the neck network YBFPN provided by the application is redesigned on the basis of the BiFPN pyramid network.
[0086] Based on the above model structure design, the first / second SEP module in the backbone network reduces the feature map by expanding the receptive field through downsampling, learns more global and larger range of context information, and then extracts abstract high-level semantic features, but this operation will lose a large amount of spatial information and detailed feature information. The first / second upsampling layer in the neck network enlarges the feature map to obtain a higher resolution feature map, and then learns texture, edge and other detailed feature information to enhance the detection performance of small size targets; specifically, after the backbone network in the neck network YBFPN performs 5 times of downsampling operation through the convolution layer structure in the 0th layer, the 1st layer, the 3rd layer, the 5th layer and the 7th layer, the neck network YBFPN only performs 2 times of upsampling operation through the first / second upsampling layer in the 12th layer and the 17th layer. The insufficient number of upsampling operations will lead to insufficient recovery of detailed features, resulting in that the small target defect features on the liquid cooling plate surface cannot be effectively extracted. Therefore, by adding the third upsampling layer in the 29th layer, the number of upsampling operations in the neck network is increased to 3, so that the model obtains more fine feature maps.
[0087] Further, in the detection head of the instance segmentation model SMA-YOLO shown in the example: Figure 2
[0088] The output end of the ninth C3k2 module is connected to the first detection head for outputting micro target defects, the output end of the eighth C3k2 module is connected to the second detection head for outputting small target defects, the output end of the seventh C3k2 module is connected to the third detection head for outputting medium target defects, and the output end of the sixth C3k2 module is connected to the fourth detection head for outputting large target defects.
[0089] Specifically, the neck network YBFPN contains the second / third / fourth detection heads respectively receiving the P3, P4 and P5 level output feature maps, and the neck network YBFPN adds the first detection head receiving the P2 level output feature map on the basis of the traditional BiFPN bidirectional pyramid network. The first detection head improves the detection capability of the model for small size targets by receiving a high-resolution feature map containing rich semantic information.
[0090] To enable the first detection head to receive feature maps containing more detailed feature information, a YTW small target feature extraction structure (marked in the dashed box in the figure) is designed in the neck network YBFPN. The P2 detection layer obtained by three upsampling operations of the backbone network layers 4 and 10 through the first, second, and third upsampling layers of layers 12, 17, and 29, and the P2 detection layer obtained by one upsampling operation of the neck network YBFPN layers 18 and 20 through the third upsampling layer of layer 29, are fused through the fourth BiFPN module of layer 31. The fused P2 feature map is then directly output to the first detection head, and the fused P2 feature map is not passed down to avoid loss of detailed feature information. This design effectively improves the network's ability to detect small targets by fully extracting the shallow detailed feature information of the P2 feature map.
[0091] In this embodiment of the invention, the backbone network of the traditional YOLOv11 model uses Conv convolution for downsampling. However, processing with a single convolution kernel will cause a large amount of detailed feature information to be lost in the deep network as the feature map size is reduced. This is particularly unfavorable for detecting small target defects such as scratches, pits, and black spots on the surface of the battery liquid cooling plate.
[0092] In this embodiment, a (first / second) SEP module is proposed in the backbone network for downsampling, such as... Figure 3 As shown, the first SEP module and the second SEP module have the same structure, both including a first average pooling layer.
[0093] The output of the first average pooling layer is connected to the input of the channel average pooling layer;
[0094] The first output terminal of each channel is connected in sequence to the first max pooling layer, the first SET attention unit, and the first multiplier, and the output terminal of the first max pooling layer is also connected to the input terminal of the first multiplier;
[0095] The second output terminal of each channel is connected in sequence to the second max pooling layer, the second SET attention unit, and the second multiplier, and the output terminal of the second max pooling layer is also connected to the input terminal of the second multiplier;
[0096] The output terminals of the first multiplier and the second multiplier are connected to the channel splicing layer.
[0097] exist Figure 3 In the diagram, C, H, and W represent the number of channels, height, and width of the input feature map, respectively. Based on the structure of the (first / second) SEP module described above, the input feature... Figure X ∈R C×H×W First, a 2×2 average pooling layer is used to effectively extract spatial information and output features. Figure Xa is:
[0098]
[0099] The pooled feature map is divided into two sub-features Figure X 1 and X2:
[0100]
[0101] In the formula, indicates that the channel dimension is divided;
[0102] Two sub-features Figure X 1 and X2 are respectively processed by the first / second maximum pooling layer with a kernel size of 3x3 and a step of 2, and the output two features Figure X m1 and X m2 is:
[0103]
[0104] The output two features Figure X m1 and X m2 are respectively processed by the first / second SET attention unit, and then X m1 and X m2 are multiplied by the feature map, and the output two features Figure X a1 and X a2 is:
[0105]
[0106] In the formula, represents element-wise multiplication;
[0107] The output feature Figure X a1 and X a2 are spliced and fused from the channel dimension by the first channel splicing layer, and the output feature map is:
[0108]
[0109] In the first / second SEP module, the first / second max-pooling layer is used to replace the Conv convolution in the traditional network structure to perform downsampling operation, which enhances the attention of the model to the important features of small defects such as scratches, pits and black spots by capturing the maximum value in the local area. Further, since the model mainly loses detailed feature information in the deep network during the downsampling process, compared with the traditional network model, the first and second SEP modules are respectively replaced with the third layer Conv convolution downsampling module and the fifth layer Conv convolution downsampling module in the deep network.
[0110] In the first / second SEP module, the first SET attention unit and the second SET attention unit use the SET channel attention mechanism to learn the importance weight of each channel, thereby further enhancing the attention to the small target defect related features while suppressing irrelevant background information.
[0111] As shown in Figure X , the first SET attention unit and the second SET attention unit have the same structure and both include a second average pooling layer.
[0112] The output end of the second average pooling layer is connected with the input end of the first linear layer and the input end of the second linear layer respectively, the output end of the first linear layer is connected with the input end of the second channel splicing layer through the first ReLU activation function, the output end of the second linear layer is connected with the input end of the second channel splicing layer through the second ReLU activation function, and the output end of the second channel splicing layer is connected with the third linear layer, the first Sigmoid activation function and the third multiplier in sequence. The input end of the third multiplier is also connected with the input end of the second average pooling layer.
[0113] In Figure 4 , C, H and W represent the channel number, height and width of the input feature map, the first SET unit and the second SET unit are composed of feature compression, channel compression and weight expansion, and the SET attention mechanism is used to further extract features from the feature map after the first / second max-pooling layer downsampling through residual connection; specifically, first, the second average pooling layer is used to perform average pooling operation on the input tensor X ∈ R C×H×W to compress the spatial dimension to 1x1, and the compressed feature vector Z is:
[0114]
[0115] Then, the feature vector Z is processed by two parallel paths (first / second linear layer + first / second ReLU activation function) for channel dimension reduction, and the output two feature vectors X1 and X2 are:
[0116]
[0117]
[0118] where Linear ∈ R C / r×1×1 , r represents 16 represents the channel compression ratio, and σ represents the first / second ReLU activation function.
[0119] The dual-path output vector is spliced along the channel dimension through the second channel splicing layer, and then channel attention weights are generated through a third linear layer and a first Sigmoid activation function
[0120]
[0121] where Linear ∈ R KC×1×1 , K represents 16 represents the channel growth ratio, and σ1 represents the first Sigmoid activation function.
[0122] Finally, the channel attention weights are expanded to the initial dimension by multiplying the initial input tensor through a broadcast mechanism, and the output feature Figure 4 out
[0123]
[0124] where ⊙ represents element-wise multiplication.
[0125] In the embodiment, the sizes of the scratch, pit and black spot defects on the surface of the liquid cooling plate are small, and the sizes of the oil stain and roll mark are relatively large. In view of the problem that the sizes of the defects on the liquid cooling plate are quite different, a C2PSA-IEMA module is proposed in the backbone network, as shown in Figure X The output end of the Spilt layer is further connected with a first PSA-IEMA unit, a second PSA-IEMA unit and a first Concat layer in sequence.
[0126] As shown in Figure 5 The first PSA-IEMA unit and the second PSA-IEMA unit have the same structure, and each includes an IEMA unit, a first adder, a fourteenth convolutional layer, a fifteenth convolutional layer and a second adder connected in sequence. The input end of the IEMA unit is further connected with the input end of the first adder, and the output end of the first adder is further connected with the input end of the second adder.
[0127] As shown in Figure 6 As shown, the IEMA unit includes, in sequence, a normalization layer, an EMA unit, a third adder, a sixteenth convolutional layer, a regularization layer, and a fourth adder, an input end of the normalization layer is also connected to an input end of the fourth adder, and an output end of the EMA unit is connected, in sequence, to a deep separable convolution, an SE block, and an input end of the third adder.
[0128] The EMA unit is used to extract multi-scale features of the micro target.
[0129] Specifically, the EMA unit is an existing network structure, which is constructed by referring to the iRMB inverted residual structure and combining the EMA attention mechanism. The EMA unit is a multi-scale feature extraction mechanism focusing on micro targets, and its network structure is as shown in Figure 7 As shown, / / in the figure represents a grouping processing, X and Y represent two different spatial directions respectively, the input features are divided into G groups of sub-features, each group of sub-features is processed through the interaction between the channel dimensions to learn more rich semantic features, and the two parallel 1x1 branches and 3x3 branches can effectively capture multi-scale features. In the 3x3 branch, large-scale features are extracted through a convolution with a 3x3 convolution kernel. In the 1x1 branch, channel encoding is performed along two different spatial directions, and a 1x1 convolution with weight sharing is used to prevent dimension compression. After the two output vectors are processed by the Sigmoid activation function and then multiplied, cross-channel information fusion is completed. Therefore, the EMA attention mechanism effectively integrates spatial information into the channel while adjusting the importance of each channel through channel encoding.
[0130] In Figure 8 As shown in the IEMA unit structure formed based on the above EMA unit, first, the input feature map is normalized by the normalization layer, then the EMA attention mechanism of the EMA unit is used to perform multi-scale analysis on the feature map, and then the correlation between the features is explored and the importance is evaluated. After that, a first residual branch is established, the feature map processed by the channel attention of the deep separable convolution and the SE block is added to the feature map processed by the EMA attention mechanism to obtain an output feature map. This operation retains the global feature information while enhancing the model's ability to extract local features. Then, the channel number of the feature map is adjusted by a 1x1 convolution (sixteenth convolutional layer). Finally, a second residual branch is established, and the original input feature map is added to the feature map processed by a series of processes. This operation can make the model learn the feature difference more effectively.
[0131] In Figure 7In the first / second PSA-IEMA unit shown based on the above IEMA unit, the IEMA unit is used to replace the Attention self-attention module in the traditional PSA module, thereby forming the first / second PSA-IEMA unit structure. The traditional PSA module includes two residual connections. The first residual connection is to add the input feature map after being processed by the Attention self-attention module to the input feature map. The second residual connection is to add the output feature map of the first residual connection to the feature map processed by the feedforward neural network containing two Conv convolutions. The Attention self-attention module is a self-attention mechanism. The mechanism projects the input feature map into three tensors of query (Q), key (K) and value (V) through a 1x1 Conv convolution, and calculates the correlation between spatial positions. Meanwhile, a 3x3 Conv convolution is used as a position encoder to enhance the ability of the model to extract local position information.
[0132] In Figure 6 In the C2PSA-IEMA module shown based on the above first / second PSA-IEMA unit, the PSA-IEMA unit is used to replace the PSA module in the traditional C2PSA module, thereby forming the C2PSA-IEMA module structure. In the traditional C2PSA module, the input feature map is divided into two paths containing half of the input channel number along the channel dimension after being processed by a Conv convolution with a size of 1x1. One path directly transmits the initial input feature, and the other path is processed by the PSA module. Then the output feature maps of the two paths are spliced along the channel dimension through the Concat layer, and finally the output feature map is processed by a 1x1 Conv convolution.
[0133] The C2PSA-IEMA module structure provided in the embodiment inherits the advantages of the iRMB structure, strengthens the information interaction ability between branches, and uses a multi-scale feature extraction mechanism to enable the model to adaptively process liquid cooling plate surface defects of different sizes. In addition, the model pays more attention to key feature areas by dynamically calculating feature weights, so the C2PSA-IEMA module can enhance the detection performance of liquid cooling plate defects of different sizes.
[0134] In the embodiment, in order to further enhance the detection ability of defects of different sizes on the liquid cooling plate, a SPAM module is proposed to replace the SPPF module in the traditional backbone network; as shown in Figure 5 As shown, the SPAM module includes a seventeenth convolutional layer, a first 2d average pooling layer, a second 2d average pooling layer, a first 2d maximum pooling layer and a second 2d maximum pooling layer arranged side by side.
[0135] The outputs of the seventeenth convolutional layer, the first 2d average pooling layer, the second 2d average pooling layer, the first 2d max pooling layer, and the second 2d max pooling layer are all connected to the second Concat layer, the eighteenth convolutional layer, and the SimAM unit in sequence.
[0136] The SimAM unit generates three-dimensional attention weights without introducing additional parameters by establishing an energy function for calculating weights, thereby enhancing the features of the input feature map.
[0137] Based on the aforementioned SPAM module structure design, two 2d average pooling layers enhance the perception of overall defect features, facilitating the extraction of larger oil stains and roller print defects. Simultaneously, two 2d max pooling layers strengthen the model's ability to capture defect edges and texture features, aiding in the extraction of smaller scratches and dents. Finally, the SimAM unit further processes the feature maps after max pooling and average pooling operations without introducing additional parameters, enabling the model to more effectively focus on defect feature regions.
[0138] exist Figure 9 In this context, C1×H×W represents the number of channels, height, and width of the intermediate feature map.
[0139] The structure of the SimAM unit is as follows: Figure 9 As shown (in the figure, C, H, and W represent the number of channels, height, and width of the input feature map, respectively), this structure generates 3D attention weights without introducing additional parameters by establishing an energy function for calculating the weights; specifically, the formula for calculating the minimum energy value when the SimAM unit generates 3D attention weights is:
[0140]
[0141] In the formula, This represents the energy value of the target neuron. This represents the mean of all neurons in a single channel. This represents the variance of all neurons in a single channel. Represents the regularization coefficient. Represents the target neuron. Indicates the relationship with the target neuron The adjacent i-th neuron, This indicates the number of neurons in each channel, with the subscript 'i' representing the neuron index. A lower energy value for the target neuron indicates a greater difference compared to other neurons, thus signifying its higher importance.
[0142] Based on the above-mentioned SPAM module structure design, it first inputs features Figure 10 ∈R C×H×WThe channel dimension is reduced by 1x1 convolution, and the output feature is Figure X 1 is:
[0143]
[0144] The reduced dimension feature Figure X 1 is processed by four branches, two of which are 2D average pooling layers, and the other two are 2D max pooling layers, and the four features after pooling are Figure X a1 , X a2 , X m1 , X m2 is:
[0145]
[0146] The reduced dimension feature Figure X 1 and the four feature maps after pooling are spliced from the channel dimension by the second Concat layer, which fuses the initial feature and the multi-scale feature after pooling processing, and enhances the richness of the model in feature extraction. The fused feature Figure X 2 is:
[0147]
[0148] The feature after 1x1 convolution of the eighteenth convolution layer is restored to the feature after the channel number Figure X 3 is:
[0149]
[0150] The feature map after a series of processing is processed by the attention mechanism of the SimAM unit to further process. The final output feature Figure X 4 is:
[0151]
[0152] The above battery liquid cooling plate surface defect detection method provided by the application utilizes the characteristics of individual instance distinction of the target detection algorithm and the characteristics of pixel classification of the semantic segmentation algorithm, and realizes accurate detection of defect targets.
[0153] In the embodiments of the application, the effect verification experiment example of the above instance segmentation model SMA-YOLO is provided.
[0154] In the experimental example, the detection accuracy Precision(Box), segmentation accuracy Precision(Mask), detection recall Recall(Box), segmentation recall Recall(Mask), detection average precision mAP0.5(Box), segmentation average precision mAP0.5(Mask), parameter quantity (Parameters), model size and the like are taken as evaluation criteria.
[0155] Table 1 is a comparison chart of algorithm performance before and after improvement, and it can be seen that compared with the YOLOv11n-seg algorithm, the detection accuracy, detection recall and detection average precision of the SMA-YOLO algorithm are improved by 1.1%, 8.9% and 5.8% respectively, the segmentation recall and segmentation average precision are improved by 2.7% and 1.4% respectively, and the model parameter quantity is reduced by 35.7%, which reduces the complexity of the algorithm while improving the detection accuracy, and is more beneficial to industrial detection.
[0156] Table 1: Comparison chart of algorithm performance before and after improvement
[0157]
[0158] The detection results are shown in Figure X Figure 11 , wherein (a) represents each one of the pictures containing pits, scratches, black spots, roll marks and oil spot defects respectively, (b) represents the detection result of each defect picture in figure (a) using the initial algorithm YOLOv11n-seg instance segmentation network to train the best weight file, and (c) represents the detection result of each defect picture in figure (a) using the improved SMA-YOLO instance segmentation network to train the best weight file, and it can be seen from the figure that the defect detection effect of SMA-YOLO is higher than that of YOLOv11n-seg model.
[0159] The principles and implementation manners of the present application are described by specific embodiments in the present application, and the above embodiment description is only used to help understand the method and core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation manners and application ranges will be changed, and the above description should not be understood as a limitation of the present application.
[0160] Those skilled in the art will realize that the embodiments described herein are for the purpose of helping the reader to understand the principles of the present application, and should be understood as not limiting the protection scope of the present application to such specific statements and embodiments. Those skilled in the art can make various other specific modifications and combinations according to the technical inspirations disclosed in the present application without departing from the essence of the present application, and these modifications and combinations are still within the protection scope of the present application.
Claims
1. A battery liquid cooling plate surface defect detection method based on SMA-YOLO, characterized by, The method comprises the following steps: S100, collecting battery liquid cooling plate surface defect data and performing data enhancement processing to construct a battery liquid cooling plate defect data set; S200, based on the battery liquid cooling plate defect data set, constructing and training an instance segmentation model SMA-YOLO for battery liquid cooling plate surface defect detection; The instance segmentation model SMA-YOLO comprises a backbone network, a neck network and a detection head; The backbone network is provided with a SEP module, a SPAM module and a C2PSA-IEMA module; the SEP module performs down-sampling on input features through a parallel maximum pooling layer and a SET channel attention mechanism; The SPAM module extracts large-scale defect features through a 2d average pooling layer, extracts defect edge and texture features through a 2d maximum pooling layer, and focuses on a defect feature region through a SimAM attention mechanism; The C2PSA-IEMA module detects defects of different sizes through a multi-scale feature extraction mechanism and dynamic feature weight calculation with enhanced information interaction capability; The backbone network comprises a first convolutional layer, a second convolutional layer, a first C3k2 module, a first SEP module, a second C3k2 module, a second SEP module, a third C3k2 module, a third convolutional layer, a fourth C3k2 module, a SPAM module and a C2PSA-IEMA module connected in sequence; The first SEP module and the second SEP module are identical in structure and each comprises a first average pooling layer; An output end of the first average pooling layer is connected with an input end of a channel equalization layer; A first output end of the channel equalization layer is connected with a first maximum pooling layer, a first SET attention unit and a first multiplier in sequence, and an output end of the first maximum pooling layer is also connected with an input end of the first multiplier; A second output end of the channel equalization layer is connected with a second maximum pooling layer, a second SET attention unit and a second multiplier in sequence, and an output end of the second maximum pooling layer is also connected with an input end of the second multiplier; Output ends of the first multiplier and the second multiplier are connected with a channel concatenation layer; The first SET attention unit and the second SET attention unit are identical in structure and each comprises a second average pooling layer; Output ends of the second average pooling layer are connected with input ends of a first linear layer and a second linear layer respectively, an output end of the first linear layer is connected with an input end of a second channel concatenation layer through a first ReLU activation function, an output end of the second linear layer is connected with an input end of the second channel concatenation layer through a second ReLU activation function, an output end of the second channel concatenation layer is connected with a third linear layer, a first Sigmoid activation function and a third multiplier in sequence, and an input end of the third multiplier is also connected with an input end of the second average pooling layer; The SPAM module comprises a seventeenth convolutional layer, a first 2d average pooling layer, a second 2d average pooling layer, a first 2d maximum pooling layer and a second 2d maximum pooling layer arranged side by side. The outputs of the seventeenth convolutional layer, the first 2d average pooling layer, the second 2d average pooling layer, the first 2d max pooling layer, and the second 2d max pooling layer are all connected sequentially to the second Concat layer, the eighteenth convolutional layer, and the SimAM unit. The SimAM unit generates three-dimensional attention weights without introducing additional parameters by establishing an energy function for calculating weights, thereby enhancing the features of the input feature map. The neck network is an improvement on the BiFPN network. By performing channel dimensionality reduction on the output features of the backbone network, the computational load of the model is reduced. The neck network includes a fourth convolutional layer, a fifth convolutional layer, a sixth convolutional layer, and a seventh convolutional layer; The input of the fourth convolutional layer is connected to the output of the C2PSA-IEMA module. The output of the fourth convolutional layer is sequentially connected to the first upsampling layer, the first BiFPN module, the fifth C3k2 module, the eighth convolutional layer, the second upsampling layer, the second BiFPN module, the ninth convolutional layer, the third BiFPN module, the third upsampling layer, the fourth BiFPN module, and the ninth C3k2 module. The output of the fourth convolutional layer is also connected to the input of the fifth BiFPN module. The output of the eighth convolutional layer is also connected to the input of the sixth BiFPN module. The input of the fifth convolutional layer is connected to the output of the third C3k2 module, and the output of the fifth convolutional layer is connected to the input of the first BiFPN module and the input of the sixth BiFPN module, respectively. The input of the sixth convolutional layer is connected to the output of the second C3k2 module, and the output of the sixth convolutional layer is sequentially connected to the second BiFPN module, the eighth C3k2 module, the eleventh convolutional layer, the sixth BiFPN module, the seventh C3k2 module, the tenth convolutional layer, the fifth BiFPN module, and the sixth C3k2 module; the output of the sixth convolutional layer and the output of the eighth C3k2 module are also connected to the input of the third BiFPN module. The input of the seventh convolutional layer is connected to the output of the first convolutional layer, and the output of the seventh convolutional layer is connected to the input of the fourth BiFPN module. The detection head includes four detection heads that output defects for micro-targets, small targets, medium targets, and large targets; S300: Defect detection is performed on the surface of the battery liquid cooling plate under test using the instance segmentation model SMA-YOLO.
2. The SMA-YOLO based battery liquid cold plate surface defect detection method of claim 1, wherein, In S100, the defect types of the battery liquid cooling plate surface defect data include pits, scratches, black spots, roller marks, and oil stains. The data augmentation process includes adding noise, changing brightness, adding pixels, and mirroring. 3.The SMA-YOLO-based battery liquid cooling plate surface defect detection method of claim 1, wherein, In the detection head: The output of the ninth C3k2 module is connected to the first detection head that outputs small target defects, the output of the eighth C3k2 module is connected to the second detection head that outputs small target defects, the output of the seventh C3k2 module is connected to the third detection head that outputs medium target defects, and the output of the sixth C3k2 module is connected to the fourth detection head that outputs large target defects. 4.The SMA-YOLO-based battery liquid cooling plate surface defect detection method of claim 1, wherein, The C2PSA-IEMA module includes a twelfth convolutional layer, a Split layer, a first Concat layer and a thirteenth convolutional layer connected in sequence. The output of the Split layer is also connected in sequence to the first PSA-IEMA unit, the second PSA-IEMA unit and the first Concat layer. The first PSA-IEMA unit and the second PSA-IEMA unit have the same structure, both including an IEMA unit, a first adder, a fourteenth convolutional layer, a fifteenth convolutional layer and a second adder connected in sequence. The input terminal of the IEMA unit is also connected to the input terminal of the first adder, and the output terminal of the first adder is also connected to the input terminal of the second adder. The IEMA unit includes a normalization layer, an EMA unit, a third adder, a sixteenth convolutional layer, a regularization layer, and a fourth adder connected in sequence. The input of the normalization layer is also connected to the input of the fourth adder. The output of the EMA unit is connected in sequence to the input of the depth-separable convolution, the SE block, and the third adder. The EMA unit is used to extract multi-scale features of small targets. 5.The SMA-YOLO-based battery liquid cooling plate surface defect detection method of claim 1, wherein, The formula for calculating the minimum energy value when the SimAM unit generates the 3D attention weights is as follows: wherein, Ei represents the energy value of the target neuron, Ei represents the mean value of all neurons in a single channel, Ei represents the variance of all neurons in a single channel, Ei represents the regularization coefficient, Ei represents the target neuron, Ei represents the i-th neuron adjacent to the target neuron, Ei represents the i-th neuron adjacent to the target neuron, Ei represents the number of neurons contained in each channel, and subscript i represents the neuron index.
Citation Information
Patent Citations
Industrial product surface defect detection method based on deep learning
CN115511812A
Structure defect detection using machine learning algorithms
US20200175352A1