Lightweight high-precision power battery pole detection method in complex environment
By optimizing the structure of the YOLOX target detection model, the accuracy and efficiency problems of the pole column detection of power batteries in complex environments are solved, lightweight and high-precision pole column detection is achieved, and it is successfully deployed on the industrial control machine.
Patent Information
- Application Number
- CN202510120865.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2045-01-24
AI Technical Summary
The prior art is difficult to detect the pole columns of the power battery in complex environments, especially when there are impurities and environmental changes on the battery surface, the template matching method performs poorly, and deep learning methods are difficult to deploy on industrial control machines with limited hardware resources.
A lightweight and high-precision power battery pole detection method in complex environments is adopted. Through iterative training of the training set and initialization model, the CSP module, model neck network and spatial pyramid pooling module of the YOLOX object detection model are optimized to build an efficient lightweight detection model.
Lightweight and high-precision power battery pole detection in complex welding environments is realized, avoiding the performance degradation of traditional methods in complex environments, and an efficient object detection model is deployed on industrial control machines.
Smart Images

Figure CN120032226A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision and its application technology, and in particular to a lightweight and high-precision power battery pole detection method in a complex environment. Background Art
[0002] It is proposed to take intelligent manufacturing as the main direction of the integration of industrialization and informatization to promote the intelligent manufacturing process. In this context, visual technology, as an advanced technology with non-contact, fast processing speed and large amount of information, has been widely used in the field of welding, such as identification and guidance of the initial welding position before welding, weld tracking, welding quality control and evaluation, weld defect detection, etc. As the core component of new energy vehicles, the connection quality of the poles between battery modules directly affects the stability and utilization efficiency of the final product. In order to ensure the high quality of the battery module and ensure the stable and reliable power supply of the vehicle, an accurate and reliable initial welding position recognition method is required. At present, most companies use the template matching method to locate the battery pole from the captured image. This method performs poorly when there are impurities on the battery surface and is difficult to cope with complex welding environments.
[0003] For example, the Chinese invention patent with publication number CN 115731165 A introduces a method for determining the size of lithium battery components using a template matching method based on grayscale values.
[0004] Specific methods include:
[0005] Step 1: The image acquisition unit acquires the image information of the calibration unit and transmits it to the host computer. The calibration is achieved using film, the accuracy of the film is 1um, and the shape is a 5mm×5mm square.
[0006] Step 2: The computing unit in the host computer obtains the regional position of the calibration unit in the calibration unit image information through a template matching method based on gray value.
[0007] Step 3: The computing unit in the host computer obtains the grayscale value in the area position of the calibration unit and calculates the average grayscale value in the area position, compares the deviation with the actual grayscale value of the calibration unit, and determines whether it is NG based on the deviation value.
[0008] Step 4: The computing unit in the host computer obtains the center point coordinates of the calibration unit, and determines the coordinate values of the left, right, upper and lower edges of the calibration unit according to the center point coordinates.
[0009] Step 5: The computing unit in the host computer calculates the estimated width and height values of the calibration unit according to the horizontal and vertical coordinate differences of the upper and lower edges, and based on this, calculates the deviation between the estimated width and height values and the actual width and height values, and determines whether it is NG according to the deviation value.
[0010] In the above technical solution, a method for calculating the size of lithium battery components is implemented. In the image captured by the image acquisition unit, the visual camera stick is black, the product to be detected is gray, and the pole ear is white. Different areas have obvious color distinctions, and relatively accurate results can be achieved in target area detection. In the above technical solution, it is required that there is a clear color distinction between the foreground and the background, and a clear boundary line can be drawn. If it is applied to pole detection, the performance will be greatly reduced. The surface of the power battery pole is all metallic color, and there is no obvious division. Impurities are prone to appear on the battery surface, and changes in the environment will also affect the presentation of the foreground and background in the imaging results.
[0011] In addition, although deep learning methods are widely used in the field of visual recognition, hardware resources are often limited in industrial applications, and deep learning methods are difficult to maximize their effectiveness. Therefore, it is necessary to lightweight the model to reduce the demand for hardware and resources, making it possible to deploy target detection models in industrial computers. However, there is currently no lightweight model that matches the pole recognition of power batteries in complex environments. Summary of the invention
[0012] In view of the deficiencies in the prior art, an object of the present invention is to provide a lightweight and high-precision power battery pole detection method in a complex environment.
[0013] In order to achieve the above-mentioned invention object, the technical solution adopted by the present invention includes:
[0014] In a first aspect, the present invention provides a training method for a lightweight and high-precision power battery pole detection model in a complex environment, which comprises:
[0015] Providing a training set, the training set comprising training images and training marks, the training images comprising photos of power batteries in a variety of different environments, and the training marks marking the pole positions of the power batteries;
[0016] An initialization model is provided, wherein the initialization model is obtained by adjusting a basic YOLOX target detection model, wherein the adjustment includes replacing a CSP module in the basic YOLOX target detection model with an efficient CSP module, introducing a lightweight model neck network, and optimizing a spatial pyramid pooling module in the basic YOLOX target detection model;
[0017] Iteratively training the initialization model using the training set to obtain the lightweight and high-precision power battery pole detection model;
[0018] Among them, the efficient CSP module replaces the Bottleneck submodule in the CSP module with a parallel connected DenseBottleneck submodule, the DenseBottleneck submodule includes multiple fused convolution layers, the fused convolution layer includes a standard convolution and a depth-separable convolution, the input features of the fused convolution layer generate a first convolution output after the standard convolution, the first convolution output generates a second convolution output after the depth-separable convolution, the first convolution output and the second convolution output are fused to form a fused output as the output feature of the fused convolution layer, the input features and output features of the adjacent previous fused convolution layer are spliced to form a spliced feature as the input of the adjacent next fused convolution layer; the lightweight model neck network replaces some standard convolution layers in the original neck network with the fused convolution layers; the spatial pyramid pooling module adds average pooling processing, and the output features of the average pooling processing are fused with the output features of the original maximum pooling processing to replace the output features of the maximum pooling processing.
[0019] In a second aspect, the present invention further provides a lightweight and high-precision power battery pole detection method in a complex environment, which comprises:
[0020] Provide a lightweight and high-precision power battery pole detection model trained by the above training method;
[0021] The image to be detected is input into the lightweight and high-precision power battery pole detection model to obtain the pole position mark.
[0022] In a third aspect, the present invention further provides a pole welding method for a power battery, which comprises:
[0023] An image acquisition device is used to acquire an image of the power battery;
[0024] The above-mentioned lightweight and high-precision power battery pole detection method is used to obtain the pole position mark;
[0025] Based on the pole position mark, a welding device is guided to weld the pole.
[0026] In a fourth aspect, the present invention further provides a training system for a lightweight and high-precision power battery pole detection model in a complex environment, which includes:
[0027] A training set unit, configured to provide a training set, wherein the training set includes training images and training marks, wherein the training images include photos of power batteries in a variety of different environments, and the training marks mark the positions of the poles of the power batteries;
[0028] A model initialization unit, used to provide an initialization model, wherein the initialization model is obtained based on the adjustment of the basic YOLOX target detection model, wherein the adjustment includes replacing the CSP module in the basic YOLOX target detection model with an efficient CSP module, introducing a lightweight model neck network, and optimizing the spatial pyramid pooling module in the basic YOLOX target detection model;
[0029] An iterative training unit, configured to iteratively train the initialization model using the training set to obtain the lightweight and high-precision power battery pole detection model;
[0030] Among them, the efficient CSP module replaces the Bottleneck submodule in the CSP module with a parallel connected DenseBottleneck submodule, the DenseBottleneck submodule includes multiple fused convolution layers, the fused convolution layer includes a standard convolution and a depth-wise separable convolution, the input features of the fused convolution layer generate a first convolution output after the standard convolution, the first convolution output generates a second convolution output after the depth-wise separable convolution, the first convolution output and the second convolution output are fused to form a fused output as the output feature of the fused convolution layer, the input features and output features of the adjacent previous fused convolution layer are spliced to form a spliced feature as the input of the adjacent next fused convolution layer; the lightweight model neck network replaces some standard convolution layers in the original neck network with the fused convolution layers; the spatial pyramid pooling module adds an average pooling process, and the output features of the average pooling process are fused with the output features of the original maximum pooling process to replace the output features of the maximum pooling process.
[0031] In a fifth aspect, the present invention further provides a readable storage medium, wherein the readable storage medium stores a computer program, and when the computer program is executed, the steps of the above-mentioned training method are executed.
[0032] Based on the above technical solution, compared with the prior art, the beneficial effects of the present invention at least include:
[0033] The present invention applies visual inspection technology to pre-welding inspection of power battery poles, combines lightweight methods to optimize model parameters and computational complexity while maintaining high precision, uses densely connected DenseBottleneck modules to enhance the guiding role of original features in the feature extraction process, optimizes simple but poorly performing serial structures into parallel structures, enriches feature gradients, and applies residual branches to reduce the probability of gradient explosion and gradient vanishing; introduces a lightweight neck VoV-GSCSP constructed by deep separable convolution, greatly reduces the parameters and computational complexity of the model by multiples, while maintaining feature extraction and fusion capabilities comparable to the original neck network; also introduces a novel spatial pyramid pooling module (SPP), considers the information in the convolution kernel from both global and local perspectives, and enhances the reuse capability of features; thereby, the optimized YOLOX model is used to realize power battery pole detection, which can effectively avoid the interference of complex welding environments that are difficult for traditional detection methods to cope with, and realize lightweight and high-precision pole detection with environmental universality.
[0034] The above description is only an overview of the technical solution of the present invention. In order to enable those skilled in the art to more clearly understand the technical means of the present application and implement them according to the contents of the specification, the following is a description of the preferred embodiments of the present invention in conjunction with detailed drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A schematic flow chart of a pole pre-welding detection method provided for a typical implementation case of the present invention;
[0036] Figure 2 A schematic diagram of data annotation results provided for a typical implementation case of the present invention;
[0037] Figure 3 A schematic diagram of data enhancement results provided for a typical implementation case of the present invention;
[0038] Figure 4 A schematic diagram of the structure of a high-efficiency CSP module constructed using DenseBottleneck provided in a typical implementation case of the present invention;
[0039] Figure 5 A schematic diagram of the structure of a benchmark model CSP module provided for a typical implementation case of the present invention;
[0040] Figure 6 A schematic diagram of the structure of a lightweight neck VoV-GSCSP provided for a typical implementation case of the present invention;
[0041] Figure 7 A schematic diagram of the structure of an optimized spatial pyramid pooling module provided for a typical implementation case of the present invention;
[0042] Figure 8 A schematic diagram of the structure of the SPP module of the benchmark model provided for a typical implementation case of the present invention;
[0043] Fig. 9 A schematic diagram of pole detection results provided for a typical implementation case of the present invention. DETAILED DESCRIPTION
[0044] In view of the deficiencies in the prior art, the inventor of this case has proposed the technical solution of the present invention after long-term research and extensive practice. The technical solution, its implementation process and principle will be further explained as follows.
[0045] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0046] Moreover, relational terms such as “first” and “second” are merely used to distinguish one component or method step from another with the same name, but do not necessarily require or imply any such actual relationship or order between these components or method steps.
[0047] The main technical idea of the present invention is: in view of the pole detection problem before welding of power battery modules in complex environments, a lightweight and high-precision power battery pole detection method in complex environments with low requirements for welding environment and low requirements for hardware resources is established. Compared with the traditional template matching method, the present invention introduces the visual detection model into the pre-welding target detection method, which reduces the requirements for the welding environment. At the same time, a more efficient CSP module is used to enhance the gradient flow of the model, a lightweight neck is used to reduce the parameters and calculation amount of the model, and an optimized SPP module is introduced to take global information into consideration to reduce information loss.
[0048] Based on the above technical concept, an embodiment of the present invention provides a training method for a lightweight and high-precision power battery pole detection model in a complex environment, which includes the following steps:
[0049] Providing a training set, the training set comprising training images and training marks, the training images comprising photos of power batteries in a variety of different environments, and the training marks marking the pole positions of the power batteries;
[0050] An initialization model is provided, wherein the initialization model is obtained by adjusting a basic YOLOX target detection model, wherein the adjustment includes replacing a CSP module in the basic YOLOX target detection model with an efficient CSP module, introducing a lightweight model neck network, and optimizing a spatial pyramid pooling module in the basic YOLOX target detection model;
[0051] Iteratively training the initialization model using the training set to obtain the lightweight and high-precision power battery pole detection model;
[0052] Among them, the efficient CSP module replaces the Bottleneck submodule in the CSP module with a parallel connected DenseBottleneck submodule, the DenseBottleneck submodule includes multiple fused convolution layers, the fused convolution layer includes a standard convolution and a depth-separable convolution, the input features of the fused convolution layer generate a first convolution output after the standard convolution, the first convolution output generates a second convolution output after the depth-separable convolution, the first convolution output and the second convolution output are fused to form a fused output as the output feature of the fused convolution layer, the input features and output features of the adjacent previous fused convolution layer are spliced to form a spliced feature as the input of the adjacent next fused convolution layer; the lightweight model neck network replaces some standard convolution layers in the original neck network with the fused convolution layers; the spatial pyramid pooling module adds average pooling processing, and the output features of the average pooling processing are fused with the output features of the original maximum pooling processing to replace the output features of the maximum pooling processing.
[0053] In the basic YOLOX target detection model, its backbone network is mainly composed of a combination of standard convolution and CSP modules. Network modules of different depths focus on different content. The low-level backbone modules extract the position information of the input image, and the high-level backbone modules extract the semantic information of the input image. The neck of YOLOX mainly adopts the feature transfer structure PAFPN that combines top-down and bottom-up methods. It still uses standard convolution and CSP stacking to further process the output information of different sizes obtained from the backbone, and mixes feature information of different sizes through upsampling operators and feature splicing methods. The feature extraction ability of the backbone network is very important in the network training process. The input image is processed by the backbone network, and the features of the target and foreground are separated. Therefore, the present invention retains the original CSP structure of the backbone and only optimizes the CSP module of the neck. The original CSP module uses the Bottleneck submodule to realize feature extraction, but the serial method has the problem of information loss when the network is deepened. Therefore, the Bottleneck module is optimized. For details, see the structural comparison before and after optimization. Figure 4-Figure 8. For the SPP module, its fundamental role is to divide the input feature map into grids of different sizes, perform pooling operations at different scales to obtain feature representations, and finally concatenate all features into a feature vector of fixed length, which effectively solves the problem of how to avoid precision loss and computational redundancy caused by image scaling when there are multiple input features of different scales. The SPP module in the original model is applied to the connection between the backbone network and the neck of the model, which can effectively deal with the scale problems caused by different levels of the model. However, it only uses maximum pooling, focusing on the features with the largest weights in the pooling area. Taking the 3×3 convolution kernel as an example, the remaining 8 information within the range are discarded, resulting in information loss. Therefore, the present invention combines maximum pooling and average pooling, and introduces more convolution modules to realize the function of SPP, which can effectively avoid the problem of information loss.
[0054] In some embodiments, the method for obtaining the training set may specifically include the following process:
[0055] Collecting an original power battery image, and marking the poles in the original power battery image to form training marks;
[0056] Performing data augmentation on the original power battery image to obtain the training set;
[0057] The data augmentation method includes any one or more combinations of image rotation, partial occlusion, illumination change, and noise addition.
[0058] In some embodiments, the original image is collected in a manner including normal shooting, tilted shooting, shooting with part of the pole out of the camera field of view, and shooting of the pole image under actual welding conditions.
[0059] As a specific example of the above training method, the training process in practical application may include the following steps:
[0060] S1. Change the welding environment, collect images of power battery cells, manually annotate the collected images, and save the annotated file information;
[0061] S2. Using data enhancement methods, a data set containing multiple welding environments is constructed, and corresponding image labels are obtained, and the above data set is divided according to a certain ratio;
[0062] S3. Optimize the selected YOLOX target detection model, use the densely connected Bottleneck module (DenseBottleneck) to build a more efficient CSP module, introduce the lightweight model neck VoV-GSCSP and the optimized spatial pyramid pooling module (SPP) to improve the YOLOX target detection algorithm;
[0063] S4. The YOLOX network is used to train the data set to obtain a YOLOX algorithm network model through training. The model performance is evaluated using detection accuracy (Precision) and recall rate (Recall). The optimal model is used for the detection of the pole image to obtain the region of interest to indicate the position of the pole.
[0064] As for the specific process of obtaining the training set, the image acquisition and annotation method in step S1 above specifically includes:
[0065] Use Daheng Mercury MERCURY2-U3 series cameras or other equipment to shoot power battery images in various welding environments from multiple angles, including power battery graphics under a clean and tidy background, power battery graphics placed under a clamping device, power battery images with circular background interference, power battery images under strong lighting conditions, power battery images under weak light, etc. In addition, the number of power battery poles in the camera's field of view changes during the shooting process to ensure that the data sets for both single-target and multi-target situations are covered;
[0066] Use the labelimg tool to annotate the battery pole images and create a corresponding label file for each image. The label file uses the Pascal VOC format suitable for the YOLOX target detection model. Specifically, each time a target is annotated, the target's category label is recorded in the xml label file. The category label is the coordinate information of Battery and the true target box (GT).
[0067] Furthermore, the data enhancement method and data set division operation in step S2 specifically include:
[0068] Image rotation: set each existing image to rotate once, with a maximum rotation angle of 25°, to simulate the situation where the relative position of the target and the camera changes;
[0069] The image is partially blocked. A rectangular or circular mask of random size is generated to simulate the situation where the detection target is partially blocked. The mask is required to block no more than half of the target.
[0070] Light changes: change the brightness of the existing image through the brightness factor alpha. When alpha is less than 1, it simulates the battery pole image under low light conditions, and when alpha is greater than 1, it simulates the battery pole image under strong light conditions.
[0071] Add noise. Noise cannot be ignored in the welding environment. Different degrees of Gaussian noise or salt and pepper noise are added through random numbers to simulate the changes in the welding environment.
[0072] For the image data that has been annotated in the early stage, the images of the above four situations are added in a certain proportion to form the final data set for training the model. The simulation of multiple welding environments can effectively enhance the generalization ability of the model. Finally, the final battery data set is divided into training set, verification set and test set in a ratio of 8:1:1.
[0073] Regarding the optimization of the above-mentioned YOLOX target detection model, on the one hand, in some implementation schemes, the CSP module includes a first branch, a second branch and a third branch, the first branch is a direct transmission output, the second branch is sequentially passed through the first standard convolution layer and then passed to multiple parallel connected DenseBottleneck sub-modules and output, the third branch is output after passing through the second standard convolution layer, and the input features of the efficient CSP module pass through the first branch, the second branch and the third branch, and after splicing, continue to pass through the third standard convolution layer as the output features of the efficient CSP module.
[0074] As a typical example, the more efficient CSP module constructed by using the densely connected Bottleneck module (DenseBottleneck) in the above step S3 specifically includes:
[0075] CSP is constructed by the standard convolution module (Conv) and the Bottleneck module. The specific implementation of the Bottleneck module used by YOLOX is as follows:
[0076] The original features are input and convolved twice to achieve fast dimensionality reduction and feature extraction respectively, and the convolved features are obtained. The original features and the convolved features are summed using a branching structure to obtain a new feature representation. This implementation method faces the problem of gradual information loss when processing deeper networks, and each layer can only extract features based on the output of the previous layer, which limits the reuse and sharing of features.
[0077] The Bottleneck module included in the more efficient CSP module adopts a dense connection method, called DenseBottleneck, and its specific implementation method is as follows:
[0078] The standard convolution is replaced by a lightweight convolution module GSConv that combines feature extraction capabilities with small size. The output of the first convolution layer is concatenated with the input features as the input of the second convolution layer, ensuring that each layer can directly receive the feature information after all previous convolution processing, retaining the feature information to the maximum extent for subsequent effective feature extraction of the input graphics, greatly enhancing the reusability of the features and further alleviating the problem of gradient disappearance.
[0079] In addition to using DenseBottleneck modules, the more efficient CSP module also optimizes the connection method of multiple DenseBottleneck modules. Specifically:
[0080] Parallel connections are used to enrich the flow of gradient information and reduce the impact of deepening the model hierarchy on gradient information. Parallel module connections can extract features more efficiently. In addition, residual connections are introduced to directly concatenate input features with features processed by multiple DenseBottlenecks through branches, which can maximize the role of input features and effectively avoid gradient explosion and gradient disappearance.
[0081] In a second aspect, in some embodiments, the lightweight model neck network includes a main branch, a first side branch, and a second side branch;
[0082] The main branch passes through the fourth standard convolution layer, the two fused convolution layers, the first sum layer, the first connection layer and the fifth standard convolution layer in sequence; the first side branch passes the output features of the fourth standard convolution layer to the first sum layer after passing through the sixth standard convolution layer; the second side branch passes the input features of the fourth standard convolution layer to the first connection layer after passing through the seventh standard convolution layer.
[0083] As a typical example, the lightweight model neck Vov-GSCSP in step S3 specifically includes:
[0084] The standard convolution module Conv is replaced by an effective combination of standard convolution and depthwise separable convolution (DWConv), called GSConv. For a given input feature map, GSConv first obtains a convolution output with half the number of channels through standard convolution, and then obtains the feature map of the other half of the channels through depthwise separable convolution. Finally, the two parts of the feature map are spliced in the channel dimension and randomly shuffled, and the feature information of the two convolutions is fused to obtain the final output. Depthwise separable convolution divides the convolution operation into two steps. First, the input features are convolved depthwise, and the convolution kernel is used to process each channel of the image separately to obtain the effect of spatial convolution. Secondly, pointwise convolution is used, and 1×1 convolution is used to increase the dimension of the feature map obtained by depthwise convolution to extract channel features. For a known input feature map X, the shape is (Cin, H, W), the shape of the output feature map is (Cout, H, W), and the convolution kernel size is K×K. The number of parameters and the amount of calculation required for standard convolution are expressed as:
[0085] Param Conv =C in ×C out ×K×K
[0086] FLOPSConv =H×W×C in ×C out ×K×K
[0087] The reason why the GSConv module can effectively reduce the number of module parameters when the convolution capability is equivalent is that the depthwise separable convolution decouples the channel and space dimensions and extracts features in the two dimensions respectively. The number of parameters and the amount of calculation required are expressed as:
[0088] Param DWConv =C in ×K×K+C in ×C out
[0089] FLOPS DWConv =H×W×C in ×K×K+H×W×C in ×C out .
[0090] In a third aspect, in some embodiments, the spatial pyramid pooling module includes a main path, a first branch path, a second branch path, and a third branch path;
[0091] The main path passes through the eighth standard convolution layer, the ninth standard convolution layer, the tenth standard convolution layer, two maximum pooling layers, the second sum layer, a maximum pooling layer, the second connection layer, the eleventh standard convolution layer, the twelfth standard convolution layer, the third connection layer, and the thirteenth standard convolution layer in sequence; the first branch directly transfers the input features of the eighth standard convolution layer to the third connection layer; the second branch directly transfers the output features of the tenth standard convolution layer to the second sum layer; the third branch transfers the output features of the tenth standard convolution layer to the second connection layer after passing through an average pooling layer.
[0092] As a typical example, the optimization of the spatial pyramid pooling module in step S3 specifically includes:
[0093] YOLOX performs spatial pyramid pooling on the extracted features in the deepest network of the backbone, performs pooling operations at different scales to obtain feature representations, and finally concatenates all features into a feature vector of fixed length, effectively solving the problem of how to avoid precision loss and computational redundancy caused by image scaling when there are input features of multiple scales. The SPP module in YOLOX only uses the maximum pooling method for downsampling, focusing only on the maximum weight within the convolution kernel, resulting in information loss and a large redundancy in the processing of pooling operation results at multiple scales. Specifically, for the input feature map X, where the local area R contains k×k elements, R={x i,j}, where i, j are the indices of the elements in R, then the maximum pooling can be expressed as:
[0094]
[0095] The optimized SPP module introduces average pooling while retaining the maximum pooling. Average pooling uses the average value of all weights in the convolution kernel as an indicator, fully considering all the information in the convolution kernel. Maximum pooling is conducive to focusing on the maximum weight, that is, the most obvious feature. The combination of the two can achieve more fine-grained information combination. In addition, more convolution processing is introduced in the optimized SPP module to enhance the feature extraction capability. Specifically, for the input feature map X, where the local area R contains k×k elements, R={x i,j}, where i, j are the indices of the elements in R, then average pooling can be expressed as:
[0096]
[0097] In addition, regarding the training process, various labeled training methods can be used and the corresponding loss functions can be matched for training. Of course, in the present invention, an exemplary method is selected for training, that is, the model training and evaluation process in step S4, specifically including:
[0098] The divided training set images are input into the optimized YOLOX network model for training, and the batch_size parameter is set to 16. The stochastic gradient descent with momentum of 0.9 is used. The initial learning rate is set to 0.01 and the cosine learning rate is continuously adjusted. A reasonable number of training times is set, and the model training is judged to be underfitting or overfitting according to the convergence of the loss data of the model. In addition, the performance of the model is evaluated by calculating the precision and recall rate of the model at different IoU thresholds, and the parameters such as the number of training times and learning rate are reasonably adjusted according to the performance of the model.
[0099] Among them, for each predicted bounding box, the confidence threshold is first used to determine whether the current predicted box is a positive sample Positive or a negative sample Negative. The confidence higher than the threshold is identified as a positive sample, and the confidence lower than the threshold is identified as a negative sample. For positive samples, the predicted value with an IoU value greater than or equal to the set threshold is identified as a true positive sample TP, and the one that does not meet the above threshold condition is identified as a false positive sample FP. For negative samples, all detected target boxes whose IoU values with the true target boxes are less than the threshold are called true negative examples TN, and at least one IoU value greater than or equal to the threshold is called a false negative example FN. The precision of the target category Precision measures the accuracy of the model in samples predicted as positive samples, and the recall rate Recall measures the accuracy of the proportion of positive samples correctly detected by the model to all positive samples. The calculation method of the two can be expressed as:
[0100]
[0101] Use the validation set to verify the improved YOLOX network model obtained through training to obtain the validation set results. Analyze the differences between the training set results and the validation set results, and focus on observing whether the targets are missed and whether the detection rate of the targets is not much different from the detection rate on the validation set. If the verification results are not satisfactory, continue with the adjustment strategy in the previous step until the performance of the model on the training set and the validation set is balanced.
[0102] The above steps obtain a relatively optimal model. Use this model to detect the power battery images captured by the camera to obtain the images of the pole columns of interest. Thus, a lightweight and high-precision power battery pole column detection model in a complex environment is achieved.
[0103] Based on the above training method, an embodiment of the present invention further provides a lightweight and high-precision power battery pole column detection method in a complex environment, which includes the following steps:
[0104] Provide a lightweight and high-precision power battery pole column detection model obtained by training using the training method provided in any of the above embodiments;
[0105] Input the image to be detected into the lightweight and high-precision power battery pole column detection model to obtain the pole column position markings.
[0106] As a further application of the above solution, an embodiment of the present invention further provides a pole column welding method for a power battery, which includes the following steps:
[0107] Use an image acquisition device to obtain an image of the power battery;
[0108] Use the above lightweight and high-precision power battery pole column detection method to obtain the pole column position markings;
[0109] Based on the pole column position markings, guide a welding device to weld the pole columns.
[0110] Correspondingly, an embodiment of the present invention further provides a training system for a lightweight and high-precision power battery pole column detection model in a complex environment, which includes:
[0111] A training set unit for providing a training set, where the training set includes training images and training markings, the training images include power battery photos in various different environments, and the training markings annotate the pole column positions of the power batteries;
[0112] A model initialization unit, used to provide an initialization model, wherein the initialization model is obtained based on the adjustment of the basic YOLOX target detection model, wherein the adjustment includes replacing the CSP module in the basic YOLOX target detection model with an efficient CSP module, introducing a lightweight model neck network, and optimizing the spatial pyramid pooling module in the basic YOLOX target detection model;
[0113] An iterative training unit, configured to iteratively train the initialization model using the training set to obtain the lightweight and high-precision power battery pole detection model;
[0114] Among them, the efficient CSP module replaces the Bottleneck submodule in the CSP module with a parallel connected DenseBottleneck submodule, the DenseBottleneck submodule includes multiple fused convolution layers, the fused convolution layer includes a standard convolution and a depth-separable convolution, the input features of the fused convolution layer generate a first convolution output after the standard convolution, the first convolution output generates a second convolution output after the depth-separable convolution, the first convolution output and the second convolution output are fused to form a fused output as the output feature of the fused convolution layer, the input features and output features of the adjacent previous fused convolution layer are spliced to form a spliced feature as the input of the adjacent next fused convolution layer; the lightweight model neck network replaces some standard convolution layers in the original neck network with the fused convolution layers; the spatial pyramid pooling module adds average pooling processing, and the output features of the average pooling processing are fused with the output features of the original maximum pooling processing to replace the output features of the maximum pooling processing.
[0115] In addition, an embodiment of the present invention further provides a readable storage medium, in which a computer program is stored. When the computer program is executed, the steps of the training method provided in any of the above-mentioned embodiments are executed.
[0116] The technical solution of the present invention is further described in detail below through several embodiments and in conjunction with the accompanying drawings. However, the selected embodiments are only used to illustrate the present invention, and do not limit the scope of the present invention.
[0117] Example 1
[0118] This embodiment illustrates the training and specific application process of a pole detection model, which is specifically as follows:
[0119] The specific technical solution is:
[0120] See also Figure 1 This embodiment provides a lightweight and high-precision power battery pole detection method in a complex environment, comprising the following steps:
[0121] S1. Change the welding environment, collect images of power battery cells, manually annotate the collected images, and save the annotated file information;
[0122] S2. Using data enhancement methods, a data set containing multiple welding environments is constructed, and corresponding image labels are obtained, and the above data set is divided according to a certain ratio;
[0123] S3. Optimize the selected YOLOX target detection model, use the densely connected Bottleneck module (DenseBottleneck) to build a more efficient CSP module, introduce the lightweight model neck VoV-GSCSP and the optimized spatial pyramid pooling module (SPP) to improve the YOLOX target detection algorithm;
[0124] S4, training the data set with the YOLOX network, obtaining a YOLOX algorithm network model through training, evaluating the model performance using detection accuracy Precision and recall Recall, and using the optimal model for detection of the pole image to obtain the region of interest;
[0125] It should be noted that, in this embodiment, the division ratio of the data set is not limited to the above-disclosed text ratio. It is sufficient for the data set used to train the model to exceed 70% of the overall data set. The model can be judged whether it has converged based on the evaluation index data of the model training continuously observed as described above. If it has converged, appropriate adjustments can be made.
[0126] As some typical examples of the above technical solutions, the main process of the pole detection method adopted is as follows: Figure 1 As shown, the specific steps include step 1 to step 6.
[0127] Step 1: Image acquisition, as shown below.
[0128] One training, multiple uses. In order to achieve such a model effect, it is necessary to ensure that a sufficient number of images are collected. During the collection process, full consideration should be given to image collection in all situations, such as when the camera is slightly tilted, some poles are beyond the camera's field of view, and pole images under actual welding conditions, etc. Image collection should be achieved from multiple angles, and the welding environment can be flexibly changed during collection, including improving the environment and deteriorating the environment, to ensure that the target pole can be accurately detected in a variety of situations after one training.
[0129] Step 2: Data annotation, combined with Figure 2 , as shown below.
[0130] The collected image data is manually annotated to select the target area on the image. It should be noted that the selected area should reflect the position of the target on the entire image as accurately as possible, and it is not appropriate to mark too much background information as the target area. Select the pole area on the Labelimg software, and correspond the image data and the annotation data xml file one by one. The xml label file includes the image ID, image path, image name, image pixel height and width, and image label name. The pixel height and width of the image are represented by four coordinates of a rectangular box, including xmin, ymin, xmax, and ymax, which represent the upper left corner x pixel coordinate of the real target area, the upper left corner y pixel coordinate of the real target area, the lower right corner x pixel coordinate of the real target area, and the lower right corner y pixel coordinate of the real target area. Accurate correspondence can help accurately locate the target position during model training and learn the features of the target position.
[0131] Step 3: Data enhancement, combined Figure 3 , as shown below.
[0132] After completing the annotation of the collected images in the above step 2, the image data and the corresponding annotation file information are obtained. The image data is enhanced with a data enhancement method according to a certain probability to expand the data set, and the battery pole images under various welding environments and their corresponding annotation file information are obtained, which are used as the final data set for training and verifying the model.
[0133] The data enhancement method used in this embodiment includes:
[0134] Image rotation: set each existing image to rotate once, with a maximum rotation angle of 25°, to simulate the situation where the relative position of the target and the camera changes;
[0135] The image is partially blocked. A rectangular or circular mask of random size is generated to simulate the situation where the detection target is partially blocked. The mask is required to block no more than half of the target.
[0136] Light changes: change the brightness of the existing image through the brightness factor alpha. When alpha is less than 1, it simulates the battery pole image under low light conditions, and when alpha is greater than 1, it simulates the battery pole image under strong light conditions.
[0137] Add noise. Noise cannot be ignored in the welding environment. Different degrees of Gaussian noise or salt and pepper noise are added through random numbers to simulate the changes in the welding environment.
[0138] Step 4: Model construction, as shown below.
[0139] CSP is constructed by standard convolution modules (Conv) and Bottleneck modules. The specific implementation of the Bottleneck module adopted by YOLOX is as follows:
[0140] Input the original features, perform two convolutions on the original features to respectively achieve fast dimensionality reduction and feature extraction, obtain the convolved features, and use a branch structure to add and sum the original features and the convolved features to obtain a new feature representation. This implementation method faces the problem of gradually losing information when processing deeper networks, and each layer can only perform feature extraction based on the output of the previous layer, which limits the reuse and sharing of features.
[0141] Combined with Figure 4 , the Bottleneck module included in the more efficient CSP module adopts a densely connected method, called DenseBottleneck. Its specific implementation method is as follows:
[0142] Replace the standard convolution with a lightweight convolution module GSConv that takes into account both feature extraction ability and small volume. Concatenate the output of the first convolution layer with the input features as the input of the second convolution layer, ensuring that each layer can directly receive the feature information after all previous convolutions, maximizing the retention of feature information for subsequent effective feature extraction of the input graph, greatly enhancing the reusability of features and further alleviating the problem of gradient disappearance.
[0143] In addition to adopting the DenseBottleneck module, the connection method of multiple DenseBottleneck modules in the more efficient CSP module is also optimized. Specifically:
[0144] Adopt parallel connections to enrich the flow of gradient information, weaken the impact of deepening the model hierarchy on gradient information. The parallel module connections can perform feature extraction more efficiently. In addition, introduce residual connections, and directly concatenate the input features with the features after multiple DenseBottleneck processes through branches, which can maximize the role of the input features and effectively avoid gradient explosion and gradient disappearance.
[0145] Furthermore, combined with Figure 6 , the lightweight model neck Vov-GSCSP specifically includes:
[0146] The standard convolution module Conv is replaced by an effective combination of standard convolution and depthwise separable convolution (DWConv), called GSConv. For a given input feature map, GSConv first obtains a convolution output with half the number of channels through standard convolution, and then obtains the feature map of the other half of the channels through depthwise separable convolution. Finally, the two parts of the feature map are spliced in the channel dimension and randomly shuffled, and the feature information of the two convolutions is fused to obtain the final output. Depthwise separable convolution divides the convolution operation into two steps. First, the input features are convolved depthwise, and the convolution kernel is used to process each channel of the image separately to obtain the effect of spatial convolution. Secondly, pointwise convolution is used, and 1×1 convolution is used to increase the dimension of the feature map obtained by depthwise convolution to extract channel features. For a known input feature map X, the shape is (Cin, H, W), the shape of the output feature map is (Cout, H, W), and the convolution kernel size is K×K. The number of parameters and the amount of calculation required for standard convolution are expressed as:
[0147] Param Conv =C in ×C Dut ×K×K
[0148] FLOPS Conv =H×W×C in ×C out ×K×K
[0149] The reason why the GSConv module can effectively reduce the number of module parameters when the convolution capability is equivalent is that the depthwise separable convolution decouples the channel and space dimensions and extracts features in the two dimensions respectively. The number of parameters and the amount of calculation required are expressed as:
[0150] Param DWConv =C in ×K×K+C in ×C out
[0151] FLOPS DWConv =H×W×C in ×K×K+H×W×C in ×C out
[0152] Furthermore, the optimization of the spatial pyramid pooling module specifically includes:
[0153] YOLOX performs spatial pyramid pooling on the extracted features in the deepest network of the backbone, performs pooling operations at different scales to obtain feature representations, and finally concatenates all features into a feature vector of fixed length, effectively solving the problem of how to avoid precision loss and computational redundancy caused by image scaling when there are input features of multiple scales. The SPP module in YOLOX only uses the maximum pooling method for downsampling, focusing only on the maximum weight within the convolution kernel, resulting in information loss and a large redundancy in the processing of pooling operation results at multiple scales. Specifically, for the input feature map X, where the local area R contains k×k elements, R={x i,j}, where i, j are the indices of the elements in R, then the maximum pooling can be expressed as:
[0154]
[0155] Combination Figure 7 , the optimized SPP module introduces average pooling while retaining the maximum pooling. Average pooling uses the average value of all weights in the convolution kernel as an indicator, fully considering all the information in the convolution kernel. Maximum pooling is conducive to focusing on the maximum weight, that is, the most obvious feature. The combination of the two can achieve more fine-grained information combination. In addition, more convolution processing is introduced in the optimized SPP module to enhance the feature extraction capability. Specifically, for the input feature map X, where the local area R contains k×k elements, R={x i,j}, where i, j are the indices of the elements in R, then average pooling can be expressed as:
[0156]
[0157] For step 5: training and verification, the divided training set images are input into the optimized YOLOX network model for training, the batch_size parameter is set to 16, the stochastic gradient descent with momentum of 0.9 is used, the initial learning rate is set to 0.01 and the cosine learning rate is continuously adjusted, and a reasonable number of training times is set. According to the convergence of the model's loss data, it is judged whether the model training is underfitting or overfitting. In addition, the model's performance is evaluated by calculating the precision and recall rate of the model at different IoU thresholds, and the parameters such as the number of training times and learning rate are reasonably adjusted according to the model performance.
[0158] Use the validation set to verify the improved YOLOX network model obtained through training, obtain the validation set results, analyze the differences between the training set results and the validation set results, and focus on observing whether the target is missed and whether the detection rate of the target is not much different from the detection rate on the validation set. If the verification result is not ideal, continue with the adjustment strategy in the previous step until the performance of the model on the training set and the validation set is balanced.
[0159] According to the existing training parameter settings, the model is trained. Given the number of iterations, each iteration is completed to preliminarily judge whether the current model has converged through the change in the model loss value. After the current model is trained, the changes in the precision and recall rate during the model training process are visualized, and the performance of the model is judged by observing the trend of the curve and the specific value that it eventually tends to. The precision of the target category measures the accuracy of the model in the samples predicted as positive samples, and the recall rate Recall measures the accuracy of the positive samples correctly detected by the model to all positive samples.
[0160] Step 5: Apply, Combine Fig. 9 , the specific implementation is as follows.
[0161] The optimized YOLOX model in this embodiment has high detection accuracy while its parameters and calculation amount are relatively reduced, which is conducive to deployment in an industrial computer. Therefore, in the end, the model is deployed in the industrial computer and used with a camera to capture images to achieve pole pre-welding detection.
[0162] Example 2
[0163] This embodiment uses a series of comparison and knockout experiments to demonstrate the superior performance of the training method and model provided in Example 1, as shown below:
[0164] D0: Example 1;
[0165] D1: Perform the same training and testing directly using the basic YOLOX model;
[0166] D2: Restoring the high-efficiency CSP module in the model provided in Example 1 to the CSP module in the basic YOLOX model;
[0167] D3: Restoring the lightweight model neck network in the model provided in Example 1 to the neck network in the basic YOLOX model;
[0168] D4: Remove the average pooling process in the spatial pyramid pooling module in the model provided in Example 1 and restore it to the spatial pyramid pooling module in the basic YOLOX model.
[0169] After conducting the same test experiment, the results are shown in the following table:
[0170]
[0171] Based on the above embodiments, it can be clearly seen that the embodiments of the present invention apply visual inspection technology to the pre-welding inspection of power battery poles, combine lightweight methods to optimize the parameters and computational complexity of the model while maintaining high precision, use densely connected DenseBottleneck modules to enhance the guiding role of the original features in the feature extraction process, optimize the simple but poorly performing serial structure into a parallel structure, enrich the feature gradients and apply residual branches to reduce the probability of gradient explosion and gradient disappearance; introduce a lightweight neck VoV-GSCSP constructed by deep separable convolution, which greatly reduces the parameters and computational complexity of the model by multiples, while maintaining the feature extraction and fusion capabilities comparable to the original neck network; also introduce a novel spatial pyramid pooling module (SPP) to consider the information in the convolution kernel from both global and local perspectives to enhance the reuse capability of features; thereby using the optimized YOLOX model to realize power battery pole detection, which can effectively avoid the interference of complex welding environments that are difficult for traditional detection methods to cope with, and realize lightweight and high-precision pole detection with environmental universality.
[0172] It should be understood that the above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent changes or modifications made according to the spirit of the present invention should be included in the protection scope of the present invention.
Claims
1. A training method for a lightweight and high-precision power battery pole detection model in a complex environment, characterized in that: include: Providing a training set, the training set comprising training images and training marks, the training images comprising photos of power batteries in a variety of different environments, and the training marks marking the pole positions of the power batteries; An initialization model is provided, wherein the initialization model is obtained by adjusting a basic YOLOX target detection model, wherein the adjustment includes replacing a CSP module in the basic YOLOX target detection model with an efficient CSP module, introducing a lightweight model neck network, and optimizing a spatial pyramid pooling module in the basic YOLOX target detection model; Iteratively training the initialization model using the training set to obtain the lightweight and high-precision power battery pole detection model; Among them, the efficient CSP module replaces the Bottleneck submodule in the CSP module with a parallel connected DenseBottleneck submodule, the DenseBottleneck submodule includes multiple fused convolutional layers, the fused convolutional layer includes a standard convolution and a depth-separable convolution, the input features of the fused convolutional layer are subjected to the standard convolution to generate a first convolution output, the first convolution output is subjected to the depth-separable convolution to generate a second convolution output, the first convolution output and the second convolution output are fused to form a fused output as the output feature of the fused convolutional layer, the input features and output features of the adjacent previous fused convolutional layer are spliced to form a spliced feature as the input of the adjacent next fused convolutional layer; the lightweight model neck network replaces some standard convolutional layers in the original neck network with the fused convolutional layers; The spatial pyramid pooling module adds an average pooling process, and the output features of the average pooling process are fused with the output features of the original maximum pooling process to replace the output features of the maximum pooling process.
2. The training method according to claim 1, characterized in that: The method of obtaining the training set specifically includes: Collecting an original power battery image, and marking the poles in the original power battery image to form training marks; Performing data augmentation on the original power battery image to obtain the training set; The data augmentation method includes any one or more combinations of image rotation, partial occlusion, illumination change, and noise addition.
3. The training method according to claim 2, characterized in that: The original image acquisition method includes normal shooting, tilted shooting, shooting with part of the pole out of the camera field of view, and shooting of the pole image under actual welding conditions.
4. The training method according to claim 1, characterized in that: The CSP module includes a first branch, a second branch and a third branch. The first branch is a direct transmission output. The second branch is sequentially passed through the first standard convolution layer and then passed to multiple parallel connected DenseBottleneck sub-modules and output. The third branch is output after passing through the second standard convolution layer. The input features of the efficient CSP module pass through the first branch, the second branch and the third branch, and after splicing, continue to pass through the third standard convolution layer as the output features of the efficient CSP module.
5. The training method according to claim 1, characterized in that: The lightweight model neck network includes a main branch, a first side branch, and a second side branch; The main branch passes through the fourth standard convolution layer, the two fused convolution layers, the first sum layer, the first connection layer and the fifth standard convolution layer in sequence; the first side branch passes the output features of the fourth standard convolution layer to the first sum layer after passing through the sixth standard convolution layer; the second side branch passes the input features of the fourth standard convolution layer to the first connection layer after passing through the seventh standard convolution layer.
6. The training method according to claim 1, characterized in that: The spatial pyramid pooling module includes a main path, a first branch path, a second branch path and a third branch path; The main path passes through the eighth standard convolution layer, the ninth standard convolution layer, the tenth standard convolution layer, two maximum pooling layers, the second sum layer, a maximum pooling layer, the second connection layer, the eleventh standard convolution layer, the twelfth standard convolution layer, the third connection layer, and the thirteenth standard convolution layer in sequence; the first branch directly transfers the input features of the eighth standard convolution layer to the third connection layer; the second branch directly transfers the output features of the tenth standard convolution layer to the second sum layer; the third branch transfers the output features of the tenth standard convolution layer to the second connection layer after passing through an average pooling layer.
7. A lightweight and high-precision power battery pole detection method in a complex environment, characterized in that: include: Providing a lightweight and high-precision power battery pole detection model obtained by training using the training method described in any one of claims 1 to 6; The image to be detected is input into the lightweight and high-precision power battery pole detection model to obtain the pole position mark.
8. A method for welding a pole of a power battery, characterized in that: include: An image acquisition device is used to acquire an image of the power battery; The lightweight and high-precision power battery pole detection method according to claim 7 is used to obtain the pole position mark; Based on the pole position mark, a welding device is guided to weld the pole.
9. A training system for a lightweight and high-precision power battery pole detection model in a complex environment, characterized in that: include: A training set unit, configured to provide a training set, wherein the training set includes training images and training marks, wherein the training images include photos of power batteries in a variety of different environments, and the training marks mark the positions of the poles of the power batteries; A model initialization unit, used to provide an initialization model, wherein the initialization model is obtained based on the adjustment of the basic YOLOX target detection model, wherein the adjustment includes replacing the CSP module in the basic YOLOX target detection model with an efficient CSP module, introducing a lightweight model neck network, and optimizing the spatial pyramid pooling module in the basic YOLOX target detection model; An iterative training unit, configured to iteratively train the initialization model using the training set to obtain the lightweight and high-precision power battery pole detection model; Among them, the efficient CSP module replaces the Bottleneck submodule in the CSP module with a parallel connected DenseBottleneck submodule, the DenseBottleneck submodule includes multiple fused convolutional layers, the fused convolutional layer includes a standard convolution and a depth-separable convolution, the input features of the fused convolutional layer are subjected to the standard convolution to generate a first convolution output, the first convolution output is subjected to the depth-separable convolution to generate a second convolution output, the first convolution output and the second convolution output are fused to form a fused output as the output feature of the fused convolutional layer, the input features and output features of the adjacent previous fused convolutional layer are spliced to form a spliced feature as the input of the adjacent next fused convolutional layer; the lightweight model neck network replaces some standard convolutional layers in the original neck network with the fused convolutional layers; The spatial pyramid pooling module adds an average pooling process, and the output features of the average pooling process are fused with the output features of the original maximum pooling process to replace the output features of the maximum pooling process.
10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed, the steps of the training method according to any one of claims 1 to 6 are executed.
Citation Information
Patent Citations
Detection system and method for online size spot inspection of lithium battery
CN115731165A
Lightweight SAR ship detection method and system
CN116844055A
Underwater target detection method based on multi-scale feature cross fusion
CN119091286A
General target detection method for adaptive attention guidance mechanism
WO2021139069A1
Defect detection method and related device
WO2024255919A1