A machine vision-based battery appearance detection method and system
By using a machine vision-based battery appearance inspection method, combined with standard geometric templates and image processing technology, the problem of unstable inspection results in existing technologies has been solved. This method enables accurate identification of battery surface deformation and actual defects, improving the accuracy and stability of the inspection.
Patent Information
- Application Number
- CN202611234945.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-14
- Publication Date
- 2026-11-24
AI Technical Summary
Existing technologies struggle to accurately identify deformation and actual defects on the surface of batteries in complex production environments. In particular, the detection results are unstable when faced with differences in light, angle, or surface material, making it difficult to distinguish between production defects and normal deformation.
A machine vision-based detection method is adopted. The original image of the battery appearance is acquired and preliminarily processed. Rigidity matching calculation is performed by combining it with a preset standard geometric template, the gradient intensity of the surface deviation field is extracted, candidate areas of abnormal deformation are selected, weighted deviation degree is calculated and comprehensive quantitative scoring is performed, and finally abnormal state classification is achieved.
It enhances the image's anti-interference capability, accurately captures surface deformation features, effectively distinguishes between production defects and normal deformation, and improves the accuracy of defect identification and the stability of batch inspection.
Smart Images

Figure CN123160938A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial vision intelligence technology, and in particular to a method and system for inspecting the appearance of batteries based on machine vision. Background Technology
[0002] Currently, as a core component of energy storage, the appearance quality of batteries is directly related to the safety and reliability of products, especially in fields such as new energy vehicles and energy storage equipment. Any minor appearance defect may lead to serious consequences. Therefore, it is crucial to conduct accurate appearance inspection of battery surfaces through visual inspection.
[0003] In a current technology, traditional detection methods are difficult to adapt to the changing appearance features and dynamic conditions in complex production environments. When dealing with batteries of different types and states, they are easily affected by differences in light, angle, or surface material, resulting in unstable detection results. At the same time, due to the complexity of appearance features, it is difficult to accurately separate key clues related to defects from the complex image information. This directly affects the accurate judgment of defect morphology, making it difficult for the system to distinguish between production defects and normal deformation when faced with abnormal morphologies such as bulges.
[0004] In summary, existing technologies suffer from the problem of difficulty in accurately identifying surface deformation and actual defects in batteries. Summary of the Invention
[0005] This invention provides a method and system for inspecting the appearance of batteries based on machine vision, so as to achieve accurate identification of surface deformation and actual defects of batteries.
[0006] In a first aspect, to address the aforementioned technical problems, the present invention provides a machine vision-based method for inspecting the appearance of a battery, comprising:
[0007] Obtain the original image of the battery's appearance, and perform preliminary processing on the original image to obtain an image with clear texture;
[0008] For the image with clear texture, the overall contour region is extracted to obtain the basic contour region corresponding to the inherent characteristics of each individual.
[0009] Based on the basic contour region, rigid matching calculation is performed in conjunction with a preset standard geometric template to obtain a rigid transformation matrix. Then, based on the rigid transformation matrix and the basic contour region, the deformation deviation field gradient intensity is calculated to obtain the deviation field gradient intensity of each region of the surface.
[0010] Based on the gradient intensity of the deviation field, candidate regions for abnormal deformation are selected to obtain candidate regions for abnormal deformation. The boundary point sequence of the candidate regions for abnormal deformation is extracted, and a shape parameter vector is generated based on the boundary point sequence to obtain the boundary point sequence and shape parameter vector of the bulge under abnormal conditions.
[0011] The position information is calculated based on the boundary point sequence and the shape parameter vector to obtain the center coordinates of the bulge region and the position information of the bounding box. The deviation degree is calculated by combining the center coordinates of the bulge region and the position information of the bounding box with the historical normal fluctuation template to obtain the weighted deviation degree.
[0012] Spatial position weights are calculated based on the center coordinates of the bulge area and the bounding box position information to obtain spatial position sensitivity weights. Comprehensive anomaly quantification is then performed based on the spatial position sensitivity weights and the weighted deviation to obtain a comprehensive quantitative score.
[0013] Based on the comprehensive quantitative score, combined with the pre-established deformation trend state model, quantitative classification is performed to obtain the abnormal state classification label of the current batch of batteries.
[0014] Secondly, the present invention provides a battery appearance inspection system based on machine vision, comprising:
[0015] The image preliminary processing module is used to acquire the original appearance image of the battery and perform preliminary processing on the original appearance image to obtain an image with clear texture;
[0016] The basic contour extraction module is used to extract the overall contour region for the image with clear texture, and obtain the basic contour region corresponding to the inherent characteristics of the individual.
[0017] The deformation deviation calculation module is used to perform rigid matching calculation based on the basic contour region and a preset standard geometric template to obtain a rigid transformation matrix, and to calculate the deformation deviation field gradient intensity based on the rigid transformation matrix and the basic contour region to obtain the deviation field gradient intensity of each region of the surface.
[0018] The candidate region selection module is used to select abnormal deformation candidate regions based on the gradient intensity of the deviation field, obtain abnormal deformation candidate regions, extract the boundary point sequence of the abnormal deformation candidate regions, generate a shape parameter vector based on the boundary point sequence, and obtain the boundary point sequence and shape parameter vector of the bulge under abnormal conditions.
[0019] The deviation calculation module is used to calculate the position information based on the boundary point sequence and the shape parameter vector to obtain the center coordinates of the bulge region and the bounding box position information, and to calculate the deviation degree by combining the center coordinates of the bulge region, the bounding box position information and the historical normal fluctuation template to obtain the weighted deviation degree.
[0020] The comprehensive anomaly quantification module is used to calculate the spatial position weight based on the center coordinates of the bulge region and the bounding box position information to obtain the spatial position sensitivity weight, and to perform comprehensive anomaly quantification based on the spatial position sensitivity weight and the weighted deviation to obtain a comprehensive quantification score.
[0021] The abnormal state classification module is used to perform quantitative classification based on the comprehensive quantitative score and the pre-established deformation trend state model to obtain the abnormal state classification label of the current batch of batteries.
[0022] Compared with the prior art, the present invention has the following beneficial effects:
[0023] (1) The present invention obtains a textured image by performing preliminary processing on the original appearance image, and obtains the deviation field gradient intensity by performing rigid matching calculation in combination with a preset standard geometric template. Because of the preliminary processing, such as illumination normalization and noise filtering, the image interference caused by differences in light, shooting angle and surface material is eliminated. Rigid matching can filter the inherent shape differences of individual batteries based on standard contours, accurately extract the true deformation information of the surface, solve the problem of unstable detection results caused by environmental factors in the existing technology, improve the image anti-interference ability and accurately capture surface deformation features.
[0024] (2) This invention extracts geometric boundary features from candidate areas of abnormal deformation and calculates weighted deviation by combining historical normal fluctuation templates. The historical normal fluctuation templates contain the deformation range of the battery under normal working conditions. The weighted deviation can quantify the degree of difference between the bulge shape and normal deformation, effectively distinguishing between bulges caused by production defects and normal deformation, and achieving accurate identification of real defects on the surface of the battery.
[0025] (3) This invention uses spatial location sensitivity weight and weighted deviation to perform comprehensive anomaly quantification, and combines deformation trend state model to obtain anomaly state classification label. Because spatial location weight can reflect the difference in the impact of bulging in different areas on battery safety, such as the higher risk of bulging near the terminal, the deformation trend model achieves batch-based accurate classification based on historical data, improving the accuracy of defect assessment and batch detection stability. Attached Figure Description
[0026] Figure 1 This is a schematic flowchart of a battery appearance inspection method based on machine vision provided in the first embodiment of the present invention;
[0027] Figure 2 This is a schematic diagram of a battery appearance inspection system based on machine vision provided in the second embodiment of the present invention. Detailed Implementation
[0028] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0029] Reference Figure 1 The first embodiment of the present invention provides a battery appearance inspection method based on machine vision, including the following steps:
[0030] S11, acquire the original image of the battery's appearance, and perform preliminary processing on the original image to obtain a clear texture image;
[0031] S12, For the image with clear texture, extract the overall contour region to obtain the basic contour region corresponding to the inherent characteristics of the individual.
[0032] S13, Based on the basic contour region, perform rigid matching calculations using a preset standard geometric template to obtain a rigid transformation matrix, and calculate the deformation deviation field gradient intensity based on the rigid transformation matrix and the basic contour region to obtain the deviation field gradient intensity of each region of the surface.
[0033] S14. Based on the gradient intensity of the deviation field, select candidate regions for abnormal deformation to obtain candidate regions for abnormal deformation, extract the boundary point sequence of the candidate regions for abnormal deformation, generate a shape parameter vector based on the boundary point sequence, and obtain the boundary point sequence and shape parameter vector of the bulge under abnormal conditions.
[0034] S15, calculate the position information based on the boundary point sequence and the shape parameter vector to obtain the center coordinates of the bulge region and the bounding box position information, and calculate the degree of deviation by combining the center coordinates of the bulge region, the bounding box position information and the historical normal fluctuation template to obtain the weighted deviation degree.
[0035] S16, calculate the spatial position weight based on the center coordinates of the bulge area and the position information of the bounding box to obtain the spatial position sensitivity weight, and perform comprehensive anomaly quantification based on the spatial position sensitivity weight and the weighted deviation to obtain a comprehensive quantification score;
[0036] S17. Based on the comprehensive quantitative score, combined with the pre-established deformation trend state model, quantitative classification is performed to obtain the abnormal state classification label of the current batch of batteries.
[0037] In step S11, it is necessary to obtain the original image of the battery's appearance and perform preliminary processing on the original image to obtain a clear texture image.
[0038] It is worth noting that this step, through adaptive brightness equalization and edge-preserving filtering combined processing of the original appearance image, eliminates local overexposure or underexposure caused by complex lighting conditions in industrial environments. Simultaneously, it separates and reconstructs effective texture information, providing a high-quality image foundation with uniform brightness distribution and high-contrast details for subsequent overall contour extraction and local deformation analysis based on conditional random fields. Specifically, a grayscale image with a resolution of 1920*1080 is obtained by photographing the battery surface using a high-resolution industrial camera; this grayscale image serves as the original appearance image, thus achieving the acquisition of the original appearance image.
[0039] In one implementation, the original appearance image undergoes preliminary processing to obtain a textured image, including:
[0040] The original appearance image is subjected to brightness equalization processing to obtain a brightness equalization image;
[0041] Layer separation is performed on the brightness-equalized image to obtain the base layer image and the high-frequency difference map;
[0042] The pixel gradient magnitude is calculated based on the high-frequency difference map. If the pixel gradient magnitude is greater than a preset magnitude threshold, texture reconstruction is performed in combination with the base layer image to obtain a texture reconstruction image.
[0043] The texture reconstruction image is enhanced with contrast based on dynamic range mapping to obtain a textured image with enhanced surface texture details.
[0044] It's worth noting that when acquiring the original appearance image, uneven lighting may cause some areas to be too dark or too bright. For example, side lighting might cause the grayscale values on the left side to be concentrated in the 50-80 range (too dark), while the right side might be concentrated in the 180-220 range (too bright). In such cases, brightness equalization processing is needed to map the grayscale levels concentrated in specific ranges to a wider dynamic range, allowing the details in the originally too dark or too bright areas to be revealed, resulting in a brightness-equalized image. During brightness equalization, the grayscale histogram of the original image is calculated, a cumulative distribution function is generated, and the original grayscale value of 50 is mapped to 0, the original grayscale value of 220 is mapped to 255, and intermediate grayscale values are non-linearly interpolated according to the cumulative distribution to obtain a brightness-equalized image whose grayscale distribution extends to the complete 0-255 range, with the average brightness of the entire image approaching 128.
[0045] Furthermore, the base layer image is a smooth image reflecting low-frequency information of the scene, obtained through edge-preserving filtering, which preserves edge structure while suppressing noise; the high-frequency difference map is the difference result between the original image and the base layer image, containing high-frequency information such as surface scratches and texture details. Layer separation is achieved using a bilateral filter. A convolution operation is performed on the brightness-equalized image, and spatial and gray-level standard deviation parameters are set to obtain the base layer image; then, the high-frequency difference map is obtained by performing a pixel-by-pixel difference operation between the brightness-equalized image and the base layer image. The bilateral filter constructs a filter kernel by multiplying the spatial domain Gaussian weights and the gray-level domain Gaussian weights, which smooths the image while preserving edge structures. The spatial domain standard deviation is set according to the filter radius, with a value range of 3 to 5 pixels, and is used to control the weight attenuation of spatially adjacent pixels. The gray-level standard deviation is set according to the image's gray-level dynamic range, with a value range of 20 to 40 gray levels, and is used to control the weight retention of pixels with similar gray levels. After performing bilateral filtering convolution on the brightness-balanced image, a base layer image reflecting the overall illumination distribution of the scene is obtained. Then, the gray values of each pixel in the brightness-balanced image are subtracted from the gray values of the corresponding pixels in the base layer image to obtain a high-frequency difference map containing surface scratches and texture details.
[0046] In one example, a preset amplitude threshold is used to quantify the boundary between valid surface texture information and random noise contamination. This is achieved by selecting a flat area in the center of a historical high-frequency difference map, calculating the standard deviation of the gradient amplitude of each pixel within that area, and using twice that standard deviation as the preset amplitude threshold. Texture reconstruction is the process of superimposing the pixels corresponding to valid textures with significant gray-level changes in the high-frequency difference map onto the base layer image. This process is used to suppress noise while preserving valid surface defect features. Pixel gradient amplitude calculation requires traversing the high-frequency difference map and calculating the absolute value of the gray-level difference between each pixel and its eight neighboring pixels as the gradient amplitude. A preset amplitude threshold of 20 is used. For a scratched area, the calculated pixel gradient amplitude is 25, which is greater than the threshold and is therefore considered valid texture. Texture reconstruction is then performed on the pixels of this specific valid texture, superimposing the pixel's gray-level value onto the corresponding position in the base layer image. For noisy areas, the gradient amplitude is 8, which is less than the threshold and is therefore considered invalid information and removed, ultimately forming the texture-reconstructed image.
[0047] Specifically, dynamic range mapping is the process of linearly or non-linearly transforming processed image data from the original grayscale range to the target display range. This mapping operation enhances visual contrast, resulting in a clearer texture image that more accurately reflects the true state of the battery surface; for example, fine cracks or wear marks can be clearly presented. For instance, if the actual grayscale range of the detected texture reconstruction image is 30-200, a linear mapping relationship is established from the range [30,200] to [10,240]. Grayscale stretching is then applied to the entire image to obtain a clearer texture image. In this clearer texture image, fine cracks that were obscured by uneven lighting in the original image appear as distinct dark lines. The grayscale contrast is increased from 15 grayscale levels in the original image to 80 grayscale levels, which is significant for subsequent quality inspection or defect classification.
[0048] In step S12, for the image with clear texture, the overall contour region is extracted to obtain the basic contour region corresponding to the inherent characteristics of each individual, including:
[0049] Calculate the edge gradient intensity of the textured image to obtain the edge distribution features;
[0050] Extract the region statistical features of the image with clear texture;
[0051] A probabilistic graphical model is constructed based on the edge distribution features and the region statistical features to obtain the probabilistic graphical model, and pixel category classification is performed based on the probabilistic graphical model to obtain pixel category labels;
[0052] Based on the pixel category labels, the regions are classified to obtain a preliminary contour mask;
[0053] A morphological closing operation is performed on the preliminary contour mask to obtain the basic contour region.
[0054] It is worth noting that this step involves performing dual-feature joint analysis on images with clear textures to construct a probabilistic graphical model, which divides image pixels into different categories such as background, overall outline, and local deformation. Then, morphological processing is used to remove interference from local deformations and complete the outline structure, thereby accurately extracting the baseline outline that only reflects the inherent geometric shape of the battery from the complex background.
[0055] Edge distribution features are spatial distribution data sets reflecting the drastic changes in image grayscale. They are used to characterize the salience of battery surface edges and defect boundaries. They can be obtained by calculating the absolute value of the grayscale difference between each pixel and its eight neighboring pixels, or by performing convolution operations using edge detection operators such as Sobel. For example, for a 1920*1080 resolution image of a battery with clear surface texture, using the Sobel operator to perform convolution in both the horizontal and vertical directions, and calculating the gradient magnitude of each pixel, yields a gradient intensity map. The gradient magnitude reaches 150-200 at the outer contour edge of the battery, 30-50 at areas with minor surface scratches, and less than 10 in flat background areas. In this way, the distribution of surface features can be preliminarily located. If the grayscale change in a certain area ranges from 50 to 150, this significant change may indicate the presence of a potential defect area.
[0056] In this embodiment, regional statistical features are constructed by dividing the image into non-overlapping or partially overlapping local sub-regions and calculating the statistical measures of pixel grayscale values within each sub-region, including but not limited to mean, variance, and standard deviation. These measures are used to measure the uniformity of grayscale distribution within a local region and the similarity of grayscale distribution between regions. In one example, when extracting regional statistical features, the 1920*1080 image is divided into multiple 32*32 pixel sub-blocks, and the mean and variance of grayscale values for each sub-block are calculated. In the battery body region, the sub-block mean is 120 and the variance is 8; in the left shadow region, the mean is 80 and the variance is 25; and in the surface bulge region, the mean is 140 and the variance is 40.
[0057] Furthermore, the probabilistic graphical model is a conditional random field probabilistic graphical model based on an undirected graph, with image pixels as the node set V={v1,v2,...,v...} n}, using the four-neighbor or eight-neighbor spatial adjacency relationships between pixels as the edge set E, construct a graph structure G=(V,E). Define an energy function E(X) to describe the pixel category label configuration X={x1,x2,...,x}. n The quality of} is determined by the following, where xᵢ∈{0,1,2} corresponds to the three categories of labels: background, overall outline, and local deformation, respectively. The energy function consists of a univariate potential function term and a binary potential function term, and its expression is:
[0058]
[0059] in, It is a univariate potential function, defined as a negative log-likelihood function based on marginal distribution characteristics and regional statistical characteristics; The potential function is a binary function, defined using the Potts model. This represents the set of neighborhood edges between pixels, typically using four-neighbor or eight-neighbor connections. The specific forms of the univariate and bivariate potential functions are:
[0060]
[0061]
[0062] in, Let i be the feature vector of pixel i. For edge gradient intensity, This is a regional grayscale statistic. Let k be a Gaussian probability density function for class k, with mean μ. k With covariance matrix Σ k The observation likelihood of pixel i belonging to class k is estimated from the training samples. This is the penalty coefficient (ranging from 5 to 20). The indicator function takes a value of 1 when adjacent pixels i and j have different class labels, and a value of 0 when they have the same label. The Potts model applies a label inconsistency penalty to force adjacent pixels to tend to have the same class label, ensuring the spatial continuity of the classification results and avoiding jagged edges or noise interference caused by independent pixel classification.
[0063] The pixel classification problem is transformed into finding the optimal label configuration that minimizes the energy function through the energy function. Here, a graph cut algorithm is used to solve the energy minimization problem. First, a flow network corresponding to the conditional random field probabilistic graphical model is constructed, mapping each pixel node to a vertex in the network. A univariate potential function is mapped to the edge capacity from the source and sink to each vertex, and a binary potential function is mapped to the edge capacity between adjacent vertices. Then, the maximum flow-minimum cut theorem is used to calculate the maximum flow of the network using the Boykov-Kolmogorov algorithm or the Push-Relabel algorithm, where the maximum flow value equals the minimum value of the energy function. Finally, the category label of each pixel is determined based on the minimum cut partitioning result. Vertices on one side of the cut set are labeled as source-connection categories (overall contour), and vertices on the other side are labeled as sink-connection categories (background). Local deformation categories are obtained through iterative optimization using α-β exchange or α-expansion algorithms with multi-label extension.
[0064] In this embodiment, the gradient intensity of the pixels at the outer contour edge of the battery (150-200) is marked as label 1 and considered as the overall contour. A 50×40 pixel bulge area on the surface with a grayscale mean of 140 and a variance of 40 is marked as label 2 and considered as a local deformation area. The gradient intensity of the flat background area is less than 10 and is marked as label 0 and considered as the background.
[0065] Specifically, the preliminary contour mask is a binary image generated based on the classification results of a conditional random field. Specific grayscale values represent pixels classified as either part of the overall contour or exhibiting local deformation, while background grayscale values represent non-target areas. The preliminary contour mask includes the main contour of the battery and small abnormal areas attached to its surface. For example, the pixels of labels 1 and 2 are set to 255, and the pixels of label 0 are set to 0; in this case, the mask includes the complete outer contour and the internal bulge area.
[0066] For example, morphological closing operations perform a cascaded process of dilation followed by erosion on a binary image. This connects adjacent target regions, fills small internal holes, and smooths boundary burrs without significantly altering the overall area of the target region. For instance, using a 5x5 pixel elliptical structuring element, the mask is first dilated to connect two gaps on the outer contour caused by illumination, then eroded to restore the original contour size. Simultaneously, bulging areas are preserved because their area exceeds the 100-pixel threshold. The resulting base contour region is a closed polygonal contour, accurately defining the inherent shape of the battery, eliminating noise interference with areas smaller than the threshold, effectively improving the continuity and accuracy of the contour, and providing a reference coordinate framework for subsequent registration with a standard geometric template.
[0067] In step S13, rigid matching calculation is performed based on the basic contour region and a preset standard geometric template to obtain a rigid transformation matrix. Then, the deformation deviation field gradient intensity is calculated based on the rigid transformation matrix and the basic contour region to obtain the deviation field gradient intensity of each region of the surface.
[0068] It is worth noting that this step involves rigidly registering the individual basic contour region extracted in step S12 with a preset standard geometric template to eliminate the overall posture differences caused by shooting angle, placement position and individual size tolerance, and to establish a unified reference coordinate system. Then, the pixel-level displacement deviation after registration is calculated and its spatial gradient distribution is obtained, thereby quantifying the severity of local geometric deformation in each region of the surface.
[0069] Standard geometric templates are typically built based on ideal design dimensions, such as a typical outline with a rectangular outer contour and a circular arc transition, and their geometry is defined by key point coordinates. Rigid transformation matrices are used to describe isometric transformations in a two-dimensional plane, containing rotation submatrices, translation vectors, and scaling factors. They maintain the shape and angle of the graphic unchanged, only changing its spatial position, orientation, and size. For example, for a certain type of rectangular battery, its standard geometric template is defined as 200 pixels long, 150 pixels wide, and four arcs with a radius of 20 pixels at the four corners. The origin of the template coordinate system is at the geometric center. When performing rigid matching calculation, four arc corner points are extracted from the basic contour area, with coordinates of (45,55), (245,52), (248,202), and (42,205). The theoretical coordinates of the four corner points of the corresponding standard template are (50,50), (250,50), (250,200), and (50,200). The rigid transformation matrix is solved by the least squares method, resulting in a rotation angle of -1.2 degrees, a horizontal translation of +3 pixels, a vertical translation of -2 pixels, and a scaling factor of 1.01. This matrix can align the individual contours to the template position as much as possible, thereby eliminating the overall posture difference.
[0070] In one implementation, the deformation deviation field gradient intensity is calculated based on the rigid transformation matrix and the basic contour region to obtain the deviation field gradient intensity of each region of the surface, including:
[0071] By combining the rigid transformation matrix and the basic contour region, a coordinate difference operation is performed to obtain a set of displacement vectors;
[0072] The local gradient intensity is calculated based on the set of displacement vectors to obtain the local gradient intensity.
[0073] Spatial location aggregation is performed based on the local gradient intensity to obtain the gradient intensity distribution.
[0074] It is worth noting that the displacement vector set is a collection of two-dimensional coordinate difference vectors between the theoretical coordinates of each pixel in the basic contour region after rigid transformation and the corresponding reference point of the standard geometric template. For example, multiplying the pixel coordinates in the basic contour region by the transformation matrix to obtain the mapped position, and then subtracting it from the corresponding position in the original basic contour region, yields the horizontal and vertical displacement components of that pixel, forming a complete displacement vector field, i.e., the displacement vector set. For instance, if the original coordinates of a pixel are (120, 180), and the mapped coordinates are (122.5, 178.2), then the displacement vector is approximately (2.5, -1.8), reflecting the remaining local offset after overall alignment.
[0075] In this embodiment, the gradient intensity is the magnitude of the rate of change of the displacement vector with spatial position, obtained by calculating the Euclidean norm of the partial derivatives of the deviation field in the x and y directions. The larger the value, the more severe the spatial transition of geometric deformation in that region. For example, to calculate the local gradient intensity, it is necessary to perform spatial differentiation on the displacement vector field. In a certain bulging region, the displacement vector gradually changes from (0.5, 0.2) on the left to (4.2, 1.5) on the right. The partial derivative in the x direction is calculated to be 0.18, and the partial derivative in the y direction is 0.05. After square root averaging, the synthesized local gradient intensity is 0.19 pixels / pixel. In the normal edge region, the displacement change of adjacent points is only from (0.1, 0.1) to (0.2, 0.15), and the local gradient intensity is 0.04 pixels / pixel.
[0076] Furthermore, spatial location aggregation is the process of dividing continuous gradient intensity data into blocks according to a preset grid for statistical analysis. By calculating the average gradient intensity, maximum gradient intensity, or cumulative gradient energy within each sub-region, a discretized data set characterizing the deformation distribution is formed. The preset grid is based on the geometric dimensions and shape characteristics of the battery casing and surface functional partitions, such as the central plane area, long sidewall area, four corner transition areas, and electrode connection area, setting coarse-grained partition boundaries to ensure homogeneity of mechanical properties and failure risks within the same grid unit. For example, the surface can be divided into grids, such as 50*50 pixels per block, and the average and maximum gradient intensities within each block are statistically analyzed to form a distribution heatmap, obtaining the gradient intensity of the deviation field. If the average intensity in the top region is 0.06, in the middle it is 0.22, and at the bottom it is 0.09, then the middle region is identified as the main deformation area. This aggregation method can intuitively reflect the non-uniformity of deformation on the overall surface, providing a reliable basis for quality grading and defect location.
[0077] In step S14, candidate regions for abnormal deformation are selected based on the gradient intensity of the deviation field to obtain candidate regions for abnormal deformation. The boundary point sequence of the candidate regions for abnormal deformation is extracted, and a shape parameter vector is generated based on the boundary point sequence to obtain the boundary point sequence and shape parameter vector of the bulge under abnormal conditions.
[0078] It is worth noting that this step performs threshold screening and statistical anomaly analysis on the deviation field gradient intensity obtained in step S13, locates candidate regions that may have geometric deformation from each region of the surface, and then uses a convolutional neural network to extract the deep geometric features of the candidate regions to accurately capture the continuity and curvature change information of the bulge edge. Finally, the bulge boundary is transformed into a parametric description through geometric modeling.
[0079] The abnormal deformation candidate region is a local spatial area in the deviation field gradient intensity where the gradient intensity value significantly exceeds a preset statistical threshold. This region has a high probability of exhibiting geometric anomalies such as bulges or dents. The preset statistical threshold is obtained by statistically analyzing the historical deviation field gradient intensities during normal fluctuations; here, the mean plus twice the standard deviation is taken as the preset statistical threshold. For example, the deviation field gradient intensity display shows an area in the middle-right position of the battery casing with a gradient intensity mean of 0.35 pixels / pixel, significantly exceeding the upper limit of the preset local statistical threshold of 0.15 pixels / pixel, and is therefore identified as an abnormal deformation candidate region.
[0080] In one implementation, the boundary point sequence of the abnormal deformation candidate region is extracted, and a shape parameter vector is generated based on the boundary point sequence to obtain the boundary point sequence and shape parameter vector of the bulge in the abnormal state, including:
[0081] Based on the abnormal deformation candidate regions, feature extraction is performed using a pre-established convolutional feature extraction network to obtain a high-dimensional feature map.
[0082] The boundary point sequence of the bulge is obtained by generating a boundary point sequence based on the high-dimensional feature map.
[0083] Geometric fitting is performed on the boundary point sequence to obtain the shape parameter vector that characterizes the specific morphological attributes of the bulge.
[0084] It is worth noting that the high-dimensional feature map is multi-dimensional tensor data output from the intermediate layer of the convolutional feature extraction network. Each channel represents the feature response intensity of the input image at a specific level of abstraction, including the geometric continuity and local curvature information of the bump edges. The convolutional feature extraction network is a feature learning model built on a deep convolutional neural network architecture. By stacking multiple convolutional operation layers, non-linear activation layers, and downsampling layers, it forms a non-linear transformation chain from raw pixels to abstract semantic features. For example, a 100*100 pixel image patch centered on the original image with clear texture is extracted and input into a pre-trained convolutional feature extraction network. After forward propagation, the network outputs a high-dimensional feature map of size 25*25*128 from the third convolutional layer.
[0085] In this embodiment, the model structure of the convolutional feature extraction network can be as follows: the input layer receives a single-channel grayscale image patch with a size of 100*100 pixels; the first convolutional layer is configured with 32 convolutional kernels of 3*3 pixels, with a stride of 1 and padding of 1, followed by a ReLU activation function and a 2*2 max pooling layer, outputting a feature map with a size of 50*50*32 pixels, used to extract local edge responses; the second convolutional layer is configured with 64 convolutional kernels of 3*3 pixels, with a stride of 1 and padding of 1, followed by a ReLU activation function and a 2*2 max pooling layer, outputting a feature map with a size of 25*25*64 pixels, used to capture intermediate texture patterns. The third convolutional layer has 128 kernels of 3*3 pixels each with a stride of 1 and padding of 1, followed by a ReLU activation function. It outputs a feature map of size 25*25*128, which is used to integrate the continuity information of the bulge edge. The fourth convolutional layer has 256 kernels of 3*3 pixels each with a stride of 1 and padding of 1, followed by a ReLU activation function. It outputs a feature map of size 25*25*128 as the final high-dimensional feature map. A skip connection is set between the third and fourth convolutional layers to concatenate the outputs of the second and fourth convolutional layers, enhancing the ability to perceive changes in the curvature of the bulge boundary.
[0086] Furthermore, the convolutional feature extraction network is trained using a supervised learning paradigm. The training dataset consists of multiple batches of battery surface image samples, covering four scenarios: normal, defect-free surfaces; bulging, scratched, and dented surfaces. The samples are then labeled with data scene annotations. Preprocessing is required, employing the same adaptive brightness equalization and edge-preserving filtering process as in step S11. The image size is standardized to 100×100 pixels, and grayscale values are normalized to the [0,1] range. Data augmentation is performed on the samples, including random rotation, random scaling, random horizontal flipping, and the addition of Gaussian noise, expanding the original sample size to 5 to 8 times its original size, constructing a dataset containing 8000 to 12000 training samples. The dataset is then divided into a training set, a validation set, and a test set in an 8:1:1 ratio.
[0087] For example, an encoder-decoder structure or a variant of U-Net is used as the basic architecture, with the weighted sum of the cross-entropy loss function and the Dice loss function as the optimization objective. The cross-entropy loss weight is 0.3, and the Dice loss weight is 0.7, used to balance edge localization accuracy and region segmentation accuracy. The Adam optimizer is used for parameter updates, with an initial learning rate set to 0.001. The learning rate is dynamically adjusted using a cosine annealing strategy, decaying to 10% of the initial value every 50 epochs. An early stopping mechanism is used to monitor the validation set loss. Training is terminated when the validation loss does not decrease for 20 consecutive epochs to prevent overfitting. Batch normalization layers and Dropout layers are used with a dropout rate of 0.3 to enhance the model's generalization ability. K-fold cross-validation is used to evaluate model stability, ensuring that the F1 score for edge detection on different data subsets is greater than 0.85. Finally, the model weights with the minimum validation set loss are selected as the pre-trained model and stored in the detection system for real-time inference.
[0088] Specifically, the boundary point sequence is an ordered set of pixel coordinates that constitute the geometric boundary of the bulge. The points in the sequence are connected sequentially in a specific direction to form a closed curve, which is used to accurately describe the outer contour shape of the bulge on the image plane. When generating the boundary point sequence, a sub-pixel level edge detection algorithm is used to track the local maxima of the feature response in the high-dimensional feature map, generating a boundary point sequence containing 20 coordinate points, namely (20,30), (25,28), (30,25)...(22,32), which form a closed loop.
[0089] Specifically, the shape parameter vector is a numerical vector calculated from the boundary point sequence through geometric fitting. Its elements represent the geometric properties of the bulge and are used to quantitatively describe the size, shape, and spatial orientation of the bulge. In this embodiment, the bulge is a local outward bulge of the battery casing caused by abnormal internal pressure. Its projected contour on the two-dimensional imaging plane is close to an ellipse or quasi-ellipse in physical morphology. Therefore, the boundary point sequence is fitted with an ellipse using least squares to obtain the shape parameter vector, with a major axis length of 30.5 pixels, a minor axis length of 18.2 pixels, a major axis direction angle of 15 degrees, center point coordinates (50, 60), an average curvature of 0.08 radians / pixel, and a boundary regularity of 0.92.
[0090] In step S15, position information is calculated based on the boundary point sequence and the shape parameter vector to obtain the center coordinates of the bulge region and the bounding box position information. The deviation degree is calculated by combining the center coordinates of the bulge region, the bounding box position information and the historical normal fluctuation template to obtain the weighted deviation degree.
[0091] It is worth noting that this step establishes a precise spatial mapping relationship between the bulge and the historical normal fluctuation template by calculating the spatial location parameters and geometric scale of the bulge, and quantifies the degree of deviation of the current bulge morphology from the normal process fluctuation benchmark, thereby transforming the qualitative description of geometric deformation into a numerical index with spatial distribution characteristics.
[0092] The center coordinates of the bulge region are two-dimensional coordinates representing the spatial position of the bulge in the image coordinate system. The centroid position is calculated by the average pixel coordinates of the boundary point sequence. The bounding box position information is determined by defining the spatial range of the bulge using the smallest bounding rectangle, and is obtained by traversing the boundary point sequence to obtain the maximum and minimum values of the horizontal and vertical coordinates. For example, in step S14, the shape parameter vector has a major axis of 30 pixels, a minor axis of 18 pixels, center coordinates (120, 150), and a major axis direction angle of 15 degrees. Therefore, when calculating the position information, it is necessary to traverse the boundary point sequence to obtain the horizontal coordinate range of 105 to 135 pixels and the vertical coordinate range of 141 to 159 pixels, determine the upper left corner (105, 141) and lower right corner (135, 159) of the smallest bounding rectangle of the bounding box, and the center coordinates of the bulge region are (120, 150).
[0093] In one implementation, the weighted deviation is calculated by combining the center coordinates of the bulge region, the bounding box position information, and the historical normal fluctuation template, including:
[0094] Based on the center coordinates of the bulge region and the bounding box position information, template matching is performed using historical normal fluctuation templates to obtain template matching region data.
[0095] The shape parameter vector is compared with the template matching region data to obtain the normal distance field distribution data.
[0096] The weighted deviation is obtained by performing a deviation-weighted accumulation operation on the normal distance field distribution data.
[0097] In this embodiment, the historical normal fluctuation template is a benchmark model established based on the statistical analysis of surface deformation data from multiple batches of qualified battery samples. It includes typical deformation ranges of the surface in different regions. Specifically, for each batch of qualified samples, the deviation field displacement vector of each region is obtained through steps S11 to S13. Then, all samples are aligned in a unified spatial coordinate system, and the mean and standard deviation of the displacement are calculated pixel-by-pixel to form a pixel-level template. Alternatively, the surface is divided into several sub-regions, and the mean and standard deviation of the displacement within each sub-region are statistically analyzed to form a region-level template. During template matching, the mean and standard deviation of the displacement within the corresponding region are extracted based on the center coordinates and bounding box position of the current bulge as the benchmark for calculating the normal distance field. The template matching region data is the region benchmark data extracted from the historical normal fluctuation template that corresponds to the spatial position and size of the current bulge, used to provide a normal deformation reference benchmark for that specific location. For example, the template matching region data corresponding to the coordinate region in the historical normal fluctuation template is extracted using the current geometric center coordinates and bounding box position information.
[0098] Furthermore, the normal distance field distribution data is a two-dimensional scalar field distribution consisting of the distance difference along the normal direction between the currently measured bulge surface and the template reference surface at each sampling point within the bulge region. Positive values indicate outward bulging exceeding the normal range, while negative values indicate inward concavity. For example, the shape parameter vector describes a bulge with a major axis of 25 and a minor axis of 15. A three-dimensional surface model is generated through fitting, and then compared with the template matching area data to calculate the distance deviation of each point in the normal direction, forming a distribution map, i.e., the normal distance field distribution data. This distribution data can intuitively reflect the degree of difference between the bulge and the normal surface; for example, the normal distance deviation at the bulge apex is 0.3, while it is 0.05 at the edge.
[0099] Specifically, the weighted deviation is a cumulative scalar value obtained by weighting and summing the absolute distance values of each sampling point in the normal distance field according to a preset spatial weighting coefficient. This comprehensively quantifies the overall severity of the bulge exceeding the normal fluctuation range. The preset spatial weighting coefficients are determined based on the engineering importance of each sampling point within the bulge region to structural safety. Here, a higher weight (0.6) is assigned to the central region of the bulge to highlight the danger of the largest bulge variation at the apex, while a lower weight (0.4) is assigned to the edge transition region to mitigate the impact of secondary deformations. The weighted deviation is obtained by multiplying the distance value by its corresponding weight and summing the results. This weighted deviation characterizes the degree to which the bulge exceeds the normal fluctuation range and, along with the center coordinates and bounding box position information, serves as input data for subsequent steps.
[0100] In step S16, spatial position weights are calculated based on the center coordinates of the bulge region and the bounding box position information to obtain spatial position sensitivity weights. Then, comprehensive anomaly quantification is performed based on the spatial position sensitivity weights and the weighted deviation to obtain a comprehensive quantification score.
[0101] It is worth noting that this step quantifies the degree of spatial deviation of the bulge from the center of the battery surface and its relative occupied area, introduces a pre-established spatial location risk weight mapping relationship, and performs location sensitivity correction and normalization quantification on the weighted deviation output of step S15. This transforms the pure geometric deformation index into a comprehensive risk assessment result with a unified dimension, and achieves comparable risk classification of defects of different locations and sizes.
[0102] In one implementation, spatial position weights are calculated based on the center coordinates of the bulge region and the bounding box position information to obtain spatial position sensitivity weights, including:
[0103] The center offset is calculated based on the center coordinates of the bulge area to obtain the center offset of the bulge.
[0104] The area percentage of the bounding box is calculated based on the bounding box position information to obtain the bounding box area percentage.
[0105] By combining a preset spatial position weight mapping matrix, weight mapping is performed based on the offset of the bulge center and the area ratio of the bounding box to obtain the spatial position sensitivity weight.
[0106] It's worth noting that the bulge center offset is the spatial distance between the geometric center of the bulge region and the standard geometric center point of the battery surface. For example, when the battery surface image resolution is 200*200, the standard geometric center is located at coordinates 100, 100. If the geometric center of a bulge is at 120 on the horizontal axis and 85 on the vertical axis, then the center offset is 20 pixels horizontally and -15 pixels vertically, resulting in a center offset of 25. To facilitate subsequent weight mapping, this center offset is normalized, i.e., the ratio of the center offset to the length of half the image diagonal is taken as the final bulge center offset.
[0107] In this embodiment, the bounding box area ratio is the ratio of the pixel area covered by the bounding box of the bulge to the total pixel area of the detection area on the battery surface. For example, the battery surface image resolution is 200*200 pixels, and the total detection area is 40,000 pixels; if the bounding box position information has a horizontal span of 30 pixels and a vertical span of 25 pixels, the area is 750 pixel units, and the area ratio is 750 / 40000 = 0.01875.
[0108] Furthermore, the spatial location weight mapping matrix is a two-dimensional lookup table. It uses the bulge center offset and area ratio as independent variables, and is established based on the battery's structural mechanical characteristics and historical failure data statistics to map spatial location to risk level. Specifically, when constructing the spatial location weight mapping matrix, it is necessary to process historical failure samples and normal operation samples from multiple batches of batteries, and statistically analyze the failure frequency under different combinations of spatial location and area. Then, based on the battery casing mechanical model analysis, the surface is divided into a low-risk central area, a transition area, and a high-risk edge area (including electrode connections). Subsequently, the bulge center offset and area ratio are divided into discrete intervals to establish a two-dimensional grid. Based on the failure frequency and stress concentration coefficient, each grid cell is assigned a risk weight value; for example, the central area is set to a baseline value of 1.0, and the edge and electrode areas are set to a magnified value of 1.2-1.8. Finally, bilinear interpolation is performed on the grid node weights to form a continuous two-dimensional mapping surface, or it can be retained as a piecewise linear two-dimensional lookup table. For example, the normalized value of the bulge center offset is divided into five intervals: [0, 0.2), [0.2, 0.4), [0.4, 0.6), [0.6, 0.8), and [0.8, 1.0]. The area proportion is divided into five intervals: [0, 0.01), [0.01, 0.03), [0.03, 0.05), [0.05, 0.1), and [0.1, 1.0]. This forms a 5×5 two-dimensional grid. Based on failure statistics, each grid node is assigned a weight: regions with small offsets and small area proportions have a weight of 0.8~1.0; regions with large offsets and large area proportions have a weight of 1.5~2.0; and intermediate regions are linearly interpolated. For any input center offset and area proportion, the grid in which it belongs is first determined, and then the weights of the four vertices are bilinearly interpolated to obtain the final spatial position sensitivity weight.
[0109] For example, the spatial location sensitivity corresponds to a lower spatial location sensitivity in the central region of the spatial location weight mapping matrix, while the spatial location sensitivity is higher near the edge or electrode connection area. For instance, when the offset is small and the area proportion is low, the spatial location sensitivity weight may be 0.8; if the offset is large and the area proportion exceeds 0.05, the spatial location sensitivity weight can reach 1.4; this weight design reflects the difference in the impact of different spatial locations on overall safety.
[0110] In one implementation, a comprehensive anomaly quantification is performed based on the spatial location sensitivity weight and the weighted deviation to obtain a comprehensive quantification score, including:
[0111] The weighted deviation is calculated by performing a weighted product operation on the weighted deviation based on the spatial location sensitivity weight to obtain the corrected deviation intensity;
[0112] The corrected deviation intensity is normalized and mapped to obtain the comprehensive quantitative score.
[0113] It is worth noting that the corrected deviation strength is an intermediate result of the weighted deviation degree after being weighted by the spatial location sensitivity weight, and is used to characterize the deformation anomaly strength after adjustment by the location risk coefficient. For example, if the weighted deviation degree output in step S15 is 0.22 and the spatial location sensitivity weight is 1.5, then the corrected deviation strength is calculated as 0.22 * 1.5 = 0.33. This correction process makes the deviation assessment pay more attention to location factors and avoids relying solely on the deformation amplitude while ignoring the importance of location.
[0114] Furthermore, the comprehensive quantitative score is the final dimensionless score after normalizing the corrected deviation intensity value to a unified interval of 0-1. A higher score indicates a greater overall anomaly risk, directly supporting classification decisions or trend analysis. In this embodiment, the normalization mapping process involves collecting the distribution of corrected deviation intensity values from historical samples, determining the maximum and minimum values as the upper and lower bounds of the mapping interval, and using a linear transformation to map the actual calculated value to the 0-1 interval. For example, comparing historical sample statistics, the maximum corrected deviation intensity value is 0.65, and the minimum is 0.10. After linear normalization, the comprehensive quantitative score is (0.33-0.10) / (0.65-0.10)=0.42. This score integrates multi-dimensional information such as deformation deviation, spatial offset, and occupied area, and can more accurately reflect the overall severity of the bulge anomaly.
[0115] In step S17, based on the comprehensive quantitative score and combined with the pre-established deformation trend state model, quantitative classification is performed to obtain the abnormal state classification label of the current batch of batteries, including:
[0116] An evolution sequence is constructed based on the comprehensive quantitative score to obtain the score evolution sequence;
[0117] Extract the deformation acceleration features of the scoring evolution sequence;
[0118] The parameters of the pre-established deformation trend state model are corrected based on the deformation acceleration characteristics to obtain the updated second deformation trend state model.
[0119] The abnormal state classification label is obtained by making a decision based on the second deformation trend state model.
[0120] It is worth noting that this step, by tracking the historical score evolution trajectory of the same battery individual over multiple testing cycles, extracts dynamic features reflecting the acceleration of deformation deterioration to correct the trend prediction model. It integrates the current state with predictive evolution risk as the basis for classification decisions, thereby achieving dynamic grading and forward-looking risk assessment of abnormal battery states. Specifically, the score evolution sequence is a historical comprehensive quantitative score data sequence of the same battery individual arranged in chronological order of testing time. The sequence includes discrete time node markers and corresponding score values at each time point. For example, for a certain battery, from day 30 to day 180 of operation, a total of 6 valid scores were collected. The score evolution sequence can be represented as the correspondence between time points and scores: day 30 0.18, day 60 0.21, day 90 0.29, day 120 0.42, day 150 0.58, and day 180 0.71.
[0121] Furthermore, when extracting deformation acceleration features based on the score evolution sequence, the focus is mainly on the changing trend of the numerical growth slope. The deformation acceleration feature is a feature quantity obtained by calculating the second time derivative of the score evolution sequence, used to quantitatively characterize the changing trend of the rate of deformation deterioration on the battery surface.
[0122] In this embodiment, the deformation trend state model is a predictive model that describes the evolution of the comprehensive quantitative score with usage time or detection batches in the form of a mathematical function. It typically employs an exponential growth model and includes baseline rate and acceleration parameters. The second deformation trend state model is an updated trend prediction model after parameter correction based on the deformation acceleration feature. Specifically, the model structure is as follows:
[0123]
[0124] Where S(t) is the predicted value of the comprehensive quantitative score at time t; is the initial scoring baseline value; k is the baseline growth rate parameter; a is the acceleration parameter; it should be noted that these initial parameters are obtained using least squares nonlinear regression.
[0125] In one example, when updating model parameters, the second derivative of the current score evolution sequence is calculated as the deformation acceleration feature. When the acceleration feature is significantly positive, the acceleration parameter 'a' is increased according to a preset adjustment coefficient. When the acceleration feature is negative, the acceleration parameter is decreased according to the preset adjustment coefficient. Alternatively, a moving average method is used to smooth the recent acceleration feature and feed it back to the model parameters, resulting in an updated second deformation trend state model, which is used to extrapolate the predicted score value for future time windows. The preset adjustment coefficient is a fixed percentage (e.g., 0.6) used to calculate the change ratio of the new acceleration parameter relative to the original parameter. This coefficient is determined based on the balance between model convergence stability and response sensitivity, and the statistical distribution of acceleration features under normal process fluctuations in historical samples.
[0126] For example, the initial deformation trend state model is set as S(t) = 0.15 * exp(0.002 * t), where the baseline rate k = 0.002 / day, and the initial acceleration parameter a = 0 (simplified to a pure exponential model). For example, based on the detection data of a battery from day 150 to day 180, the deformation acceleration characteristic is calculated to be 0.0045. According to the preset update rule, the acceleration parameter a is adjusted from 0 to 0.0027, i.e., the growth rate increases by 60%, resulting in the second deformation trend state model S'(t) = 0.15 * exp(0.002 * t + 0.0027 * t). ).
[0127] Specifically, the abnormal state classification label is a classification identifier that comprehensively reflects the current severity level of the battery's abnormality and its recent deterioration trend. This includes, but is not limited to, discrete categories such as low-risk stable, medium-risk slowly developing, and high-risk rapidly deteriorating, used to guide subsequent maintenance decisions. For example, based on the updated second deformation trend state model, the predicted peak score for the next 30 days, i.e., day 210, is 0.89. The current score of 0.71, the predicted peak score of 0.89, and the acceleration feature of 0.0014 are input into a classification decision tree. The first split node of this decision tree is when the current score > 0.7 (satisfied), the second split node is when the acceleration feature > 0.001 (satisfied), and the third split node is when the predicted peak score > 0.85 (satisfied). The final mapping output is the abnormal state classification label: high-risk rapidly deteriorating.
[0128] The construction of the classification decision tree requires collecting historical test data from multiple batches of batteries, including input parameters such as current comprehensive score, deformation acceleration features, and predicted peak values. Based on actual failure consequences or maintenance records, corresponding risk level labels are added, such as low-risk and stable, high-risk and rapidly deteriorating, forming a training dataset. Then, decision tree algorithms such as CART classification and regression trees, ID3, or C4.5 are used, with information gain, Gini impurity, or information gain ratio as splitting criteria. The optimal features and thresholds are recursively selected for node splitting to construct a tree structure. Subsequently, pruning is performed to prevent overfitting and optimize the tree's generalization ability. Finally, the classification accuracy of the model on the test set is verified, and the decision tree model that meets the performance indicators is stored in the detection system for real-time classification decisions.
[0129] It should be noted that if the current battery is being tested for the first time or there is no historical scoring sequence, an evolution sequence cannot be constructed. In this case, the trend model correction is skipped, and the battery is directly classified based on the current comprehensive quantitative score and the preset threshold. The current score record is then used as the starting point of the initial sequence for the battery.
[0130] In summary, this invention discloses a machine vision-based method for inspecting the appearance of a battery, comprising: acquiring an original image of the battery's appearance; performing preliminary processing on the original image to obtain a textured image; extracting the overall contour region of the textured image to obtain a basic contour region corresponding to the inherent characteristics of each individual battery; performing rigidity matching calculation based on the basic contour region and a preset standard geometric template to obtain a rigidity transformation matrix; calculating the deformation deviation field gradient intensity based on the rigidity transformation matrix and the basic contour region to obtain the deviation field gradient intensity of each surface region; selecting abnormal deformation candidate regions based on the deviation field gradient intensity to obtain abnormal deformation candidate regions; extracting the boundary point sequence of the abnormal deformation candidate regions; and performing a method based on the boundary point sequence... A shape parameter vector is generated to obtain the boundary point sequence and shape parameter vector of the bulge under abnormal conditions. Position information is calculated based on the boundary point sequence and the shape parameter vector to obtain the center coordinates and bounding box position information of the bulge region. The deviation degree is calculated by combining the center coordinates of the bulge region, the bounding box position information, and the historical normal fluctuation template to obtain a weighted deviation degree. Spatial position weights are calculated based on the center coordinates of the bulge region and the bounding box position information to obtain spatial position sensitivity weights. Comprehensive anomaly quantification is performed based on the spatial position sensitivity weights and the weighted deviation degree to obtain a comprehensive quantification score. Based on the comprehensive quantification score, a pre-established deformation trend state model is used for quantification classification to obtain the abnormal state classification label for the current batch of batteries. This invention obtains a textured image by performing preliminary processing on the original appearance image. Then, it calculates the gradient intensity of the deviation field using a pre-set standard geometric template for rigid matching. The preliminary processing, such as illumination normalization and noise filtering, eliminates image interference caused by differences in lighting, shooting angle, and surface material. Rigid matching, based on a standard contour, filters out the inherent morphological differences of individual batteries, accurately extracting true surface deformation information. This solves the problem of unstable detection results due to environmental factors in existing technologies, improving image anti-interference capabilities and accurately capturing surface deformation features. Furthermore, this invention extracts geometric boundary features from candidate abnormal deformation areas and calculates a weighted average using a historical normal fluctuation template. The deviation degree, a historical normal fluctuation template, includes the deformation range of the battery under normal operating conditions. The weighted deviation degree can quantify the degree of difference between the bulge morphology and normal deformation, effectively distinguishing between bulges caused by production defects and normal deformation, and achieving accurate identification of real defects on the battery surface. This invention uses spatial location sensitivity weight and weighted deviation degree to perform comprehensive anomaly quantification, and combines it with the deformation trend state model to obtain anomaly state classification labels. Because the spatial location weight can reflect the difference in the impact of bulges in different areas on battery safety, such as the higher risk of bulges near terminals, the deformation trend model achieves batch-based accurate classification based on historical data, improving the accuracy of defect assessment and the stability of batch detection.
[0131] Reference Figure 2 The second embodiment of the present invention provides a battery appearance inspection system based on machine vision, comprising:
[0132] The image preliminary processing module is used to acquire the original appearance image of the battery and perform preliminary processing on the original appearance image to obtain an image with clear texture;
[0133] The basic contour extraction module is used to extract the overall contour region for the image with clear texture, and obtain the basic contour region corresponding to the inherent characteristics of the individual.
[0134] The deformation deviation calculation module is used to perform rigid matching calculation based on the basic contour region and a preset standard geometric template to obtain a rigid transformation matrix, and to calculate the deformation deviation field gradient intensity based on the rigid transformation matrix and the basic contour region to obtain the deviation field gradient intensity of each region of the surface.
[0135] The candidate region selection module is used to select abnormal deformation candidate regions based on the gradient intensity of the deviation field, obtain abnormal deformation candidate regions, extract the boundary point sequence of the abnormal deformation candidate regions, generate a shape parameter vector based on the boundary point sequence, and obtain the boundary point sequence and shape parameter vector of the bulge under abnormal conditions.
[0136] The deviation calculation module is used to calculate the position information based on the boundary point sequence and the shape parameter vector to obtain the center coordinates of the bulge region and the bounding box position information, and to calculate the deviation degree by combining the center coordinates of the bulge region, the bounding box position information and the historical normal fluctuation template to obtain the weighted deviation degree.
[0137] The comprehensive anomaly quantification module is used to calculate the spatial position weight based on the center coordinates of the bulge region and the bounding box position information to obtain the spatial position sensitivity weight, and to perform comprehensive anomaly quantification based on the spatial position sensitivity weight and the weighted deviation to obtain a comprehensive quantification score.
[0138] The abnormal state classification module is used to perform quantitative classification based on the comprehensive quantitative score and the pre-established deformation trend state model to obtain the abnormal state classification label of the current batch of batteries.
[0139] It should be noted that the battery appearance inspection system based on machine vision provided in this embodiment of the invention is used to execute all the process steps of the battery appearance inspection method based on machine vision in the above embodiment. The working principle and beneficial effects of the two are one-to-one, so they will not be described again.
[0140] It should be noted that the system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the system embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0141] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.
Claims
1. A method for inspecting the appearance of a storage battery based on machine vision, characterized in that, include: Obtain the original image of the battery's appearance, and perform preliminary processing on the original image to obtain an image with clear texture; For the image with clear texture, the overall contour region is extracted to obtain the basic contour region corresponding to the inherent characteristics of each individual. Based on the basic contour region, rigid matching calculation is performed in conjunction with a preset standard geometric template to obtain a rigid transformation matrix. Then, based on the rigid transformation matrix and the basic contour region, the deformation deviation field gradient intensity is calculated to obtain the deviation field gradient intensity of each region of the surface. Based on the gradient intensity of the deviation field, candidate regions for abnormal deformation are selected to obtain candidate regions for abnormal deformation. The boundary point sequence of the candidate regions for abnormal deformation is extracted, and a shape parameter vector is generated based on the boundary point sequence to obtain the boundary point sequence and shape parameter vector of the bulge under abnormal conditions. The position information is calculated based on the boundary point sequence and the shape parameter vector to obtain the center coordinates of the bulge region and the position information of the bounding box. The deviation degree is calculated by combining the center coordinates of the bulge region and the position information of the bounding box with the historical normal fluctuation template to obtain the weighted deviation degree. Spatial position weights are calculated based on the center coordinates of the bulge area and the bounding box position information to obtain spatial position sensitivity weights. Comprehensive anomaly quantification is then performed based on the spatial position sensitivity weights and the weighted deviation to obtain a comprehensive quantitative score. Based on the comprehensive quantitative score, combined with the pre-established deformation trend state model, quantitative classification is performed to obtain the abnormal state classification label of the current batch of batteries.
2. The battery appearance inspection method based on machine vision according to claim 1, characterized in that, The process involves preliminary processing of the original appearance image to obtain a textured image, including: The original appearance image is subjected to brightness equalization processing to obtain a brightness equalization image; Layer separation is performed on the brightness-equalized image to obtain the base layer image and the high-frequency difference map; The pixel gradient magnitude is calculated based on the high-frequency difference map. If the pixel gradient magnitude is greater than a preset magnitude threshold, texture reconstruction is performed in combination with the base layer image to obtain a texture reconstruction image. The texture reconstruction image is enhanced with contrast based on dynamic range mapping to obtain a textured image with enhanced surface texture details.
3. The battery appearance inspection method based on machine vision according to claim 1, characterized in that, The step of extracting the overall contour region of the image with clear texture to obtain the basic contour region corresponding to the inherent characteristics of each individual includes: Calculate the edge gradient intensity of the textured image to obtain the edge distribution features; Extract the region statistical features of the image with clear texture; A conditional random field probabilistic graphical model is constructed based on the edge distribution characteristics and the regional statistical characteristics to obtain a probabilistic graphical model. Pixel category classification is then performed based on the probabilistic graphical model to obtain pixel category labels. Based on the pixel category labels, the regions are classified to obtain a preliminary contour mask; A morphological closing operation is performed on the preliminary contour mask to obtain the basic contour region.
4. The battery appearance inspection method based on machine vision according to claim 1, characterized in that, The deformation deviation field gradient intensity is calculated based on the rigid transformation matrix and the basic contour region to obtain the deviation field gradient intensity of each region of the surface, including: By combining the rigid transformation matrix and the basic contour region, a coordinate difference operation is performed to obtain a set of displacement vectors; The local gradient intensity is calculated based on the set of displacement vectors to obtain the local gradient intensity. Spatial location aggregation is performed based on the local gradient intensity to obtain the gradient intensity distribution.
5. The battery appearance inspection method based on machine vision according to claim 1, characterized in that, The process involves extracting the boundary point sequence of the candidate abnormal deformation region, generating a shape parameter vector based on the boundary point sequence, and obtaining the boundary point sequence and shape parameter vector of the bulge under abnormal conditions, including: Based on the abnormal deformation candidate regions, feature extraction is performed using a pre-established convolutional feature extraction network to obtain a high-dimensional feature map. The boundary point sequence of the bulge is obtained by generating a boundary point sequence based on the high-dimensional feature map. Geometric fitting is performed on the boundary point sequence to obtain the shape parameter vector that characterizes the specific morphological attributes of the bulge.
6. The battery appearance inspection method based on machine vision according to claim 1, characterized in that, The weighted deviation is calculated by combining the center coordinates of the bulge region, the bounding box position information, and the historical normal fluctuation template, including: Based on the center coordinates of the bulge region and the bounding box position information, template matching is performed using historical normal fluctuation templates to obtain template matching region data. The shape parameter vector is compared with the template matching region data to obtain the normal distance field distribution data. The weighted deviation is obtained by performing a deviation-weighted accumulation operation on the normal distance field distribution data.
7. The battery appearance inspection method based on machine vision according to claim 1, characterized in that, The step of calculating spatial positional sensitivity weights based on the center coordinates of the bulge region and the bounding box position information includes: The center offset is calculated based on the center coordinates of the bulge area to obtain the center offset of the bulge. The area percentage of the bounding box is calculated based on the bounding box position information to obtain the bounding box area percentage. By combining a preset spatial position weight mapping matrix, weight mapping is performed based on the offset of the bulge center and the area ratio of the bounding box to obtain the spatial position sensitivity weight.
8. The battery appearance inspection method based on machine vision according to claim 1, characterized in that, The process involves performing comprehensive anomaly quantification based on the spatial location sensitivity weight and the weighted deviation to obtain a comprehensive quantification score, including: The weighted deviation is calculated by performing a weighted product operation on the weighted deviation based on the spatial location sensitivity weight to obtain the corrected deviation intensity; The corrected deviation intensity is normalized and mapped to obtain the comprehensive quantitative score.
9. The battery appearance inspection method based on machine vision according to claim 1, characterized in that, The abnormal state classification labels for the current batch of batteries are obtained by combining the comprehensive quantitative score with a pre-established deformation trend state model for quantitative classification, including: An evolution sequence is constructed based on the comprehensive quantitative score to obtain the score evolution sequence; Extract the deformation acceleration features of the scoring evolution sequence; The parameters of the pre-established deformation trend state model are corrected based on the deformation acceleration characteristics to obtain the updated second deformation trend state model. The abnormal state classification label is obtained by making a decision based on the second deformation trend state model.
10. A battery appearance inspection system based on machine vision, characterized in that, include: The image preliminary processing module is used to acquire the original appearance image of the battery and perform preliminary processing on the original appearance image to obtain an image with clear texture; The basic contour extraction module is used to extract the overall contour region for the image with clear texture, and obtain the basic contour region corresponding to the inherent characteristics of the individual. The deformation deviation calculation module is used to perform rigid matching calculation based on the basic contour region and a preset standard geometric template to obtain a rigid transformation matrix, and to calculate the deformation deviation field gradient intensity based on the rigid transformation matrix and the basic contour region to obtain the deviation field gradient intensity of each region of the surface. The candidate region selection module is used to select abnormal deformation candidate regions based on the gradient intensity of the deviation field, obtain abnormal deformation candidate regions, extract the boundary point sequence of the abnormal deformation candidate regions, generate a shape parameter vector based on the boundary point sequence, and obtain the boundary point sequence and shape parameter vector of the bulge under abnormal conditions. The deviation calculation module is used to calculate the position information based on the boundary point sequence and the shape parameter vector to obtain the center coordinates of the bulge region and the bounding box position information, and to calculate the deviation degree by combining the center coordinates of the bulge region, the bounding box position information and the historical normal fluctuation template to obtain the weighted deviation degree. The comprehensive anomaly quantification module is used to calculate the spatial position weight based on the center coordinates of the bulge region and the bounding box position information to obtain the spatial position sensitivity weight, and to perform comprehensive anomaly quantification based on the spatial position sensitivity weight and the weighted deviation to obtain a comprehensive quantification score. The abnormal state classification module is used to perform quantitative classification based on the comprehensive quantitative score and the pre-established deformation trend state model to obtain the abnormal state classification label of the current batch of batteries.
