Weld defect detection method and device, electronic equipment and readable storage medium
By combining adaptive threshold and fixed threshold algorithms for weld feature extraction and defect identification, and using multi-layer neural perception algorithm models to determine defect types, the problems of high error judgment and low accuracy of weld automatic detection in the prior art are solved, and efficient and accurate weld defect detection is achieved.
Patent Information
- Application Number
- CN202410874493.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2025-06-17
AI Technical Summary
The prior art has a high probability of misjudgment in automatic detection of welds and low detection accuracy, especially when the edge contrast is insufficient and the reflectivity is inconsistent.
Using a combination of adaptive threshold algorithm and fixed threshold algorithm, feature extraction and defect recognition are performed on weld images, and the defect type is further judged through the multi-layer neural perception algorithm model.
It reduces the probability of misjudgment of weld defect detection, improves detection accuracy, and is suitable for complex and variable weld images.
Smart Images

Figure CN120163759A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of automatic detection of battery packs, and particularly relates to a method, device, electronic device and readable storage medium for detecting weld defects. Background Art
[0002] In recent years, as an important part of new energy energy storage systems, the weld quality of energy storage power battery packs is directly related to the safety, reliability and service life of the battery packs. Defects in the weld appearance may lead to accidents such as the breakdown and liquid leakage of battery poles, and are likely to cause explosions at the aging test stations.
[0003] At present, the detection of weld appearance mainly relies on manual visual inspection, which has the disadvantages of slow detection speed, strong subjectivity and easy fatigue. In the existing weld automatic detection algorithms in related technologies, for the complex and variable appearance defects of welds, misjudgments are likely to occur and the detection accuracy is relatively low. Summary of the Invention
[0004] Embodiments of this application provide a method, device, electronic device and readable storage medium for detecting weld defects, which can reduce the misjudgment probability of weld defect detection and improve the detection accuracy.
[0005] In a first aspect, this application provides a method for detecting weld defects, which may include:
[0006] Extract weld features from the weld image to be detected to determine the weld area in the weld image; for the weld area, use an adaptive threshold algorithm to determine the suspected defect area in the weld area; for the suspected defect area, use a fixed threshold algorithm to determine the pending defect area in the suspected defect area; when the area ratio of the pending defect area to the suspected defect area exceeds a preset ratio threshold, it is determined that there are weld defects in the weld area of the weld image.
[0007] In a possible implementation manner of the first aspect, for the weld area, using an adaptive threshold algorithm to determine the suspected defect area in the weld area includes:
[0008] For the weld area, use an adaptive threshold algorithm to determine the first feature area; perform feature filtering on the first feature area to determine the suspected defect area in the weld area.
[0009] In a possible implementation manner of the first aspect, after determining that there are weld defects in the weld area of the weld image, the method further includes:
[0010] Input the weld image with weld defects in the weld area into a multi-layer neural perception algorithm model, and after being processed by the multi-layer neural perception algorithm model, output the defect type of the weld defect.
[0011] In a possible implementation of the first aspect, weld features are extracted from the weld image to be detected to determine the weld area in the weld image, including:
[0012] Weld features are extracted from the weld image to be detected to determine the weld edge in the weld image; a curve fitting algorithm is used to fit the weld edge to obtain the weld area.
[0013] In a possible implementation of the first aspect, weld features are extracted from the weld image to be detected to determine the weld edge in the weld image, including:
[0014] For the weld image to be detected, a discrete edge area is extracted; based on the attribute features of the discrete edge area, non-weld areas in the discrete edge area are filtered to obtain a discrete weld area; a closing operation algorithm is used to connect the discrete weld areas to obtain the weld edge.
[0015] In a possible implementation of the first aspect, after weld features are extracted from the weld image to be detected to determine the weld area in the weld image, the method further includes:
[0016] When the weld area is arc-shaped, the inner arc radius and the outer arc radius of the weld area are calculated; based on the comparison result between the inner arc radius, the outer arc radius and the preset process standard data, it is determined whether there are weld defects in the weld area.
[0017] In a possible implementation of the first aspect, before weld features are extracted from the weld image to be detected to determine the weld area in the weld image, the method further includes:
[0018] The obtained initial weld image is preprocessed to obtain the weld image to be detected.
[0019] In a second aspect, an embodiment of the present application provides a weld defect detection device, which may include:
[0020] A feature extraction unit for extracting weld features from the weld image to be detected to determine the weld area in the weld image;
[0021] A first defect extraction unit for using an adaptive threshold algorithm for the weld area to determine a suspected defect area in the weld area;
[0022] A second defect extraction unit for using a fixed threshold algorithm for the suspected defect area to determine a to-be-determined defect area in the suspected defect area;
[0023] A result output unit, configured to determine that there is a weld defect in the weld area of the weld image when the area ratio of the to-be-determined defect area to the suspected defect area exceeds a preset ratio threshold.
[0024] In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method described in the first aspect is implemented.
[0025] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0026] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on a terminal device, the terminal device is enabled to execute the method described in the first aspect above.
[0027] The beneficial effects of the present application compared with the prior art are as follows: After determining the weld area by extracting weld features from the weld image, the method of the present application uses an adaptive threshold algorithm and a fixed threshold algorithm to identify weld defects, which can improve the accuracy of weld defect identification; especially for weld images with insufficient edge contrast where the weld area cannot be accurately identified, and the problem of easy misjudgment due to materials with inconsistent reflectivity, based on a lightweight algorithm, features in the image can be accurately and quickly extracted to achieve high-precision identification of weld defects; it has strong usability and practicality.
[0028] It can be understood that the beneficial effects of the above second aspect to fifth aspect can refer to the relevant descriptions in the first aspect and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0030] Figure 1 It is a schematic diagram of the overall architecture of the weld defect detection method provided by an embodiment of the present application;
[0031] Figure 2 It is a schematic flowchart of the weld defect detection method provided by an embodiment of the present application;
[0032] Figure 3It is a schematic diagram of the effect of the extraction process of the weld area provided by an embodiment of the present application;
[0033] Figure 4 It is a schematic diagram of the effect of the extraction process of the feature area provided by an embodiment of the present application;
[0034] Figure 5 It is a schematic structural diagram of a weld defect detection device provided by an embodiment of the present application;
[0035] Figure 6 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0036] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system structures and technologies are presented to thoroughly understand the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present application.
[0037] It should be understood that when used in the specification and appended claims of the present application, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0038] It should also be understood that the term "and / or" used in the specification and appended claims of the present application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0039] As used in the specification and appended claims of the present application, the term "if" can be interpreted as "when", "once", "in response to determining", or "in response to detecting" according to the context. Similarly, the phrase "if determined" or "if detecting [the described condition or event]" can be interpreted as meaning "once determined", "in response to determining", "once detecting [the described condition or event]", or "in response to detecting [the described condition or event]" according to the context.
[0040] In addition, in the description of the specification and appended claims of the present application, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.
[0041] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that a specific feature, structure, or characteristic described in connection with that embodiment is included in one or more embodiments of this application. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized. The terms "comprising", "including", "having" and their variants all mean "including but not limited to", unless otherwise specifically emphasized.
[0042] Currently, the weld quality of energy storage power battery packs is directly related to the safety, reliability, and service life of the battery packs. It is particularly important to accurately and efficiently detect the appearance of the welds of energy storage power battery packs. Especially for complex and variable weld images with insufficient edge contrast and inconsistent reflectivity due to different materials, it is impossible to accurately identify the weld area, and there are misjudgments of weld defects due to different reflectivities.
[0043] In view of the above defects, the embodiments of this application provide a weld defect detection method. By adopting a lightweight algorithm that combines an adaptive threshold and a fixed threshold, automatic, rapid, and accurate detection of the weld appearance can be achieved. The following introduces the specific implementation process of the weld defect detection method through embodiments.
[0044] Please refer to Figure 1 , Figure 1 which is a schematic diagram of the overall architecture of the weld defect detection method provided by the embodiments of this application. As Figure 1 shown, after the electronic device acquires the weld image, it determines the weld area and uses the adaptive threshold algorithm and the fixed threshold algorithm to detect weld defects in the weld area.
[0045] When it is detected that there are weld defects in the weld area, the weld image with weld defects can also be input into the neural network model to identify the type of weld defects and output the defect type.
[0046] In the embodiments of this application, when extracting the weld defect features, by combining the use of the adaptive threshold algorithm and the fixed threshold algorithm, the misjudgment probability caused by light and dark contrast can be reduced.
[0047] Moreover, when a weld defect is detected, the neural network model can be used to further determine the type of the defect. Based on a lightweight algorithm, it is possible to quickly and accurately determine whether there is a weld defect, and then the neural network model is used to identify the weld defect. Compared with the existing method of directly inputting the weld image into the neural network model for defect detection and identification, in this application, it is not necessary to input each weld image into the neural network model for identification, thereby improving the accuracy of weld defect detection and also improving the detection efficiency.
[0048] Based on the above overall implementation process, an embodiment of this application provides a weld defect detection method. The following introduces the specific process of implementing this method through the embodiments of this application.
[0049] Please refer to Figure 2 , Figure 2 which is a schematic flowchart of the weld defect detection method provided by an embodiment of this application. As Figure 2 shown, the method includes the following steps:
[0050] S201, extract weld features from the weld image to be detected, and determine the weld area in the weld image.
[0051] In some embodiments, in the welding application of energy storage power battery packs, the detection of weld quality and the identification of weld types are of great significance for improving the production quality of battery packs and ensuring the use safety. Among them, the weld features may include features such as edge position, color, and texture.
[0052] Exemplarily, through an image processing algorithm, the weld image is processed to extract weld features and determine the weld area in the weld image. For example, based on an edge extraction algorithm, the weld edge area is extracted. Based on the weld edge area, non-weld areas are filtered out, the weld areas are connected, the weld edge is determined, and then the weld edge is fitted to determine the accurate position of the weld area in the weld image.
[0053] Among them, the edge extraction algorithm may include the Gaussian-Laplace algorithm, the Canny edge detection algorithm, and the local binary pattern algorithm, etc.
[0054] In some embodiments, before extracting weld features from the weld image to be detected and determining the weld area in the weld image, the method further includes:
[0055] Perform image preprocessing on the obtained initial weld image to obtain the weld image to be detected.
[0056] Exemplarily, preprocessing the collected initial weld image may include image enhancement, denoising, normalization, etc., to improve the image quality and reduce the sensitivity of subsequent image processing algorithms to noise.
[0057] Among them, when collecting the initial weld image, a large number of initial weld images with different qualities can be collected. These initial weld images contain different types of welds, such as normal welds, defective welds, etc.; for a large number of initial weld images, the process of image preprocessing can also be optimized and adjusted, so that for the weld image data in different application scenarios, the weld features can be extracted more accurately and the weld defects can be detected, improving the generalization ability of weld defect detection and being applicable to various actual welding conditions and environments.
[0058] In some embodiments, for the weld image to be detected, weld feature extraction is performed to determine the weld area in the weld image, including:
[0059] For the weld image to be detected, weld feature extraction is performed to determine the weld edge in the weld image; a curve fitting algorithm is used to fit the weld edge to obtain the weld area.
[0060] Exemplarily, by using the Laplacian of Gaussian algorithm, the weld edge area is extracted; the weld image is smoothed by the Laplacian of Gaussian algorithm to reduce noise; then the edge detection is performed by finding the zero-crossing points of the second derivative of the image. For the weld image, by using the Laplacian of Gaussian algorithm, the change rate of the rapid change of the image intensity of the weld edge can be calculated, such as the change of the reflection intensity and the light-dark contrast. The change of this image intensity corresponds to the edge or contour of the image, so as to realize the detection of the weld edge.
[0061] Exemplarily, since there may be serious partial reflection in the weld area, there will be a small part of the extracted weld edge missing, and the determined weld edge may be serrated. Therefore, the curve fitting algorithm is used to fit the weld edge again to obtain the weld area; for example, using the least squares method to fit the trajectory of the weld, a regular weld edge can be fitted, so as to determine the accurate position of the weld area in the image.
[0062] In some embodiments, for the weld image to be detected, weld feature extraction is performed to determine the weld edge in the weld image, including:
[0063] For the weld image to be detected, the discrete edge area is extracted; based on the attribute features of the discrete edge area, the non-weld areas in the discrete edge area are filtered to obtain the discrete weld area; a closing operation algorithm is used to connect the discrete weld areas to obtain the weld edge.
[0064] Exemplarily, such as Figure 3For the binary image shown, the extracted weld features may include discrete edge regions. In the extracted discrete edge regions, there may be non-weld regions. For example, after image processing, the weld region appears as discrete speckles, and there are also feature objects in the extracted feature region that do not meet the weld feature requirements, such as long strip regions. By setting the thresholds for various parameters such as shape, height, width, and area, the non-weld regions are filtered to remove the non-weld regions in the weld feature region. For example, the regions with a height exceeding the preset height threshold are filtered out, the long strip regions are filtered out, the regions with an area larger than the preset area threshold are filtered out, etc., and the regions that meet the threshold requirements are filtered out. As Figure 3 shown, by filtering out the objects to be filtered, a discrete weld region can be obtained.
[0065] Correspondingly, for the discrete weld region, a closing operation algorithm can be adopted. During the process of using the closing operation algorithm, the individual offline weld regions can be first dilated to connect the discrete weld regions; then the connected regions are eroded to obtain the weld edge. By first performing the dilation operation and then the erosion operation, the isolated dark spots in the feature image can be eliminated; the feature image can also be smoothed to improve the extracted weld edge.
[0066] As Figure 4 shown in, after edge feature extraction, filtering of the non-weld regions, and closing operation processing, the connected weld regions are obtained. Through the above processing, the probability of misjudgment caused by the connection of non-weld regions and weld regions can be reduced, and the accuracy of weld defect detection is improved.
[0067] S202. For the weld region, an adaptive threshold algorithm is adopted to determine the suspected defect regions in the weld region.
[0068] In some embodiments, the adaptive threshold algorithm is an image segmentation method that sets different thresholds based on local features, and sets the threshold according to the local gray value distribution around each pixel point in the weld region to achieve the segmentation of the weld region. For weld regions with large light and shadow changes and insignificant color differences, the detailed information of the weld features in the weld region can be better retained.
[0069] Exemplarily, by traversing each pixel point in the weld region, an adaptive threshold is set according to the gray value distribution in the surrounding region of the pixel point. When the gray value of the pixel point is higher than the adaptive threshold, it is marked as a normal pixel point in the weld region. When the gray value of the pixel point is lower than the adaptive threshold, it is marked as a pixel point in the suspected defect region. Based on the set adaptive threshold, the gray values of different pixel points are marked to achieve region segmentation. For example, when the gray value of the pixel point is higher than the adaptive threshold, the gray value of the pixel point is set to 255; when the gray value of the pixel point is lower than the adaptive threshold, the gray value of the pixel point is set to 0.
[0070] For example, by analyzing features such as the gray value, texture, and shape of the weld region, a gray value range or a texture feature threshold is set, and the region that does not conform to the gray value range or the texture feature threshold is marked as a suspected defect region. As Figure 4 shown, the suspected defect region determined in the weld region.
[0071] Through the above adaptive threshold algorithm, an adaptive threshold is set according to the local features in the weld region, which can adapt to weld images under different lighting conditions, different materials, and different welding processes. Since the threshold is set based on local features and more attention is paid to the details of weld features, the division between the normal weld region and the suspected defect region is more detailed, achieving a better binarization effect.
[0072] In some embodiments, for the weld region, an adaptive threshold algorithm is adopted to determine the suspected defect region in the weld region, including:
[0073] For the weld region, an adaptive threshold algorithm is adopted to determine the first feature region; feature filtering is performed on the first feature region to determine the suspected defect region in the weld region.
[0074] Exemplarily, in the process of determining the suspected defect region by using the adaptive threshold algorithm, the first feature region can be initially determined based on the adaptive threshold algorithm; for the first feature region, the opening and closing operation algorithm and feature filtering are adopted to extract the suspected defect region in the weld region.
[0075] Among them, in the process of adopting the opening and closing operation algorithm, the first feature region is processed by first eroding and then dilating. Through the erosion operation, objects with smaller structural elements (such as units containing a certain number of pixel points) in the first feature region are eliminated, the adhered objects are disconnected, and the boundaries of the objects are shrunk; through the dilation operation, the pixels removed by the erosion operation in the structural elements are restored, so that smaller features can be eliminated, the suspected weld defect region can be more carefully separated, and at the same time, the boundaries of objects with larger structural elements in the suspected weld defects are smoothed.
[0076] By adopting the above opening and closing operation algorithm and reasonably selecting the structuring element (used to define the size and shape of erosion and dilation operations) to process the first feature region, the suspected defect region in the weld region can be effectively extracted through the opening and closing operation.
[0077] S203. For the suspected defect region, adopt the fixed threshold algorithm to determine the pending defect region in the suspected defect region.
[0078] In some embodiments, for the suspected defect region extracted through careful division, further image processing is performed by adopting the fixed threshold algorithm to determine the pending defect region in the suspected defect region.
[0079] Exemplarily, the suspected defect region may include real defects or some non-defect regions with similar characteristics; by adopting the fixed threshold algorithm, the suspected defect region is further screened. Among them, the fixed threshold can be set based on one or more features, such as setting the thresholds of various parameters based on brightness, contrast, area, and shape.
[0080] Exemplarily, as Figure 4 shown in the pending defect region; for the pixel points in the suspected defect region, calculate the relevant feature values related to the above various parameters and compare the relevant feature values with the preset fixed threshold. If the gray value of some sub-regions (pixel point sets) in the suspected defect region exceeds the fixed threshold, then determine that the sub-region is a pending defect region; if it is lower than the fixed threshold, then exclude the sub-region.
[0081] It should be noted that the above Figure 3 and Figure 4 schematic diagrams of the feature extraction effects are only for exemplary illustration and do not limit the feature performance of the actual processing process. For weld images under different welding conditions and environments, different feature extraction effects may be shown. The setting of the above fixed threshold can be set according to the actual application scenario or historical data. For example, for the brightness feature, the fixed threshold can be set according to the brightness difference between the normal region and the defect region of the weld feature.
[0082] S204. When the area ratio of the pending defect region to the suspected defect region exceeds the preset ratio threshold, it is determined that there is a weld defect in the weld region of the weld image.
[0083] In some embodiments, to ensure the accuracy and reliability of weld defect detection, the calculation process of the area ratio of the pending defect region extracted based on a fixed threshold is increased, so as to exclude some regions with certain defect characteristics but too small in area to constitute actual defects, reduce the misjudgment probability caused by noise, illumination, or other non-defect factors, and thus ensure that defects having an actual impact on the overall weld region are detected, improving the detection accuracy and effectiveness.
[0084] Exemplarily, based on the positions of the pixel points in the suspected defect region and the pending defect region, the area of the suspected defect region and the area of the pending defect region are obtained through integral operation, and then the area ratio of the pending defect region to the area of the suspected defect region is calculated. The ratio threshold can be set to 50%, or other applicable ratio thresholds can be set according to the different degrees of influence of defect characteristics on the weld in the actual application scenario, such as 45%, 55%, etc.
[0085] Exemplarily, the ratio threshold can be set based on the actual application scenario requirements of the user. For example, different application scenarios may have different requirements for the defect determination criteria, so it can be flexibly adjusted based on the actual application situation to meet the actual detection needs. By setting the ratio threshold, the severity of the defect can be further evaluated, providing data support for subsequent repair or treatment.
[0086] Exemplarily, the above ratio threshold is only for illustration. For example, the ratio threshold of the pending defect region relative to the weld region can also be set, and specifically, it can be set based on the actual application scenario needs. For example, it can be set for weld images with different resolutions or different scales.
[0087] Compared with the traditional algorithm, for a weld image with insufficient edge contrast, the weld trajectory cannot be accurately fitted; once there is a certain light and dark contrast in the weld region, it will be regarded as a defect, or in the face of materials with inconsistent reflectivity, misjudgment is likely to occur. In the embodiments of the present application, by combining the adaptive threshold algorithm and the fixed threshold algorithm to detect weld defects, it can be flexibly applied to various complex or highly variable application scenarios.
[0088] In some embodiments, after performing weld feature extraction on the weld image to be detected and determining the weld region in the weld image, the method further includes:
[0089] When the weld region is arc-shaped, calculate the inner arc radius and the outer arc radius of the weld region; based on the comparison result of the inner arc radius, the outer arc radius and the preset process standard data, determine whether there are weld defects in the weld region.
[0090] Exemplarily, for the weld images at specific positions or with specific shapes on the battery pack, corresponding process standard data can be set, and the shape of the extracted weld area is compared with the preset process standard data to determine whether the weld area meets the process standard data; when it does not meet the process standard data, it is determined that there is a defect in the weld.
[0091] As Figure 3 shown, when the weld area is arc-shaped, the preset process standard data may include data such as the preset inner arc radius and the preset outer arc radius of the weld. By calculating the inner arc radius and the outer arc radius of the weld area and comparing them with the preset inner arc radius and the preset outer arc radius respectively, if the comparison results are the same or within the preset error range, it is determined that there is no weld defect in the weld area; otherwise, it is determined that there is a weld defect.
[0092] In some embodiments, after determining that there is a weld defect in the weld area in the weld image, the method further includes:
[0093] Inputting the weld image with a weld defect in the weld area into a multi-layer neural perception algorithm model, and after being processed by the multi-layer neural perception algorithm model, outputting the defect type of the weld defect.
[0094] Exemplarily, the multi-layer neural perception algorithm model is a neural network model for identifying defect types, and may include an input layer, a hidden layer, and an output layer. Among them, the output layer receives the image with weld defect features, such as receiving feature data such as pixel values and defect shapes in the weld defect area, performs feature extraction and conversion through the hidden layer, and the output layer outputs the classification result, that is, the defect type.
[0095] Exemplarily, the multi-layer neural perception algorithm model includes an input layer, a hidden layer, and an output layer; the activation function of the output layer can be a sigmoid function (Sigmoid function) or a rectified linear unit (ReLU) function. Based on the output probability value, the defect type is determined; the loss function can be a cross-entropy loss function or other types of functions, which is used in the training process. When the value of the loss function is determined to be the smallest or converges, the trained multi-layer neural perception algorithm model is obtained.
[0096] Exemplarily, based on the Multilayer Perceptron (MLP) model, the obtained weld defect area is trained to label the defect types, and a classification model is obtained. The model is called to classify the detected weld defects. For example, for each type of weld defect in the weld defect area (such as deviation, explosion point, different color, hole, and crack, etc.), labels are provided. By inputting the weld defect data into the MLP model with accurate label information, the output of the model is calculated through forward propagation, that is, the type of weld defect is predicted; by comparing the output of the model with the true label, the value of the loss function is calculated, the gradient is calculated according to the value of the loss function, and the weights and parameters of the model (such as learning rate, number of iterations, and number of neurons in the hidden layer, etc.) are updated through the backpropagation algorithm. The processes of forward propagation, loss calculation, and backpropagation are repeated, and the value of the loss function is gradually reduced through iterative optimization to improve the classification performance of the model.
[0097] In the embodiments of the present application, based on traditional image processing algorithms and deep learning algorithms, the appearance of the welds of energy storage power battery packs is detected and recognized.
[0098] Through traditional algorithms, the weld image is preprocessed, weld features are extracted, the weld edge trajectory is fitted, and weld defects are extracted, so that the feature information in the weld image can be accurately and quickly extracted, the high-precision recognition of weld quality can be realized, and it can be quickly and accurately determined whether there are weld defects.
[0099] After that, the extracted weld defects can also be classified through deep learning to realize the classification of the recognized weld defects, without processing each weld image with deep learning algorithms, which greatly improves the production efficiency; and based on lightweight image processing algorithms, a large amount of image data can be quickly processed to realize real-time detection.
[0100] In addition, the method provided in the embodiments of the present application also realizes the automation of weld appearance detection, reduces manual intervention, and reduces the influence of human factors; at the same time, it can be extended and optimized according to actual needs to adapt to the weld detection of different types and specifications of battery packs.
[0101] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0102] Corresponding to the weld defect detection method provided in the above embodiments, Figure 5 The structural schematic diagram of the weld defect detection device provided in the embodiments of the present application is shown. For the sake of convenience of description, only the parts related to the embodiments of the present application are shown.
[0103] Refer to Figure 5, the device includes:
[0104] A feature extraction unit 51, configured to perform weld feature extraction on a weld image to be detected, and determine a weld area in the weld image;
[0105] A first defect extraction unit 52, configured to determine a suspected defect area in the weld area by using an adaptive threshold algorithm for the weld area;
[0106] A second defect extraction unit 53, configured to determine a pending defect area in the suspected defect area by using a fixed threshold algorithm for the suspected defect area;
[0107] A result output unit 54, configured to determine that there is a weld defect in the weld area of the weld image when the area ratio of the pending defect area to the suspected defect area exceeds a preset ratio threshold.
[0108] In a possible implementation manner, the first defect extraction unit 52 is further configured to determine a first feature area by using an adaptive threshold algorithm for the weld area; perform feature filtering on the first feature area to determine the suspected defect area in the weld area.
[0109] In a possible implementation manner, the device further includes a defect type detection unit, configured to input a weld image with a weld defect in the weld area into a multi-layer neural perception algorithm model, and output the defect type of the weld defect after being processed by the multi-layer neural perception algorithm model.
[0110] In a possible implementation manner, the feature extraction unit 51 is configured to perform weld feature extraction on a weld image to be detected, determine a weld edge in the weld image; use a curve fitting algorithm to fit the weld edge to obtain the weld area.
[0111] In a possible implementation manner, the feature extraction unit 51 is configured to extract a discrete edge area for the weld image to be detected; filter non-weld areas in the discrete edge area based on the attribute features of the discrete edge area to obtain a discrete weld area; use a closing operation algorithm to connect the discrete weld area to obtain the weld edge.
[0112] In a possible implementation manner, the result output unit 54 is further configured to calculate an inner arc radius and an outer arc radius of the weld area when the weld area is arc-shaped; determine whether there is a weld defect in the weld area based on the comparison result of the inner arc radius, the outer arc radius and preset process standard data.
[0113] In a possible implementation, the device further includes: a preprocessing unit, configured to perform image preprocessing on the acquired initial weld image to obtain the weld image to be detected.
[0114] Through the embodiments of the present application, when extracting the weld defect features, by combining the adaptive threshold algorithm and the fixed threshold algorithm, the misjudgment probability caused by illumination and light and dark contrast can be reduced; and when a weld defect is detected, the neural network model is used to further determine the defect type. Based on the lightweight algorithm, it can quickly and accurately determine whether there is a weld defect. Compared with the existing method of directly inputting the weld image into the neural network model for defect detection and recognition, the present application does not need to input each weld image into the neural network model for recognition, thereby improving the accuracy of weld defect detection while also improving the detection efficiency.
[0115] Figure 6 FIG. 6 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. As Figure 6 shown, the electronic device 6 in this embodiment includes: at least one processor 60 ( Figure 6 only one is shown in the figure), a memory 61, and a computer program 62 stored in the memory 61 and executable on the at least one processor 60. When the processor 60 executes the computer program 62, the steps in the above embodiments are implemented.
[0116] The electronic device 6 may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art can understand that Figure 6 this is only an example of the electronic device 6 and does not constitute a limitation on the electronic device 6. It may include more or fewer components than shown in the figure, or combine some components, or different components. For example, it may also include input / output devices, network access devices, etc.
[0117] The so-called processor 60 may be a central processing unit (CPU), and the processor 60 may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0118] In some embodiments, the memory 61 may be an internal storage unit of the electronic device 6, such as a hard disk or memory of the electronic device 6. In other embodiments, the memory 61 may also be an external storage device of the electronic device 6, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 6. Further, the memory 61 may also include both an internal storage unit and an external storage device of the electronic device 6. The memory 61 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 61 may also be used to temporarily store data that has been output or is to be output.
[0119] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0120] It should be noted that the structure of the above-mentioned electronic device is only illustrative, and based on different application scenarios, it may also include other physical structures, and the physical structure of the electronic device is not limited here.
[0121] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0122] In the above embodiments, the descriptions of the respective embodiments have their own focuses. For parts not described in detail or recorded in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
[0123] The embodiments of the present application further provide a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the steps in the above various method embodiments can be implemented.
[0124] The embodiments of the present application provide a computer program product, and when the computer program product runs on an electronic device, the electronic device is enabled to implement the steps in the above various method embodiments when executed.
[0125] The device, electronic device, computer storage medium, and computer program product provided in the above embodiments of the present application are all used to execute the method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects corresponding to the method provided above, and will not be elaborated here.
[0126] It should be understood that the above is only to help those skilled in the art better understand the embodiments of the present application, rather than to limit the scope of the embodiments of the present application. Those skilled in the art can obviously make various equivalent modifications or changes according to the above examples given. For example, some steps in the various embodiments of the above detection method may not be necessary, or some steps may be newly added, etc. Or any combination of any two or any multiple of the above embodiments. The modified, changed, or combined solutions also fall within the scope of the embodiments of the present application.
[0127] It should also be understood that the division of the manners, situations, categories, and embodiments in the embodiments of the present application is only for the convenience of description and should not constitute a special limitation. The features in various manners, categories, situations, and embodiments can be combined without conflict.
[0128] It should also be understood that in the various embodiments of the present application, if there is no special explanation and logical conflict, the terms and / or descriptions between different embodiments are consistent and can be mutually referred to, and the technical features in different embodiments can be combined to form new embodiments according to their internal logical relationships.
[0129] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present application.
[0130] In the embodiments provided in the present application, it should be understood that the disclosed device / network device and method can be implemented in other ways. For example, the device / network device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in electrical, mechanical or other forms.
[0131] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0132] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
[0133] Finally, it should be noted that the above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or replacements within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A weld defect detection method, characterized in that: The method comprises: Extract weld features from the weld image to be detected, and determine the weld area in the weld image; For the weld area, an adaptive threshold algorithm is used to determine a suspected defect area in the weld area; For the suspected defect area, a fixed threshold algorithm is used to determine a pending defect area in the suspected defect area; When the area ratio of the pending defect area to the suspected defect area exceeds a preset ratio threshold, it is determined that a weld defect exists in the weld area in the weld image.
2. The method according to claim 1, characterized in that The method of using an adaptive threshold algorithm to determine a suspected defect area in the weld area includes: For the weld area, an adaptive threshold algorithm is used to determine a first characteristic area; Feature filtering is performed on the first feature area to determine the suspected defect area in the weld area.
3. The method according to claim 1, characterized in that After determining that a weld defect exists in the weld region in the weld image, the method further includes: The weld image with weld defects in the weld area is input into a multi-layer neural perception algorithm model, and after being processed by the multi-layer neural perception algorithm model, the defect type of the weld defect is output.
4. The method according to claim 1, characterized in that The step of extracting weld features from the weld image to be detected and determining the weld area in the weld image includes: Extract weld features from the weld image to be detected, and determine the weld edge in the weld image; A curve fitting algorithm is used to fit the weld edge to obtain the weld area.
5. The method according to claim 4, characterized in that The step of extracting weld features from the weld image to be detected and determining the weld edge in the weld image includes: Extracting discrete edge regions from the weld image to be detected; Based on the attribute characteristics of the discrete edge region, filtering the non-weld region in the discrete edge region to obtain a discrete weld region; The discrete weld areas are connected by a closing algorithm to obtain the weld edge.
6. The method according to claim 1, characterized in that After extracting weld features from the weld image to be detected and determining the weld area in the weld image, the method further includes: When the weld area is arc-shaped, calculating the inner arc radius and the outer arc radius of the weld area; Based on the comparison result of the inner arc radius, the outer arc radius and the preset process standard data, it is determined whether there is a weld defect in the weld area.
7. The method according to any one of claims 1 to 6, characterized in that Before extracting weld features from the weld image to be detected and determining the weld area in the weld image, the method further includes: The acquired initial weld image is subjected to image preprocessing to obtain the weld image to be detected.
8. A weld defect detection device, characterized in that: include: A feature extraction unit, used to extract weld features from the weld image to be detected, and determine the weld area in the weld image; A first defect extraction unit is used to determine a suspected defect area in the weld area by using an adaptive threshold algorithm for the weld area; A second defect extraction unit is used to determine a pending defect area in the suspected defect area by using a fixed threshold algorithm for the suspected defect area; The result output unit is used to determine that there is a weld defect in the weld area in the weld image when the area ratio of the pending defect area to the suspected defect area exceeds a preset ratio threshold.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.