Shape matching-based full-size online high-speed visual detection method and system for primary battery
Through the online high-speed visual detection method based on shape matching, combined with deep learning technology and feature point matching network, the accuracy and efficiency of size detection in battery production is solved, and the rapid and accurate detection of battery size is achieved, and the production efficiency is improved. and security.
Patent Information
- Application Number
- CN202411085419.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2024-11-26
AI Technical Summary
The existing technology is difficult to meet the accuracy and efficiency of battery size detection, especially in the battery production process. Traditional detection methods are difficult to adapt to the needs of a wide variety of battery sizes, resulting in unqualified sizes, which may lead to safety hazards and low production efficiency. .
Using a full-size online high-speed visual detection method of primary cells based on shape matching, Superpoints keys that can be combined with deep separation convolution and attention mechanisms through image acquisition, calibration, preprocessing, network model construction and training, key point detection and registration. Point detection network, using Superglue feature point matching network for battery size detection, and high-speed imaging and automatic capture are achieved through industrial cameras and green coaxial light sources.
It realizes high accuracy and high efficiency in battery size detection in high-speed motion, can quickly eliminate batteries with unqualified sizes, improves efficiency and safety in battery production, and meets the detection speed and accuracy requirements of industrial production.
Smart Images

Figure CN119027382A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of machine vision and deep learning for online battery detection, and in particular relates to a full-size online high-speed visual detection method and system for primary batteries based on shape matching. Background Art
[0002] my country's annual battery production exceeds 50% of the world's total battery production, among which the production of No. 5 and No. 7 batteries plays a pivotal role and has an important impact on the national economy. my country's annual battery production exceeds 50% of the world's total battery production, among which the production of primary batteries plays a pivotal role and has an important impact on the national economy. Cylindrical batteries are used in many small appliances and digital products due to their small size and moderate capacity, and are widely used in both civilian and military fields. At present, my country's battery production equipment level and battery process technology have gradually gotten rid of the fate of being introduced from abroad and have begun to take the road of independent innovation. The quality and speed of battery production have been rapidly improved.
[0003] Product quality inspection is a very important part of the production process of traditional products. Its inspection results are important indicators for controlling the production process. Among them, workpiece size inspection is one of the most basic quality means in industrial production. As one of the traditional industries, battery production is difficult to avoid quality problems. In the process of battery production and preparation, due to the different materials used for the battery shell, it is very easy for the size to not meet the production requirements during the production process. This will not only affect the performance and life of the battery, but serious size failure may even cause the battery to explode during use, posing a huge safety hazard. It is the social responsibility of enterprises to produce and sell excellent products and ensure the safety of products. Therefore, it is an indispensable task for enterprises to inspect the size of the shell of the produced batteries. At the same time, online detection of the battery shell size during the production process is also of great significance for feedback guidance of the production link and improvement of the production process.
[0004] Due to the vigorous development of machine learning technology, image-based detection technology is also increasingly used in industrial production. Although the demand for battery size detection has increased significantly in recent years, the corresponding detection technology research still has a corresponding time lag. Therefore, the research on non-destructive automatic detection of battery external dimensions based on machine vision technology has become a research hotspot in this field. However, due to the wide variety of battery sizes, traditional detection technologies and methods are difficult to adapt to people's needs for accuracy and efficiency. Summary of the invention
[0005] In response to the above technical problems, the present invention provides a full-size online high-speed visual inspection method for primary batteries based on shape matching and a system for implementing the full-size online high-speed visual inspection method for primary batteries based on shape matching, so as to improve the efficiency and accuracy of size inspection during the battery production process.
[0006] The present invention achieves the above technical objectives through the following technical means.
[0007] A method for online high-speed visual inspection of original battery size based on shape matching comprises the following steps:
[0008] Step S1, image acquisition: acquiring the original image of the battery in high-speed motion through the image acquisition module;
[0009] Step S2, image calibration: correct the internal and external parameters of the image acquisition module through the calibration board, obtain the actual pixel size, and perform distortion correction on the original battery image in step S1;
[0010] Step S3, image preprocessing: filtering, denoising, and image equalization are performed on the battery original image set after distortion correction in step S2 to obtain a battery image data set;
[0011] Step S4, network model construction and training: construct a battery size key point detection network model, input the battery image data set prepared in step S3 into the constructed network model for training and testing, and obtain a trained battery size key point detection network model;
[0012] Step S5, online detection of key points of the image: placing the battery size key point detection network model trained in step S4 on an industrial computer, performing block detection on the battery image in real time, and obtaining the key points of the battery size;
[0013] Step S6, key point registration: the key points of the battery size detected in step S5 are registered with a preset battery size key point set through a key point matching network to obtain a key point set that can calculate the full size of the battery;
[0014] Step S7, size detection: Calculate and process the key point set obtained in step S6 to achieve full-size measurement of the battery, and remove batteries with unqualified sizes.
[0015] In the above scheme, the step S4 of network model construction and training is specifically as follows:
[0016] Based on the improved Superpoints key point detection network, a virtual data set is used to pre-train the improved Superpoints key point detection network. The virtual data set adopts a virtual image containing basic graphics, and the corner points of the virtual image are known, which is used for pre-training of the key point detection network; the trained key point detection network is used to detect the feature points of the real image and the image after N random homography transformations, and the N feature points of the image after N random homography transformations are restored to the original image through inverse homography transformation, and merged with the feature points of the original image into an enhanced feature point data set; the enhanced feature point data set is input into the Superpoint network to generate the final model weights, and the trained battery size key point detection network model is obtained.
[0017] Furthermore, the improvements of the improved Superpoints key point detection network in step S4 include:
[0018] The network introduces deep separable convolution to compress the parameters of the network;
[0019] Compress the network structure;
[0020] Adding attention mechanism.
[0021] Furthermore, the network introduces a depth-separable convolution, and the parameters of the compressed network are specifically:
[0022] The standardized convolution in the original backbone network in the Superpoints key point detection network is decomposed into depth convolution and point-by-point convolution, and its computational complexity formula is:
[0023] O2=H×W×c in (k 2 +C out )
[0024] Among them, H and W represent the length and width of the output feature map, k represents the convolution kernel, and c in represents the input channel, c out Indicates the output channel.
[0025] Furthermore, the network structure is compressed as follows:
[0026] The ordinary convolution and pooling layers in the original supenpoints network model are compressed into depth-separable convolutions with a stride of 2. In addition, the common parts of the feature point decoding network and the descriptor decoding network in the original superpoints network model are merged into the shared encoder network, and the output of the shared encoder network is changed to 256 channels. After the improved shared encoder detects the input image, it will output a 256-channel heat map and output the detection results to the feature point decoding network and the descriptor decoding network respectively.
[0027] Furthermore, the added attention mechanism is to add an attention mechanism in the encoding layer to enhance the feature expression capability, specifically:
[0028] The channel convolution block and spatial convolution block attention model are introduced at the decoding end of the Superpoints network. First, the channel attention module is used to calculate the importance of each channel to adjust the feature map F∈R C×H×W The weights of different channels in the input image are calculated, H and W are the length and width of the input image, C is the number of channels, and R represents the set. The adjusted feature map F′ is obtained. Then the spatial attention module is used to calculate the importance of each spatial position to adjust the weights of different positions in the feature map. The channel attention output feature map F′ is combined with the spatial attention map M s Multiply them together to get the final output F″ after passing through the attention module and the spatial attention module.
[0029] In the above solution, the block detection of the battery image in step S5 is specifically as follows:
[0030] The battery image with high resolution and densely distributed feature points is divided into several small-resolution images, and the images containing key point information are input into the trained battery size key point detection network model, and finally the results of the block detection are merged.
[0031] In the above scheme, the key point matching network in step S6 is an improved Superglue key point matching network, and the improved Superglue key point matching network specifically includes: setting a confidence f(x) threshold for matching, screening out matching results with higher confidence,
[0032]
[0033] Among them, t is the confidence screening threshold, and the matching pairs with confidence less than t are eliminated to make the matching results have higher credibility; for the matching pairs with confidence higher than t, shape constraints are set between the matching points. The shape constraints include the upper and lower symmetry of the matching point set and the distance constraint between the two points. It is judged whether the matching points meet the constraint requirements, and the points that meet the shape constraints are reselected.
[0034] A system for realizing the online high-speed visual inspection method for original battery size based on shape matching, comprising an image acquisition module, an image calibration module, an image preprocessing module, a network model building and training module, an industrial computer and a battery rejection device;
[0035] The image acquisition module includes a high-speed visual imaging mechanism, and the high-speed visual imaging mechanism is used to acquire the original image of the battery in high-speed motion;
[0036] The image calibration is used to correct the internal and external parameters of the image acquisition module through the calibration plate, obtain the actual pixel size, and perform distortion correction on the original battery image;
[0037] The image preprocessing is used to filter, denoise, and equalize the original battery image set after distortion correction to obtain a battery image data set;
[0038] The network model construction and training module is used to construct a battery size key point detection network model, input the prepared battery image data set into the constructed network model for training and testing, and obtain a trained battery size key point detection network model;
[0039] The industrial computer includes a trained battery size key point detection network model, which is used to perform block detection on battery images in real time to obtain battery size key points, and to align the detected battery size key points with a preset battery size key point set through a key point matching network to obtain a key point set that can calculate the full size of the battery; the obtained key point set is calculated and processed to achieve full-size measurement of the battery, and a battery rejection device is controlled to reject batteries that do not meet the size requirements.
[0040] In the above scheme, the high-speed visual imaging mechanism includes an industrial camera, a green coaxial light source, a proximity switch and a limit device;
[0041] The industrial camera adopts a double telecentric lens, and the industrial camera is arranged opposite to the green coaxial light source, so that the industrial camera can achieve backlight shooting; the proximity switch is connected to the industrial camera to trigger the industrial camera to take pictures, and the limit device is used to limit the height of the battery to be tested so that the battery is always at the same height as the image.
[0042] Compared with the prior art, the present invention has the following beneficial effects:
[0043] The present invention uses key point detection and matching algorithms in the field of deep learning to accurately extract the size of batteries in high-speed motion and eliminate batteries with unqualified sizes. The detection speed is fast and the accuracy is high, so as to improve the efficiency of the battery production process and guide the battery production process.
[0044] The present invention uses an improved Superpoints key point detection network, introduces depth-separable convolution, and compresses the network structure to reduce the number of network parameters and the amount of calculation. By adding an attention mechanism, the network's detection capability for battery key points is enhanced while reducing the detection speed of the network model.
[0045] The present invention uses the Superglue feature point matching network to achieve feature point matching and then eliminates false matches. By setting a matching confidence threshold, matching results with higher confidence are screened out. For matching pairs with confidence higher than t, shape constraints are set between matching points, including upper and lower symmetry of the matching point set and distance constraints between points, to determine whether the matching points meet the constraint requirements, and reselect points that do not meet the constraints to obtain accurate matching data.
[0046] The present invention adopts an industrial camera equipped with a double telecentric lens, uses a green coaxial light source for backlight shooting, and designs a proximity switch for external triggering system photography, so that the appearance outline of the battery can be clearly photographed, and the battery is placed at the same height of the image through a limit device. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A schematic diagram of a full-size online high-speed visual inspection method for primary cells based on shape matching according to an embodiment of the present invention;
[0048] Figure 2 is a schematic diagram of a high-speed visual imaging mechanism according to an embodiment of the present invention;
[0049] Figure 3 is a schematic diagram of a battery rejection device according to an embodiment of the present invention;
[0050] Figure 4 It is a schematic diagram of decomposing the standardized convolution in the Superpoint network into depth convolution and point-by-point convolution according to one embodiment of the present invention;
[0051] Figure 5 It is an improved Superpoint network structure of an implementation mode of the present invention;
[0052] Figure 6 is a schematic diagram of the structure of an attention module added to a Superpoint network according to an embodiment of the present invention;
[0053] Figure 7 It is a flowchart of mismatch screening of Superglue point set matching results according to one embodiment of the present invention;
[0054] Figure 8 It is a set of original images of some No. 7 batteries collected according to an embodiment of the present invention;
[0055] Fig. 9 It is a partial synthetic_shapes virtual image data set of one embodiment of the present invention;
[0056] Fig.10 It is a partial straight line and curve intersection data set produced for key point features of battery images according to one embodiment of the present invention;
[0057] Fig.11 It is a schematic diagram of preset key points of an embodiment of the present invention;
[0058] Fig.12 This is a key point matching effect diagram of an embodiment of the present invention.
[0059] Among them, 1. Industrial camera; 2. Green coaxial light source; 3. Proximity switch; 4. Limit device; 5. Rejection device. DETAILED DESCRIPTION
[0060] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.
[0061] Figure 1 The figure shows a preferred embodiment of the full-size online high-speed visual inspection method for primary cells based on shape matching, and the full-size online high-speed visual inspection method for primary cells based on shape matching comprises the following steps:
[0062] Step S1, image acquisition: The original image of the battery in high-speed motion is acquired by the image acquisition module, such as Figure 2 As shown, specifically, an industrial camera 1 and a green coaxial light source 2 are used to realize backlight shooting, a proximity switch 3 is used to realize external triggering of the camera to take pictures, and a limit device 4 is used to ensure that the battery is always at the same height of the image, and the battery in high-speed motion is automatically captured to obtain a data set of original images of the battery in high-speed motion;
[0063] Step S2, image calibration: correct the internal and external parameters of the industrial camera 1 through the calibration plate, obtain the actual pixel size, and perform distortion correction on the original battery image in S1;
[0064] Step S3, image preprocessing: filtering, denoising, and image equalization are performed on the battery original image set after distortion correction in step S2 to obtain a battery image data set;
[0065] Step S4, network model construction and training: construct a battery size key point detection network model, input the battery image data set produced in step S3 into the constructed network model for training and testing, and obtain a trained battery size key point detection network model; specifically, based on the improved Superpoints key point detection network, the key point detection capability is improved, the detection time is shortened, so that it can meet the battery production speed. The training process is divided into three steps. First, a virtual data set is used to pre-train the improved Superpoints key point detection network. The virtual data set is a virtual image containing basic graphics, such as lines, polygons, and cubes. The corner points of the virtual image are known and used for pre-training of the key point detection network; then, the trained key point detection network is used to detect the feature points of the real image and the image after N times of random homography transformation, and the N feature points of the image after random homography transformation are restored to the original image through inverse homography transformation, and merged with the feature points of the original image into an enhanced feature point data set; finally, the enhanced feature point data set is input into the Superpoint network to generate the final model weights to obtain a trained battery size key point detection network model.
[0066] Step S5, online detection of key points of the image: the battery size key point detection network model trained in step S4 is placed on the industrial computer, and the battery image is detected in blocks in real time to obtain the key points of the battery size; specifically, the trained battery key point detection network model is arranged on the industrial computer, and the industrial camera 1 and the green coaxial light source 2 are respectively installed on the left and right sides of the battery production line to ensure that the battery image can be clearly displayed in the industrial computer, and the external trigger system proximity switch 3 is used to shoot the battery image, and the shot image is transmitted to the trained battery size key point detection network model for processing, and the key points of the battery are output;
[0067] Step S6, key point registration: the key points of the battery size detected in step S5 are registered with the preset key point set of the battery size through the improved Superglue key point matching network to obtain a key point set that can calculate the full size of the battery, and the registration points are further screened to eliminate matching pairs with a confidence level less than t so that the matching results have a higher degree of credibility. For matching pairs with a confidence level higher than t, shape constraints are set between the matching points, including upper and lower symmetry of the matching point set and distance constraints between the points to determine whether the matching points meet the constraint requirements, and the points that do not meet the constraints are reselected to obtain accurate matching data;
[0068] Step S7, size detection: Process the key point set obtained in step S6 to achieve full-size measurement of the battery, and remove batteries with unqualified sizes. If the battery size is found to be unqualified, the industrial computer sends a signal to the removal device 5 to remove the defective batteries with unqualified sizes. Otherwise, no signal is sent.
[0069] Preferably, in step S1, the telecentric camera is set to be hardware-triggered for taking photos. In order to alleviate motion blur, the photo is taken with a green telecentric light source backlight and the exposure time is reduced to 80 μs.
[0070] Preferably, the improvement of the improved Superpoints key point detection network in step S4 includes:
[0071] Introducing depthwise separable convolution to compress the number of network parameters;
[0072] Adjust the network structure to speed up model reasoning;
[0073] Add an attention mechanism to enhance the feature point detection network's ability to detect battery feature points.
[0074] The network introduces deep separable convolution to compress the network parameters. Specifically, the standardized convolution in the original backbone network in the Superpoints key point detection network is decomposed into deep convolution and point-by-point convolution, which can greatly reduce the number of network parameters, the amount of calculation and the model size. The introduced deep separable convolution structure is as follows: Figure 4 As shown, the reduction ratio of separable convolution parameters compared to standard convolution is:
[0075] Ordinary convolution performs a full convolution operation on the input feature map and the convolution kernel. For an input size of H×W×C in Features Figure X , the output size is H×W×C out The feature map Y, convolution kernel K, size is k×k×C in ×C out , the output Y calculation formula of ordinary convolution is:
[0076]
[0077] Among them, i and j represent the rows and columns of the output feature map respectively, c in represents the input channel, c out Indicates the output channel.
[0078] The calculation complexity formula is:
[0079] O1=H×W×c in ×c out ×k 2
[0080] Among them, H and W represent the length and width of the output feature map, and k represents the convolution kernel.
[0081] The introduced separable convolution decomposes the ordinary convolution into two steps: depthwise convolution and pointwise convolution. First, the convolution operation is applied independently on each input channel through depthwise convolution, and then the convolution operation is performed at each position using a 1*1 convolution kernel to mix the channel information. For an input size of H×W×C in Features Figure X , the output size is H×W×C out The feature map Y, the output of the depth convolution Y depth The calculation formula is:
[0082]
[0083] Among them, K depth Represents the depthwise convolution kernel.
[0084] The calculation formula for the point-by-point convolution output Y is:
[0085]
[0086] The computational complexity formula of depth-separable convolution is:
[0087] O2=H×W×c in (k 2 +C out )
[0088] Therefore, the depth-wise separable convolution can significantly reduce the amount of calculation and parameters by decomposing the ordinary convolution into two steps: depth-wise convolution and point-wise convolution. Its overall computational complexity is H×W×c in (k 2 +C out ), compared to the H×W×c of ordinary convolution in ×c out ×k 2 It has significant computational and parameter advantages.
[0089] The specific method of compressing the network structure is as follows:
[0090] The ordinary convolution and pooling layers in the original supenpoints network model are compressed into depth-separable convolutions with a stride of 2; in addition, the common parts of the feature point decoding network and the descriptor decoding network in the original superpoints network model are merged into the shared encoder network to reduce repeated operations in the detection process, and the output of the shared encoder network is changed to 256 channels. After the improved shared encoder detects the input image, it will output a 256-channel heat map and output the detection results to the feature point decoding network and the descriptor decoding network respectively. The modified network model structure is as follows: Figure 5 shown.
[0091] The added attention mechanism is to add an attention mechanism to the encoding layer to enhance the feature expression capability, specifically:
[0092] The channel convolution block and spatial convolution block attention model are introduced at the decoding end of the Superpoints network to adaptively adjust the weight of the feature map. The attention structure model is as follows: Figure 6 As shown. First, the channel attention module is used to calculate the importance of each channel to adjust the feature map F∈R C×H×W The weights of different channels in the feature map F∈R. H and W are the length and width of the input image respectively, C is the number of channels, and R represents a set. The shape of each element in the set is: number of channels (C) * length (H) * width (W). C×H×W Perform global average pooling and global maximum optimization to obtain two feature vectors F avf and F max ,
[0093] F avf =AvgPool(F)
[0094] F max =Maxpool(F)
[0095] Then F avf and F max Through the shared multi-layer perceptron, two weight vectors M are obtained. avf and M max ,
[0096] M avf =AvgPool(F avf )
[0097] M max =Maxpool(F max )
[0098] Then M avf and M max Add together and use the Sigmoid activation function to get the channel attention map Mc .
[0099] M c =Sigmoid(M avf )+M max
[0100] Finally, the input feature map F and the channel attention map M c Multiply them together to get the adjusted feature map F′
[0101] F′=F×M c
[0102] Then, the spatial attention module is used to calculate the importance of each spatial position to adjust the weights of different positions in the feature map. First, the output F′ of the channel attention module is max-pooled and average-pooled in the channel dimension to obtain two spatial feature maps. and
[0103]
[0104] Then and Concatenate in the channel dimension and pass through a 7*7 convolution layer to obtain the spatial attention map M s ,
[0105]
[0106] Finally, the channel attention output feature map F′ and the spatial attention map M s Multiply them together to get the final output F″ after passing through the attention module and the spatial attention module.
[0107] ″′
[0108] F″=F′×M s
[0109] For the Superpoint key point detection network, the original network model has 629,568 parameters, and the inference time on the CPU is 12.067ms, the inference time on the GPU is 11.230ms, and the repetition accuracy on the hpatches public dataset is 0.672. For the improved Superpoint network model, by introducing deep separable convolution, adjusting the network structure for compression and adding the attention mechanism, the number of network model parameters is reduced to 42,314, the inference time on the CPU is 8.449ms, the inference time on the GPU is 8.493ms, and the repetition accuracy on the hpatches public dataset is 0.671. Therefore, the modified network model has improved the model parameter quantity and running speed while ensuring almost no loss of running accuracy.
[0110] Preferably, the key point matching network in step S6 is an improved Superglue key point matching network. After the feature points are matched using the Superglue key point matching network, false matches are eliminated, specifically:
[0111] In order to obtain accurate matching data, it is necessary to set a confidence f(x) threshold for the match and filter out matching results with higher confidence.
[0112]
[0113] Among them, t is the confidence screening threshold, and the matching pairs with confidence less than t are eliminated to make the matching results have a higher credibility.
[0114] For matching pairs with confidence higher than t, shape constraints are set between matching points. The shape constraints include the upper and lower symmetry of the matching point set and the distance constraint between the two points. It is determined whether the matching points meet the constraint requirements, and the points that meet the shape constraints are reselected. The reason for point mismatch is that the descriptors of the feature points are close in distance. By querying the point descriptors similar to the mismatched point and judging whether they meet the shape constraints, the mismatched point can be reselected. The flowchart is shown below. Figure 7 shown.
[0115] A system for realizing the online high-speed visual inspection method for original battery size based on shape matching, comprising an image acquisition module, an image calibration module, an image preprocessing module, a network model building and training module, an industrial computer and a battery rejection device;
[0116] The image acquisition module includes a high-speed visual imaging mechanism, and the high-speed visual imaging mechanism is used to acquire the original image of the battery in high-speed motion;
[0117] The image calibration is used to correct the internal and external parameters of the image acquisition module through the calibration plate, obtain the actual pixel size, and perform distortion correction on the original battery image;
[0118] The image preprocessing is used to filter, denoise, and equalize the original battery image set after distortion correction to obtain a battery image data set;
[0119] The network model construction and training module is used to construct a battery size key point detection network model, input the prepared battery image data set into the constructed network model for training and testing, and obtain a trained battery size key point detection network model;
[0120] The industrial computer includes a trained battery size key point detection network model, which is used to perform block detection on battery images in real time to obtain battery size key points, and to align the detected battery size key points with a preset battery size key point set through a key point matching network to obtain a key point set that can calculate the full size of the battery; the obtained key point set is calculated and processed to achieve full-size measurement of the battery, and a battery rejection device is controlled to reject batteries that do not meet the size requirements.
[0121] Preferably, the high-speed visual imaging mechanism comprises an industrial camera 1, a green coaxial light source 2, a proximity switch 3 and a limit device 4;
[0122] The industrial camera 1 adopts a double telecentric lens, and the industrial camera 1 is arranged opposite to the green coaxial light source 2, so that the industrial camera 1 can achieve backlight shooting; the proximity switch 3 is connected to the industrial camera 1 to trigger the industrial camera 1 to take pictures, and the limit device 4 is used to limit the height of the battery to be tested so that the battery is always at the same height as the image.
[0123] The overall flow chart of the original battery full-size online high-speed visual inspection method based on shape matching is as follows: Figure 1 As shown, it includes the following steps:
[0124] Step S101, image acquisition: as shown in the attached Figure 1 As shown, an industrial camera 1 and a green coaxial light source 2 are used to realize backlight shooting, a proximity switch 3 is used to realize external triggering of the camera to take pictures, and a limit device 4 is used to ensure that the battery is always at the same height of the image. The battery in high-speed motion is automatically captured to obtain the battery original image data set. Figure 8 The figure shows a set of partial original images of No. 7 batteries. The middle area of the battery is blocked by the disk, but the key areas of the positive and negative poles are not blocked.
[0125] Step S102, image calibration: correct the internal and external parameters of the camera through the calibration plate, obtain the actual pixel size, and perform distortion correction on the original battery image in S101.
[0126] Step S103, image preprocessing: filtering, denoising, and image equalization processing are performed on the original battery image set in step S;
[0127] Step S104, network model construction and training: first generate a synthetic_shapes virtual data set, part of the synthetic_shapes virtual data set is as follows Fig. 9 As shown in the figure, it includes graphics such as chessboard, rectangle, line and their key point positions, adds Gaussian noise interference, and adds virtual data sets of intersections of straight lines and curves according to the characteristics of battery key points, such as Fig.10 The following is a dataset of some straight-line and curve intersection points produced for key point features of battery images. The training set for each type of image is 10,000 images, and the ratio of training set, test set, and verification machine is 100:2:5; the encoder and feature point decoder are trained to extract feature points, and then the trained encoder and feature point decoder are used to detect the feature points of the collected battery image and its 50 randomly homographically transformed images, and then the detected feature points are restored to the original image through inverse homography, and merged with the feature points of the original image into an enhanced feature point dataset; finally, the real battery image and the image after homography transformation are input into the improved SuperPoint network, and the final model weights are obtained through training.
[0128] Step S105, online detection of image key points: the trained battery key point detection network model is arranged on the industrial computer, and the industrial camera 1 and the green coaxial light source 2 are respectively installed on the upper and lower sides of the battery production line to ensure that the battery image can be clearly displayed in the industrial computer, and the battery image is captured by an external trigger system, and the captured image is passed to the detection model for processing, and the key points of the battery are output.
[0129] Step S106, key point registration: using the improved Superglue key point matching network, the key points detected in step S105 are registered with the preset battery size key point set to obtain a key point set that can calculate the full size of the battery, and the registration points are further screened to remove matching pairs with a confidence level less than 0.6, so that the matching results have a higher degree of credibility, and the matching point set is judged by shape constraints. If the constraint is not met, the misjudged point is reselected. Among them, the preset battery size key point set is as follows: Fig.11 As shown, the final point set matching effect is as follows Fig.12 As shown, the left side is the No. 7 battery image and its template point set, the detected No. 7 battery is located on the right side of the image, and the matching key points are drawn using straight lines.
[0130] Step S107, size detection: Process the key point set obtained in step S6, calculate the distance between the matching points, and correct the result according to the battery deflection angle to achieve full-size measurement of the battery, and remove batteries with unqualified sizes. If the battery size is found to be unqualified, the industrial computer sends a 50ms high-level signal to the removal device 5 to remove the defective batteries with unqualified sizes, otherwise, no signal is sent.
[0131] In a specific embodiment of the present invention, the improved Superpoint model training parameters are: the initial learning rate is 1×10 -3 , iterate 10 times for the virtual data set and 8 times for the real data set. Since a small amount of mis-pickup is allowed in industry (i.e., normal batteries are rejected as defective products) but missed pickup (i.e., defective products are not rejected as normal batteries) is almost intolerable, the mismatch confidence threshold is set to 0.6 in this example, and the dimensional tolerance range is, total height: 44.15±0.15mm, shoulder height: 41.95±0.15mm, and the outer diameter of the pull-up is ≦10.15mm.
[0132] Therefore, through the above steps, the full-size online high-speed visual inspection method of original batteries based on shape matching is adopted, and the three-size inspection results of a group of No. 7 batteries are as follows:
[0133] Table 1 Measurement results of the original battery size online detection system based on shape matching
[0134]
[0135]
[0136] Compare the measurement results with the actual manual measurement of the battery size, using a vernier caliper to measure the following:
[0137] Table 2 Vernier caliper measurement results
[0138]
[0139] Therefore, through the above steps, the battery size is measured by using the original battery size online high-speed visual inspection system based on shape matching, and compared with the measurement results of the vernier caliper. The absolute error does not exceed ±0.03mm, which meets the company's production requirements for size accuracy, and can detect 800 batteries per minute, meeting the company's production line speed requirements.
[0140] In summary, the present invention can realize the size detection of various types of original batteries, which can not only check the quality of the produced batteries, but also help guide the production process of the batteries. The present invention obtains clear imaging of the battery in high-speed motion by arranging a backlight shooting method through a high-speed visual imaging mechanism, automatically captures the battery in high-speed motion through an external trigger device close to the switch 3, and ensures that the battery is always at the same height of the image through a limit device 4, thereby realizing the automatic collection of battery pictures in high-speed motion. The present invention improves the Superpoint key point detection network, and aims at the problem of unqualified battery size on the battery production line, reduces the number of network parameters and the amount of calculation, adjusts the network structure, and speeds up the model reasoning speed by introducing a deep separable convolution; adds an attention mechanism to enhance the detection network's ability to detect key points of the battery, and eliminates mismatches after matching the feature points through an improved Superglue feature point matching network, thereby enhancing the accuracy of feature matching. The present invention realizes the online size detection of the original battery in high-speed motion through the corresponding relationship between the target point set and the template click registration, and meets the speed and accuracy requirements of detection in industrial production.
[0141] The present invention collects battery images in high-speed motion during the battery manufacturing process to obtain an original battery image set; preprocesses the original battery images, including calibration, distortion correction, and filtering operations; constructs an improved Superpoint key point detection model, uses the preprocessed images and performs unsupervised training on them; arranges the trained key point detection model on an industrial computer, detects the battery image in real time, and performs Superglue feature matching on the detected results and template points, and screens the matching points, and calculates the battery size through the registration relationship between the template points and the detected points; if the battery size is found to be unqualified, an instruction is issued to reject the battery through the rejection device 5. The present invention can extract the size of batteries in high-speed operation, including No. 5, No. 7, and No. 9 original batteries, with fast detection speed and high accuracy.
[0142] It should be understood that although this specification is described according to various embodiments, not every embodiment contains only one independent technical solution. This narrative method of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation methods that can be understood by those skilled in the art.
[0143] The series of detailed descriptions listed above are only specific descriptions of feasible embodiments of the present invention. They are not intended to limit the scope of protection of the present invention. All equivalent embodiments or changes that do not deviate from the technical spirit of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for online high-speed visual inspection of original battery size based on shape matching, characterized in that: The following steps are involved: Step S1, image acquisition: acquiring the original image of the battery in high-speed motion through the image acquisition module; Step S2, image calibration: correct the internal and external parameters of the image acquisition module through the calibration board, obtain the actual pixel size, and perform distortion correction on the original battery image in step S1; Step S3, image preprocessing: filtering, denoising, and image equalization are performed on the battery original image set after distortion correction in step S2 to obtain a battery image data set; Step S4, network model construction and training: construct a battery size key point detection network model, input the battery image data set prepared in step S3 into the constructed network model for training and testing, and obtain a trained battery size key point detection network model; Step S5, online detection of key points of the image: placing the battery size key point detection network model trained in step S4 on an industrial computer, performing block detection on the battery image in real time, and obtaining the key points of the battery size; Step S6, key point registration: the key points of the battery size detected in step S5 are registered with a preset battery size key point set through a key point matching network to obtain a key point set that can calculate the full size of the battery; Step S7, size detection: Calculate and process the key point set obtained in step S6 to achieve full-size measurement of the battery, and remove batteries with unqualified sizes.
2. The method for online high-speed visual inspection of original battery size based on shape matching according to claim 1 is characterized in that: The step S4 of network model construction and training is specifically as follows: Based on the improved Superpoints key point detection network, a virtual data set is used to pre-train the improved Superpoints key point detection network. The virtual data set is a virtual image containing basic graphics. The corner points of the virtual image are known and used for pre-training of the key point detection network. Use the trained key point detection network to detect the feature points of the real image and the image after N random homography transformations, restore the N feature points of the image after random homography transformation to the original image through inverse homography transformation, and merge them with the feature points of the original image into an enhanced feature point dataset; The enhanced feature point dataset is input into the Superpoint network to generate the final model weights and obtain the trained battery size key point detection network model.
3. The method for online high-speed visual inspection of original battery size based on shape matching according to claim 2 is characterized in that: The improvements of the improved Superpoints key point detection network in step S4 include: The network introduces deep separable convolution to compress the parameters of the network; Compress the network structure; Adding attention mechanism.
4. The method for online high-speed visual inspection of original battery size based on shape matching according to claim 3 is characterized in that: The network introduces depthwise separable convolution, and the parameters of the compressed network are specifically: The standardized convolution in the original backbone network in the Superpoints key point detection network is decomposed into depth convolution and point-by-point convolution, and its computational complexity formula is: O2=H×W×c in (k 2 +C out ) Among them, H and W represent the length and width of the output feature map, k represents the convolution kernel, and c in represents the input channel, c out Indicates the output channel.
5. The method for online high-speed visual inspection of original battery size based on shape matching according to claim 3 is characterized in that: The specific method of compressing the network structure is as follows: The ordinary convolution and pooling layers in the original supenpoints network model are compressed into depth-separable convolutions with a stride of 2. In addition, the common parts of the feature point decoding network and the descriptor decoding network in the original superpoints network model are merged into the shared encoder network, and the output of the shared encoder network is changed to 256 channels. After the improved shared encoder detects the input image, it will output a 256-channel heat map and output the detection results to the feature point decoding network and the descriptor decoding network respectively.
6. The method for online high-speed visual inspection of original battery size based on shape matching according to claim 3 is characterized in that: The added attention mechanism is to add an attention mechanism to the encoding layer to enhance the feature expression capability, specifically: The channel convolution block and spatial convolution block attention model are introduced at the decoding end of the Superpoints network. First, the channel attention module is used to calculate the importance of each channel to adjust the feature map F∈R C×H×W The weights of different channels in , H and W are the length and width of the input image respectively, C is the number of channels, R represents the set, and the adjusted feature map F′ is obtained; Then, the spatial attention module is used to calculate the importance of each spatial position to adjust the weights of different positions in the feature map, and the channel attention output feature map F′ is combined with the spatial attention map M s Multiply them together to get the final output F″ after passing through the attention module and the spatial attention module.
7. The method for online high-speed visual inspection of original battery size based on shape matching according to claim 1, characterized in that: In step S5, the block detection of the battery image is specifically as follows: The battery image with high resolution and densely distributed feature points is divided into several small-resolution images, and the images containing key point information are input into the trained battery size key point detection network model, and finally the results of the block detection are merged.
8. The method for online high-speed visual inspection of original battery size based on shape matching according to claim 1 is characterized in that: The key point matching network in step S6 is an improved Superglue key point matching network. The improved Superglue key point matching network specifically includes: setting a confidence f(x) threshold for matching, screening out matching results with higher confidence, Among them, t is the confidence screening threshold, and the matching pairs with confidence less than t are eliminated to make the matching results have higher credibility; for the matching pairs with confidence higher than t, shape constraints are set between the matching points. The shape constraints include the upper and lower symmetry of the matching point set and the distance constraint between the two points. It is judged whether the matching points meet the constraint requirements, and the points that meet the shape constraints are reselected.
9. A system for implementing the online high-speed visual inspection method for original battery size based on shape matching as described in any one of claims 1 to 8, characterized in that: It includes image acquisition module, image calibration module, image preprocessing module, network model building and training module, industrial computer and battery rejection device; The image acquisition module includes a high-speed visual imaging mechanism, and the high-speed visual imaging mechanism is used to acquire the original image of the battery in high-speed motion; The image calibration is used to correct the internal and external parameters of the image acquisition module through the calibration plate, obtain the actual pixel size, and perform distortion correction on the original battery image; The image preprocessing is used to filter, denoise, and equalize the original battery image set after distortion correction to obtain a battery image data set; The network model construction and training module is used to construct a battery size key point detection network model, input the prepared battery image data set into the constructed network model for training and testing, and obtain a trained battery size key point detection network model; The industrial computer includes a trained battery size key point detection network model, which is used to perform block detection on the battery image in real time to obtain the battery size key points, and to align the detected battery size key points with a preset battery size key point set through a key point matching network to obtain a key point set that can calculate the full size of the battery; The obtained key point set is calculated and processed to achieve full-size measurement of the battery, and the battery rejection device is controlled to reject batteries with unqualified sizes.
10. The system of the online high-speed visual inspection method for the size of the original battery based on shape matching according to claim 9 is characterized in that: The high-speed visual imaging mechanism comprises an industrial camera (1), a green coaxial light source (2), a proximity switch (3) and a limit device (4); The industrial camera (1) adopts a double telecentric lens, and the industrial camera (1) and the green coaxial light source (2) are arranged relative to each other, so that the industrial camera (1) can achieve backlight photography; the proximity switch (3) is connected to the industrial camera (1) and is used to trigger the industrial camera (1) to take pictures, and the limit device (4) is used to limit the height of the battery to be tested so that the battery is always at the same height in the image.
