Disclosure of Invention
The invention aims to provide a battery piece microdefect automatic identification system based on 3D machine vision so as to solve the problems in the background art.
In order to achieve the above purpose, the present invention provides the following technical solutions: battery piece microdefect automatic identification system based on 3D machine vision includes:
the 3D vision sensing module is used for acquiring detailed surface morphology information of the battery piece; the 3D vision sensor module comprises an image shooting unit and a light source control unit, wherein the image shooting unit adopts a high-precision depth camera to comprehensively acquire 3D images of a battery piece welding area; the light source control unit is used for adjusting illumination conditions and reducing the influence of reflection and shadow on image quality;
the mechanical transmission module is used for automatically and stably transmitting the battery piece to the lower part of the image shooting unit for detection;
The 3D image processing module is used for preprocessing the acquired 3D image and optimizing image data; the 3D image processing module comprises an image denoising unit, a registration alignment unit and a geometric correction unit; the image denoising unit adopts a 3D image filtering technology to denoise and smooth the image; the image registration alignment unit is used for aligning the same object in different images to the same coordinate system in the multi-view images; the geometric correction unit is used for correcting geometric distortion in the image, including perspective deformation and distortion of the image;
The machine learning module is used for carrying out defect recognition on the battery piece image output by the 3D image processing module, and the machine learning module is used for constructing a defect recognition model based on a deep learning algorithm, wherein the defect recognition model is used for judging whether the battery piece in the image has defects and the number, the position and the type of the defects;
the user interaction module is used for providing a graphical user interface for the interaction between an operator and the system; the interface design comprises a real-time image display window used for displaying the battery piece image acquired by the 3D vision sensor module; a defect list display area for listing defect information identified by the machine learning module, including the number, location and type of defects; the parameter setting panel is used for an operator to adjust system detection parameters, including illumination conditions, image preprocessing algorithm parameters and defect recognition thresholds;
and the report generation module is used for sorting the data and the results collected in the system detection process into a report form and outputting the report form.
Preferably, the mechanical transmission module comprises a battery piece fixing device, a transmission guide rail and a driving device; the battery piece fixing device is used for firmly clamping the battery piece; the transmission guide rail is used for realizing stable conveying of the battery piece; the driving device is used for providing power and controlling the battery piece fixing device to move along the transmission guide rail;
The driving device starts and drives the transmission guide rail to move, the battery piece is placed on the fixing device and is firmly clamped, and along with the movement of the transmission guide rail, the fixing device carries the battery piece to move along a preset path to the position below the image shooting unit.
Preferably, the image denoising unit removes noise points in the 3D image by using a gaussian filtering method, and obtains a denoised image by convolution of a three-dimensional gaussian kernel and calculation of a three-dimensional gaussian function, wherein a calculation formula of the three-dimensional gaussian function is as follows:
wherein x, y and z represent coordinates of each voxel of the three-dimensional image in a three-dimensional space, G (x, y and z) represents coordinates obtained by calculating the three-dimensional Gaussian function of the voxels, sigma is a standard deviation of the three-dimensional Gaussian function, e is a base of natural logarithm, and pi is a circumference ratio.
Preferably, the method for aligning the same object in the multi-view image to the same coordinate system by the registration alignment unit is as follows:
i) Collecting 3D image data of multiple views including a battery cell welding region;
ii) selecting an image of one view as a reference image and transforming the images of the other views to align with the reference image;
iii) Extracting key feature points from each image by using a feature extraction algorithm, and establishing a corresponding relation between the feature points;
iv) calculating a coordinate transformation matrix for transforming the feature points in the non-reference image into the coordinate system of the reference image according to the correspondence between the feature points;
v) performing coordinate transformation on the non-reference image by using a coordinate transformation matrix, and aligning the same object in the multi-view image to the same coordinate system;
The coordinate transformation matrix is calculated by the following formula:
Wherein T is a coordinate transformation matrix, R is a rotation matrix, representing a rotation relationship between images, and T is a translation vector, representing a translation relationship between images.
Preferably, the geometric correction unit corrects the image by using a perspective transformation matrix to eliminate perspective deformation and distortion; the perspective transformation matrix is expressed as:
Wherein H is a perspective transformation matrix, H ij is an element in the matrix, and the direct linear transformation DLT algorithm is used for calculation.
Preferably, the types of welding defects include welding cracks, incomplete welding, slag inclusion, air holes, explosion points, pinholes, pits, bumps, polarized light and black spots.
Preferably, the step of constructing and training the defect recognition model by the machine learning module includes:
step 1: constructing a three-dimensional convolutional neural network model, wherein the model comprises an input layer, a plurality of hidden layers and a plurality of output layers; the input layer is used for receiving the preprocessed 3D battery piece image data; the hidden layer is used for extracting image features; the plurality of output layers are respectively used for outputting the number, the position and the type of the defects;
Step 2: preparing a training dataset comprising a plurality of 3D battery slice images labeled with the number, location, and type of defects;
Step 3: training the three-dimensional convolutional neural network model by using a training data set, and adjusting model parameters through forward propagation and backward propagation algorithms to minimize the difference between the number, position and type of defects predicted by the output layer and the real marks;
Step 4: in the training process, a proper loss function is adopted to evaluate the accuracy of model prediction, and model parameters are updated according to the gradient of the loss function;
Step 5: repeating the steps 3 and 4 until the performance of the model on the verification set reaches a predetermined standard or training reaches a predetermined iteration number;
step 6: and storing the trained model for the subsequent battery piece defect identification.
Preferably, the method for evaluating the performance of the defect recognition model comprises the following steps: preparing a test dataset containing images of the battery cells of known defect number, location and type; performing defect recognition on the images in the test data set by using the trained defect recognition model to obtain the number, position and type of defects predicted by the model; comparing the number, position and type of the defects predicted by the model with the known number, position and type of the defects in the test data set, and calculating the accuracy rate, recall rate and F1 score of model identification; and evaluating the performance of the model according to the accuracy, recall and F1 score calculation results.
Preferably, the report generating module designs a report template according to a preset format and structure, and the content comprising the template comprises a battery piece image, a defect identification result, detection parameters and detection time.
Compared with the prior art, the invention has the beneficial effects that:
The system adopts the 3D visual sensing module, can comprehensively and accurately acquire the detailed surface morphology information of the battery piece, and compared with the traditional 2D visual scheme, the detection capability of the battery piece on highly relevant defects (such as pits, bumps and the like) is remarkably improved. The automatic detection flow replaces manual visual inspection, so that the detection efficiency is greatly improved, and the detection error caused by human factors is reduced.
The machine learning module builds a strong defect recognition model based on a deep learning algorithm, can accurately judge whether defects exist in the battery piece, and the number, the position and the type of the defects, so that the comprehensiveness and the accuracy of defect recognition are improved.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1-4, the present invention provides a technical solution: battery piece microdefect automatic identification system based on 3D machine vision includes:
3D vision sensing module: the 3D vision sensing module adopted by the system comprises an image shooting unit and a light source control unit. The image shooting unit uses a high-precision depth camera, and the camera can acquire a comprehensive 3D image of a battery piece welding area and capture detailed surface morphology information. The light source control unit is responsible for adjusting illumination conditions so as to reduce the influence of reflection and shadow on image quality and ensure that the acquired image is clear and accurate.
And the mechanical transmission module is as follows: the mechanical transmission module is responsible for automatically and stably transmitting the battery piece to the lower part of the image shooting unit for detection. The module adopts a precise mechanical design and a transmission device, ensures the accurate and stable position of the battery piece in the transmission process, and avoids the blurring or distortion of images caused by vibration or displacement.
3D image processing module: the 3D image processing module preprocesses the acquired 3D image to optimize image data. The module comprises an image denoising unit, a registration alignment unit and a geometric correction unit. The image denoising unit adopts a 3D image filtering technology to denoise and smoothen the image, so that the definition and contrast of the image are improved. The registration alignment unit is used for aligning the same object in different images to the same coordinate system in the multi-view images, so as to ensure the accuracy of subsequent processing. The geometric correction unit is used for correcting geometric distortion in the image, including perspective deformation and distortion of the image, so that the image can more truly and accurately reflect the actual shape of the battery piece.
A machine learning module: the machine learning module is responsible for carrying out defect recognition on the battery piece image output by the 3D image processing module. The module builds a defect identification model based on a deep learning algorithm, and the model can judge whether the battery piece in the image has defects and the number, the position and the type of the defects. Through a large amount of data training and algorithm optimization, the model can realize efficient and accurate defect identification.
And a user interaction module: the user interaction module provides a graphical user interface for an operator to interact with the system. The interface design comprises a real-time image display window used for displaying the battery piece image acquired by the 3D vision sensor module; a defect list display area for listing defect information identified by the machine learning module, including the number, location and type of defects; and a parameter setting panel, which allows an operator to adjust system detection parameters, such as illumination conditions, image preprocessing algorithm parameters, defect recognition thresholds and the like, according to actual requirements.
A report generation module: the report generation module is responsible for arranging data and results collected in the system detection process into a report form and outputting the report form. The module can automatically generate a detailed detection report, including detection time, battery piece information, defect details and the like, and is convenient for an operator to analyze and archive detection results.
According to the invention, the 3D image of the welding area of the battery piece is acquired through the high-precision depth camera, and the automatic identification of the defects is realized through the steps of image processing, machine learning and the like, so that the method has the advantages of high efficiency, accuracy, high degree of automation and the like, and can remarkably improve the production quality and efficiency of the battery piece.
The invention is further illustrated in the following in connection with examples 1 to 3:
example 1:
the mechanical transmission module mainly comprises a battery piece fixing device, a transmission guide rail and a driving device.
The battery piece fixing device is used for firmly clamping the battery piece and ensuring that the battery piece cannot displace or shake in the conveying process. For example, the device can adopt a spring clamping mechanism, and the battery pieces with different thicknesses and sizes can be adapted by adjusting the pretightening force of the spring, so that the moderate clamping force is ensured, and the battery pieces cannot be damaged. Meanwhile, soft materials such as rubber pads and the like can be arranged on the clamping mechanism, so that the clamping stability is improved, and the surface of the battery piece is protected from being scratched.
The transmission guide rail is used for realizing stable conveying of the battery piece, the guide rail can be a high-precision linear guide rail, and the surface of the guide rail is subjected to precise grinding and polishing treatment, so that the stability and the accuracy of the battery piece in the conveying process are ensured. The guide rail can be provided with components such as a sliding block, a guide wheel and the like so as to reduce friction resistance and improve conveying stability. In addition, the design of the guide rail also considers the requirements of easy maintenance and replacement, for example, the guide rail is conveniently detached, cleaned and replaced by adopting a modularized design.
The driving device is a power source of the mechanical transmission module and is used for providing power and controlling the battery piece fixing device to move along the transmission guide rail. The driving device can adopt a mode of combining a servo motor and a speed reducer, and the accurate positioning and speed control of the battery piece fixing device can be realized by accurately controlling the rotating speed and the steering of the motor. For example, the servo motor can adopt a closed-loop control system, and the encoder feeds back the position information to realize accurate position control of the battery piece fixing device. The speed reducer can adopt a planetary speed reducer or a worm gear speed reducer and other high-precision speed reducers so as to ensure accurate transmission ratio and high transmission efficiency.
In the actual working process, the driving device is started and drives the transmission guide rail to move. The battery piece is placed on the fixing device by an operator, and the battery piece is firmly clamped by adjusting the pretightening force of the clamping mechanism. Along with the movement of the transmission guide rail, the fixing device carries the battery piece to move along a preset path to the lower part of the image shooting unit. For example, after the transmission speed and the path are set in the operation interface, the driving device is started, and the servo motor starts to rotate and drives the transmission guide rail to move after being decelerated by the speed reducer. The battery piece fixing device stably moves along the guide rail, and the battery piece is conveyed to the lower part of the image shooting unit for image acquisition and defect identification. In the process, the mechanical transmission module can ensure the stability and the accuracy of the battery piece, and provides a reliable basis for subsequent image acquisition and defect identification.
Example 2:
In the 3D image processing module, the image denoising unit is responsible for removing noise points in the 3D image so as to improve the quality and definition of the image. The gaussian filtering method is a widely used image denoising technology, and the denoised image is obtained through convolution of a three-dimensional gaussian kernel and calculation of a three-dimensional gaussian function. The three-dimensional Gaussian function is the core of the method, and the calculation formula is as follows:
wherein x, y and z represent coordinates of each voxel of the three-dimensional image in a three-dimensional space, G (x, y and z) represents coordinates obtained by calculating the three-dimensional Gaussian function of the voxels, sigma is a standard deviation of the three-dimensional Gaussian function, e is a base of natural logarithm, and pi is a circumference ratio. The specific denoising steps are as follows:
Step 1, determining standard deviation sigma: a suitable standard deviation sigma value is selected depending on the noise level of the image and the degree of denoising desired. A larger σ value results in a stronger denoising effect, but may also cause the image to become too blurred. If the noise level in the image is low, a relatively small sigma value may be selected to slightly remove the noise while preserving the details of the image as much as possible. For example, the sigma value may be between 0.5 and 1.0. For images with moderate noise levels, a moderate σ value may be chosen to balance the denoising effect and image detail preservation. For example, the sigma value may be between 1.0 and 2.0.
Step 2, constructing a three-dimensional Gaussian kernel: based on the selected sigma value, a three-dimensional gaussian kernel is constructed. The kernel is a three-dimensional matrix in which each element is calculated by a three-dimensional gaussian function.
Step 3, convolution operation: and carrying out convolution operation on the constructed three-dimensional Gaussian kernel and the original 3D image. This step corresponds to sliding a gaussian kernel across each voxel of the image and weighting the surrounding voxels according to the weights in the kernel, resulting in a denoised voxel value.
Step 4, acquiring a denoised image: the convolution operation is repeated until all voxels in the image have been processed. Finally, a denoised 3D image is obtained, wherein noise points are effectively removed, and important features of the image are preserved.
The registration alignment unit is a key part in multi-view 3D image processing, which is responsible for aligning the same object in images of different view angles under the same coordinate system. The following is a specific implementation procedure of the registration alignment unit:
and step 1, collecting multi-view 3D image data containing the welding area of the battery piece. These data may be acquired by a 3D scanner or other 3D imaging device to ensure that the images for each view contain the desired weld area.
And 2, selecting an image at one view angle as a reference image, and transforming the images at other view angles so as to enable the images to be visually aligned with the reference image.
And 3, extracting key feature points from each image by using a feature extraction algorithm, wherein the key feature points are corner points and edge points in the image. After extracting the feature points, establishing a corresponding relation between the feature points, namely determining which feature points in different images represent the same physical position.
And 4, calculating a coordinate transformation matrix according to the corresponding relation between the characteristic points, wherein the transformation matrix is used for transforming the characteristic points in the non-reference image into the coordinate system of the reference image. The calculation of the coordinate transformation matrix uses the following formula: Wherein T is a coordinate transformation matrix, R is a rotation matrix, representing a rotation relationship between images, and T is a translation vector, representing a translation relationship between images. By solving this matrix, the rotation and translation parameters required to align the non-reference image to the reference image can be obtained.
And 5, carrying out coordinate transformation on the non-reference image by using a coordinate transformation matrix, and updating the coordinates of each pixel in the non-reference image by using the coordinate transformation matrix calculated before so as to align the non-reference image with the reference image. After this step, the same object in the multi-view image will be aligned to the same coordinate system.
The geometric correction unit corrects the image by using a perspective transformation matrix. The following steps are specific:
Step 1, determining a perspective transformation matrix H, wherein the matrix is a 3x3 matrix, and elements in the matrix are obtained through Direct Linear Transformation (DLT) algorithm calculation. The DLT algorithm is an effective mathematical tool that can calculate a perspective transformation matrix from corresponding points in an image.
Before the perspective transformation matrix is calculated, some corresponding points in the image are selected, which are points with a definite position in both the original image and the desired corrected image. For example, four corner points of a rectangle are selected in the original image, and positions to which the four corner points should correspond are specified in the image for which correction is desired.
And 2, calculating a perspective transformation matrix H according to the corresponding points by using a DLT algorithm. The DLT algorithm considers the geometric relationships in the image and calculates a perspective transformation matrix that best maps the corresponding points. The perspective transformation matrix is expressed as:
Wherein H is a perspective transformation matrix, H ij is an element in the matrix, and the direct linear transformation DLT algorithm is used for calculation.
After the perspective transformation matrix H is obtained, it can be used to correct the image, which involves applying the perspective transformation matrix to each pixel in the image to eliminate perspective distortion and warping. Specifically, for each pixel in the image, its new coordinates in the corrected image are calculated from its coordinates and the perspective transformation matrix.
And 3, rearranging pixels in the image according to the calculated new coordinates to obtain a corrected image. This corrected image will eliminate perspective distortion and warping in the original image, making the objects in the image appear more natural and realistic.
Assuming that a 3D image of the battery cell welding area is photographed from obliquely above, the welding lines in the image appear curved due to perspective deformation. To correct the image, a rectangular region of the image is first selected, which contains the solder strips that need to be corrected. The position and shape that this rectangular area should correspond to, i.e. a standard rectangle, is specified in the desired corrected image. The perspective transformation matrix H is calculated from the corresponding points of the two rectangular areas using DLT algorithm. Finally, the original image is corrected by applying the perspective transformation matrix, so that a corrected image without perspective deformation and distortion is obtained, and welding strips in the corrected image are more visual and accurate.
Example 3:
The machine learning module builds and trains the defect recognition model comprising the following steps:
Step 1, constructing a three-dimensional convolutional neural network model: a three-dimensional convolutional neural network model is constructed, which consists of an input layer, a plurality of hidden layers and a plurality of output layers. The input layer is responsible for receiving the preprocessed 3D battery piece image data, and the image data is subjected to registration alignment and denoising processing so as to ensure the quality and consistency of the image. The hidden layer is used to extract features in the image. The plurality of output layers are respectively designed for outputting the number, the position and the type of the defects so as to realize comprehensive defect identification.
Step 2, preparing a training data set: for training a three-dimensional convolutional neural network model, a training dataset containing a large number of 3D battery slice images is prepared, and the images in the training dataset have been marked with the number, location and type of defects to ensure that the model can learn accurate defect recognition capability. The types of welding defects include welding cracks, lack of penetration, slag inclusions, air holes, explosions, pinholes, pits, bumps, polarized light, and black spots.
Step 3, training a three-dimensional convolutional neural network model: the three-dimensional convolutional neural network model is trained using the prepared training data set. In the training process, the output of the model is calculated by adopting a forward propagation algorithm and compared with the real mark. The parameters of the model are then adjusted by a back propagation algorithm to minimize the differences between the number, location and kind of defects predicted by the output layer and the real marks. The above is iterated until the performance of the model meets the production requirements.
Step 4, evaluating the accuracy of model prediction: during the training process, a loss function is used to evaluate the accuracy of model predictions. The loss function can quantify the difference between the model predictions and the true signature and provide a basis for adjusting the model parameters. Model parameters are updated according to the gradient of the loss function to further optimize the performance of the model.
Step 5, iterative training until reaching a preset standard: repeating steps 3 and 4, and continuously training and adjusting the model until the performance of the model on the verification set reaches a predetermined standard or the training reaches a predetermined iteration number.
Step 6, saving the trained model: after the performance of the model on the verification set reaches a preset standard or training reaches a preset iteration number, the trained model is stored.
The method for evaluating the performance of the defect recognition model comprises the following steps: a test dataset containing images of the battery cells of known defect number, location and type is prepared, the test dataset being independent of the training dataset, for objectively evaluating the recognition capabilities of the model. Each image in the data set is accurately marked, so that the accuracy of defect information is ensured. And performing defect recognition on the images in the test data set by using the trained defect recognition model. The model will output the number, location and type of defects predicted in each image.
The number, location and type of defects predicted by the model are compared to the number, location and type of defects known in the test dataset. By comparing the prediction result with the real label, the accuracy rate, recall rate and F1 fraction of model identification can be calculated. The accuracy is the ratio of the number of defects correctly identified by the model to the total number of defects identified, and reflects the accuracy of model identification. The recall rate is the ratio of the number of defects correctly identified by the model to the total number of real defects, and reflects the detection capability of the model to the defects. The F1 score is the harmonic mean of the accuracy and the recall rate, and the F1 score comprehensively considers the accuracy and the detectability of the model, so that the model is a more comprehensive performance index. According to the calculation results of the accuracy, the recall rate and the F1 score, the performance of the model can be objectively evaluated. If the accuracy, recall rate and F1 score of the model are all higher, the model has better performance in the task of identifying the defects of the battery piece, and the number, the position and the types of the defects can be accurately identified. Conversely, if these metrics are low, then further optimization of the model structure or training process is required to improve its recognition capabilities.
By the method, the machine learning module can effectively identify the welding defects in the battery piece so as to improve the quality and reliability of the product.
The report generation module designs a report template according to a preset format and structure, and the content comprising the template comprises a battery piece image, a defect identification result, detection parameters and detection time.
In order to intuitively display the detection object, the template comprises the insertion position of the battery piece image. And when the report is actually generated, the battery piece image acquired during detection is inserted into the corresponding position.
The defect recognition results detail all defects detected by the defect recognition model, including information on the number, location, type, and possibly severity of the defects.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
Although embodiments of the present invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made therein without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.