Weld defect detection method and device, electronic equipment and storage medium
By evaluating and pre-processing the weld image, the problems of low efficiency and low accuracy of weld defect detection in the prior art are solved, and efficient and accurate defect detection is achieved.
Patent Information
- Application Number
- CN202311649425.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-04
- Publication Date
- 2025-06-06
AI Technical Summary
In the prior art, weld defect detection efficiency and low accuracy lead to problems such as false detection and missed inspection.
By performing quality evaluation on the weld image to be detected, if the evaluation score is less than the threshold, image preprocessing is performed, including noise reduction and edge enhancement, and defect detection is performed after image quality is improved.
It improves the accuracy and efficiency of weld defect detection, reduces the occurrence of false detection and missed detection, and can obtain defect detection results quickly and accurately.
Smart Images

Figure CN120107142A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of defect detection, and in particular to a weld defect detection method, device, electronic equipment and storage medium. Background Art
[0002] Defect detection of pipeline welds is an important part of preventing pipeline failure. Pipeline weld defect detection aims to timely detect and evaluate defects in welds to ensure that welding quality meets requirements and improve the reliability and safety of pipeline systems.
[0003] Currently, most of the defects are detected by obtaining X-ray films of pipeline welds and manually judging whether there are defects. However, the number of X-ray films is usually large, resulting in low detection efficiency, and manual judgment is highly subjective, which is prone to problems such as false detection and missed detection. Summary of the invention
[0004] The present invention provides a weld defect detection method, device, electronic equipment and storage medium, which are used to solve the defects of low detection efficiency and low accuracy in the prior art.
[0005] The present invention provides a weld defect detection method, comprising:
[0006] Determine the weld image to be inspected;
[0007] Performing quality assessment on the weld image to be inspected to obtain a quality assessment score;
[0008] When the quality assessment score is less than a threshold value, performing image preprocessing on the weld image to be detected so that the quality assessment score corresponding to the preprocessed weld image to be detected is greater than or equal to the threshold value;
[0009] Defect detection is performed on the preprocessed weld image to be detected to obtain a defect detection result.
[0010] According to a weld defect detection method provided by the present invention, the image preprocessing of the weld image to be detected comprises:
[0011] Performing noise reduction processing on the weld image to be detected to obtain a noise-reduced image;
[0012] A weld area image is extracted from the denoised image, and edge enhancement is performed on the weld area image.
[0013] According to a weld defect detection method provided by the present invention, the denoising process is performed on the weld image to be detected to obtain a denoised image, comprising:
[0014] Based on the bilateral filtering algorithm, the weld image to be detected is subjected to noise reduction processing to obtain the noise reduced image.
[0015] According to a weld defect detection method provided by the present invention, the weld area image is extracted from the denoised image based on an image binarization segmentation algorithm.
[0016] According to a weld defect detection method provided by the present invention, the quality assessment of the weld image to be detected is performed to obtain a quality assessment score, including:
[0017] A quality assessment is performed based on at least one of the resolution, color depth, and image distortion of the weld image to be inspected to obtain the quality assessment score.
[0018] According to a weld defect detection method provided by the present invention, the defect detection is performed on the preprocessed weld image to be detected to obtain the defect detection result, including:
[0019] Inputting the preprocessed weld image to be detected into a defect detection model to obtain the defect detection result output by the defect detection model;
[0020] The defect detection model is trained based on sample weld images and corresponding defect labels.
[0021] According to a weld defect detection method provided by the present invention, the method further comprises:
[0022] When the quality assessment score is greater than or equal to the threshold, defect detection is performed on the weld image to be detected to obtain a defect detection result.
[0023] The present invention also provides a weld defect detection device, comprising:
[0024] A determination unit, used for determining the weld image to be detected;
[0025] An evaluation unit, used for performing a quality evaluation on the weld image to be detected to obtain a quality evaluation score;
[0026] A processing unit, configured to perform image preprocessing on the weld image to be detected when the quality assessment score is less than a threshold value, so that the quality assessment score corresponding to the preprocessed weld image to be detected is greater than or equal to the threshold value;
[0027] The detection unit is used to perform defect detection on the preprocessed weld image to be detected to obtain a defect detection result.
[0028] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a weld defect detection method as described above is implemented.
[0029] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the weld defect detection method as described in any one of the above is implemented.
[0030] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the weld defect detection method as described above is implemented.
[0031] The weld defect detection method, device, electronic device and storage medium provided by the present invention perform image preprocessing on the weld image to be detected when the quality assessment score is less than a threshold value, thereby enhancing the details of the weld image to be detected, greatly increasing the strength and accuracy of defect recognition, and further being able to accurately and quickly obtain defect detection results based on the preprocessed weld image to be detected. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 It is a schematic diagram of the process of the weld defect detection method provided by the present invention;
[0034] Figure 2 It is a schematic diagram of the process of the image edge enhancement method provided by the present invention;
[0035] Figure 3 It is a structural schematic diagram of a weld defect detection device provided by the present invention;
[0036] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0038] Currently, most of the defects are detected by obtaining X-ray films of pipeline welds and manually judging whether there are defects. However, the number of X-ray films is usually large, resulting in low detection efficiency, and manual judgment is highly subjective, which is prone to problems such as false detection and missed detection.
[0039] To this end, the present invention provides a weld defect detection method. Figure 1 Schematic diagram of the process of the weld defect detection method provided by the present invention, such as Figure 1 As shown, the method comprises the following steps:
[0040] Step 110: Determine the weld image to be inspected.
[0041] Here, the weld image to be detected is an image that needs to be inspected for weld defects. The weld image to be detected can be an image scanned by a scanner, or taken by a high-speed scanner, a mobile device, etc., or an image downloaded from the Internet, or an image received from a device, or an image in a video. Exemplarily, the weld image to be detected can be an image imported by a user from other devices, for example, a user imports an image in a Universal Serial Bus (USB) flash drive into an electronic device, so that the electronic device obtains the image, that is, the electronic device obtains the weld image to be detected.
[0042] Step 120: Perform quality assessment on the weld image to be inspected to obtain a quality assessment score.
[0043] Specifically, quality assessment refers to performing quality assessment on the weld image to be inspected to obtain a quality assessment score for characterizing the quality of the weld image to be inspected. The quality assessment methods may include contrast assessment, sharpness assessment, noise assessment, detail retention assessment, saturation assessment, uniformity assessment, etc.
[0044] Optionally, the weld image to be inspected can be input into a pre-trained quality assessment model, and the quality assessment model can perform quality assessment on the weld image to be inspected to obtain a quality assessment score; or the corresponding quality assessment scores can be obtained respectively through the above-mentioned different quality assessment methods, and the weighted sum of each quality assessment score can be performed to determine the final quality assessment score.
[0045] Step 130: When the quality assessment score is less than the threshold, the weld image to be inspected is preprocessed so that the quality assessment score corresponding to the preprocessed weld image to be inspected is greater than or equal to the threshold.
[0046] Specifically, the larger the quality assessment score, the better the quality of the weld image to be detected (such as the higher the clarity), and the smaller the quality assessment score, the worse the quality of the weld image to be detected (such as the lower the clarity). When the quality assessment score is less than the threshold, it indicates that the quality of the weld image to be detected is poor, and it is necessary to perform image preprocessing on the weld image to be detected so that the quality assessment score corresponding to the preprocessed weld image to be detected is greater than or equal to the threshold, thereby ensuring the quality of the weld image to be detected, so that the weld defect detection can be accurately performed on the weld image to be detected with good quality.
[0047] Step 140: perform defect detection on the preprocessed weld image to be detected to obtain a defect detection result.
[0048] Specifically, the quality assessment score of the weld image to be detected after preprocessing is greater than or equal to the threshold, that is, the weld image to be detected after preprocessing has been enhanced in detail, which greatly increases the strength and accuracy of defect recognition, and thus can accurately detect defects based on the weld image to be detected with good quality to obtain defect detection results. Among them, defect detection refers to analyzing and processing the weld image to be detected generated during the welding process to detect possible weld defects in the weld. Weld defects may include weld fractures, pores, slag inclusions, etc.
[0049] Optionally, defect detection can be performed manually on the detail-enhanced weld image to be inspected, thereby obtaining a defect detection result with higher accuracy; or the preprocessed weld image to be inspected can be input into a pre-trained defect detection model, and the defect detection model can be used to identify defects, thereby obtaining a defect detection result with higher accuracy.
[0050] The weld defect detection method provided by the embodiment of the present invention performs image preprocessing on the weld image to be detected when the quality assessment score is less than a threshold value, thereby enhancing the details of the weld image to be detected, greatly increasing the strength and accuracy of defect recognition, and further accurately and quickly obtaining defect detection results based on the preprocessed weld image to be detected.
[0051] Based on the above embodiment, the image preprocessing of the weld image to be inspected includes:
[0052] Performing noise reduction processing on the weld image to be inspected to obtain a noise-reduced image;
[0053] The weld area image in the denoised image is extracted, and the edge of the weld area image is enhanced.
[0054] Specifically, there may be noise in the weld image to be inspected, which may interfere with defect detection. Therefore, the embodiment of the present invention first performs noise reduction processing on the weld image to be inspected to reduce noise and interference in the image and obtain a clean and clear noise-reduced image.
[0055] After obtaining the denoised image, extract the weld-related regional image from the denoised image to avoid interference of other regional images (such as background images) on defect detection, and perform edge enhancement on the weld regional image, so as to highlight the contour features of the weld for accurate weld defect detection. Optionally, the edge enhancement technique Laplace operator can be used to detect and enhance the edges of the three components of the image, and finally the enhanced three components are fused to obtain an image with enhanced edge contours. The edge of the film is detected using the Laplace operator with added edge color constraints and adaptive thresholds, and is generally processed by fusing edge detection with the original image. Figure 2 As shown, the image can be decomposed into three components of R, G and B in the RGB space. Through adaptive threshold and enhancement processing, the edges of the three components are detected, the edge information is obtained and enhanced, and the enhanced three components are edge enhanced and fused to obtain the enhanced image.
[0056] Based on any of the above embodiments, performing noise reduction processing on the weld image to be inspected to obtain a noise-reduced image includes:
[0057] Based on the bilateral filtering algorithm, the weld image to be inspected is subjected to denoising to obtain a denoised image.
[0058] Specifically, the bilateral filtering algorithm is a nonlinear filter that uses a weighted averaging method to process the weld image to be inspected with noise, combining spatial neighborhood information and grayscale similarity values, to achieve the processing effect of maintaining image edges and reducing noise and smoothing. Among them, the weight coefficient of the bilateral filter is jointly determined by the two parameters of spatial variance σs and grayscale variance σr. Therefore, setting appropriate parameters can filter out the noise in the film to obtain a clean and clear denoised image.
[0059] Based on any of the above embodiments, the weld area image is extracted from the denoised image based on an image binarization segmentation algorithm.
[0060] Optionally, the weld area image can be extracted from the denoised image using the Otsu method (OTSU), which is an algorithm for determining the image binarization segmentation threshold, and is used to automatically determine the threshold of the image. It is based on the grayscale histogram of the image and divides the image into two categories (foreground and background) by finding an optimal threshold to maximize the inter-class variance.
[0061] The segmented binary film image is subjected to a connected domain analysis method. The connected domain is screened by parameters such as the shape and area of the weld area, and then the convex hull calculation of the weld boundary is completed. The entire weld area of the weld is extracted to obtain the weld area image.
[0062] Based on any of the above embodiments, quality assessment is performed on the weld image to be inspected to obtain a quality assessment score, including:
[0063] A quality assessment is performed based on at least one of the resolution, color depth, and image distortion of the weld image to be inspected to obtain a quality assessment score.
[0064] Specifically, resolution refers to the number of pixels per unit length in an image. Higher resolution provides more details and clarity, which is very important for weld inspection and evaluation. Generally speaking, the higher the resolution, the better the image quality.
[0065] Color depth refers to the number of colors that each pixel in the image can display. Higher color depth can provide richer color expression capabilities, which is important for capturing weld details and color changes.
[0066] Image distortion may be caused by sensors, acquisition equipment, transmission process or image processing. Common image distortions include noise, blur, artifacts, uneven brightness, etc. Image distortion will cause the details of the weld to be blurred or information to be lost, which will have an adverse effect on quality assessment. Therefore, when evaluating the quality of weld images, it is necessary to consider and minimize image distortion.
[0067] Optionally, resolution, color depth, and image distortion may be used as evaluation indicators, and a certain weight may be defined for each indicator, and finally a comprehensive quality evaluation score may be calculated as the quality evaluation score.
[0068] Based on any of the above embodiments, defect detection is performed on the preprocessed weld image to be detected to obtain a defect detection result, including:
[0069] The preprocessed weld image to be inspected is input into the defect detection model to obtain the defect detection result output by the defect detection model;
[0070] The defect detection model is trained based on sample weld images and corresponding defect labels.
[0071] Specifically, the defect detection model is used to perform defect detection on the preprocessed weld image to be detected to obtain corresponding defect detection results.
[0072] Before inputting the preprocessed weld image to be detected into the defect detection model, the defect detection model can also be pre-trained, which can be achieved by performing the following steps: First, a large number of sample weld images are collected and their corresponding defect labels are determined by manual annotation. Then, the initial model is trained based on the sample weld images and the corresponding defect labels to obtain the defect detection model.
[0073] Based on any of the above embodiments, the method further includes:
[0074] When the quality assessment score is greater than or equal to the threshold, defect detection is performed on the weld image to be inspected to obtain a defect detection result.
[0075] Specifically, when the quality assessment score is greater than or equal to the threshold, it indicates that the quality of the weld image to be detected is good, that is, the details of the weld image to be detected are clear enough, so that defect detection can be performed directly based on the weld image to be detected and the defect detection result can be accurately obtained.
[0076] The weld defect detection device provided by the present invention is described below. The weld defect detection device described below and the weld defect detection method described above can be referenced to each other.
[0077] Based on any of the above embodiments, the present invention also provides a weld defect detection device, such as Figure 3 As shown, the device comprises:
[0078] A determination unit 310 is used to determine a weld image to be detected;
[0079] An evaluation unit 320 is used to perform quality evaluation on the weld image to be inspected to obtain a quality evaluation score;
[0080] The processing unit 330 is used to perform image preprocessing on the weld image to be detected when the quality assessment score is less than the threshold value, so that the quality assessment score corresponding to the weld image to be detected after the preprocessing is greater than or equal to the threshold value;
[0081] The detection unit 340 is used to perform defect detection on the preprocessed weld image to be detected to obtain a defect detection result.
[0082] Figure 4 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 4 As shown, the electronic device may include: a processor 410, a memory 420, a communication interface 430 and a communication bus 440, wherein the processor 410, the memory 420 and the communication interface 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 420 to execute the weld defect detection method, which includes: determining a weld image to be detected; performing quality assessment on the weld image to be detected to obtain a quality assessment score; when the quality assessment score is less than a threshold, performing image preprocessing on the weld image to be detected so that the quality assessment score corresponding to the preprocessed weld image to be detected is greater than or equal to the threshold; performing defect detection on the preprocessed weld image to be detected to obtain a defect detection result.
[0083] In addition, the logic instructions in the above-mentioned memory 420 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0084] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the weld defect detection method provided by the above methods, and the method includes: determining a weld image to be detected; performing quality assessment on the weld image to be detected to obtain a quality assessment score; when the quality assessment score is less than a threshold, performing image preprocessing on the weld image to be detected so that the quality assessment score corresponding to the preprocessed weld image to be detected is greater than or equal to the threshold; performing defect detection on the preprocessed weld image to be detected to obtain a defect detection result.
[0085] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the above-mentioned weld defect detection methods, the methods comprising: determining a weld image to be detected; performing quality assessment on the weld image to be detected to obtain a quality assessment score; when the quality assessment score is less than a threshold, performing image preprocessing on the weld image to be detected so that the quality assessment score corresponding to the preprocessed weld image to be detected is greater than or equal to the threshold; performing defect detection on the preprocessed weld image to be detected to obtain a defect detection result.
[0086] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0087] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0088] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A weld defect detection method, It is characterized in that include: Determine the weld image to be inspected; Performing quality assessment on the weld image to be inspected to obtain a quality assessment score; When the quality assessment score is less than a threshold value, performing image preprocessing on the weld image to be detected so that the quality assessment score corresponding to the preprocessed weld image to be detected is greater than or equal to the threshold value; Defect detection is performed on the preprocessed weld image to be detected to obtain a defect detection result.
2. The weld defect detection method according to claim 1, It is characterized in that The image preprocessing of the weld image to be detected includes: Performing noise reduction processing on the weld image to be detected to obtain a noise-reduced image; A weld area image is extracted from the denoised image, and edge enhancement is performed on the weld area image.
3. The weld defect detection method according to claim 2, It is characterized in that The step of performing noise reduction processing on the weld image to be detected to obtain a noise-reduced image includes: Based on the bilateral filtering algorithm, the weld image to be detected is subjected to noise reduction processing to obtain the noise reduced image.
4. The weld defect detection method according to claim 2, It is characterized in that The weld area image is extracted from the denoised image based on an image binarization segmentation algorithm.
5. The weld defect detection method according to any one of claims 1 to 4, It is characterized in that The step of performing quality assessment on the weld image to be inspected to obtain a quality assessment score includes: A quality assessment is performed based on at least one of the resolution, color depth, and image distortion of the weld image to be inspected to obtain the quality assessment score.
6. The weld defect detection method according to any one of claims 1 to 4, It is characterized in that The defect detection is performed on the preprocessed weld image to be detected to obtain a defect detection result, including: Inputting the preprocessed weld image to be detected into a defect detection model to obtain the defect detection result output by the defect detection model; The defect detection model is trained based on sample weld images and corresponding defect labels.
7. The weld defect detection method according to any one of claims 1 to 4, It is characterized in that The method further comprises: When the quality assessment score is greater than or equal to the threshold, defect detection is performed on the weld image to be detected to obtain a defect detection result.
8. A weld defect detection device, It is characterized in that include: A determination unit, used for determining the weld image to be detected; An evaluation unit, used for performing a quality evaluation on the weld image to be detected to obtain a quality evaluation score; A processing unit, configured to perform image preprocessing on the weld image to be detected when the quality assessment score is less than a threshold value, so that the quality assessment score corresponding to the preprocessed weld image to be detected is greater than or equal to the threshold value; The detection unit is used to perform defect detection on the preprocessed weld image to be detected to obtain a defect detection result.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the weld defect detection method according to any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the weld defect detection method according to any one of claims 1 to 7 is implemented.