A 3D optical profile detection method for lithium battery sealing nails
By combining a spectral confocal sensor and a deep learning model, three-dimensional contour detection of lithium battery sealing nails was achieved, solving the stability and transferability problems of 2D detection systems under equipment vibration and light source aging, and improving detection accuracy and defect detection rate.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHANGZHOU REECHI PRECISION MEASURETECH CO LTD
- Filing Date
- 2026-03-09
- Publication Date
- 2026-06-02
AI Technical Summary
Existing 2D inspection systems require frequent parameter adjustments and repeated calibrations when there is equipment vibration, focal length shift, light source aging, or changes in workpiece surface color. It is difficult to maintain consistent inspection accuracy over a long period of time when replicating across entire production lines, multiple machines, or across production lines, and it is also difficult to reliably distinguish minute weld defects.
A spectral confocal sensor is used to acquire grayscale and height maps of the sealing nail region. Instance segmentation is performed using a deep learning-based dfine model. Combined with pixel-level masks and global height maps, the three-dimensional contour reconstruction and defect detection of the sealing nail weld are realized.
It improves the detection rate of sealing nail defects, can quantify various defects in three-dimensional space, enhances the stability and transferability of detection, and improves detection accuracy.
Smart Images

Figure CN122134702A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of battery testing technology, and more specifically, to a method for detecting the 3D optical contour of a lithium battery sealing nail. Background Technology
[0002] After the electrolyte is injected into the battery cell, the injection hole needs to be sealed with a sealing pin to ensure complete isolation between the inside of the cell and the external environment. A typical process is as follows: cell casing → pre-drilled injection hole on the casing → electrolyte injection → insertion of rubber stopper or plug → placement of sealing pin in the receiving groove of the casing cover plate → laser or resistance welding to form a circumferential weld, thus sealing the casing.
[0003] In actual production, due to factors such as residual electrolyte, electrolyte crystallization, welding energy fluctuations, tooling precision, and surface cleanliness, sealing nail welds are prone to various defects, including weld beads, spalls, incomplete welds, pinholes, cracks, weld misalignment, and discolored electrolyte residue. These defects can lead to electrolyte leakage, capacity decay, bulging, and even fire, significantly impacting battery safety and lifespan. Therefore, sealing nail welds typically require 100% online inspection.
[0004] The sealing nail body and weld are mostly made of highly reflective metal materials. The weld width is narrow, the weld height varies, and the crack depth is often on the order of micrometers. Locally, there may also be crystals or stains formed by electrolyte residue. This combination of "narrow weld + mirror metal + micro-defects" makes it difficult for traditional 2D imaging methods to reliably distinguish between slight surface textures and real three-dimensional defects such as cracks and pits, under problems such as brightness saturation, reflective glare, and shadow occlusion. Summary of the Invention
[0005] The technical problem to be solved by this invention is that 2D inspection systems require frequent parameter adjustments and repeated calibrations when there is equipment vibration, focal length shift, light source aging, or changes in workpiece surface color. Their stability and portability are limited, making it difficult to maintain consistent inspection accuracy over a long period when replicating across entire production lines, multiple machines, or across production lines. Therefore, this invention provides a 3D optical contour inspection method for lithium battery sealing nails, which can reconstruct the three-dimensional contour or height map of the weld seam for more accurate analysis of weld width, height, pits, and weld beads.
[0006] The technical solution adopted by this invention to solve its technical problem is: A method for detecting the 3D optical contour of a lithium battery sealing nail includes the following steps: A1: Acquire multiple frames of grayscale images and height maps of the sealing nail area; A2: Perform stitching on multiple frames of images and anisotropic scaling on the stitched images according to the physical pixel spacing to establish a global grayscale image and a global height image with a proportional relationship consistent with the physical coordinate system. A3: Input the global grayscale image and global height image into the deep learning-based dfine model for instance segmentation, and output the category, location and pixel-level mask of various defects in the welding area; A4: Combining pixel-level masks and global height maps, perform nail warping detection, welding trajectory offset detection, and defect geometry and depth feature extraction, and determine the pass / fail status of the sealing nails based on preset thresholds. Preferably, in step A2, the specific implementation of anisotropic scaling includes: Calculate scaling factors Kx and Ky based on the physical pixel spacing in the X and Y directions, and perform interpolation scaling on the global grayscale image and global height image by scaling Kx in the X direction and Ky in the Y direction respectively to eliminate geometric distortion caused by inconsistent sampling spacing.
[0007] Preferably, in step A3, the dfine model includes: The feature extraction backbone network performs multi-layer convolution and downsampling on the input grayscale image and height image to extract multi-scale features; The grayscale image and height map feature fusion module enables the fusion of multimodal features; The multi-scale feature fusion module constructs a multi-scale feature map from coarse to fine through upsampling and lateral connections; The detection head outputs the target bounding box regression results and class probabilities on the feature maps of each layer, which are used to detect cracks, weld beads, weld spatters, and weld deviations. The segmentation head generates corresponding pixel-level defect masks based on the target bounding boxes output by the detection head; The model training process uses a sample set with bounding boxes and pixel-level mask annotations. The loss function is a weighted sum of classification loss, bounding box regression loss, and segmentation mask loss. The network parameters are optimized through backpropagation, and data augmentation is used to improve robustness. Preferably, the nail detection in step A4 includes: The area of the battery's metal casing surrounding the sealing nail was selected as the reference area. Invalid values are masked based on the effective height region. The least squares method is used to fit the plane equation Z=aX+bY+c to the effective height points within the reference area; Calculate the vertical distance from each effective height point within the sealing nail welding area to the reference plane, generate a warping height mapping, and extract the maximum warping height and abnormal areas exceeding a set threshold as the basis for judgment. Preferably, the welding trajectory offset detection in step A4 includes: Using a template matching algorithm, pit regions are identified in a grayscale image, and the coordinates of the pit center (C) are obtained. pit,x C pit,y); Fit the outer contour of the weld bead to obtain the coordinates of the center of the weld bead trajectory circle (C). weld,x C weld,y ); Convert pixel coordinates to physical coordinates and calculate the offset ΔX=(C weld,x - Cpit,x )×X pitch ΔY=( Cweld,y - C pit,y )×Y pitch ; Calculate the offset distance D offset = And determine whether it exceeds the preset threshold. Preferably, the effective height region extraction in step A2 includes: Based on the measurement parameters, set the minimum depth (MinDepth) and maximum depth (MaxDepth) thresholds, perform initial threshold segmentation on the height map, and obtain the initial effective area. Identify pixel regions in the height map that are equal to outliers and merge them into an outlier region mask; The final effective depth region mask is generated by subtracting the abnormal region mask from the rectangular region of the entire image and intersecting it with the initial effective region. Within the effective mask area, the global minimum and maximum depth values of the height map are statistically analyzed and used as a reference benchmark for depth feature analysis. Preferably, step A1 further includes: When acquiring multiple frames of images, the two-dimensional or three-dimensional displacement parameters of each frame relative to the workpiece coordinate system are recorded for coordinate alignment during subsequent image stitching. Preferably, in step A3, the network structure and weights are fixed during the deployment phase of the dfine model, and the classification threshold and post-processing feature algorithm parameters are adjusted through an external configuration file.
[0008] Preferably, in step A1, a spectral confocal sensor is used to acquire multiple frames of grayscale images and height maps of the sealing nail area.
[0009] The beneficial effects of this invention are: using a spectral confocal sensor to obtain the height map of the sealing nail area, using pixel physical spacing for anisotropic scaling, unifying the stitched height map to a physical scale coordinate system, and using a deep learning instance segmentation model to perform defect detection on the sealing nail weld, outputting a pixel-level mask, thereby improving the defect detection rate of the sealing nail and enabling the quantification of various defects at a three-dimensional spatial scale. Attached Figure Description
[0010] Figure 1 This is a schematic diagram of the lithium battery detection location; Figure 2This is an image of the sealing nail. Figure 3 A schematic diagram of the point cloud image of the sealing nail; Figure 4 This is a schematic diagram of the principle of spectral confocalization. Detailed Implementation
[0011] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0012] It should be noted that, unless otherwise specified, all technical and scientific terms used in this application have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.
[0013] In this invention, unless otherwise stated, the directional terms such as "up" and "down" generally refer to the directions shown in the accompanying drawings, or to the vertical, perpendicular, or gravitational direction; similarly, for ease of understanding and description, "left" and "right" generally refer to the left and right shown in the accompanying drawings; "inner" and "outer" refer to the inner and outer contours of each component itself, but the above directional terms are not intended to limit this invention.
[0014] The main characteristics and limitations of technologies based on 2D optical microscopy or 2D machine vision AOI systems are as follows: Imaging is essentially a two-dimensional grayscale / color projection, which can only reflect the brightness, texture, and contour information of the weld surface. It cannot directly obtain the true three-dimensional geometric parameters of the weld, such as its height and depth. Therefore, it is difficult to quantitatively characterize defects such as "shallow but dangerous microcracks, porosity, and weld penetration depth".
[0015] Sealing nail welds are mostly narrow annular welds with mirror-like reflective surfaces. Electrolyte or crystals may also remain in some areas, causing high-saturation highlights, shadows in dark areas, and localized reflective spots in the image. Traditional rule-based algorithms based on thresholds and edges are prone to missed detections and false detections. Even when using 2D deep learning segmentation or defect classification, the judgment basis is still two-dimensional texture features, and the sensitivity to crack-like defects that are "not visible in brightness but have obvious abrupt changes in height" is still limited.
[0016] 2D systems require frequent parameter adjustments and repeated calibrations when there is equipment vibration, focal length shift, light source aging, or changes in workpiece surface color. Their stability and portability are limited, making it difficult to maintain consistent detection accuracy over a long period when replicating across entire production lines, multiple machines, or across production lines.
[0017] The main characteristics and limitations of technologies based on 2D optical microscopy or 2D machine vision AOI systems are as follows: Imaging is essentially a two-dimensional grayscale / color projection, which can only reflect the brightness, texture, and contour information of the weld surface. It cannot directly obtain the true three-dimensional geometric parameters of the weld, such as its height and depth. Therefore, it is difficult to quantitatively characterize defects such as "shallow but dangerous microcracks, porosity, and weld penetration depth".
[0018] Sealing nail welds are mostly narrow annular welds with mirror-like reflective surfaces. Electrolyte or crystals may also remain in some areas, causing high-saturation highlights, shadows in dark areas, and localized reflective spots in the image. Traditional rule-based algorithms based on thresholds and edges are prone to missed detections and false detections. Even when using 2D deep learning segmentation or defect classification, the judgment basis is still two-dimensional texture features, and the sensitivity to crack-like defects that are "not visible in brightness but have obvious abrupt changes in height" is still limited.
[0019] 2D systems require frequent parameter adjustments and repeated calibrations when there is equipment vibration, focal length shift, light source aging, or changes in workpiece surface color. Their stability and portability are limited, making it difficult to maintain consistent detection accuracy over a long period when replicating across entire production lines, multiple machines, or across production lines.
[0020] To overcome the limitations of pure 2D vision in providing height information, spectral confocal 3D vision technology has been introduced into the inspection of power battery welds. This is a type of optical sensor that utilizes the principle of chromatic aberration to achieve non-contact, high-precision 3D measurement. Its basic principle is as follows: using multi-wavelength white light or a broadband light source, after passing through a confocal objective lens with chromatic aberration characteristics, different wavelengths form focal points at different axial positions. When the measured surface is at a specific focal point, only light of that wavelength is clearly focused and returns through a pinhole and a spectrometer. Based on the center wavelength of the reflected light, the absolute distance to the measured point can be calculated, reconstructing the 3D contour or height map of the weld, which is used to analyze weld width, height, pits, and weld beads.
[0021] The lithium battery sealing nail 3D inspection system of the present invention mainly consists of the following components: 1.1 Three-dimensional acquisition section: including a spectral confocal sensor and a two-dimensional / three-dimensional motion platform for driving the battery to move within the sensor's field of view, used to acquire grayscale images and corresponding height maps (depth maps) of the sealing nail area. 1.2 Data Acquisition and Preprocessing Module: This module acquires, corrects, and stitches together multiple local grayscale and height maps output by the spectral confocal sensor to form a full-width grayscale and height map covering the entire sealing nail area. 1.3 Instance Segmentation and Detection Module: Based on the deep learning-based dfine model, it performs instance segmentation on the preprocessed image and outputs the category, location, and pixel-level mask of each defect and key structure (weld bead, pit, outer circle, etc.). 1.4 Feature Calculation and Judgment Module: The output results of the instance segmentation and detection module are further analyzed in combination with the three-dimensional height information to complete the calculation of geometric and depth features of the knocking nail detection (flatness / knob height), welding trajectory offset detection, and various defects (cracks, pores, etc.), thereby giving the OK / NG judgment for each sealing nail.
[0022] The overall workflow of a 3D inspection system includes the following steps: A1: Multiple grayscale images and corresponding height images of the sealing nail area were acquired using a spectral confocal sensor; A2: Stitch, scale, and extract the effective height region from multiple images to obtain a global grayscale image, a height map, and an effective region mask; A3: Input the grayscale image and height image into the instance segmentation model to obtain the segmentation results of weld beads, pits and various defects; A4: Select the corresponding feature algorithm for various types of defects and features according to the configuration, and complete the detection of knocked nails, calculation of weld trajectory offset, and extraction of defect geometric / depth features; A5: Compare the above features with the set thresholds to determine the pass / fail status of the sealing nails and output a test report.
[0023] 3D data acquisition and preprocessing Specific methods for image acquisition and stitching: Because the field of view of a single-frame spectral confocal sensor is limited, this invention performs multiple scans on the same sealing nail area to obtain multiple local grayscale images and height maps, and records the offset of each image relative to the workpiece coordinate system. Based on the offset, the multiple grayscale images and height maps are stitched together in a unified coordinate system to obtain a global grayscale image and a global height map.
[0024] To eliminate the impact of inconsistent sampling intervals in the X and Y directions on geometric accuracy, this invention calculates the scaling ratio based on the physical pixel spacing and performs anisotropic scaling on the stitched image, ensuring that the image coordinates and physical coordinates maintain a consistent proportional relationship in the X and Y directions, thus providing a basis for subsequent physical quantization of length, area, and offset.
[0025] Effective height region extraction To eliminate the interference of invalid values (such as sensor out-of-bounds, reflection saturation, no measurement area, etc.) on 3D analysis, this invention performs threshold segmentation on the height map to obtain effective depth region masks and abnormal region masks.
[0026] The specific steps include: S1: Based on the MinDepth and MaxDepth parameters in the measurement, the height map is segmented by threshold to obtain the initial effective area; S2: Through multiple thresholding operations, pixels with height values equal to special outliers are marked as irregular regions, and these regions are merged into an outlier region mask. S3: Subtract the out-of-area mask from the rectangular whole image area to obtain the effective area after excluding out-of-area points, and find the intersection with the initial effective area to finally form a stable effective depth region mask; S4: Under the effective mask, calculate the global minimum and maximum values of the entire height map, which will serve as the global depth reference for subsequent feature algorithms; Instance segmentation model technical details Overall Model Structure: The dfine model used in this invention is an instance segmentation model built on the basis of existing object detection networks by adding a segmentation head. It combines the input grayscale image with height... Figure 1 The data is fed into the network in one go, and the network outputs the category and segmentation mask for each detected object. The overall network structure includes: 1) Feature extraction backbone network: Perform multi-layer convolution and downsampling on the input grayscale image of the sealing nail (optionally fused with height map or its encoded features) to extract texture and structural features at different scales.
[0027] 2) Feature Fusion / Multi-Scale Feature Pyramid Module: Upsamples and connects features at different levels to construct a multi-scale feature map from coarse to fine, enabling the model to perceive both the overall weld morphology and details such as minute cracks.
[0028] 3) Detection head: Outputs the target bounding box regression results and the corresponding class probability on each layer of feature map, which is used to detect macroscopic structures such as sealing nail cracks, weld beads, weld explosions, and weld deviations.
[0029] 4) Segmentation Head: Utilizes the pixel-level defect mask corresponding to the target box output by the mask branch output detection head to achieve instance segmentation of defects.
[0030] Model training 1) Grayscale and height maps of sealing nails with defect annotations were used as training samples, and the defect categories included weld cracks, weld beads, and weld spatters; 2) Label the bounding box and pixel-level mask for each defect instance; 3) The network parameters are optimized through backpropagation by using the weighted sum of classification loss, bounding box regression loss, and segmentation mask loss as the overall loss function; 4) Use data augmentation (random rotation, translation, brightness variation, etc.) to improve the robustness of the model to sealing nails with different postures and surface conditions; 5) During the deployment phase, the network structure and weights are fixed, and the thresholds and post-processing feature algorithms are adjusted only through external configuration files, thereby ensuring both detection accuracy and improving system maintainability.
[0031] Pry bar detection algorithm A raised sealing pin refers to a sealing pin that is significantly raised, either entirely or partially, relative to the reference plane of the battery casing, which may lead to poor sealing or assembly interference. This invention utilizes depth mapping for three-dimensional quantitative detection of raised pins.
[0032] S1: Select the reference region. Based on geometric priors, select the battery metal shell area around the sealing nail as the reference region for plane fitting. S2: Use the aforementioned effective depth region mask to mask outvalid or outlier regions in the height map; S3: Fitting the reference plane, the effective height point cloud in the reference area is regarded as a set of plane points, and the plane equation Z=aX+bY+c is fitted by the least squares method. This plane represents the theoretically ideal shell surface. S4: For all effective height points in the sealing nail welding area, calculate their vertical distance to the reference plane to form a warp height mapping; obtain the maximum warp height in the area and the area index exceeding the preset height threshold.
[0033] Welding trajectory offset detection algorithm Welding trajectory offset reflects the degree of eccentricity of the sealing nail weld relative to the theoretical welding path (usually a concentric circle trajectory), and is an important indicator for ensuring sealing uniformity. S1: Use template matching to search for pit regions in the grayscale image and obtain the coordinates of the pit center. ; S2: Measure and fit the outer contour of the weld bead to obtain the coordinates of the center of the weld bead trajectory circle. ; S3: Convert pixel coordinates to physical coordinates, calculate the offset vector and offset distance of the weld bead center relative to the pit center. If the offset distance exceeds the allowable range, the weld trajectory offset is determined to be defective.
[0034]
[0035]
[0036] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0037] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in sequences other than those illustrated or described herein.
[0038] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. 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.
Claims
1. A method for detecting the 3D optical contour of a lithium battery sealing nail, characterized in that: Includes the following steps: A1: Acquire multiple frames of grayscale images and height maps of the sealing nail area; A2: Perform stitching on multiple frames of images and anisotropic scaling on the stitched images according to the physical pixel spacing to establish a global grayscale image and a global height image with a proportional relationship consistent with the physical coordinate system. A3: Input the global grayscale image and global height image into the deep learning-based dfine model for instance segmentation, and output the category, location and pixel-level mask of various defects in the welding area; A4: Combining pixel-level masks and global height maps, perform nail warping detection, welding trajectory offset detection, and defect geometry and depth feature extraction, and determine the pass / fail status of the sealing nails based on preset thresholds.
2. The 3D optical contour detection method for lithium battery sealing nails according to claim 1, characterized in that: In step A2, the specific implementation of anisotropic scaling includes: Calculate scaling factors Kx and Ky based on the physical pixel spacing in the X and Y directions, and perform interpolation scaling on the global grayscale image and global height image by scaling Kx in the X direction and Ky in the Y direction respectively to eliminate geometric distortion caused by inconsistent sampling spacing.
3. The 3D optical contour detection method for lithium battery sealing nails according to claim 1, characterized in that: In step A3, the dfine model includes: The feature extraction backbone network performs multi-layer convolution and downsampling on the input grayscale image and height image to extract multi-scale features; The grayscale image and height map feature fusion module enables the fusion of multimodal features; The multi-scale feature fusion module constructs a multi-scale feature map from coarse to fine through upsampling and lateral connections; The detection head outputs the target bounding box regression results and class probabilities on the feature maps of each layer, which are used to detect cracks, weld beads, weld spatters, and weld deviations. The segmentation head generates corresponding pixel-level defect masks based on the target bounding boxes output by the detection head; The model training process uses a sample set with bounding boxes and pixel-level mask annotations. The loss function is a weighted sum of classification loss, bounding box regression loss, and segmentation mask loss. The network parameters are optimized through backpropagation, and data augmentation is used to improve robustness.
4. The 3D optical contour detection method for lithium battery sealing nails according to claim 1, characterized in that: The knocking nail detection in step A4 includes: The area of the battery's metal casing surrounding the sealing nail was selected as the reference area. Invalid values are masked based on the effective height region. The least squares method is used to fit the plane equation Z=aX+bY+c to the effective height points within the reference area; Calculate the vertical distance from each effective height point within the sealing nail welding area to the reference plane, generate a warping height mapping, and extract the maximum warping height and abnormal areas exceeding a set threshold as the basis for judgment.
5. The 3D optical contour detection method for lithium battery sealing nails according to claim 1, characterized in that: The welding trajectory offset detection in step A4 includes: Using a template matching algorithm, pit regions are identified in a grayscale image, and the coordinates of the pit center (C) are obtained. pit,x C pit,y ); Fit the outer contour of the weld bead to obtain the coordinates of the center of the weld bead trajectory circle (C). weld,x C weld,y ); Convert pixel coordinates to physical coordinates and calculate the offset ΔX=(C weld,x - Cpit,x )×X pitch ΔY=( Cweld,y -C pit,y )×Y pitch ; Calculate the offset distance D offset = And determine whether it exceeds the preset threshold.
6. The 3D optical contour detection method for lithium battery sealing nails according to claim 1, characterized in that: The effective height region extraction in step A2 includes: Based on the measurement parameters, set the minimum depth (MinDepth) and maximum depth (MaxDepth) thresholds, perform initial threshold segmentation on the height map, and obtain the initial effective area. Identify pixel regions in the height map that are equal to outliers and merge them into an outlier region mask; The final effective depth region mask is generated by subtracting the abnormal region mask from the rectangular region of the entire image and intersecting it with the initial effective region. Within the effective mask area, the global minimum and maximum depth values of the height map are statistically analyzed and used as a reference benchmark for depth feature analysis.
7. The 3D optical contour detection method for lithium battery sealing nails according to claim 1, characterized in that: Step A1 also includes: When acquiring multiple frames of images, the two-dimensional or three-dimensional displacement parameters of each frame relative to the workpiece coordinate system are recorded for coordinate alignment during subsequent image stitching.
8. The 3D optical contour detection method for lithium battery sealing nails according to claim 1, characterized in that: In step A3, the network structure and weights are fixed during the deployment phase of the dfine model, and the classification threshold and post-processing feature algorithm parameters are adjusted through an external configuration file.
9. The 3D optical contour detection method for lithium battery sealing nails according to claim 1, characterized in that: In step A1, a spectral confocal sensor is used to acquire multiple frames of grayscale images and height maps of the sealing nail area.