Method, device, equipment and medium for detecting welding defects of new energy battery poles
Automatically detecting welding defects in new energy battery poles through a semantic segmentation model solves the low efficiency problem of existing detection methods and achieves efficient and accurate defect detection.
Patent Information
- Application Number
- CN202211008108.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-22
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2042-08-22
AI Technical Summary
Existing methods for detecting welding defects in new energy battery poles are inefficient, require a lot of time to design and match complex defect templates, and are difficult to adapt to production environments with multiple welding defects.
A semantic segmentation model is used for feature extraction and information recognition. Through iterative training of training images, verification images, and test images, battery pole welding defects are automatically detected to avoid constructing defect templates.
The efficiency and accuracy of new energy battery pole welding defect detection are improved, the detection time is reduced, and the level of detection automation is improved.
Smart Images

Figure CN115375652B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of new energy vehicle batteries, and in particular to a method, device, equipment and medium for detecting welding defects of new energy battery poles. Background Art
[0002] New energy lithium-ion batteries are a crucial component of automotive production. To ensure their safety, the industry typically adds a cover plate to the surface of these batteries. This cover plate contains a rupture-proof disc and positive and negative terminals. A welded explosion-proof valve prevents internal pressure from extrusion and collision, which could cause the battery to explode. The laser-welded positive and negative terminals serve as the battery's positive and negative electrodes, outputting electrical energy. The quality of these welded terminals directly impacts the battery's airtightness, conductivity, lifespan, and safety. However, during the production process, various weld defects, such as weld holes, weld height, and leaks, are unavoidable due to internal and external factors. To ensure the quality of weld inspection, detecting weld defects in new energy battery terminals has become an integral part of production.
[0003] Existing methods for detecting welding defects in new energy battery poles rely on constructing defect templates, which are then used to identify welding defects. However, constructing these templates requires significant time and effort to design features. Different defect templates must be developed and then matched to the defects. However, in actual production environments, the variety of defects is numerous, and template design is complex and time-consuming, resulting in low detection efficiency for welding defects in new energy battery poles. Summary of the Invention
[0004] The purpose of the embodiments of the present application is to propose a method, device, equipment and medium for detecting welding defects of new energy battery poles, so as to improve the detection efficiency of welding defects of new energy battery poles.
[0005] In order to solve the above technical problems, the present invention provides a method for detecting welding defects of new energy battery poles, comprising:
[0006] Obtaining annotated images of battery pole welding defects, and dividing the annotated images into training images, verification images, and test images;
[0007] Inputting the training image into a semantic segmentation model, and performing feature extraction on the training image using a feature extraction module of the semantic segmentation model to obtain a feature map;
[0008] The feature map is subjected to spatial information recognition and semantic information recognition respectively by the residual module in the semantic segmentation model to obtain spatial information and semantic information, and the spatial information and semantic information are superimposed to obtain a network output result;
[0009] Calculating the error between the network output result and a preset target value, and back-propagating the error to the semantic segmentation model to update the weights of the semantic segmentation model, and re-inputting the training image into the semantic segmentation model for iterative training, wherein the current semantic segmentation model is saved after each iterative training to obtain a semantic segmentation model to be verified;
[0010] Verifying the segmentation model to be verified using the verification image to obtain a target semantic segmentation model;
[0011] In response to a battery pole welding defect detection request, a target battery pole welding image is acquired, and the battery pole welding image is detected using the target semantic segmentation model to obtain a semantic segmentation result.
[0012] In order to solve the above technical problems, the present invention provides a device for detecting welding defects of new energy battery poles, comprising:
[0013] a marked image acquisition module, configured to acquire marked images of battery pole welding defects and divide the marked images into training images, verification images, and test images;
[0014] A feature extraction module is used to input the training image into a semantic segmentation model, and extract features from the training image using the feature extraction module of the semantic segmentation model to obtain a feature map;
[0015] a network output result generating module, configured to perform spatial information recognition and semantic information recognition on the feature map respectively through the residual module in the semantic segmentation model to obtain spatial information and semantic information, and to superimpose the spatial information and semantic information to obtain a network output result;
[0016] a module for generating a semantic segmentation model to be verified, configured to calculate the error between the network output result and a preset target value, and back-propagate the error to the semantic segmentation model to update the weights of the semantic segmentation model, and re-input the training image into the semantic segmentation model for iterative training, wherein the current semantic segmentation model is saved after each iterative training to obtain the semantic segmentation model to be verified;
[0017] A target semantic segmentation model generation module is used to verify the segmentation model to be verified using the verification image to obtain a target semantic segmentation model;
[0018] The semantic segmentation result generation module is used to respond to a battery pole welding defect detection request, obtain a target battery pole welding image, and detect the battery pole welding image through the target semantic segmentation model to obtain a semantic segmentation result.
[0019] In order to solve the above technical problems, a technical solution adopted by the present invention is: a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the method for detecting welding defects of new energy battery poles as described in any one of the above.
[0020] An embodiment of the present invention provides a method, device, equipment, and medium for detecting welding defects in new energy battery poles. The method includes: obtaining an annotated image of a battery pole welding defect and dividing the annotated image into a training image, a verification image, and a test image; inputting the training image into a semantic segmentation model, performing feature extraction on the training image using a feature extraction module of the semantic segmentation model to obtain a feature map; performing spatial information recognition and semantic information recognition on the feature map using a residual module in the semantic segmentation model to obtain spatial information and semantic information, and superimposing the spatial information and semantic information to obtain a network output result; calculating the error between the network output result and a preset target value, and backpropagating the error into the semantic segmentation model to update the weights of the semantic segmentation model, and re-inputting the training image into the semantic segmentation model for iterative training, wherein the current semantic segmentation model is saved after each iterative training to obtain a semantic segmentation model to be verified; verifying the segmentation model to be verified using a verification image to obtain a target semantic segmentation model; responding to a battery pole welding defect detection request, obtaining a target battery pole welding image, and detecting the battery pole welding image using the target semantic segmentation model to obtain a semantic segmentation result. The embodiment of the present invention obtains annotated images of battery pole welding defects and trains a semantic segmentation model based on the annotated images to obtain a target semantic segmentation model. The target semantic segmentation model is then used to automatically detect battery pole welding defects, thereby avoiding the need to construct defect templates and improving the detection efficiency of new energy battery pole welding defects. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the solutions in this application, a brief introduction will be given below to the drawings required for use in the description of the embodiments of this application. Obviously, the drawings described below are some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0022] Figure 1 This is a flowchart of a method for detecting welding defects of new energy battery poles provided in an embodiment of the present application;
[0023] Figure 2 This is another implementation flow chart of a sub-process in the method for detecting welding defects of new energy battery poles provided in an embodiment of the present application;
[0024] Figure 3 This is another implementation flow chart of a sub-process in the method for detecting welding defects of new energy battery poles provided in an embodiment of the present application;
[0025] Figure 4 This is another implementation flow chart of a sub-process in the method for detecting welding defects of new energy battery poles provided in an embodiment of the present application;
[0026] Figure 5 This is another implementation flow chart of a sub-process in the method for detecting welding defects of new energy battery poles provided in an embodiment of the present application;
[0027] Figure 6 This is another implementation flow chart of a sub-process in the method for detecting welding defects of new energy battery poles provided in an embodiment of the present application;
[0028] Figure 7 Schematic diagram of a device for detecting welding defects of new energy battery poles provided in an embodiment of the present application;
[0029] Figure 8 It is a schematic diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] Unless otherwise defined, all technical and scientific terms used herein have the same meanings as commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of the application are for the purpose of describing specific embodiments only and are not intended to limit this application. The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0031] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0032] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0033] The present invention will be described in detail below with reference to the accompanying drawings and embodiments.
[0034] It should be noted that the method for detecting welding defects of new energy battery poles provided in the embodiments of the present application is generally executed by a server. Accordingly, the device for detecting welding defects of new energy battery poles is generally configured in the server.
[0035] See also Figure 1 , Figure 1 A specific implementation method of a method for detecting welding defects of new energy battery poles is shown.
[0036] It should be noted that the method of the present invention is not limited to the method of Figure 1 The process sequence shown is limited to the following steps:
[0037] S1: Obtain annotated images of battery pole welding defects and divide the annotated images into training images, verification images, and test images.
[0038] Specifically, in the actual production process of battery cover plates (such as lithium battery cover plates), multiple battery pole welding defect images are collected; then the battery pole welding defect images are divided into welding defect types such as weld holes, weld leaks, weld heights, and unwelded areas. The LabelMe annotation tool is then used to annotate the battery pole welding defect images according to the welding defect types to obtain annotated images. Finally, according to a preset ratio, the annotated images are divided into training images, verification images, and test images. Among them, the preset ratio is set according to the actual situation and is not limited here. In a specific embodiment, the annotated images are divided into training images, verification images, and test images according to a ratio of 8:1:1.
[0039] S2: Input the training image into the semantic segmentation model, and extract features from the training image through the feature extraction module of the semantic segmentation model to obtain a feature map.
[0040] Specifically, in the embodiment of the present application, the semantic segmentation model is a two-branch semantic segmentation network, which includes three connected feature extraction modules, a residual module, and an overlay module. The residual module includes a spatial branch module and a semantic branch module. The semantic branch module includes three connected semantic modules and a contextual semantic module. The spatial branch module includes three connected spatial branch modules. The feature extraction module is the Resnet_cbam module.
[0041] See also Figure 2 , Figure 2 A specific implementation of step S2 is shown, which is described in detail as follows:
[0042] S21: The training images are fed into the semantic segmentation model in batches using the stochastic gradient algorithm.
[0043] S22: performing feature extraction on the training image through three connected feature extraction modules in a manner of gradually decreasing resolution, and obtaining an output result corresponding to each feature extraction module, wherein the resolution of the output result gradually decreases.
[0044] S23: In the first feature extraction module, convolution processing is performed on the training image through the first convolution block to obtain a first convolution result.
[0045] S24: Convolve the training image through two layers of second convolution blocks to obtain a second convolution result, and multiply the second convolution result with the channel weight parameter obtained by the channel attention module to obtain a first multiplication result.
[0046] S25: Multiply the first multiplication result by the position weight parameter of the feature map obtained by the spatial attention module to obtain a second multiplication result, and finally add the first convolution result and the second multiplication result to obtain an initial feature map.
[0047] Specifically, the training images are input into the semantic segmentation model in batches using a stochastic gradient algorithm. For example, batch_size is set to 8, and the stochastic gradient algorithm of SGD is used to input the training images into the semantic segmentation model in batches for training. After every three rounds of training, the training model parameters obtained are verified using a validation image. In an embodiment of the present application, feature extraction is performed on the training images using three connected feature extraction modules in a step-by-step manner, i.e., in the first feature extraction module, the training image is reduced to half of the original image; in the second feature extraction module, the training image is reduced to a quarter of the original image; and in the third feature extraction module, the training image is reduced to an eighth of the original image.
[0048] Specifically, in the first feature extraction module, the training image is convolved with a first convolution block (kernel size 1, stride 1) to obtain a first convolution result. The training image is convolved with two layers of second convolution blocks (kernel size 3, stride 1) to obtain a second convolution result. The second convolution results are then multiplied with channel parameters to obtain a multiplication result, and the second convolution results and the multiplication results are added to obtain an initial feature map. The channel parameters include channel gate parameters and spatial gate parameters. The initial feature map is then used as the input of the second feature extraction module and feature extraction is performed by the second feature extraction module. The feature extraction process in the second feature extraction module is the same as that in the first feature extraction module, resulting in a feature map output by the second feature extraction module. Finally, the feature map output by the second feature extraction module is used as the input of the third feature extraction module and feature extraction is performed by the third feature extraction module. The feature extraction process in the third feature extraction module is the same as that in the first feature extraction module, resulting in a final feature map.
[0049] S3: The feature map is used to perform spatial information recognition and semantic information recognition respectively through the residual module in the semantic segmentation model to obtain spatial information and semantic information, and the spatial information and semantic information are superimposed to obtain the network output result.
[0050] Specifically, the residual module includes a spatial branch module and a semantic branch module. In the embodiment of the present application, the features identified by the spatial branch module and the semantic branch module are integrated with each other to improve the detection accuracy of welding defects of new energy battery poles.
[0051] See also Figure 3 , Figure 3 A specific implementation of step S3 is shown, which is described in detail as follows:
[0052] S31: The feature map is respectively identified through the spatial branch module and the semantic branch module to obtain initial spatial information and initial semantic information.
[0053] Specifically, since the semantic branch module includes three connected semantic modules and a contextual semantic module, and the spatial branch module includes three connected spatial branch modules, the first spatial module and the first semantic module are used to perform information recognition on the feature map, respectively, to obtain initial spatial information and initial semantic information. The first spatial branch module convolves the feature map using two identical convolution blocks (kernel size 3, stride 1) to obtain initial spatial information; the first semantic module convolves the feature map using two identical convolution blocks (kernel size 3, stride 1) to obtain initial semantic information.
[0054] S32: The initial semantic information is subjected to convolution upsampling to obtain an upsampling result, and the upsampling result is superimposed with the initial spatial information to obtain a spatial information superposition result, and the spatial information superposition result is used as the input of the next spatial branch module, so that the next spatial branch module can perform spatial information recognition and obtain spatial information.
[0055] Specifically, the initial semantic information is subjected to convolution upsampling to obtain an upsampling result, which is then superimposed with the initial spatial information to obtain a spatial information superposition result. The spatial information superposition result is used as the input of the second spatial branch module, and spatial information recognition is performed on the information superposition result by the second spatial branch module to obtain a recognition result of the second spatial branch module. The output of the second semantic module is then subjected to convolution upsampling to obtain a processing result, which is superimposed with the recognition result of the second spatial branch module to obtain a superposition result. The superposition result is then used as the input of the third spatial branch module, and spatial information recognition is performed by the third spatial branch module to ultimately obtain spatial information.
[0056] The second spatial branch module convolves the feature map with two identical convolution blocks (kernel size 3, stride 1) to perform spatial information recognition on the information superposition results, obtaining the recognition results of the second spatial branch module. The third spatial branch module is composed of a convolution block with a kernel size of 1 and stride 1, a convolution block with a kernel size of 3 and stride 1, and a convolution block with a kernel size of 1 and stride 1, connected in sequence.
[0057] Furthermore, in the spatial branch module, no change is made to the resolution size of the feature map.
[0058] S33: The initial spatial information is subjected to convolution downsampling processing to obtain a downsampling result, and the downsampling result is superimposed on the initial semantic information to obtain a semantic information superposition result, and the semantic information superposition result is used as the input of the next semantic branch module, so that the next semantic branch module can perform semantic information recognition and obtain semantic information.
[0059] See also Figure 4 , Figure 4 A specific implementation of step S33 is shown, which is described in detail as follows:
[0060] S331: performing convolution downsampling processing on the initial spatial information to obtain a downsampling result, and superimposing the downsampling result and the initial semantic information to obtain a semantic information superposition result.
[0061] S332: Using the semantic information superposition result as the input of the next semantic module, and performing semantic information recognition on the semantic information superposition result by the next semantic module until all semantic modules are recognized to obtain initial semantic information.
[0062] S333: Perform contextual semantic information recognition on the initial semantic information through the contextual semantic module to obtain semantic information.
[0063] Specifically, the initial spatial information is subjected to convolutional downsampling to obtain a downsampling result, which is then superimposed with the initial semantic information to obtain a semantic information superposition result. The semantic information superposition result is used as the input of a second semantic module, and semantic information recognition is performed on the information superposition result by the second semantic module to obtain a recognition result of the second semantic module. The output of the second spatial branch module is then subjected to convolutional downsampling to obtain a processing result, which is then superimposed with the recognition result of the second semantic module to obtain a superposition result. The superposition result is then used as the input of a third semantic module, which performs spatial information recognition to obtain the initial semantic information. Finally, the initial semantic information is subjected to contextual semantic information recognition by the contextual semantic module to obtain semantic information.
[0064] The second semantic module convolves the feature map with two identical convolutional blocks (kernel size 3, stride 1) to perform spatial information recognition on the information superposition results, obtaining the recognition results of the second semantic module. The third semantic module is composed of a convolutional block with a kernel size of 1 and stride 1, a convolutional block with a kernel size of 3 and stride 1, and a convolutional block with a kernel size of 1 and stride 1, connected in sequence.
[0065] Furthermore, in the semantic modules, three connected semantic modules extract image features from the feature map in a stepwise manner, obtaining the output results corresponding to each semantic module. The resolution of the output results corresponding to each semantic module gradually decreases. That is, in the first semantic module, the training image is reduced to one-sixteenth of the original image; in the second semantic module, the training image is reduced to one-thirty-second of the original image; and in the third semantic module, the training image is reduced to one-sixty-fourth of the original image.
[0066] See also Figure 5 , Figure 5 A specific implementation of step S333 is shown, which is described in detail as follows:
[0067] S3331: Perform convolution processing on the initial semantic information through convolution blocks with different convolution kernels and strides to obtain first semantic information, second semantic information, third semantic information, fourth semantic information, fifth semantic information and sixth semantic information.
[0068] S3332: Perform upsampling and convolution processing on the second semantic information, the third semantic information, the fourth semantic information and the fifth semantic information respectively to obtain second target semantic information, third target semantic information, fourth target semantic information and fifth target semantic information.
[0069] S3333: By calling a merge function, the first semantic information, the second target semantic information, the third target semantic information, the fourth target semantic information and the fifth target semantic information are connected and processed to obtain initial context semantic information.
[0070] S3334: Perform convolution processing on the initial context to obtain basic context semantic information, and superimpose the context semantic information with the sixth semantic information to obtain semantic information.
[0071] Specifically, the initial semantic information is convolved with a convolution block with a kernel size of 1 and a stride of 1 to obtain the first semantic information; the initial semantic information is convolved with a convolution block with a kernel size of 5 and a stride of 2 to obtain the second semantic information; the initial semantic information is convolved with a convolution block with a kernel size of 9 and a stride of 4 to obtain the third semantic information; the initial semantic information is convolved with a convolution block with a kernel size of 13 and a stride of 6 to obtain the fourth semantic information; the initial semantic information is convolved with a convolution block with a kernel size of H*W to obtain the fifth semantic information; and the initial semantic information is convolved with a convolution block with a kernel size of 1 and a stride of 1 to obtain the sixth semantic information. The second, third, fourth, and fifth semantic information are then upsampled with convolution blocks with a kernel size of 1 and a stride of 1 to obtain second, third, fourth, and fifth semantic sampling information, respectively, to achieve multi-scale feature extraction capabilities. The second semantic sampling information is convolved with two convolution blocks with a kernel size of 3 and a stride of 1 to obtain the second target semantic information. The second target semantic information is superimposed with the third semantic sampling information to obtain a third semantic result, and the third semantic result is convolved with two convolution blocks with a kernel size of 3 and a stride of 1 to obtain the third target semantic information. The third target semantic information is superimposed with the fourth semantic sampling information to obtain a fourth semantic result, and the fourth semantic result is convolved with two convolution blocks with a kernel size of 3 and a stride of 1 to obtain the fourth target semantic information. The fourth target semantic information is superimposed with the fifth semantic sampling information to obtain a fifth semantic result, and the fifth semantic result is convolved with two convolution blocks with a kernel size of 3 and a stride of 1 to obtain the fifth target semantic information.
[0072] Furthermore, the first semantic information, the second target semantic information, the third target semantic information, the fourth target semantic information, and the fifth target semantic information are concatenated by calling a merge function, where the merge function is the concat() function. The initial context semantic information is then convolved with a convolution block with a kernel size of 1 and a stride of 1 to obtain basic context semantic information. The context semantic information is then superimposed with the sixth semantic information to obtain semantic information.
[0073] S34: Superimpose the spatial information and semantic information to obtain the network output result.
[0074] Specifically, the spatial information and semantic information are superimposed through the superposition module to obtain the network output result.
[0075] S4: Calculate the error between the network output result and the preset target value, and back-propagate the error to the semantic segmentation model to update the weights of the semantic segmentation model, and re-input the training image into the semantic segmentation model for iterative training. After each iterative training, the current semantic segmentation model is saved to obtain the semantic segmentation model to be verified.
[0076] Specifically, the error between the network output result and the preset target value is calculated to obtain the error, and the error is back-propagated to the semantic segmentation model to update the weights of the semantic segmentation model to obtain the updated semantic segmentation model. The training image is then re-input into the semantic segmentation model for iterative training. The error is calculated and the weights are updated in each iterative training. After each iterative training, the current semantic segmentation model is saved to obtain the semantic segmentation model to be verified.
[0077] S5: Verify the segmentation model to be verified through the verification image to obtain the target semantic segmentation model.
[0078] See also Figure 6 , Figure 6 A specific implementation of step S5 is shown, which is described in detail as follows:
[0079] S51: Verify the segmentation model to be verified through the verification image to obtain the verification result and verification loss on the verification image.
[0080] S52: Based on the verification results and verification loss, save the current best semantic segmentation model.
[0081] S53: Obtain the current best semantic segmentation model during the iterative training process. When the preset number of iterative training times is continuously performed and it is determined that the verification loss value has not decreased, stop the iterative training and use the current semantic segmentation model as the target semantic segmentation model.
[0082] Specifically, the model is validated using validation images, and the validation results and loss on the validation images are calculated. If the validation image produces the best result, the optimal model is saved. During training, the best validation image accuracy to date is recorded. If the optimal accuracy is not achieved after multiple consecutive epochs and the loss value does not continue to decrease, training is terminated and the final model is saved. Furthermore, during training, the loss values of the training set and validation images can be monitored over time to verify that the model hyperparameters are set appropriately. If overfitting is observed, training can be stopped promptly, the detection model hyperparameters can be adjusted, and the step of inputting the training images into the detection model can be repeated. For example, during training, the best validation image accuracy to date is recorded. If the optimal accuracy is not achieved after 20 consecutive epochs and the loss value does not decrease, training is terminated. Model parameters include learning rate, batch size, optimizer parameters, and the number of network layers.
[0083] S6: Respond to the battery pole welding defect detection request, obtain the target battery pole welding image, and detect the battery pole welding image through the target semantic segmentation model to obtain the semantic segmentation result.
[0084] Specifically, the above steps have trained the target semantic segmentation model. When battery pole welding defect detection is required, a battery pole welding defect detection request is sent to the server. After receiving the battery pole welding defect detection request, the server responds to the battery pole welding defect detection request, obtains the target battery pole welding image, and detects the battery pole welding image using the target semantic segmentation model to obtain the semantic segmentation result.
[0085] In this embodiment, an annotated image of a battery pole welding defect is obtained, and the annotated image is divided into a training image, a verification image, and a test image; the training image is input into a semantic segmentation model, and the feature extraction module of the semantic segmentation model performs feature extraction on the training image to obtain a feature map; the feature map is subjected to spatial information recognition and semantic information recognition respectively by the residual module in the semantic segmentation model to obtain spatial information and semantic information, and the spatial information and semantic information are superimposed to obtain a network output result; the error between the network output result and the preset target value is calculated, and the error is back-propagated into the semantic segmentation model to update the weight of the semantic segmentation model, and the training image is re-input into the semantic segmentation model for iterative training, wherein the current semantic segmentation model is saved after each iterative training to obtain a semantic segmentation model to be verified; the segmentation model to be verified is verified by the verification image to obtain a target semantic segmentation model; in response to a battery pole welding defect detection request, a target battery pole welding image is obtained, and the battery pole welding image is detected by the target semantic segmentation model to obtain a semantic segmentation result. The embodiment of the present application obtains annotated images of battery pole welding defects, trains a semantic segmentation model based on the annotated images, obtains a target semantic segmentation model, and automatically detects battery pole welding defects through the target semantic segmentation model, thereby avoiding the construction of defect templates and improving the detection efficiency of new energy battery pole welding defects. In addition, the embodiment of the present application also performs information fusion of spatial information and semantic information, thereby improving the detection accuracy of new energy battery pole welding defects.
[0086] Please refer to Figure 7 , as a response to the above Figure 1 The present application provides an embodiment of a device for detecting welding defects of a new energy battery pole. Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0087] like Figure 7 As shown, the detection device for welding defects of new energy battery poles of this embodiment includes: a labeled image acquisition module 61, a feature extraction module 62, a network output result generation module 63, a semantic segmentation model generation module to be verified 64, a target semantic segmentation model generation module 65 and a semantic segmentation result generation module 66, wherein:
[0088] The annotated image acquisition module 61 is used to acquire annotated images of battery pole welding defects and divide the annotated images into training images, verification images, and test images;
[0089] A feature extraction module 62 is used to input the training image into the semantic segmentation model, and extract features from the training image through the feature extraction module of the semantic segmentation model to obtain a feature map;
[0090] A network output result generating module 63 is configured to perform spatial information recognition and semantic information recognition on the feature map using the residual module in the semantic segmentation model to obtain spatial information and semantic information, and to superimpose the spatial information and semantic information to obtain a network output result;
[0091] The semantic segmentation model generation module 64 is used to calculate the error between the network output result and the preset target value, and back-propagate the error to the semantic segmentation model to update the weights of the semantic segmentation model. The training image is re-input into the semantic segmentation model for iterative training. After each iterative training, the current semantic segmentation model is saved to obtain the semantic segmentation model to be verified.
[0092] A target semantic segmentation model generating module 65 is configured to verify the segmentation model to be verified using a verification image to obtain a target semantic segmentation model;
[0093] The semantic segmentation result generation module 66 is used to respond to the battery pole welding defect detection request, obtain the target battery pole welding image, and detect the battery pole welding image through the target semantic segmentation model to obtain the semantic segmentation result.
[0094] Furthermore, the semantic segmentation model includes three connected feature extraction modules, and the feature extraction module 62 includes:
[0095] The training image input submodule is used to input the training images into the semantic segmentation model in batches using the stochastic gradient algorithm;
[0096] An image reduction submodule is used to extract features from the training image through three connected feature extraction modules in a step-by-step manner, obtaining an output result corresponding to each feature extraction module, wherein the resolution of the output result is gradually reduced;
[0097] a first convolution result generating submodule, configured to perform convolution processing on the training image through the first convolution block in the first feature extraction module to obtain a first convolution result;
[0098] A first multiplication result generation submodule is used to convolve the training image through two layers of second convolution blocks to obtain a second convolution result, and multiply the second convolution result with the channel weight parameter obtained by the channel attention module to obtain a first multiplication result;
[0099] The initial feature map generation submodule is used to multiply the first multiplication result by the position weight parameter of the feature map obtained by the spatial attention module to obtain a second multiplication result, and finally add the first convolution result and the second multiplication result to obtain the initial feature map;
[0100] The feature map generation submodule is used to take the initial feature map as the input of the next feature extraction module, and perform feature extraction through the feature extraction module until all feature extraction modules have completed feature extraction to obtain a feature map.
[0101] Furthermore, the residual module includes a spatial branch module and a semantic branch module, and the detection result generation module 63 includes:
[0102] The information recognition submodule is used to perform information recognition on the feature map through the spatial branch module and the semantic branch module respectively to obtain initial spatial information and initial semantic information;
[0103] The spatial information recognition submodule is used to perform convolution upsampling on the initial semantic information to obtain an upsampling result, and superimpose the upsampling result with the initial spatial information to obtain a spatial information superposition result. The spatial information superposition result is used as the input of the next spatial branch module, so that the next spatial branch module performs spatial information recognition to obtain spatial information;
[0104] The semantic information recognition submodule is used to perform convolution downsampling processing on the initial spatial information to obtain a downsampling result, and superimpose the downsampling result with the initial semantic information to obtain a semantic information superposition result, and use the semantic information superposition result as the input of the next semantic branch module, so that the next semantic branch module performs semantic information recognition to obtain semantic information;
[0105] The information superposition submodule is used to superimpose spatial information and semantic information to obtain network output results.
[0106] Furthermore, the semantic branch module includes three connected semantic modules and a contextual semantic module, and the semantic information recognition submodule includes:
[0107] The spatial information adopting unit is used to obtain a downsampling result by performing convolution downsampling processing on the initial spatial information, and superimpose the downsampling result and the initial semantic information to obtain a semantic information superposition result;
[0108] An initial semantic information recognition unit is used to use the semantic information superposition result as the input of the next semantic module, and perform semantic information recognition on the semantic information superposition result through the next semantic module until all semantic modules are recognized to obtain initial semantic information;
[0109] The context information recognition unit is used to perform context semantic information recognition on the initial semantic information through the context semantic module to obtain semantic information.
[0110] Furthermore, the context information identification unit includes:
[0111] a convolution processing subunit, configured to perform convolution processing on the initial semantic information through convolution blocks with different convolution kernels and strides, respectively, to obtain first semantic information, second semantic information, third semantic information, fourth semantic information, fifth semantic information, and sixth semantic information;
[0112] a target semantic information extraction subunit, configured to perform upsampling and convolution processing on the second semantic information, the third semantic information, the fourth semantic information, and the fifth semantic information, respectively, to obtain the second target semantic information, the third target semantic information, the fourth target semantic information, and the fifth target semantic information;
[0113] an information connection processing subunit, configured to connect the first semantic information, the second target semantic information, the third target semantic information, the fourth target semantic information, and the fifth target semantic information by calling a merging function to obtain initial context semantic information;
[0114] The basic context information recognition subunit is used to perform convolution processing on the initial context to obtain basic context semantic information, and to superimpose the context semantic information with the sixth semantic information to obtain semantic information.
[0115] Furthermore, the detection result generating module 63 further includes:
[0116] The feature map reduction submodule is used to extract features from the feature map through three connected semantic modules in a manner of gradually reducing the resolution, and obtain the output results corresponding to each semantic module, wherein the resolution of the output results corresponding to each semantic module gradually decreases.
[0117] Furthermore, the target semantic segmentation model generation module 64 includes:
[0118] The verification submodule is used to verify the segmentation model to be verified through the verification image, and obtain the verification result and verification loss on the verification image;
[0119] The model saving submodule is used to save the current best semantic segmentation model based on the validation results and validation loss;
[0120] The training stop submodule is used to obtain the current best semantic segmentation model during the iterative training process. When the preset number of iterative training times is continuously performed and the verification loss value is judged to have not decreased, the iterative training is stopped and the current semantic segmentation model is used as the target semantic segmentation model.
[0121] To solve the above technical problems, the present application also provides a computer device. Figure 8 , Figure 8 This is a basic structural block diagram of the computer device in this embodiment.
[0122] The computer device 7 includes a memory 71, a processor 72, and a network interface 73 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 7 having three components: a memory 71, a processor 72, and a network interface 73. However, it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead. Among them, those skilled in the art will understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital signal processor (DSP), an embedded device, etc.
[0123] Computer devices can be desktop computers, laptops, PDAs, cloud servers, etc. Computer devices can interact with users through keyboards, mice, remote controls, touchpads, or voice-activated devices.
[0124] The memory 71 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, magnetic disk, optical disk, etc. In some embodiments, the memory 71 can be an internal storage unit of the computer device 7, such as the hard disk or memory of the computer device 7. In other embodiments, the memory 71 can also be an external storage device of the computer device 7, such as a plug-in hard disk equipped on the computer device 7, a smart memory card (SMC), a secure digital (SD) card, a flash memory card, etc. Of course, the memory 71 can also include both the internal storage unit of the computer device 7 and its external storage device. In this embodiment, the memory 71 is generally used to store the operating system and various application software installed on the computer device 7, such as the program code of the method for detecting welding defects of new energy battery poles. In addition, the memory 71 can also be used to temporarily store various types of data that have been output or are to be output.
[0125] In some embodiments, the processor 72 can be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 72 is generally used to control the overall operation of the computer device 7. In this embodiment, the processor 72 is used to execute program code stored in the memory 71 or process data, such as executing the program code of the aforementioned method for detecting welding defects in new energy battery poles, to implement various embodiments of the method for detecting welding defects in new energy battery poles.
[0126] The network interface 73 may include a wireless network interface or a wired network interface. The network interface 73 is generally used to establish a communication connection between the computer device 7 and other electronic devices.
[0127] The present application also provides another embodiment, namely, providing a computer-readable storage medium, which stores a computer program, and the computer program can be executed by at least one processor to enable at least one processor to perform the steps of a method for detecting welding defects of a new energy battery pole as described above.
[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods of each embodiment of the present application.
[0129] Obviously, the embodiments described above are only some of the embodiments of the present application, rather than all of the embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions described in the aforementioned specific embodiments, or to make equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the present application specification and the accompanying drawings, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present application.
Claims
1. A method for detecting welding defects of new energy battery poles, characterized in that: include: Obtaining annotated images of battery pole welding defects, and dividing the annotated images into training images, verification images, and test images; Inputting the training image into a semantic segmentation model, and performing feature extraction on the training image using a feature extraction module of the semantic segmentation model to obtain a feature map; The feature map is subjected to spatial information recognition and semantic information recognition respectively by the residual module in the semantic segmentation model to obtain spatial information and semantic information, and the spatial information and semantic information are superimposed to obtain a network output result; Calculating the error between the network output result and a preset target value, and back-propagating the error to the semantic segmentation model to update the weights of the semantic segmentation model, and re-inputting the training image into the semantic segmentation model for iterative training, wherein the current semantic segmentation model is saved after each iterative training to obtain a semantic segmentation model to be verified; Verifying the segmentation model to be verified using the verification image to obtain a target semantic segmentation model; In response to a battery pole welding defect detection request, a target battery pole welding image is acquired, and the battery pole welding image is detected using the target semantic segmentation model to obtain a semantic segmentation result; The semantic segmentation model includes three connected feature extraction modules. The training image is input into the semantic segmentation model, and the feature extraction modules of the semantic segmentation model are used to extract features from the training image to obtain a feature map, including: Inputting the training images into the semantic segmentation model in batches through a stochastic gradient algorithm; Extracting features from the training image using three connected feature extraction modules in a manner of gradually decreasing resolution, and obtaining an output result corresponding to each feature extraction module, wherein the resolution of the output result gradually decreases; In the first feature extraction module, convolution processing is performed on the training image through a first convolution block to obtain a first convolution result; Convolving the training image through two layers of second convolution blocks to obtain a second convolution result, and multiplying the second convolution result by the channel weight parameter obtained by the channel attention module to obtain a first multiplication result; Multiplying the first multiplication result by the position weight parameter of the feature map obtained by the spatial attention module to obtain a second multiplication result, and finally adding the first convolution result and the second multiplication result to obtain an initial feature map; The initial feature map is used as the input of the next feature extraction module, and feature extraction is performed by the feature extraction module until all feature extraction modules have completed feature extraction to obtain the feature map.
2. The method for detecting welding defects of new energy battery poles according to claim 1, characterized in that: The residual module includes a spatial branch module and a semantic branch module. The spatial information and semantic information are obtained by performing spatial information recognition and semantic information recognition on the feature map respectively, and the spatial information and semantic information are superimposed and fused to obtain a network output result, including: The spatial branch module and the semantic branch module respectively perform information recognition on the feature map to obtain initial spatial information and initial semantic information; performing convolution upsampling on the initial semantic information to obtain an upsampling result, superimposing the upsampling result and the initial spatial information to obtain a spatial information superposition result, and using the spatial information superposition result as input to the next spatial branch module, so that the next spatial branch module performs spatial information recognition to obtain the spatial information; Performing convolution downsampling processing on the initial spatial information to obtain a downsampling result, superimposing the downsampling result and the initial semantic information to obtain a semantic information superposition result, and using the semantic information superposition result as input to the next semantic branch module, so that the next semantic branch module performs semantic information recognition to obtain the semantic information; The spatial information and semantic information are superimposed to obtain the network output result.
3. The method for detecting welding defects of new energy battery poles according to claim 2, characterized in that: The semantic branch module includes three connected semantic modules and a context semantic module, and the convolution downsampling process is performed on the initial spatial information to obtain a downsampling result, and the downsampling result is superimposed with the initial semantic information to obtain a semantic information superposition result, and the semantic information superposition result is used as the input of the next semantic branch module, so that the next semantic branch module performs semantic information recognition to obtain the semantic information, including: Performing convolution downsampling on the initial spatial information to obtain the downsampling result, and superimposing the downsampling result and the initial semantic information to obtain the semantic information superposition result; Using the semantic information superposition result as the input of the next semantic module, and performing semantic information recognition on the semantic information superposition result by the next semantic module until all the semantic modules are recognized to obtain initial semantic information; The context semantic module performs context semantic information recognition on the initial semantic information to obtain the semantic information.
4. The method for detecting welding defects of new energy battery poles according to claim 3, characterized in that: The step of performing contextual semantic information recognition on the initial semantic information by the contextual semantic module to obtain the semantic information includes: Convolutionally processing the initial semantic information through convolution blocks with different convolution kernels and strides to obtain first semantic information, second semantic information, third semantic information, fourth semantic information, fifth semantic information, and sixth semantic information; performing upsampling and convolution processing on the second semantic information, the third semantic information, the fourth semantic information, and the fifth semantic information, respectively, to obtain second target semantic information, third target semantic information, fourth target semantic information, and fifth target semantic information; The first semantic information, the second target semantic information, the third target semantic information, the fourth target semantic information, and the fifth target semantic information are concatenated by calling a merge function to obtain initial context semantic information; The initial context is convolved to obtain basic context semantic information, and the context semantic information is superimposed with the sixth semantic information to obtain the semantic information.
5. The method for detecting welding defects of new energy battery poles according to claim 3, characterized in that: The method further includes: performing spatial information recognition and semantic information recognition on the feature map through the residual module in the semantic segmentation model to obtain spatial information and semantic information, and superimposing the spatial information and semantic information to obtain a network output result. In a manner of gradually decreasing resolution, the feature map is subjected to image feature extraction through the three connected semantic modules to obtain an output result corresponding to each semantic module, wherein the resolution of the output result corresponding to each semantic module is gradually reduced.
6. The method for detecting welding defects of new energy battery poles according to any one of claims 1 to 5, characterized in that: The verifying the segmentation model to be verified by using the verification image to obtain a target semantic segmentation model includes: Verifying the segmentation model to be verified using the verification image to obtain a verification result and a verification loss on the verification image; Based on the verification result and the verification loss, saving the current best semantic segmentation model; The current best semantic segmentation model in the iterative training process is obtained. When the preset number of iterative training times is continuously performed and it is determined that the verification loss value has not decreased, the iterative training is stopped and the current semantic segmentation model is used as the target semantic segmentation model.
7. A device for detecting welding defects of new energy battery poles, characterized in that: include: a marked image acquisition module, configured to acquire marked images of battery pole welding defects and divide the marked images into training images, verification images, and test images; A feature extraction module is used to input the training image into a semantic segmentation model, and extract features from the training image using the feature extraction module of the semantic segmentation model to obtain a feature map; a network output result generating module, configured to perform spatial information recognition and semantic information recognition on the feature map respectively through the residual module in the semantic segmentation model to obtain spatial information and semantic information, and to superimpose the spatial information and semantic information to obtain a network output result; a module for generating a semantic segmentation model to be verified, configured to calculate the error between the network output result and a preset target value, and back-propagate the error to the semantic segmentation model to update the weights of the semantic segmentation model, and re-input the training image into the semantic segmentation model for iterative training, wherein the current semantic segmentation model is saved after each iterative training to obtain the semantic segmentation model to be verified; A target semantic segmentation model generation module is used to verify the segmentation model to be verified using the verification image to obtain a target semantic segmentation model; a semantic segmentation result generation module, configured to respond to a battery pole welding defect detection request, obtain a target battery pole welding image, and detect the battery pole welding image using the target semantic segmentation model to obtain a semantic segmentation result; The semantic segmentation model includes three connected feature extraction modules, each of which includes: A training image input submodule, configured to input the training images into the semantic segmentation model in batches using a stochastic gradient algorithm; an image reduction submodule, configured to extract features from the training image through the three connected feature extraction modules in a manner of gradually decreasing resolution, to obtain an output result corresponding to each feature extraction module, wherein the resolution of the output result gradually decreases; a first convolution result generating submodule, configured to perform convolution processing on the training image through a first convolution block in the first feature extraction module to obtain a first convolution result; a first multiplication result generating submodule, configured to perform convolution processing on the training image through two layers of second convolution blocks to obtain a second convolution result, and multiply the second convolution result with the channel weight parameter obtained by the channel attention module to obtain a first multiplication result; an initial feature map generation submodule, configured to multiply the first multiplication result by the position weight parameter of the feature map obtained by the spatial attention module to obtain a second multiplication result, and finally add the first convolution result and the second multiplication result to obtain an initial feature map; The feature map generation submodule is used to use the initial feature map as the input of the next feature extraction module, and perform feature extraction through the feature extraction module until all the feature extraction modules have completed feature extraction to obtain the feature map.
8. A computer device, characterized in that: It includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the method for detecting welding defects of new energy battery poles as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for detecting welding defects of new energy battery poles according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Hardware defect identification detection method and device and computer readable storage medium
CN112767369A
Image semantic segmentation method based on improved dilated convolution and multilevel feature information fusion
CN113033570A