A Defect Detection Method Based on X-ray Images of Laser Welds

CN116245869BActive Publication Date: 2026-09-01BEIJING XINGHANG MECHANICAL ELECTRICAL EQUIP CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310296284.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-23
Publication Date
2026-09-01
Estimated Expiration
2043-03-23

AI Technical Summary

Technical Problem

[0004]鉴于上述的分析,本发明实施例旨在提供一种面向激光焊缝X射线图像的缺陷检测方法,用以解决至少以下技术问题之一:1、人工检测速度慢,检测准确性和有效识别率低;2、现有深度学习方法直接对激光焊缝X射线图像的缺陷进行检测,容易出现过拟合,不能学习到缺陷的泛化特征,导致缺陷检测的准确性和有效识别率降低的问题

Benefits of technology

[0029]1、本发明方法通过将激光焊缝X射线图像的缺陷检测拆分为焊缝定位和缺陷识别两个阶段,避免了现有深度学习方法在超大分辨率X射线原图上直接对缺陷进行检测容易出现过拟合且检测速度慢的问题,提高了缺陷检测的准确性和检测速度,对气孔缺陷的检测准确性和有效识别率提高到了99%以上,对其他缺陷的检测准确性和有效识别率达到95%以上。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116245869B_ABST
    Figure CN116245869B_ABST
Patent Text Reader

Abstract

This invention relates to a defect detection method for X-ray images of laser welds, belonging to the field of weld defect detection technology. The method includes: acquiring sample data and establishing an X-ray image dataset; processing the X-ray image dataset to obtain a weld location dataset, inputting it into a YOLOv5 network for training to obtain a weld location model; processing the weld location dataset to obtain a first defect detection dataset, expanding the first defect detection dataset using a negative sample copy-pasting data augmentation method to obtain a second defect detection dataset, inputting it into a YOLOv5 network for training to obtain a defect detection model; inputting the image to be tested into the weld location model to locate its weld region; cropping the weld region of the image to be tested into smaller images using a sliding window method to obtain a series of weld image smalls; inputting the series of weld image smalls into the defect detection model to detect the images; and outputting the final detection result of the defect in the X-ray image of the laser weld to be tested.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of weld defect detection technology, and in particular to a defect detection method for laser weld X-ray images. Background Technology

[0002] With the improvement of industrial manufacturing processes and the continuous development of automation technology, welding technology has evolved from primitive manual forging and welding into diversified intelligent welding technology. It has become an indispensable processing method in fields such as national defense, medical equipment, machinery, high-tech equipment, and navigation and communication, and its application areas are constantly expanding. Laser welding has many advantages, including high power, low loss, long welding distance, wide range of weldable materials, and automated welding process. However, laser welding is a nonlinear, multivariable, complex, time-varying, and dynamic process. It is easily affected by many unstable factors such as poor welding contact, fluctuations in welding process parameters, and improper workpiece clamping, inevitably leading to some defects in the weld. Surface defects in laser welds are generally misalignment and black spots, while internal defects are generally porosity, cracks, and incomplete penetration. Defects such as incomplete penetration, cracks, tungsten inclusions, slag inclusions, and porosity in the weld directly determine the weld quality.

[0003] For the detection of defects in laser welds, non-destructive testing (NDT) is necessary to avoid damaging the weld. X-ray inspection of welds plays a crucial role in NDT. Currently, common methods include: 1) Generating images using film or DR imaging, followed by evaluation of defects by inspectors under the aid of viewing lights or displays. The results of manual judgment depend on the inspector's expertise, and different inspectors may have varying understandings and implementations of the evaluation criteria. Furthermore, prolonged, multi-batch inspections can cause eye fatigue, increasing the probability of missed or false positives. 2) Using deep learning methods to directly detect weld defects and their inherent flaws. However, in actual inspections, the number of images containing defects is small, and the defects themselves are often very small. Direct detection can lead to overfitting in deep learning networks, preventing them from learning the generalized features of defects and resulting in reduced accuracy. Summary of the Invention

[0004] Based on the above analysis, the present invention aims to provide a defect detection method for X-ray images of laser welds to solve at least one of the following technical problems: 1. Manual inspection is slow, and the detection accuracy and effective recognition rate are low; 2. Existing deep learning methods directly detect defects in X-ray images of laser welds, which are prone to overfitting and cannot learn the generalization features of defects, resulting in a decrease in the accuracy and effective recognition rate of defect detection.

[0005] The objective of this invention is mainly achieved through the following technical solutions:

[0006] This invention provides a defect detection method for X-ray images of laser welds, comprising the following steps:

[0007] Step 1: Obtain sample data and establish an X-ray image dataset containing different types of laser weld defects;

[0008] Step 2: Process the X-ray image dataset to obtain a weld location dataset with weld area annotations. Input the weld location dataset into the YOLOv5 network for training to obtain the weld location model.

[0009] Step 3: Cut and process the labeled weld area in the weld location dataset to obtain the first defect detection dataset. Use the negative sample copy-pasting data augmentation method to expand the first defect detection dataset to obtain the second defect detection dataset. Input the second defect detection dataset into the YOLOv5 network for training to obtain the defect detection model.

[0010] Step 4: Input the X-ray image of the laser weld to be tested into the weld positioning model to locate the weld area in the image;

[0011] Step 5: Use a sliding window-based method to crop the weld area of ​​the image to be tested into smaller images to obtain a series of weld images;

[0012] Step 6: Input the series of weld seam images into the defect detection model to detect whether there are defects in the images and the location of the defects;

[0013] Step 7: Output the final detection result of the X-ray image of the laser weld seam to be tested for defects.

[0014] Furthermore, the process of establishing the X-ray image dataset is as follows: collect original X-ray images containing laser weld defects and those without laser weld defects, obtain sample data, the number of original images is greater than 1000, perform linear grayscale processing and format modification on the original images to obtain images with 8-bit grayscale and JPEG format, thus forming an X-ray image dataset.

[0015] Further, step 2 includes:

[0016] S21: Label the weld seam regions of all X-ray images in the X-ray image dataset with rectangular boxes to obtain a weld seam location dataset with weld seam region labels;

[0017] S22: Input the weld seam location dataset into the YOLOv5 network and train it using the Adam optimization algorithm to obtain the weld seam location model.

[0018] Furthermore, the YOLOv5 network consists of an input terminal, a backbone network, a neck network, and an output terminal, wherein the backbone network is a lightweight GhostNet network.

[0019] Further, step 3 includes:

[0020] S31: The weld area marked in each X-ray image in the weld location dataset is cut using a sliding window to obtain a series of small weld images, which are denoted as the first defect detection dataset.

[0021] S32: Use the labelme annotation tool to annotate the images containing defects in the first defect detection dataset with rectangular boxes. For the small images in the first defect detection dataset that do not contain defects, apply the negative sample copy-pasting data augmentation method to expand the first defect detection dataset and obtain the second defect detection dataset.

[0022] S33: Input the second defect detection dataset into the YOLOv5m network for training to obtain the defect detection model.

[0023] Furthermore, in step S31, the length of the sliding window and the length of the series of weld seam diagrams are three times the width of the laser weld seam.

[0024] Furthermore, the step size of the sliding window is 1 / 5 of the length of the sliding window.

[0025] Further, in step S32, the negative sample copy-pasting data augmentation method includes: sequentially selecting a small image in the first defect detection dataset that does not contain defects; randomly selecting N small images in the first defect detection dataset that contain defects, and copying and pasting them to random positions in the weld area of ​​the selected small image that does not contain defects; repeating the above steps until every small image in the first defect detection dataset contains defects.

[0026] Furthermore, in step 5, the size of the series of weld seam thumbnails is equal to the size of the series of weld seam thumbnails obtained by processing the weld seam positioning dataset in step S31.

[0027] Further, step 7 includes: mapping the defect detection result onto the original X-ray image, using non-maximum suppression (NMS) to remove overlapping redundant rectangles, displaying the final defect detection result on the original image, and saving the detection information into the detection text.

[0028] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:

[0029] 1. The method of the present invention divides the defect detection of laser weld X-ray images into two stages: weld location and defect identification. This avoids the problems of overfitting and slow detection speed that existing deep learning methods are prone to when directly detecting defects on ultra-high resolution X-ray original images. It improves the accuracy and speed of defect detection, and increases the detection accuracy and effective identification rate of porosity defects to over 99%, and the detection accuracy and effective identification rate of other defects to over 95%.

[0030] 2. The method of this invention first processes the X-ray image dataset to obtain the weld seam location dataset, and trains the weld seam location model. Then, it processes the weld seam location dataset to obtain the first defect detection dataset. The first defect detection dataset is expanded using the negative sample copy-pasting data augmentation method to obtain the second defect detection dataset, so that each image in the second defect detection dataset has a defect. The defect detection model is then trained, which can avoid the difficulties of insufficient sample data and small defect morphology. This allows the model to learn the generalization features of defects, improves the generalization ability of the network model, and has a high accuracy rate for detecting weld defects caused by other welding methods, with a detection accuracy of over 94%.

[0031] 3. The method of this invention uses deep learning to train the weld positioning model and the defect recognition model in stages. It breaks down the defect detection of laser weld X-ray images into two stages: weld positioning and defect recognition. This solves the problem of slow manual defect interpretation in X-ray images in non-destructive testing and improves the detection speed. It also solves the problem of low accuracy in manual defect interpretation and improves the effective recognition rate of defects. The detection accuracy and effective recognition rate of porosity defects are increased to over 99%, and the detection accuracy and effective recognition rate of other defects reach over 95%.

[0032] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description

[0033] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.

[0034] Figure 1 This is a detailed flowchart of the defect detection method of the present invention;

[0035] Figure 2 This is a schematic diagram of the two-stage defect localization detection model of the defect detection method of the present invention;

[0036] Figure 3 This is a schematic diagram of the laser weld seam area positioning result in Embodiment 1 of the present invention;

[0037] Figure 4 This is a schematic diagram of a laser weld defect according to Embodiment 1 of the present invention;

[0038] Figure 5 This is a schematic diagram of laser weld defects in Embodiment 2 of the present invention;

[0039] Figure 6 This is a schematic diagram of a laser weld defect in Embodiment 3 of the present invention;

[0040] Figure 7 This is a schematic diagram of laser weld defects in Embodiment 4 of the present invention;

[0041] Figure 8 This is a schematic diagram of the electron beam weld area positioning results in Embodiment 5 of the present invention;

[0042] Figure 9 This is a schematic diagram of an electron beam weld defect in Embodiment 5 of the present invention. Detailed Implementation

[0043] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.

[0044] This invention provides a defect detection method for X-ray images of laser welds, comprising the following steps:

[0045] Step 1: Obtain sample data and establish an X-ray image dataset. The X-ray images in the dataset include raw X-ray images of different types of laser weld defects and raw X-ray images of welds without laser defects.

[0046] Step 2: Process the X-ray image dataset to obtain a weld location dataset with weld area annotations. Input the weld location dataset into the YOLOv5 network for training to obtain the weld location model.

[0047] Step 3: Cut and process the labeled weld area in the weld location dataset to obtain the first defect detection dataset. Use the negative sample copy-pasting data augmentation method to expand the first defect detection dataset to obtain the second defect detection dataset. Input the second defect detection dataset into the YOLOv5 network for training to obtain the defect detection model.

[0048] Step 4: Input the X-ray image of the laser weld to be tested into the weld positioning model to locate the weld area in the image;

[0049] Step 5: Use a sliding window-based method to crop the weld area of ​​the image to be tested into smaller images to obtain a series of weld images;

[0050] Step 6: Input the series of weld seam images into the defect detection model to detect whether there are defects in the images and the location of the defects;

[0051] Step 7: Output the final detection result of the X-ray image of the laser weld seam to be tested for defects.

[0052] Specifically, in step 1, raw X-ray images containing different types of laser weld defects and those without laser weld defects are first collected to obtain sample data and establish an X-ray image dataset containing different types of laser weld defects and those without laser weld defects. The acquired raw X-ray image data is generally in DICOM format, which contains basic information about the workpiece being inspected. The image data bit depth is 14 bits, which is not conducive to subsequent processing. Therefore, the 14-bit images are first linearly grayscaled to 8-bit images and saved in JPEG format. It should be noted that the number of sample data collected should be greater than 1000 images, including normal X-ray images of laser welds without defects and X-ray images of laser welds with defects. The laser weld defects in the sample data should include various defect types such as porosity, incomplete penetration, cracks, tungsten inclusions, and slag inclusions.

[0053] Specifically, in step 2, the X-ray image dataset obtained in step 1 is processed to obtain a weld location dataset with weld area annotations. The weld location dataset is then input into the YOLOv5 network for training to obtain a weld location model, including the following steps:

[0054] S21: Label the weld areas of all X-ray images in the X-ray image dataset with rectangular boxes to obtain the labeled weld location dataset;

[0055] S22: Input the weld seam location dataset into the YOLOv5 network and train it using the Adam optimization algorithm to obtain the weld seam location model;

[0056] It should be noted that a YOLOv5 network typically consists of an input, a backbone, a neck, and an output. The backbone is mainly used to extract features from images, and the commonly used one is the CSPDarknet-53 network. In this invention, the YOLOv5 network used to train the weld seam location model uses a lightweight GhostNet network instead of the original CSPDarknet-53 network. Experiments have verified that even with a 48% reduction in the number of network parameters, its average mAP0.5 accuracy did not decrease, still maintaining an mAP0.5 index of 99.5%. The number of network parameters and computational cost decreased significantly, but the detection accuracy remained unchanged.

[0057] Existing deep learning methods directly detect defects in raw X-ray images of laser welds. However, in actual detection, the number of images containing weld defects is relatively small, and the defect morphology is often very small. Most laser welds are defect-free. Therefore, in direct detection, deep learning networks are prone to overfitting and fail to learn the generalization features of defects, leading to reduced accuracy. This invention addresses this issue by providing a rich dataset of X-ray images of defect-free laser welds, as well as X-ray images containing various types of laser weld defects. The weld location model can be trained using this abundant dataset of defect-free X-ray images, overcoming the problems of insufficient sample size and small defect morphology, thereby improving the accuracy and generalization ability of the trained weld location model.

[0058] Specifically, in step 3, the labeled weld areas in the weld location dataset are cut and processed to obtain the first defect detection dataset. The first defect detection dataset is then augmented using the negative sample copy-pasting data augmentation method to obtain the second defect detection dataset. The second defect detection dataset is then input into the YOLOv5 network for training to obtain the defect detection model, including the following steps:

[0059] S31: The weld area marked in each X-ray image in the weld location dataset is cut using a sliding window to obtain a series of small weld images, which are denoted as the first defect detection dataset.

[0060] S32: Use the labelme annotation tool to annotate the images containing defects in the first defect detection dataset with rectangular boxes. For the small images in the first defect detection dataset that do not contain defects, apply the negative sample copy-pasting data augmentation method to expand the first defect detection dataset and obtain the second defect detection dataset.

[0061] S33: Input the second defect detection dataset into the YOLOv5 network for training to obtain the defect detection model;

[0062] It should be noted that in step S31, the weld width can be obtained from the weld area marked in each X-ray image in the weld positioning dataset. Generally, the sliding window length and the side length of the weld image are three times the weld width. The step size of the sliding window is generally 1 / 5 of the sliding window length or the side length of the series of weld images to ensure that the series of weld images have an appropriate overlap rate during cutting. The overlap rate refers to the ratio of the sliding window step size to the side length of the series of weld images. The step size of the sliding window is 1 / 5 of the side length of the series of weld images, that is, the overlap rate of the series of weld images is 0.2. Too high an overlap rate will cause a decrease in detection speed and the problem of repeated detection. Too low an overlap rate will easily cause large defects to be truncated, resulting in missed detection.

[0063] In step S32, the negative sample copy-pasting data augmentation method includes the following steps: sequentially selecting a small image from the first defect detection dataset that does not contain defects; randomly selecting N small images from the first defect detection dataset that contain defects, and copying and pasting them to random positions in the weld area of ​​the small image that does not contain defects; repeating the above steps until every small image in the first defect detection dataset contains defects, thus obtaining the second defect detection dataset, and randomly dividing the images in the second defect detection dataset into a training set, a validation set, and a test set, with a ratio of 8:1:1.

[0064] Specifically, in step 5, the weld area of ​​the X-ray image of the laser weld to be tested is cut using a sliding window to obtain a series of small weld images. The side length of the series of small weld images is equal to the size of the series of small weld images obtained in step S31 by processing the weld positioning dataset. The equality of the two sizes ensures that the series of small weld images obtained after cutting the X-ray image of the laser weld to be tested will not lose defect information due to aspect ratio deformation when they are subsequently input into the defect detection model. The overlap rate of the series of small weld images is also 0.2.

[0065] Specifically, in step 6, the series of weld seam images obtained in step 5 are input into the above defect detection model. The defect detection model will detect whether there is a defect in each image, the type of defect, and the location of the defect. Then, the detected defect type and defect location information are returned to the rectangle surrounding the defect.

[0066] Specifically, in step 7, the defect detection results are mapped onto the original detection image, non-maximum suppression (NMS) is used to remove overlapping and redundant rectangles, the final defect detection results are displayed on the original image, and the detection information is saved to the detection text.

[0067] This invention breaks down defect detection in laser weld X-ray images into two stages: weld location and defect recognition. Separate models are trained for weld location and defect recognition, respectively, avoiding direct defect detection on the original ultra-high resolution image. Directly detecting defects in the original laser weld X-ray image using a deep learning network is problematic because, in practice, the number of images with weld defects is relatively small, and the defects are often minimal. Most laser welds are defect-free, and in direct detection, deep learning networks are prone to overfitting, failing to learn the generalized features of defects, thus reducing the accuracy of defect detection. The sample data of this invention includes a large number of X-ray images of defect-free laser welds and X-ray images of different types of laser weld defects. When training the weld location model, the abundant X-ray images of defect-free laser welds can overcome the problems of insufficient sample size and small defect morphology, thereby improving the accuracy and generalization ability of the trained weld location model. During the training of the defect recognition model, the copy-pasting data augmentation method proposed in this invention is used to effectively expand the defect dataset, ensuring that every image in the final second defect dataset contains weld defects. The large dataset allows the defect detection model to learn the generalization features of defects through training. By decomposing the weld defect detection process in stages, the difficulties of insufficient sample data and small defect morphology can be avoided, thereby improving the generalization ability of the network model. It also achieves high accuracy in detecting weld defects caused by other welding methods.

[0068] Example 1

[0069] The method is illustrated below with specific embodiments, mainly including the following steps:

[0070] Step 1: Obtain sample data and establish an X-ray image dataset containing different types of laser weld defects:

[0071] The sample data obtained in this embodiment includes original X-ray images of laser weld defects of different types and original X-ray images of laser welds without defects. The size of each original image is more than 3 million pixels. In this embodiment, the number of original images is set to 1,000. The bit depth of the original image data is 14 bits, which is not conducive to subsequent processing. The 14-bit image is linearly grayscaled into an 8-bit image and saved in JPEG format.

[0072] Step 2: Process the X-ray image dataset to obtain a weld location dataset with weld area annotations. Input the weld location dataset into the YOLOv5 network for training to obtain the weld location model.

[0073] Step S21: Label the weld areas of all X-ray images in the X-ray image dataset obtained in Step 1 with rectangular boxes to obtain a labeled weld location dataset;

[0074] Step S22: Input the weld seam location dataset into the YOLOv5 network and train it using the Adam optimization algorithm to obtain the weld seam location model;

[0075] Step 3: Cut and process the labeled weld areas in the weld location dataset to obtain the first defect detection dataset. Use the negative sample copy-pasting data augmentation method to expand the first defect detection dataset to obtain the second defect detection dataset. Input the second defect detection dataset into the YOLOv5m network for training to obtain the defect detection model.

[0076] S31: Using a sliding window, the weld area marked in each X-ray image of the weld location dataset is cut into a series of small weld images, which are denoted as the first defect detection dataset.

[0077] In the first defect detection dataset, there are approximately 4,500 images with porosity defects, approximately 500 images with crack defects, approximately 500 images with incomplete penetration defects, approximately 500 images with slag inclusion defects, and approximately 94,000 images without defects.

[0078] S32: Use the labelme annotation tool to annotate the images containing defects in the first defect detection dataset with rectangular boxes. For the small images in the first defect detection dataset that do not contain defects, apply the negative sample copy-pasting data augmentation method to expand the first defect detection dataset and obtain the second defect detection dataset.

[0079] The negative sample copy-pasting data augmentation method involves sequentially selecting small images in the first defect detection dataset that do not contain defects, randomly selecting multiple small images in the first defect detection dataset that contain defects, and copying and pasting them to random positions in the weld area of ​​the small images that do not contain defects. The above steps are repeated until every small image in the first defect detection dataset contains defects.

[0080] S33: Input the second defect detection dataset into the YOLOv5 network for training to obtain the defect detection model;

[0081] Step 4: Input the X-ray image of the laser weld to be tested into the weld positioning model to locate the weld area in the image; for example... Figure 3 As shown.

[0082] Step 5: Crops the weld area of ​​the image to be tested into smaller images using a sliding window method to obtain a series of weld images; overlap rate 0.2.

[0083] Step 6: Input the series of weld seam images obtained in Step 5 into the defect detection model to detect the defect type and location, such as... Figure 4 As shown.

[0084] Step 7: Output the final detection result of the X-ray image of the laser weld seam to be tested: such as Figure 4 As shown, the defect in the laser weld is porosity, located at the upper left point (318 279) and the lower right point (331 306), with a confidence level of 0.82.

[0085] Example 2

[0086] This embodiment uses the weld seam location model and defect recognition model trained in Embodiment 1 to detect defects in the X-ray image of the laser weld seam under test. The detection result is: the laser weld seam defect is a crack, such as... Figure 5 As shown, the locations of the cracks are: top left (2064 402) and bottom right (2069 429), with a confidence level of 0.76.

[0087] Example 3

[0088] This embodiment uses the weld seam location model and defect recognition model trained in Embodiment 1 to detect defects in the X-ray image of the laser weld seam under test. The detection result is: the laser weld seam defect is incomplete penetration, such as... Figure 6 As shown, the defect locations are: top left (4294 285) and bottom right (4307 306), with a confidence level of 0.83.

[0089] Example 4

[0090] This embodiment uses the weld location model and defect recognition model trained in Embodiment 1 to detect defects in the X-ray image of the laser weld under test. The detection result is: the laser weld has slag inclusions, as shown below. Figure 7 As shown, the locations of the slag inclusions are: upper left (2156 455) and lower right (2163 466).

[0091] Example 5

[0092] This embodiment uses the weld location model and defect recognition model trained in Embodiment 1 to detect defects in the X-ray image of electron beam welds. The detection results are: the defect in the electron beam weld is a crack, and the weld location is: upper left point (208 447) and lower right point (2950 552). Figure 8 As shown; Crack defect locations: upper left point (2667 472), lower right point (2672 480), as... Figure 9 As shown.

[0093] Comparative Example

[0094] The original images of the weld defect dataset used in this comparative example were unprocessed, with each original image being over 3 million pixels in size. The number of original images in this comparative example was set to 1000, and the bit depth of the original image data was 14 bits, which is not conducive to subsequent processing. The 14-bit images were linearly grayscaled into 8-bit images and saved in JPEG format.

[0095] All original images are input into a deep learning network to train a defect detection model. The trained defect detection model is then used to detect defects in the X-ray image of the laser weld seam under test.

[0096] The model's detection accuracy and recognition rate were evaluated using a confusion matrix method. Table 1 shows the defect detection accuracy of the examples and comparative examples, and Table 2 shows the defect recognition rate. The units for defect detection accuracy and defect recognition rate are percentages (%).

[0097] Table 1. Accuracy of various defect detection rates in the examples and comparative examples.

[0098]

[0099] Table 2. Defect Detection and Recognition Rates of Various Types in Examples and Comparative Examples

[0100]

[0101] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0102] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A defect detection method for X-ray images of laser welds, characterized in that, The defects are porosity, cracks, incomplete penetration, and slag inclusions. The defect detection method includes the following steps: Step 1: Obtain sample data and establish an X-ray image dataset containing different types of laser weld defects; the different types of laser weld defects are porosity, cracks, incomplete penetration, and slag inclusions; Step 2: Process the X-ray image dataset to obtain a weld location dataset with weld area annotations. Input the weld location dataset into the YOLOv5 network for training to obtain a weld location model; Step 2 includes: S21: Label the weld seam regions of all X-ray images in the X-ray image dataset with rectangular boxes to obtain a weld seam location dataset with weld seam region labels; S22: Input the weld seam location dataset into the YOLOv5 network and train it using the Adam optimization algorithm to obtain the weld seam location model; Step 3: Cut and process the labeled weld area in the weld location dataset to obtain the first defect detection dataset. Use the negative sample copy-pasting data augmentation method to expand the first defect detection dataset to obtain the second defect detection dataset. Input the second defect detection dataset into the YOLOv5 network for training to obtain the defect detection model. Step 4: Input the X-ray image of the laser weld to be tested into the weld positioning model to locate the weld area in the image; Step 5: Use a sliding window-based method to crop the weld area of ​​the image to be tested into smaller images to obtain a series of weld images; Step 6: Input the series of weld seam images into the defect detection model to detect whether there are defects in the images and the location of the defects; Step 7: Output the final detection results of the defects in the X-ray image of the laser weld to be tested; Step 3 includes: S31: The weld area marked in each X-ray image in the weld location dataset is cut using a sliding window to obtain a series of small weld images, which are denoted as the first defect detection dataset. S32: Use the labelme annotation tool to annotate the images containing defects in the first defect detection dataset with rectangular boxes. For the small images in the first defect detection dataset that do not contain defects, apply the negative sample copy-pasting data augmentation method to expand the first defect detection dataset and obtain the second defect detection dataset. S33: Input the second defect detection dataset into the YOLOv5 network for training to obtain the defect detection model; In step S31, the length of the sliding window and the length of the series of weld seam diagrams are 3 times the width of the laser weld seam, and the step size of the sliding window is 1 / 5 of the length of the sliding window. In step S32, the negative sample copy-pasting data augmentation method includes: sequentially selecting a small image in the first defect detection dataset that does not contain defects; randomly selecting N small images in the first defect detection dataset that contain defects, and copying and pasting them to random positions in the weld area of ​​the selected small image that does not contain defects; repeating the above steps until every small image in the first defect detection dataset contains defects. The negative sample copy-pasting data augmentation method in step S32 ensures that each small image in the second defect detection dataset contains a defect. In step 5, the size of the series of weld seam thumbnails is equal to the size of the series of weld seam thumbnails obtained by processing the weld seam positioning dataset in step S31.

2. The defect detection method according to claim 1, characterized in that, The process of establishing the X-ray image dataset is as follows: collect original X-ray images containing laser weld defects and those without laser weld defects, obtain sample data, the number of original images is greater than 1000, perform linear grayscale processing and format modification on the original images to obtain images with 8-bit grayscale and JPEG format, thus forming the X-ray image dataset.

3. The defect detection method according to claim 1, characterized in that, The YOLOv5 network consists of an input terminal, a backbone network, a neck network, and an output terminal. The backbone network is a lightweight GhostNet network.

4. The defect detection method according to claim 1, characterized in that, Step 7 includes: mapping the defect detection results onto the original X-ray image, using non-maximum suppression (NMS) to remove overlapping and redundant rectangles, displaying the final defect detection results on the original image, and saving the detection information into the detection text.

Citation Information

Patent Citations

  • Method and device based on small sample target object defect detection and electronic equipment

    CN114881989A

  • Method for detecting pore defects in X-ray image based on deep learning

    CN115829965A