Power lithium battery pole welding quality detection method based on yolov7

By improving the detection algorithm of the YOLOv7 network, the automation and accuracy issues of welding inspection of power lithium battery terminals were solved, achieving efficient and accurate identification of welding defects and improving the overall performance of the inspection equipment.

CN116452569BActive Publication Date: 2026-05-29SHENZHEN UNIV +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN UNIV
Filing Date
2023-04-26
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing methods for inspecting the welding of power lithium battery terminals rely on manual inspection, which has low automation and low accuracy. Traditional image processing methods are unable to meet the high efficiency and high precision requirements of industrial production and cannot effectively identify welding defects.

Method used

A preliminary detection algorithm model was built using the YOLOv7 network. The C3SE attention mechanism module was introduced, the PANet structure of the Neck layer was replaced with a BiFPN structure, and the SE attention mechanism module was added. The loss function was optimized using the Wise-IoU_Loss function. The model was trained and validated using a labeled dataset and then deployed to an embedded platform for real-time detection.

Benefits of technology

It improves the accuracy and speed of welding defect detection, reduces the missed detection rate and false detection rate, enhances the generalization performance of the model, and can identify the type and location information of defects such as weld holes, bulges and burns in real time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116452569B_ABST
    Figure CN116452569B_ABST
Patent Text Reader

Abstract

The application discloses a power lithium battery pole welding quality detection method based on YOLOv7, which comprises the following steps: after laser welding images are collected and screened, defining and labeling according to defect information to obtain a labeled data set; after data enhancement and uniform size are performed on the labeled data set, the labeled data set is divided into a training set, a verification set and a test set; a detection algorithm preliminary model is constructed by using a YOLOv7 network and corresponding hyperparameters are set, a C3SE attention mechanism module is introduced in a Backbone layer, a PANet structure of a Neck layer is replaced by a BiFPN structure, an intermediate branch of an MPC module of the Neck layer is separated and combined, and an SE attention mechanism module is added, a CIoU_Loss function in a bounding box regression loss function of a Head layer is replaced by a Wise-IoU_Loss function, and an improved detection algorithm model is obtained; the model is trained and verified; and the verified model is deployed to an embedded platform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine vision-guided surface defect detection, and in particular to a method for detecting the welding quality of power lithium battery terminals based on YOLOv7. Background Technology

[0002] In recent years, due to the rapid development of the electric vehicle industry, the role of power lithium batteries in the automotive sector has become increasingly prominent. Among these components, the terminals are the parts that connect the inside and outside of the battery, enabling it to charge and discharge. Currently, the connecting posts and connecting plates of power lithium batteries are fixed together using laser welding to assemble them into battery modules. However, in actual production, due to the complexity of the welding process, defects such as weld holes, bulges, weld misalignment, and burnout are unavoidable, seriously threatening product safety and quality, and failing to guarantee the reliability and durability of the assembled battery system during actual electric vehicle operation. Therefore, it is essential to promptly identify poorly welded batteries and remove them from the current production process to prevent them from flowing into the next process and causing safety hazards.

[0003] Surface defect detection can be mainly divided into two methods: manual inspection and machine vision inspection. Currently, the detection of welding defects in power lithium battery terminals in China still relies on manual visual inspection, which has a low degree of automation and depends heavily on the technical skills and experience of the inspectors, resulting in low accuracy and long processing times. While traditional image processing methods in machine vision, such as edge detection and threshold segmentation, are faster and have a lower false negative rate than manual inspection, they are insufficient to meet the millisecond-level detection speed and high-precision results required in automated industrial production. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a method for detecting the welding quality of power lithium battery terminals based on YOLOv7, which can efficiently provide information on the type, location and geometry of defects.

[0005] To solve the above-mentioned technical problems, the purpose of this invention is achieved through the following technical solution: A method for detecting the welding quality of power lithium battery terminals based on YOLOv7 is provided, comprising the following steps: Step A: Real-time acquisition of laser welding images, image selection, and definition and annotation of the selected laser welding images according to defect information to obtain an annotation dataset; wherein, the defect information includes defect category information, defect location information, and defect border information; Step B: After data augmentation and unifying the size of the annotation dataset, it is divided into a training set, a validation set, and a test set; Step C: Using a YOLOv7 network as the basic structure to construct a preliminary detection algorithm model, setting the hyperparameters of the preliminary detection algorithm model, introducing a C3SE attention mechanism module in the Backbone layer, and replacing the Neck layer. The PANet structure is a BiFPN structure. The intermediate branches of the MPC-N module in the Neck layer are separated and merged, and an SE attention mechanism module is added. The CIoU_Loss function in the bounding box regression loss function of the Head layer is replaced with the Wise-IoU_Loss function to obtain an improved detection algorithm model. Step D: Input the laser welding images from the training set into the obtained improved detection algorithm model. Train the improved detection algorithm model and perform defect judgment. Save the target localization boxes of different sizes with defect category information detected by the output of the improved detection algorithm model to the corresponding trained model weights. Validate the laser welding images in the validation set based on the model weights. Step E: Deploy the validated improved detection algorithm model to an embedded platform.

[0006] The beneficial technical effects of this invention are as follows: The YOLOv7-based power lithium battery electrode welding quality inspection method of this invention uses the YOLOv7 network as the basic structure to construct a preliminary detection algorithm model, sets the hyperparameters of the preliminary detection algorithm model, and introduces a C3SE attention mechanism module in the backbone layer. This allows the network to focus on more important feature information without increasing model complexity, thereby improving the model's ability to extract deep and important features. By replacing the PANet structure in the Neck layer with a BiFPN structure, redundancy in the structure aimed at fusing different features is reduced. Furthermore, by separating and merging the intermediate branches of the MPC-N module in the Neck layer and adding the SE attention mechanism module, the network feature sorting process is reduced. The feature loss caused by small target networks is addressed. By replacing the CIoU_Loss function in the bounding box regression loss function of the Head layer with the Wise-IoU_Loss function, the loss function is optimized, reducing harmful gradients generated by low-quality samples and decreasing the degree of freedom of the loss function, thereby improving the overall generalization performance of the detection equipment. Using filtered laser welding images labeled with defect information as an labeled dataset and dividing them into training, validation, and test sets, the improved detection algorithm model is trained. The defect information labeled in the dataset includes defect category information, defect location information, and defect border information, enabling the final improved detection algorithm model to locate defects pixel by pixel from the background and further obtain information such as defect category, boundary, and location, effectively reducing the false negative and false positive rates. Attached Figure Description

[0007] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0008] Figure 1 A flowchart illustrating the YOLOv7-based method for detecting the welding quality of power lithium battery terminals provided in this embodiment of the invention.

[0009] Figure 2 A schematic diagram of the real-time detection results of the improved detection algorithm model of the YOLOv7-based power lithium battery electrode welding quality detection method provided in this embodiment of the invention;

[0010] Figure 3 A schematic diagram of the first sub-process of the YOLOv7-based power lithium battery electrode welding quality inspection method provided in an embodiment of the present invention;

[0011] Figure 4A schematic diagram of the BiFPN structure of the Neck layer in the YOLOv7 network of the YOLOv7-based power lithium battery electrode welding quality detection method provided in the embodiments of the present invention.

[0012] Figure 5 A comparative schematic diagram of the MPC-N module of the Neck layer before and after improvement in the YOLOv7-based power lithium battery electrode welding quality inspection method provided in the embodiments of the present invention;

[0013] Figure 6 A schematic diagram of the improved detection algorithm model for the YOLOv7-based power lithium battery electrode welding quality detection method provided in this embodiment of the invention;

[0014] Figure 7 A schematic diagram of the second sub-process of the YOLOv7-based power lithium battery electrode welding quality inspection method provided in an embodiment of the present invention;

[0015] Figure 8 This is a schematic diagram of the third sub-process of the YOLOv7-based power lithium battery electrode welding quality inspection method provided in an embodiment of the present invention. Detailed Implementation

[0016] 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. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0017] Please see Figure 1 , Figure 1 This is a flowchart illustrating a method for inspecting the welding quality of power lithium battery terminals based on YOLOv7, as provided in an embodiment of the present invention. The method includes the following steps S11-S15:

[0018] Step S11: Real-time acquisition of laser welding images, image filtering, and definition and annotation of the filtered laser welding images according to defect information to obtain an annotation dataset; wherein, defect information includes defect category information, defect location information, and defect border information. Defect category information includes weld holes, bulges, weld deviations, and burn-outs, so that the final detection algorithm improvement model can locate defects pixel by pixel from the background and further obtain information such as defect category, boundary, and location, thereby assisting in the quality assessment of product quality and effectively reducing the missed detection rate and false detection rate.

[0019] Step S12: After data augmentation and unifying the size of the labeled dataset, it is divided into training set, validation set and test set; unifying the image size can make subsequent image processing faster and more accurate.

[0020] Step S13: A preliminary detection algorithm model is constructed using a YOLOv7 network as the basic structure. Hyperparameters of the preliminary model are set. A C3SE attention mechanism module is introduced into the Backbone layer. The PANet structure in the Neck layer is replaced with a BiFPN structure. The intermediate branches of the MPC-N module in the Neck layer are separated and merged, and an SE attention mechanism module is added. The CIoU_Loss function in the bounding box regression loss function of the Head layer is replaced with a Wise-IoU_Loss function, resulting in an improved detection algorithm model. Here, the MPC-N module refers to the MPC module in the Neck layer, distinguishing it from the MPC module in the Backbone layer. The MPC module in the Backbone layer is denoted as the MPC-B module. By replacing the PANet structure in the Neck layer with a BiFPN structure, the feature fusion module is improved after feature extraction. By performing a separation and merging operation on the intermediate branches of the MPC-N module in the Neck layer and adding an SE attention mechanism to form the SE_MPC-N module, the lack of fine-grained features is avoided. Finally, by improving the loss function of the anchor box regression, the improved detection algorithm model is obtained. The YOLOv7 network consists of an Input layer, a Backbone layer, a Neck layer, and a Head layer. The Backbone layer extracts features from the final augmented labeled dataset. The Neck layer generates and outputs feature maps of large, medium, and small sizes based on the features extracted by the Backbone layer. The Head layer outputs prediction results based on the obtained feature maps. Hyperparameters include batch size, learning rate, and epochs.

[0021] Step S14: Input the laser welding images in the training set into the obtained improved detection algorithm model, extract feature information of each laser welding image pixel by pixel, train the improved detection algorithm model for learning and defect judgment, and save the target localization boxes of different sizes with defect category information detected by the output of the improved detection algorithm model to the corresponding trained model weights. Validate the laser welding images in the validation set according to the model weights to ensure that the model is not overfitting and to verify the feasibility of the model. The mean accuracy (mAP) can be used as an evaluation index. mAP evaluates the model's performance by the ratio of the number of targets successfully detected by the model to the total number of targets present. A higher mAP value indicates a better detection performance of the target detection model on a given dataset. Different intersection-union ratio (IUU) thresholds (the ratio of the overlap area between the predicted and ground truth boxes to the total area) are selected to statistically calculate the model's mean accuracy under different standards. Commonly used thresholds include mAP0.5 (IUU threshold of 0.5) and mAP0.5:0.95 (IUU threshold from 0.5 to 0.95, with a step size of 0.05).

[0022] In object detection tasks, precision and recall are commonly used to evaluate the performance of detection models. A high-performing object detection algorithm should have higher precision and recall. Precision and recall can be expressed by formulas (1) and (2), respectively:

[0023]

[0024]

[0025] In the formula, TP represents the number of samples manually labeled as defects that are correctly identified, FP represents the number of samples incorrectly identified as defects by the model, FN represents cases that are judged as negative samples but are misclassified, and TP+FP is the total number of samples that are correctly identified.

[0026] mAP is a widely recognized and authoritative evaluation metric in object detection. AP refers to the detection accuracy of a single class, while mAP is the average of the APs of all classes. The preparation steps for AP calculation include:

[0027] The number of all TN, FP, and FN is calculated; the prediction boxes are sorted from high to low according to their confidence scores (all prediction boxes within the threshold range); the Precision and Recall values ​​are calculated sequentially for the sorted prediction boxes, and the Recall and Precision values ​​are used as the horizontal and vertical axes respectively, so that each prediction box can form a point (R, P) on the coordinate axis, and all points are connected in a preset way to draw a curve.

[0028] AP can be defined as the average precision under different recalls, and is generally used to evaluate the detection accuracy of a specific category. AP can be measured by the integral under the RP curve, and AP can be expressed by formula (3):

[0029]

[0030] In the formula, p and r represent precision and recall, respectively.

[0031] The mAP index is the average detection accuracy of all defect categories. Accordingly, mAP can be expressed by formula (4):

[0032]

[0033] In the formula, n refers to the total number of categories.

[0034] Step S15: Deploy the validated improved detection algorithm model to an embedded platform to achieve real-time detection of the input welding samples, and finally output the defect location and defect category. The real-time detection results are as follows: Figure 2 As shown.

[0035] The YOLOv7-based power lithium battery terminal welding quality inspection method of this invention uses the YOLOv7 network as the basic structure to construct a preliminary detection algorithm model. The hyperparameters of the preliminary detection algorithm model are set, and a C3SE attention mechanism module is introduced into the Backbone layer. This allows the network to focus on more important feature information without increasing model complexity, thereby improving the model's ability to extract deep, important features. Redundancy in the structure aimed at fusing different features is reduced by replacing the PANet structure of the Neck layer with a BiFPN structure. Furthermore, the intermediate branches of the MPC-N module in the Neck layer are separated and merged, and an SE attention mechanism module is added to reduce... The feature loss caused by small target networks during network feature sorting is addressed. By replacing the CIoU_Loss function in the bounding box regression loss function of the Head layer with the Wise-IoU_Loss function, the loss function is optimized, reducing harmful gradients generated by low-quality samples and decreasing the degree of freedom of the loss function, thus improving the overall generalization performance of the detection equipment. Laser welding images with labeled defect information are used as labeled datasets and divided into training, validation, and test sets for training the improved detection algorithm model. The defect information labeled in the dataset includes defect category information, defect location information, and defect bounding box information, enabling the final improved detection algorithm model to locate defects pixel-by-pixel from the background and further obtain information such as defect category, boundary, and location, effectively reducing the false negative and false positive rates.

[0036] Combination Figure 3 Specifically, step S13 includes the following steps:

[0037] Step S131: Use the YOLOv7 network as the basic structure to build a preliminary detection algorithm model and set the hyperparameters of the preliminary detection algorithm model;

[0038] Step S132: Insert a C3SE attention mechanism module after the last MPC-B module in the Backbone layer of the YOLOv7 network in the preliminary detection algorithm model. Without increasing model complexity, the C3SE attention mechanism module allows the network to focus on more important feature information, which is beneficial for improving the model's ability to extract deep and important features. The C3SE attention mechanism module is obtained by concatenating the SE channel attention mechanism module with the C3 module. The C3 module is the main module for learning residual features. The structure of the C3 module includes two branches: one branch includes multiple Bottleneck stacks and three standard convolutional layers, and the other branch includes only one standard convolutional layer. Concatenating the C3 module is equivalent to concatenating the two branches, thereby improving the model's computational speed. By inserting the C3SE attention mechanism module after the last MPC-B module in the Backbone layer, the model's ability to extract deep and important features is improved.

[0039] The C3SE attention mechanism module is used for feature map extraction, and the specific steps are as follows:

[0040] Global average pooling is performed on the input feature map to compress spatial features, resulting in a compressed feature map. The input feature map is obtained from the output of the last MPC-B module, which is used for downsampling to compress the feature map size. Finally, the feature map is input to the C3SE attention mechanism module for feature extraction. The input feature map has dimensions H*W*C, and the compressed feature map has dimensions 1*1*C, where H represents the image height, W represents the image width, and C represents the number of image channels.

[0041] A fully connected layer is used to learn channel features from the obtained compressed feature map;

[0042] The compressed feature map is multiplied channel by channel by channel weight coefficients of the input feature map to obtain and output a feature map with channel attention, thus completing feature reconstruction.

[0043] Step S133: Replace the PANet (Path Aggregation Network) structure of the Neck layer in the YOLOv7 network with a BiFPN (Weighted Bidirectional Pyramid) structure. Compared to the PANet structure, which only has bottom-up and top-down paths, the BiFPN structure removes nodes with only one input edge and no feature fusion, and introduces additional cross-layer connections, thereby reducing the number of parameters and redundancy in structures aimed at fusing different features. The weighted feature fusion mechanism used by the BiFPN structure is Fastnormalized fusion, which can be expressed by formula (5):

[0044]

[0045] In the formula, I i O represents the input feature, ε represents the output feature, and ω represents the parameter. i and ω j and represent the learnable weights. To ensure output stability, the parameter can be set to 0.0001. The learnable weights can be scaled to the range [0,1] using the ReLU activation function.

[0046] Specifically, learnable and updatable weights are added to the input features to differentiate the fusion of different input features. Furthermore, by repeatedly performing feature fusion based on the BiFPN structure on each channel, feature information from feature maps at different scales can be better integrated.

[0047] Preferably, a schematic diagram of the BiFPN structure is shown below. Figure 4 As shown in the diagram, the dots represent nodes, each row represents a channel, and nodes are classified according to the number of inputs, such as two-input nodes and three-input nodes. Taking the second channel as an example, in a two-input node, the input image of the first channel is... Input image of the second channel Perform weighted fusion to obtain a preliminary fused image of the second channel based on the two inputs. This will obtain the initial fused image of the two inputs in the second channel. Input image of the second channel Perform concat stitching to obtain the stitched image. Then, perform a 1×1 convolution on the stitched image to reorganize the features and obtain the final output of the two input nodes in the second channel.

[0048] The preliminary fused image obtained from the two input nodes of the second channel can be represented by formula (6):

[0049]

[0050] In the formula, This represents the input image for the first channel. This represents the input image for the second channel. The second channel represents the initial fused image of the two inputs. ε represents a parameter with a value of 0.0001. ω1 represents the learnable weights of the fourth channel's output, ω2 represents the learnable weights of the fifth channel's output, Conv represents the convolution operation, and Resize represents upsampling or downsampling the input. Specifically, when a node contains an input image with a scale smaller than the feature map of that channel, Resize upsamples the input image; when a node contains an input image with a scale larger than the feature map of that channel, Resize downsamples the input. As shown in the figure, in the two-input node of the second channel, Resize upsamples the input.

[0051] In the three input nodes of the second channel, the input image of the second channel is... The final output of the three-input node of the third channel and the final output of the two-input node of the second channel. Weighted fusion is performed to obtain a preliminary fused image of the three inputs in the second channel. This will yield a preliminary fused image of the three inputs in the second channel. The final output of the three-input node of the third channel Perform concat stitching to obtain the stitched image. Then, perform a 1×1 convolution on the stitched image to reorganize the features and obtain the final output of the three input nodes of the second channel.

[0052] The preliminary three-input fused image of the second channel obtained from the three-input node of the second channel. It can be expressed using formula (7):

[0053]

[0054] In the formula, This represents the input image for the second channel. This represents the final output of the three-input node of the third channel. This represents the final output of the two-input node of the second channel. ε represents the parameter with a value of 0.0001. ω3, ω4, and ω5 represent the learnable weights of the input of the fourth channel. Conv represents the convolution operation. Resize represents upsampling or downsampling the input. In the three-input node of the second channel, Resize is downsampling the input.

[0055] Step S134: Perform a separation and merging operation on the MPC-N module in the Neck layer of the YOLOv7 network, and add an SE attention mechanism module to one of the convolutional modules in the MPC-N module. Adding the SE attention mechanism module reduces feature loss caused to small target networks during feature sorting. The MPC-N module is a pooling structure with the same number of input and output channels. The height and width dimensions of the output image of the MPC-N module are half the height and width dimensions of the input image, used to compress the feature map size, thereby speeding up computation and preventing model overfitting. The MPC-N module includes three branches, which can be a left branch, a middle branch, and a right branch. The outputs of the three branches need to be concatted to merge. Preferably, the SE attention mechanism module can be added to the last convolutional module of the middle branch. The left branch includes a 2×2 max pooling module with a stride of 2 and a 1×1 convolutional module with a stride of 1. The right branch is the forward output layer. The middle branch includes two 1×1 convolutional modules with a stride of 1 and a processing structure obtained by separating and merging a 3×3 convolutional module with a stride of 2. The processing structure is located between the two 1×1 convolutional modules with a stride of 1. An SE attention mechanism module is added to the last 1×1 convolutional module with a stride of 1 in the middle branch to enhance the network's ability to identify and extract important features. The improvements to the MPC-N module in the Neck layer of the YOLOv7 network are shown below. Figure 5 As shown, the improved MPC-N module is denoted as SE_MPC-N. In the figure, (a) represents the module before improvement and (b) represents the module after improvement.

[0056] Assuming the first 1×1 convolutional module with a stride of 1 in the intermediate branch outputs a feature map containing P×P pixels, the processing structure separates it into four sub-images of size P / 2×P / 2 and then concatenates these four sub-images channel by channel. After separation and merging, the feature size is halved. An SE channel attention mechanism is added to the last 1×1 convolutional module with a stride of 1, effectively achieving feature enhancement while downsampling, resulting in features of dimension P / 2×P / 2×1. The improved MPC-N module's intermediate branch achieves the same effect as the original, halving the feature map's width and height, but without causing feature loss during the operation. It also effectively enhances the feature extraction capability for small targets and fully realizes the performance improvement of deep convolutional networks through local cross-channel interaction strategies and segregated convolution methods.

[0057] Step S135: Replace the CIoU_Loss function in the bounding box regression loss function of the Head layer in the YOLOv7 network with the Wise-IoU_Loss function.

[0058] The loss function of the Head layer includes a classification loss function, a confidence loss function, and a bounding box regression loss function. The confidence loss function is the loss function for determining the presence or absence of the target. The classification loss function and the confidence loss function use the BCEWithLogitsLoss function. By replacing the CIoU_Loss function in the bounding box regression loss function of the Head layer in the YOLOv7 network with the Wise-IoU_Loss function, dynamic non-monotonic frequency tuning is applied to low-quality samples (the gradient gain changes non-monotonically with the increase of the loss value). This reduces the competitiveness of high-quality sample bounding boxes. At the same time, a more effective gradient gain allocation strategy is implemented, reducing harmful gradients generated by low-quality samples and reducing the degrees of freedom of the loss function. This allows for a greater focus on the majority of ordinary-quality bounding boxes, thereby improving the overall generalization performance of the detection. Figure 6 A schematic diagram of the improved detection algorithm model of the YOLOv7-based power lithium battery electrode welding quality detection method of the present invention is shown.

[0059] Step S136: Obtain the improved detection algorithm model.

[0060] Specifically, in combination Figure 7 Step S11 specifically includes:

[0061] Step S111: Take real-time laser welding images on the industrial welding production line; the number of laser welding images shall not be less than 10,000.

[0062] Step S112: Screen and remove the laser welding images with high repeatability and redundant images without welding defects from the obtained laser welding images to obtain the screened laser welding images; wherein, the screening and removal of images can be done manually.

[0063] Step S113: Define and annotate the selected laser welding images according to the defect information, and use the annotated selected laser welding images as the annotation dataset. This can be done manually by defining and annotating the selected laser welding images according to the defect information.

[0064] Specifically, in combination Figure 8 Step S12 specifically includes:

[0065] Step S121: Enhance the labeled dataset by using methods such as offset, random rotation, random brightness, and adding random Gaussian noise and salt-and-pepper noise to obtain the enhanced labeled dataset;

[0066] Step S122: Use the mosaic data augmentation method to augment the augmented labeled dataset to obtain an expanded labeled dataset;

[0067] Step S123: Adjust all laser welding images in the expanded annotation dataset to a uniform size to obtain the final enhanced annotation dataset; wherein, the size of all laser welding images in the expanded annotation dataset can be 640*640 pixels.

[0068] Step S124: Randomly divide all laser welding images in the final enhanced annotation dataset into a training set, a validation set, and a test set. The number of laser welding images in the training set, validation set, and test set can be divided in an 8:1:1 ratio. Assuming the final enhanced annotation dataset contains 8400 laser welding images, the number of laser welding images in the training set, validation set, and test set can be 6720, 840, and 840, respectively.

[0069] In summary, the YOLOv7-based power lithium battery electrode welding quality inspection method of this invention uses the YOLOv7 network as the basic structure to construct a preliminary detection algorithm model. The hyperparameters of this preliminary model are set, and a C3SE attention mechanism module is introduced into the Backbone layer. This allows the network to focus on more important feature information without increasing model complexity, thus improving the model's ability to extract deep, important features. The PANet structure in the Neck layer is replaced with a BiFPN structure, reducing redundancy in structures aimed at fusing different features. Furthermore, the intermediate branches of the MPC-N module in the Neck layer are separated and merged, and an SE attention mechanism module is added to reduce the interference with small features during the network feature sorting process. The feature loss caused by the labeling network is reduced; by replacing the CIoU_Loss function in the bounding box regression loss function of the Head layer with the Wise-IoU_Loss function, the loss function is optimized, reducing the harmful gradients generated by low-quality samples and reducing the degree of freedom of the loss function, which can improve the overall generalization performance of the detection equipment; using the filtered laser welding images with defect information as the labeled dataset and dividing them into training, validation and test sets, the detection algorithm improvement model is trained. The defect information labeled in the dataset includes defect category information, defect location information and defect border information, so that the final detection algorithm improvement model can locate defects pixel by pixel from the background and further obtain information such as defect category, boundary and location, effectively reducing the false negative rate and false positive rate.

[0070] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for inspecting the welding quality of power lithium battery terminals based on YOLOv7, characterized in that, Includes the following steps: Step A: Real-time acquisition of laser welding images, image filtering, and definition and annotation of the filtered laser welding images based on defect information to obtain an annotation dataset; wherein, defect information includes defect category information, defect location information, and defect border information; Step B: After data augmentation and standardization of the size of the labeled dataset, it is divided into training set, validation set and test set; Step C: Construct a preliminary detection algorithm model using the YOLOv7 network as the basic structure, set the hyperparameters of the preliminary detection algorithm model, introduce the C3SE attention mechanism module in the Backbone layer, replace the PANet structure in the Neck layer with the BiFPN structure, perform separation and merging operations on the middle branches of the MPC-N module in the Neck layer and add the SE attention mechanism module, replace the CIoU_Loss function in the bounding box regression loss function in the Head layer with the Wise-IoU_Loss function, and obtain the improved detection algorithm model; Step D: Input the laser welding images in the training set into the obtained detection algorithm improvement model, train and learn the detection algorithm improvement model and judge defects, save the target localization boxes of different sizes with defect category information detected by the output of the detection algorithm improvement model to the corresponding trained model weights, and verify the laser welding images in the validation set according to the model weights. Step E: Deploy the validated improved detection algorithm model to the embedded platform; The specific steps in step C, namely, separating and merging the intermediate branches of the MPC-N module in the Neck layer and adding the SE attention mechanism module, are as follows: The MPC-N module in the Neck layer of the YOLOv7 network is split and merged, and an SE attention mechanism module is added to one of the convolutional modules in the MPC-N module.

2. The method for detecting the welding quality of power lithium battery terminals based on YOLOv7 according to claim 1, characterized in that, Step A specifically includes: Real-time capture of laser welding images on an industrial welding production line; The laser welding images with high repeatability and redundant images without welding defects are screened and removed from the obtained laser welding images to obtain the screened laser welding images. The selected laser welding images are defined and labeled according to the defect information, and the labeled selected laser welding images are used as the labeled dataset.

3. The method for detecting the welding quality of power lithium battery terminals based on YOLOv7 according to claim 1, characterized in that, Step B specifically includes: The labeled dataset is augmented using methods such as offsetting, random rotation, random brightness, and adding random Gaussian noise and salt-and-pepper noise to obtain the augmented labeled dataset. The enhanced labeled dataset was augmented using the mosaic data augmentation method to obtain an expanded labeled dataset. All laser welding images in the expanded annotation dataset are adjusted to a uniform size to obtain the final enhanced annotation dataset. All laser welding images in the final enhanced labeled dataset are randomly divided into training, validation, and test sets.

4. The method for detecting the welding quality of power lithium battery terminals based on YOLOv7 according to claim 1, characterized in that, The specific steps in step C of introducing the C3SE attention mechanism module into the Backbone layer are as follows: A C3SE attention mechanism module is inserted after the last MPC-B module in the Backbone layer of the YOLOv7 network in the preliminary model of the detection algorithm.