Multi-scale feature detail enhanced lithium battery surface defect detection method and system
Through the multi-scale feature detail enhancement detection method, the problem of poor defect visibility in surface defect detection of lithium batteries is solved, and higher detection reliability and detail presentation capabilities are achieved.
Patent Information
- Application Number
- CN202510349936.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-06-27
AI Technical Summary
The existing lithium battery surface defect detection methods have poor defect visibility during the detection process, resulting in low detection reliability.
The detection method of multi-scale feature detail enhancement is adopted, including lithium battery area segmentation, multi-scale adaptive enhancement module, comprehensive enhancement module and feature fusion module. Through pyramid decomposition and adaptive histogram equalization, combined with edge detection and semantic extraction, image detail enhancement and feature fusion are carried out to generate enhanced lithium battery area images, and ultimately defect detection is performed based on the object detection model.
The detectability of surface defects of lithium batteries is improved, the reliability of detection results is enhanced, and the loss of image information or the occurrence of artifacts is avoided.
Smart Images

Figure CN120219352A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of defect detection, and particularly to a method and system for detecting surface defects of lithium batteries with enhanced multi-scale feature details. Background Art
[0002] With the rapid development of fields such as electric vehicles and energy storage systems, lithium batteries have become the core components in these fields. Once defects such as scratches, dirt, depressions, and indentations appear on their surfaces, it will directly affect their quality and service life. Therefore, the efficient detection of surface defects of lithium batteries has become a crucial link in industrial production.
[0003] The detection of surface defects of lithium batteries usually relies on machine vision technology. However, due to problems such as large differences in defect scales, inconspicuous defects, and uneven illumination on the surface of lithium batteries, existing defect detection methods are difficult to achieve ideal results in practical applications. For this reason, existing methods for detecting surface defects of lithium batteries consider combining image enhancement techniques in image processing to improve image quality and thus enhance the visibility of defects. However, although traditional image enhancement methods such as histogram equalization can enhance image contrast to a certain extent, when directly applied to lithium battery surface images, details are often lost, noise is enhanced, or over-enhancement occurs in specific regions. Especially when the surface reflection is severe or the defect area is small and inconspicuous, traditional methods are difficult to effectively highlight the defect area and are prone to introducing image noise, interfering with subsequent defect detection and recognition, resulting in low reliability of lithium battery surface defect detection. Summary of the Invention
[0004] The present invention provides a method and system for detecting surface defects of lithium batteries with enhanced multi-scale feature details, which solves the technical problem that the visibility of defects is poor in the process of detecting surface defects of lithium batteries by existing methods, resulting in low reliability of lithium battery surface defect detection.
[0005] A method for detecting surface defects of lithium batteries with enhanced multi-scale feature details provided by the first aspect of the present invention includes:
[0006] Performing lithium battery area segmentation on the surface image of the lithium battery to be measured to obtain a lithium battery area image;
[0007] Performing pyramid decomposition and adaptive limited contrast adaptive histogram equalization on the lithium battery area image through a multi-scale adaptive enhancement module, and outputting multiple scale feature maps;
[0008] Inputting each of the scale feature maps into a comprehensive enhancement module for detail enhancement to determine corresponding detail feature maps;
[0009] Using a feature fusion module to perform upsampling fusion on each of the detail feature maps to generate an enhanced lithium battery area image;
[0010] Based on the object detection model, defect detection is performed on the enhanced lithium battery region image, and the detection result is output.
[0011] Furthermore, the segmentation of the surface image of the lithium battery to be measured into a lithium battery region image includes:
[0012] After binarizing the surface image of the lithium battery to be measured, contour detection is performed to determine the lithium battery contour;
[0013] According to the lithium battery contour, a mask image is created to construct a contour mask image;
[0014] The contour mask image and the surface image of the lithium battery to be measured are subjected to a bitwise AND operation, and the lithium battery region image is output.
[0015] Furthermore, the multi-scale adaptive enhancement module includes a Gaussian pyramid layer, an equalization layer, and a Laplacian pyramid layer; the pyramid decomposition and adaptive limited contrast adaptive histogram equalization are performed on the lithium battery region image through the multi-scale adaptive enhancement module, and multiple scale feature maps are output, including:
[0016] The Gaussian pyramid layer is used to perform downsampling multi-scale decomposition on the lithium battery region image to obtain multiple Gaussian feature maps;
[0017] Each of the Gaussian feature maps is input into the equalization layer, and adaptive limited contrast adaptive histogram equalization is performed according to the image scaling ratio of the Gaussian pyramid layer, and the corresponding equalized feature maps are output;
[0018] Based on the Laplacian pyramid layer, upsampling multi-scale detail decomposition is performed on each of the equalized feature maps to determine multiple scale feature maps.
[0019] Furthermore, the comprehensive enhancement module includes an edge detection layer, a semantic extraction layer, a low-pass filtering layer, and a convolutional layer; the processing process of the comprehensive enhancement module includes:
[0020] Based on the low-pass filtering layer, multi-scale low-pass filtering fusion is performed on the input scale feature map to construct a filtered feature map;
[0021] Edge detection is performed on the input scale feature map through the edge detection layer to generate an edge feature map;
[0022] The semantic extraction layer is used to perform context semantic extraction on the edge feature map to determine a semantic feature map;
[0023] The edge feature map and the semantic feature map are spliced and input into the convolutional layer for convolutional operation to obtain a fused feature map;
[0024] After splicing the filtered feature map and the fused feature map, the result is input into a convolutional layer for convolutional processing to output a detailed feature map.
[0025] Further, the low-pass filtering layer includes a convolutional unit, an adaptive average pooling unit, and an upsampling unit; the multi-scale low-pass filtering and fusion of the input scale feature map based on the low-pass filtering layer to construct a filtered feature map includes:
[0026] After the convolutional unit performs feature dimension elevation on the input scale feature map, it is decomposed into multiple sub-feature maps along the channel dimension;
[0027] The adaptive average pooling unit is used to perform multi-scale average pooling processing on each of the sub-feature maps to obtain corresponding pooled feature maps;
[0028] Based on the upsampling unit, after upsampling and fusing each of the pooled feature maps, it is input into the convolutional unit for feature dimension reduction to determine the filtered feature map.
[0029] Further, the semantic extraction layer includes a convolutional unit, a residual block, a softmax activation function, and a LeakyReLU activation function; the use of the semantic extraction layer to perform context semantic extraction on the edge feature map to determine the semantic feature map includes:
[0030] The convolutional unit is used to perform feature dimension elevation on the edge feature map to obtain an elevated feature map;
[0031] The elevated feature map is input into the residual block for residual learning to output a residual feature map;
[0032] The convolutional unit is used to extract features from the residual feature map and perform normalization based on the softmax activation function to determine the weight matrix;
[0033] The weight matrix is multiplied by the residual feature map to generate a weighted feature map;
[0034] The weighted feature map is sequentially processed through the convolutional unit and the Leaky ReLU activation function, added to the residual feature map, and then input into the convolutional unit for feature dimension reduction to output the semantic feature map.
[0035] A lithium battery surface defect detection system with enhanced multi-scale feature details provided by the second aspect of the present invention includes:
[0036] A preprocessing module for segmenting the lithium battery area in the surface image of the lithium battery to be measured to obtain a lithium battery area image;
[0037] A multi-scale enhancement module, which is used to perform pyramid decomposition and adaptive contrast limited adaptive histogram equalization on the lithium battery region image based on the multi-scale adaptive enhancement module, and output multiple scale feature maps;
[0038] A detail enhancement module, which is used to input each of the scale feature maps into a comprehensive enhancement module for detail enhancement respectively, and determine corresponding detail feature maps;
[0039] A multi-scale fusion module, which is used to perform upsampling fusion on each of the detail feature maps by using a feature fusion module to generate an enhanced lithium battery region image;
[0040] A detection output module, which is used to perform defect detection on the enhanced lithium battery region image based on an object detection model and output a detection result.
[0041] A computer device provided in the third aspect of the present invention includes a memory and a processor. When a computer program stored in the memory is executed by the processor, the processor executes the steps of the method for detecting surface defects of a lithium battery with multi-scale feature detail enhancement as described in any one of the above.
[0042] A computer-readable storage medium provided in the fourth aspect of the present invention stores a computer program thereon. When the computer program is executed, it implements the method for detecting surface defects of a lithium battery with multi-scale feature detail enhancement as described in any one of the above.
[0043] A computer program product provided in the fifth aspect of the present invention includes a computer program / instructions. When the computer program / instructions are executed by a processor, they implement the method for detecting surface defects of a lithium battery with multi-scale feature detail enhancement as described in any one of the above.
[0044] It can be seen from the above technical solutions that the present invention has the following advantages:
[0045] The above solution of the present invention provides a method for detecting surface defects of lithium batteries with enhanced multi-scale feature details, including: segmenting the surface image of the lithium battery to be measured to obtain a lithium battery area image; performing pyramid decomposition and adaptive limited contrast adaptive histogram equalization on the lithium battery area image through a multi-scale adaptive enhancement module, and outputting multiple scale feature maps; respectively inputting each scale feature map into a comprehensive enhancement module for detail enhancement to determine the corresponding detail feature maps; using a feature fusion module to perform upsampling fusion on each detail feature map to generate an enhanced lithium battery area image; and performing defect detection on the enhanced lithium battery area image based on an object detection model to output a detection result. Based on the above solution, while optimizing the image contrast through pyramid-based adaptive histogram image enhancement, it effectively improves the over-enhancement problem existing in the traditional CLAHE algorithm, retains important details through detail enhancement processing, prevents the loss of image information or the generation of artifacts, fuses the multi-scale feature enhancement results and then performs defect detection, and since the enhancement processing improves the detectability of defects, it helps to improve the reliability of lithium battery surface defect detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0047] Figure 1 It is a flowchart of the steps of a method for detecting surface defects of lithium batteries with enhanced multi-scale feature details provided by an embodiment of the present invention;
[0048] Figure 2 It is a network framework diagram of an enhanced defect detection network provided by an embodiment of the present invention;
[0049] Figure 3 It is a structural schematic diagram of a multi-scale adaptive enhancement module provided by an embodiment of the present invention;
[0050] Figure 4 It is a structural schematic diagram of a comprehensive enhancement module provided by an embodiment of the present invention;
[0051] Figure 5 It is a structural schematic diagram of a low-pass filtering layer provided by an embodiment of the present invention;
[0052] Figure 6 It is a structural schematic diagram of an edge detection layer provided by an embodiment of the present invention;
[0053] Figure 7Schematic diagram of the structure of the semantic extraction layer provided by the embodiment of the present invention;
[0054] Figure 8 Schematic diagram of the model training process of the enhanced defect detection network provided by the embodiment of the present invention;
[0055] Figure 9 Schematic diagram of the process of lithium battery area segmentation provided by the embodiment of the present invention;
[0056] Figure 10 Schematic diagram of the comparison before and after image enhancement provided by the embodiment of the present invention;
[0057] Figure 11 Comparison experimental graph of the YOLO model provided by the embodiment of the present invention;
[0058] Figure 12 Block diagram of the structure of a lithium battery surface defect detection system with enhanced multi-scale feature details provided by the embodiment of the present invention. Detailed implementation manners
[0059] The embodiment of the present invention provides a lithium battery surface defect detection method and system with enhanced multi-scale feature details, which is used to solve the technical problem that in the process of defect detection on the surface of a lithium battery by the existing lithium battery surface defect detection method, the visibility of defects is poor, resulting in low reliability of lithium battery surface defect detection.
[0060] In order to make the invention purpose, features, and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the embodiments described below are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present invention.
[0061] Please refer to Figure 1 , Figure 1 Flowchart of the steps of a lithium battery surface defect detection method with enhanced multi-scale feature details provided by the embodiment of the present invention.
[0062] A lithium battery surface defect detection method with enhanced multi-scale feature details provided by the present invention includes:
[0063] Step 101: Perform lithium battery area segmentation on the surface image of the lithium battery to be measured to obtain a lithium battery area image.
[0064] The surface image of the lithium battery to be measured refers to the original image containing the entire surface of the lithium battery obtained by an image acquisition device, and the image usually contains the surface of the lithium battery and its surrounding environment.
[0065] The image of the lithium - battery area refers to an image that only contains the area where the lithium - battery is located.
[0066] It should be noted that in order to make the subsequent defect detection more focused on the lithium - battery area, the surface image of the lithium - battery to be measured is subjected to lithium - battery area extraction to remove the interference of the background and other irrelevant information, so as to obtain the image of the lithium - battery area and facilitate highlighting the effective information of the lithium - battery.
[0067] In a specific implementation manner of this embodiment, step 101 includes the following sub - steps:
[0068] After binarizing the surface image of the lithium - battery to be measured, contour detection is performed to determine the lithium - battery contour.
[0069] According to the lithium - battery contour, a mask image is created to construct a contour mask image.
[0070] The contour mask image and the surface image of the lithium - battery to be measured are subjected to a bit - wise AND operation to output the image of the lithium - battery area.
[0071] The lithium - battery contour refers to the contour of the area where the lithium - battery is located in the image, which is used to represent the shape and position of the lithium - battery.
[0072] The contour mask image refers to a mask image that contains the lithium - battery contour.
[0073] It should be noted that in specific implementation, as Figure 9 shown, first, the surface image of the lithium - battery to be measured is binarized to remove unnecessary gray levels. On this basis, a contour algorithm is used for contour detection to find the boundary contour of the lithium - battery area, which is crucial for determining the shape and position of the lithium - battery. Then, a mask image with the same size as the surface image of the lithium - battery to be measured is created, and the detected lithium - battery contour is drawn on this mask image and the area inside the lithium - battery contour is filled, so as to obtain the contour mask image. Finally, the contour mask image and the surface image of the lithium - battery to be measured are subjected to a bit - wise AND operation, so that only the pixel values of the lithium - battery area are retained in the surface image of the lithium - battery to be measured, thus obtaining the image of the lithium - battery area. Thereby, the purpose of accurately segmenting the lithium - battery area from the original image is achieved.
[0074] It can be understood that in order to implement the surface defect detection of the lithium - battery, this embodiment designs an enhanced defect detection network as Figure 1 shown, including an image enhancement model and an object detection model. Among them, the image enhancement model for image enhancement includes a multi - scale adaptive enhancement module, a comprehensive enhancement module, and a feature fusion module. The object detection model for defect detection can adopt the Yolo series model in specific implementation; as Figure 8As shown, collect the NG images of the lithium battery surface inspection machine to ensure the integrity and availability of the data. Then, perform lithium battery area segmentation processing, and use the labelimg tool to annotate the image defects. The defined defect types mainly include 4 types: scratches, dirt, depressions, and indentations. Divide the image data into a training set, a validation set, and a test set. Select a target detection model according to the requirements of the task and the data characteristics. Use the training set to input and enhance the defect detection network for training and perform corresponding parameter tuning and optimization. To test the effectiveness and robustness of the network, introduce accuracy, precision, mean average precision, and inference speed as evaluation indicators, and perform verification and evaluation through the validation set to obtain a trained enhanced defect detection network. The image in the test set can be used as the lithium battery area image of the lithium battery surface image to be measured or the lithium battery area image processed from the lithium battery surface image to be measured in the actual task. After determining the lithium battery area image, input it into the trained enhanced defect detection network for processing.
[0075] Step 102: Based on the lithium battery area image, perform pyramid decomposition and adaptive contrast-limited adaptive histogram equalization through a multi-scale adaptive enhancement module, and output multiple scale feature maps.
[0076] It should be noted that in order to adapt to defects of different sizes on the lithium battery surface and achieve multi-scale defect enhancement, at the same time, in order to avoid the problems of excessive contrast enhancement or noise in the traditional histogram equalization method, this embodiment proposes a multi-scale adaptive enhancement module based on the combination of pyramid decomposition and adaptive contrast-limited adaptive histogram equalization (Adaptive Clahe) to perform multi-scale adaptive enhancement on the lithium battery area image, and obtain scale feature maps with different scale outputs.
[0077] In a specific implementation manner of this embodiment, step 102 includes the following sub-steps:
[0078] Use the Gaussian pyramid layer to perform downsampling multi-scale decomposition on the lithium battery area image to obtain multiple Gaussian feature maps;
[0079] Input each Gaussian feature map into the equalization layer respectively, and perform adaptive contrast-limited adaptive histogram equalization according to the image scaling ratio of the Gaussian pyramid layer, and output the corresponding equalized feature maps;
[0080] Based on the Laplacian pyramid layer, perform upsampling multi-scale detail decomposition on each equalized feature map to determine multiple scale feature maps.
[0081] It should be noted that the multi-scale adaptive enhancement module of this embodiment includes a Gaussian pyramid layer, an equalization layer, and a Laplacian pyramid layer; in specific implementation, as Figure 3 shown:
[0082] First, perform Gaussian pyramid decomposition on the input lithium battery area image by downsampling it multiple times in the Gaussian pyramid layer. Each time downsampling is performed, the width and height of the image are halved and the resolution becomes 1 / 4 of the original, so as to obtain multi-level image information with different resolutions, thereby determining multiple Gaussian feature maps:
[0083] (1)
[0084] In the formula, is the downsampling of the Gaussian pyramid, is the index of the level of the Gaussian pyramid, is the -th layer Gaussian feature map;
[0085] Then, in the equalization layer, perform adaptive limited contrast adaptive histogram equalization on each layer of Gaussian feature map to obtain the corresponding equalized feature map. This Adaptive Clahe processing can dynamically adjust the clipping intensity (clip_limit) and segmentation ratio (grid_size) according to the characteristics of the feature map. In this way, not only can the contrast of the image be initially enhanced, but while ensuring the global contrast, it can also avoid the consequence of excessive contrast enhancement caused by directly using CLAHE on the feature map;
[0086] In specific implementation, adjust clip_limit and grid_size in histogram equalization dynamically according to the image scaling ratio of the Gaussian pyramid layer. As shown in formulas (2) and (3), for each downsampling of the Gaussian feature map in the Gaussian pyramid, the values of grid_size and clip_limit will become 1 / 2 of the previous layer. Among them, is the segmentation ratio of the -th layer, is the width of the segmentation ratio of the -th layer, is the height of the segmentation ratio of the -th layer, is to avoid grid_size becoming 0 to ensure that the size of each grid is at least 1, is the clipping intensity of the -th layer, is to avoid clip_limit becoming too small to prevent excessive limitation of contrast enhancement:
[0087] (2)
[0088] (3)
[0089] And for the -th layer Gaussian feature map , divide it into multiple small blocks according to the updated grid_size , where the size of each block is B×B is the index of the small block, and then calculate each small block for each gray level occurrence frequency , where is the Dirac function, are the pixel points within the small block:
[0090] (4)
[0091] According to the cropping intensity of the current layer , perform local histogram cropping to obtain a local cropped image , and perform histogram normalization to obtain a normalized image :
[0092] (5)
[0093] (6)
[0094] Calculate the cumulative histogram after cropping based on the normalized image , and map it to the output image to obtain an equalized feature map , where are all gray levels less than or equal to the current , is the total number of gray levels of the image, are the pixel coordinates of the image:
[0095] (7)
[0096] (8)
[0097] Finally, since the image is downsampled in the foregoing process to reduce the image resolution, this will cause loss of a part of information, and this part of information can be used as the components required for the Laplacian pyramid. In the Laplacian pyramid layer, subtract the upsampled enlarged image of the equalized feature map of the layer from the equalized feature map of the layer in the adjacent layer to obtain a scale feature map with different resolutions , , is the index of the level of the Laplacian pyramid. These scale feature maps contain information from global to local and are also the information that needs to be enhanced subsequently:
[0098] (9)
[0099] Step 103: Input each scale feature map into the comprehensive enhancement module for detail enhancement to determine the corresponding detail feature map.
[0100] In a specific implementation manner of this embodiment, the processing process of the comprehensive enhancement module includes:
[0101] S1: Perform multi-scale low-pass filtering fusion on the input scale feature map based on the low-pass filtering layer to construct a filtered feature map;
[0102] S2: Perform edge detection on the input scale feature map through the edge detection layer to generate an edge feature map;
[0103] S3: Use the semantic extraction layer to perform context semantic extraction on the edge feature map to determine the semantic feature map;
[0104] S4: Concatenate the edge feature map and the semantic feature map and input them into the convolutional layer for convolutional operation to obtain a fused feature map;
[0105] S5: After concatenating the filtered feature map and the fused feature map, input them into the convolutional layer for convolutional processing and output the detail feature map.
[0106] It should be noted that in order to handle the situation of low light and low contrast on the surface defects of lithium batteries, as Figure 4 shown, the comprehensive enhancement module of this embodiment includes an edge detection layer, a semantic extraction layer, a low-pass filtering layer, and a convolutional layer. It performs detail enhancement through the collaborative combination of edge detection, context semantic extraction, and low-pass filtering. At the same time, it realizes the feature fusion of edge information, context semantic information, and low-frequency information based on the concatenation method, and uses convolutional operations to reduce the dimension of the merged feature map, reducing the computational amount and the number of parameters of the subsequent network layer, while reducing the number of channels to avoid overfitting problems caused by too many channels. Thereby, it enhances the edge, texture details, and low-frequency information of the image at different resolutions, realizes multi-level enhancement of the image, can improve the detail presentation ability of the image, and is also helpful to improve the contrast and visual effect of the image.
[0107] In a more specific implementation manner of this embodiment, sub-step S1 includes:
[0108] After performing feature upsampling on the input scale feature map through the convolutional unit, decompose it into multiple sub-feature maps along the channel dimension;
[0109] Use the adaptive average pooling unit to perform multi-scale average pooling processing on each sub-feature map respectively to obtain the corresponding pooled feature map;
[0110] Based on the upsampling unit, perform upsampling fusion on each pooled feature map and then input it into the convolutional unit for feature downsampling to determine the filtered feature map.
[0111] It should be noted that, as Figure 5 shown, the low-pass filtering layer of this embodiment includes a convolutional unit, an adaptive average pooling (Mean-Pooling) unit, and an upsampling unit. In the low-pass filtering layer, the adaptive average pooling operation is used to smooth the image, remove high-frequency noise, and retain the global structure. Through multi-scale low-pass filtering, the low-frequency information in the image is extracted, the influence of noise on the image quality is reduced, and the image becomes smoother and more natural. In specific implementation, first, the scale feature map as the input image, the number of channels of the scale feature map is increased from 3 to 32 through a 3×3 convolutional unit, and then it is decomposed into multiple sub-feature maps (f1, f2, f3, and f4) in the channel dimension. And average pooling is performed on each sub-feature map using pooling windows of different scales such as 1×1, 2×2, 3×3, and 6×6 to obtain the corresponding pooled feature maps. Since average pooling usually only allows information below the cut-off frequency to pass through and captures low-frequency information, after upsampling and fusing each pooled feature map based on upsampling methods such as bilinear interpolation by the upsampling unit, it is input into the convolutional unit for feature dimensionality reduction, and finally the image is restored to 3 channels through a convolutional operation.
[0112] In a more specific implementation manner of this embodiment, sub-step S2 includes:
[0113] Using a horizontal Sobel operator unit and a vertical Sobel operator unit to calculate the horizontal gradient feature map and the vertical gradient feature map of the input scale feature map respectively;
[0114] Adding the horizontal gradient feature map and the vertical gradient feature map element by element to obtain a comprehensive gradient feature map;
[0115] After feature extraction of the comprehensive gradient feature map by the convolutional unit, adding it to the scale feature map element by element and outputting an edge feature map.
[0116] It should be noted that, in order to capture the edge information and details in the image, as Figure 6 shown, the edge detection layer of this embodiment includes a horizontal Sobel operator unit, a vertical Sobel operator unit, and a convolutional unit. In the edge detection layer, edge detection based on the Sobel operator is used to calculate the image gradient. By calculating the gradients in the horizontal and vertical directions of the image and fusing them, the edge details can be effectively highlighted and the sharpness of the image can be improved. The edge detection layer is a residual structure. In specific implementation, the scale feature map as the input image, on the backbone, the horizontal Sobel operator unit uses the Sobel operator template in the horizontal direction to perform a convolutional operation with the input image to obtain a horizontal gradient feature map , the vertical Sobel operator unit uses a vertical Sobel operator template in the vertical direction to perform a convolution operation with the input image to obtain a vertical gradient feature map , and then the horizontal gradient feature map and the vertical gradient feature map are added element by element to obtain a comprehensive gradient feature map , and then the obtained comprehensive gradient feature map is used for convolution After feature extraction, it is added to the input image through a short - circuit connection to obtain an edge feature map.
[0117] In a more specific implementation manner of this embodiment, sub - step S3 includes:
[0118] Using a convolution unit to perform feature up - dimensioning on the edge feature map to obtain an up - dimensioned feature map;
[0119] Inputting the up - dimensioned feature map into a residual block for residual learning and outputting a residual feature map;
[0120] Performing feature extraction on the residual feature map through a convolution unit and normalizing based on the softmax activation function to determine a weight matrix;
[0121] Multiplying the weight matrix by the residual feature map to generate a weighted feature map;
[0122] Performing feature processing on the weighted feature map successively through a convolution unit and a Leaky ReLU activation function, adding it to the residual feature map, and then inputting it into a convolution unit for feature down - dimensioning to output a semantic feature map.
[0123] It should be noted that, as Figure 7 shown, the semantic extraction layer of this embodiment includes a convolution (Conv) unit, a residual block (ResBlock), a softmax activation function, and a Leaky ReLU activation function. By extracting high - level semantic information in the semantic extraction layer, the detailed information in the image is better processed, and the gradient vanishing problem is effectively solved; in a specific implementation, the scale feature map as the input image, first passes through a 3×3 convolution unit to increase the number of channels of the feature map from 3 to 32, obtaining an up - dimensioned feature map with multiple hierarchical features , and is used as the input of the residual block to process and obtain a residual feature map. Then, on the main trunk, the residual feature map is successively subjected to feature extraction by a convolution unit and normalization operation of the Softmax function to obtain a weight matrix. The weight matrix is multiplied by Multiplication realizes weighted fusion based on context semantic features. After the generated weighted feature map passes through the convolution operation of the convolution unit and the non-linear mapping of the Leaky ReLU activation function in sequence, it is added to Finally, it is input into a 3×3 convolution unit to restore the number of channels, and a semantic feature map containing context semantic information is output.
[0124] Step 104: Use a feature fusion module to perform upsampling fusion on each detailed feature map to generate an enhanced lithium battery area image.
[0125] It should be noted that after enhancement, multiple detailed feature maps are obtained. As shown in Figure 2 In the feature fusion module composed of upsampling units, the resolution is gradually restored to that of the original image through multiple upsampling operations, and thus an enhanced lithium battery area image containing local and global information is obtained.
[0126] Step 105: Based on the object detection model, perform defect detection on the enhanced lithium battery area image and output the detection result.
[0127] It should be noted that Figure 10 shows the comparison results of the lithium battery surface image before and after enhancement. Since the detectability of defects is improved in the image enhancement model, inputting the enhanced lithium battery area image obtained after enhancement processing into the object detection model helps to improve the reliability of lithium battery surface defect detection.
[0128] To verify the effectiveness of this solution, taking the YOLO model as an example of the object detection model, experiments are carried out on the enhanced defect detection network composed of adding the image enhancement model to different versions of the YOLO model. The comparison experiment results are shown in Table 1 and Figure 11 as follows:
[0129] Table 1 Comparison of various defects
[0130]
[0131] It can be seen from Figure 11 that as the number of training rounds increases, the average precision of the improved enhanced defect detection network improves significantly compared with the original model and finally tends to be stable. Combining Table 1, the average enhancement rates of various defects are 42.44% for scratches, 14.62% for dirt, 25.21% for depressions, and 2.2% for indentations respectively, indicating that this solution shows significant advantages in lithium battery surface defect detection, can accurately identify tiny and complex defects, and effectively improve the detection accuracy.
[0132] In the embodiments of the present invention, through the pyramid-based adaptive histogram image enhancement, while optimizing the image contrast, it effectively improves the over-enhancement problem existing in the traditional CLAHE algorithm, retains important details through detail enhancement processing, prevents the loss of image information or the generation of artifacts, fuses the multi-scale feature enhancement results and then performs defect detection. Since the enhancement processing improves the detectability of defects, it helps to improve the reliability of lithium battery surface defect detection.
[0133] Please refer to Figure 12 , Figure 12 which is a structural block diagram of a lithium battery surface defect detection system with multi-scale feature detail enhancement provided by the embodiments of the present invention.
[0134] A lithium battery surface defect detection system with multi-scale feature detail enhancement provided by the present invention includes:
[0135] A preprocessing module 1201, configured to perform lithium battery area segmentation on the surface image of the lithium battery to be measured, and obtain a lithium battery area image;
[0136] A multi-scale enhancement module 1202, configured to perform pyramid decomposition and adaptive limited contrast adaptive histogram equalization on the lithium battery area image through a multi-scale adaptive enhancement module, and output multiple scale feature maps;
[0137] A detail enhancement module 1203, configured to input each scale feature map into a comprehensive enhancement module for detail enhancement respectively, and determine the corresponding detail feature map;
[0138] A multi-scale fusion module 1204, configured to perform upsampling fusion on each detail feature map by using a feature fusion module to generate an enhanced lithium battery area image;
[0139] A detection output module 1205, configured to perform defect detection on the enhanced lithium battery area image based on a target detection model, and output a detection result.
[0140] Further, the preprocessing module 1201 is specifically configured to:
[0141] Perform contour detection on the surface image of the lithium battery to be measured after binarization to determine the lithium battery contour;
[0142] Create a mask image according to the lithium battery contour to construct a contour mask image;
[0143] Perform a bitwise AND operation on the contour mask image and the surface image of the lithium battery to be measured, and output a lithium battery area image.
[0144] Further, the multi-scale adaptive enhancement module includes a Gaussian pyramid layer, an equalization layer, and a Laplacian pyramid layer; the multi-scale enhancement module 1202 is specifically configured to:
[0145] The Gaussian pyramid layer is used to perform downsampling multi-scale decomposition on the image of the lithium battery area, and multiple Gaussian feature maps are obtained;
[0146] Each Gaussian feature map is respectively input into the equalization layer, and adaptive limited contrast adaptive histogram equalization is performed according to the image scaling ratio of the Gaussian pyramid layer, and the corresponding equalized feature maps are output;
[0147] Based on the Laplacian pyramid layer, upsampling multi-scale detail decomposition is performed on each equalized feature map to determine multiple scale feature maps.
[0148] Furthermore, the comprehensive enhancement module includes an edge detection layer, a semantic extraction layer, a low-pass filtering layer, and a convolutional layer; the processing process of the comprehensive enhancement module includes:
[0149] Based on the low-pass filtering layer, multi-scale low-pass filtering fusion is performed on the input scale feature map to construct a filtered feature map;
[0150] The input scale feature map is subjected to edge detection through the edge detection layer to generate an edge feature map;
[0151] The semantic extraction layer is used to perform context semantic extraction on the edge feature map to determine a semantic feature map;
[0152] The edge feature map and the semantic feature map are spliced and input into the convolutional layer for convolution operation to obtain a fused feature map;
[0153] After the filtered feature map and the fused feature map are spliced, they are input into the convolutional layer for convolution processing, and a detailed feature map is output.
[0154] Furthermore, the low-pass filtering layer includes a convolutional unit, an adaptive average pooling unit, and an upsampling unit; based on the low-pass filtering layer, multi-scale low-pass filtering fusion is performed on the input scale feature map to construct a filtered feature map, including:
[0155] After the feature dimension of the input scale feature map is increased by the convolutional unit, it is decomposed into multiple sub-feature maps along the channel dimension;
[0156] The adaptive average pooling unit is used to perform multi-scale average pooling processing on each sub-feature map respectively to obtain the corresponding pooled feature map;
[0157] Based on the upsampling unit, after the upsampling fusion of each pooled feature map, it is input into the convolutional unit for feature dimension reduction to determine the filtered feature map.
[0158] Furthermore, the semantic extraction layer includes a convolutional unit, a residual block, a softmax activation function, and a Leaky ReLU activation function; using the semantic extraction layer to perform context semantic extraction on the edge feature map to determine a semantic feature map, including:
[0159] Use a convolutional unit to perform feature dimension elevation on the edge feature map to obtain an elevated feature map;
[0160] Input the elevated feature map into a residual block for residual learning and output a residual feature map;
[0161] Extract features from the residual feature map through a convolutional unit and perform normalization based on the softmax activation function to determine a weight matrix;
[0162] Multiply the weight matrix by the residual feature map to generate a weighted feature map;
[0163] Perform feature processing on the weighted feature map sequentially through a convolutional unit and a Leaky ReLU activation function, add it to the residual feature map, and then input it into a convolutional unit for feature dimension reduction to output a semantic feature map.
[0164] An embodiment of the present invention also provides a computer device, including a memory and a processor, and a computer program is stored in the memory; when the computer program is executed by the processor, the processor executes the steps of the method for detecting surface defects of a lithium battery with enhanced multi-scale feature details as described in any of the above embodiments.
[0165] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program / instruction is stored, and when the computer program / instruction is executed by the processor, the steps of the method for detecting surface defects of a lithium battery with enhanced multi-scale feature details as described in any of the above embodiments are implemented.
[0166] An embodiment of the present invention also provides a computer program product, including a computer program / instruction, and when the computer program / instruction is executed by the processor, the steps of the method for detecting surface defects of a lithium battery with enhanced multi-scale feature details as described in any of the above embodiments are implemented.
[0167] Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems and modules described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0168] In the several embodiments provided in the present application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, and the indirect couplings or communication connections of devices or units can be in electrical, mechanical or other forms.
[0169] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or distributed over multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0170] In addition, each functional unit in various embodiments of the present invention may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0171] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0172] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features. And these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of various embodiments of the present invention.
Claims
1. A lithium battery surface defect detection method with multi-scale feature detail enhancement, characterized in that: include: Perform lithium battery area segmentation on the surface image of the lithium battery to be tested to obtain a lithium battery area image; Performing pyramid decomposition and adaptive limited contrast adaptive histogram equalization based on the lithium battery area image through a multi-scale adaptive enhancement module to output multiple scale feature maps; Input each of the scale feature maps into a comprehensive enhancement module for detail enhancement to determine a corresponding detail feature map; Using a feature fusion module to upsample and fuse the detail feature maps to generate an enhanced lithium battery area image; Defect detection is performed on the enhanced lithium battery area image based on the target detection model, and the detection result is output.
2. The lithium battery surface defect detection method with multi-scale feature detail enhancement according to claim 1, characterized in that: The lithium battery region segmentation is performed on the surface image of the lithium battery to be tested to obtain the lithium battery region image, including: After the surface image of the lithium battery to be tested is binarized, contour detection is performed to determine the contour of the lithium battery; Creating a mask image according to the lithium battery contour to construct a contour mask image; The contour mask image and the surface image of the lithium battery to be tested are subjected to a bitwise AND operation to output a lithium battery area image.
3. The lithium battery surface defect detection method with multi-scale feature detail enhancement according to claim 1, characterized in that: The multi-scale adaptive enhancement module includes a Gaussian pyramid layer, an equalization layer and a Laplace pyramid layer; the multi-scale adaptive enhancement module performs pyramid decomposition and adaptive limited contrast adaptive histogram equalization based on the lithium battery area image, and outputs multiple scale feature maps, including: The lithium battery region image is downsampled and decomposed at multiple scales using a Gaussian pyramid layer to obtain multiple Gaussian feature maps; Input each of the Gaussian feature maps into the equalization layer respectively, perform adaptive limited contrast adaptive histogram equalization according to the image scaling ratio of the Gaussian pyramid layer, and output the corresponding equalized feature map; The equalized feature maps are upsampled and decomposed into multi-scale details based on the Laplacian pyramid layer to determine a plurality of scale feature maps.
4. The lithium battery surface defect detection method with multi-scale feature detail enhancement according to claim 1, characterized in that: The comprehensive enhancement module includes an edge detection layer, a semantic extraction layer, a low-pass filtering layer and a convolution layer; The processing process of the comprehensive enhancement module includes: Based on the low-pass filter layer, multi-scale low-pass filtering is performed on the input scale feature map to construct a filter feature map; Perform edge detection on the input scale feature map through the edge detection layer to generate an edge feature map; Using a semantic extraction layer to perform contextual semantic extraction on the edge feature map to determine a semantic feature map; The edge feature map and the semantic feature map are concatenated and input into a convolution layer for convolution operation to obtain a fused feature map; After the filtering feature map and the fusion feature map are spliced, they are input into the convolution layer for convolution processing to output a detail feature map.
5. The lithium battery surface defect detection method with multi-scale feature detail enhancement according to claim 4, characterized in that: The low-pass filter layer includes a convolution unit, an adaptive average pooling unit and an upsampling unit; The method of performing multi-scale low-pass filtering fusion on the input scale feature map based on the low-pass filtering layer to construct the filter feature map includes: After the input scale feature map is dimensionally upgraded through the convolution unit, it is decomposed into multiple sub-feature maps along the channel dimension; Adopting an adaptive average pooling unit to perform multi-scale average pooling processing on each of the sub-feature maps to obtain a corresponding pooled feature map; After upsampling and fusion are performed using the pooling feature maps based on the upsampling unit, the maps are input into the convolution unit for feature dimension reduction to determine the filtering feature map.
6. The lithium battery surface defect detection method with multi-scale feature detail enhancement according to claim 4, characterized in that: The semantic extraction layer includes a convolution unit, a residual block, a softmax activation function and a leaky ReLU activation function; the semantic extraction layer is used to perform context semantic extraction on the edge feature map to determine the semantic feature map, including: Using a convolution unit to perform feature dimension increase on the edge feature map to obtain a dimension increase feature map; Inputting the dimension-increased feature map into a residual block for residual learning, and outputting a residual feature map; Extract features from the residual feature map through a convolution unit, normalize it based on a softmax activation function, and determine a weight matrix; Multiplying the weight matrix by the residual feature map to generate a weighted feature map; The weighted feature map is processed by a convolution unit and a Leaky ReLU activation function in turn, and after being added to the residual feature map, it is input into a convolution unit for feature dimensionality reduction to output a semantic feature map.
7. A lithium battery surface defect detection system with multi-scale feature detail enhancement, characterized in that: include: A preprocessing module is used to segment the surface image of the lithium battery to be tested into lithium battery regions to obtain a lithium battery region image; A multi-scale enhancement module, used for performing pyramid decomposition and adaptive limited contrast adaptive histogram equalization based on the lithium battery area image through a multi-scale adaptive enhancement module, and outputting multiple scale feature maps; A detail enhancement module, used for inputting each of the scale feature maps into a comprehensive enhancement module for detail enhancement, and determining a corresponding detail feature map; A multi-scale fusion module, used to upsample and fuse the detail feature maps using a feature fusion module to generate an enhanced lithium battery area image; The detection output module is used to perform defect detection on the enhanced lithium battery area image based on the target detection model and output the detection result.
8. A computer device, characterized in that: It includes a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the lithium battery surface defect detection method with multi-scale feature detail enhancement as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the lithium battery surface defect detection method with multi-scale feature detail enhancement as described in any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the lithium battery surface defect detection method with multi-scale feature detail enhancement as described in any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Camouflage target identification method and system
CN120451517A
Small target detection method, device and equipment
CN121236564A
Small target detection method, device and equipment
CN121236564B
Engine blade defect detection method based on machine vision
CN122199536A