Pressure pipeline circumferential weld X-ray image optimization method under complex noise interference
Through deep learning technology and image processing methods, the X-ray image of pressure pipeline ring welds under complex noise interference is optimized, which solves the problem of poor image optimization effect in the existing technology, and achieves efficient weld area positioning and image quality Improved, suitable for industrial testing.
Patent Information
- Application Number
- CN202410954004.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-11-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to effectively optimize the X-ray image of the pressure pipeline ring weld under complex noise interference, resulting in difficulty in extracting the weld area, high image noise, blurred details, and difficult to meet the needs of automatic defect detection, low detection efficiency and high misjudgment rate .
Deep learning technology combined with image processing methods, weld areas are positioned through YOLOv5 model, the target areas are extracted using image reconstruction algorithm, and the images are optimized through denoising, contrast adjustment and detail enhancement algorithms, and non-local mean denoising and adaptive histograms are selected. Methods such as graph equalization and convolution kernel sharpening are used to adjust parameters to improve image quality using particle swarm optimization algorithm.
It significantly improves the accuracy and efficiency of weld area extraction, improves the noise and contrast problems of the image, makes the details of the weld clearer, and achieves high-quality batch optimization, with an average accuracy of 95.62%, and an average recall rate of 98.82%. Improve image clarity and save edge details.
Smart Images

Figure CN118967576A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of industrial pipeline welding quality detection, and in particular to a pressure pipeline girth weld X-ray image optimization method under complex noise interference. Background Art
[0002] Welding defects are inevitable during the pipe annular welding process, and weld detection based on X-ray imaging is an important detection method. Due to the large number of welds and complex defect types, the traditional manual defect recognition method is inefficient, which has prompted the development of automatic weld defect detection systems. During the X-ray image acquisition process, due to different operating procedures, lighting environments, and weld positions, the acquired images have problems such as a small proportion of the weld area, dense noise, uneven brightness, and blurred details, which brings difficulties to the automatic detection of weld defects. Therefore, automatic image preprocessing of X-ray images is a necessary part of realizing automatic detection of weld defects.
[0003] In order to solve the problem of small proportion of weld area, the common method is to use multiple threshold segmentation algorithm based on column grayscale analysis or segmentation algorithm based on scale product to detect weld edge, so as to realize weld extraction. However, both methods need to perform grayscale value analysis and edge detection on the image, which are greatly affected by noise and image quality, and the versatility and efficiency of the algorithm are also low. For image quality optimization, median filtering and histogram equalization are usually used to process the entire image. This global processing introduces a large area of invalid area, which not only affects the optimization effect of the weld area, but also reduces the efficiency of batch processing. Therefore, it is necessary to further combine deep learning to reconstruct the image and select a better image processing algorithm to achieve high-quality automatic optimization of X-ray images of pressure pipeline girth welds.
[0004] Existing X-ray image processing methods for girth welds of pressure pipelines have many problems, such as difficulty in extracting weld areas, high image noise, and blurred details, which make it difficult to meet the needs of automatic defect detection, resulting in low detection efficiency and high misjudgment rate. Traditional multi-threshold segmentation algorithms and scale product segmentation algorithms based on column grayscale analysis are unstable in the presence of noise and poor image quality, and global image optimization methods such as median filtering and histogram equalization have limited effects and low efficiency. In addition, these methods often require a lot of manual intervention, further reducing detection efficiency.
[0005] Currently, no effective solution has been proposed for the problems in the related technologies. Summary of the invention
[0006] In view of this, the purpose of this application is to provide a pressure pipeline girth weld X-ray image optimization method under complex noise interference, so as to overcome the above-mentioned technical problems existing in the existing related technologies.
[0007] To this end, the specific technical solution adopted by the present invention is as follows:
[0008] A pressure pipeline girth weld X-ray image optimization method under complex noise interference, the pressure pipeline girth weld X-ray image optimization method under complex noise interference comprises the following steps:
[0009] S1. Use the X-ray imaging system and target detection model to locate the target area in the image of the pressure pipeline girth weld area.
[0010] S2. Based on the located target area, an image reconstruction algorithm is used to extract a reconstructed target area from the pressure pipeline girth weld area image to obtain a reconstructed image, and the relative position of the object in the pressure pipeline girth weld area image is maintained.
[0011] S3, screening denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm, and adjusting the parameters of the screened denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm through the optimization algorithm.
[0012] S4. Import the image and automatically perform target area positioning, image reconstruction, image denoising, contrast adjustment, detail enhancement and image saving operations in sequence.
[0013] Furthermore, using the X-ray imaging system and the target detection model to locate the target area in the pressure pipeline girth weld area image includes the following steps:
[0014] S11. Obtain images of the girth weld area of the pressure pipeline by using the digital imaging technology of the X-ray imaging system, and select part of the images of the girth weld area of the pressure pipeline as a data set, and the remaining images are used for image optimization system verification;
[0015] S12, marking the weld area and the reference area in the data set;
[0016] S13: Train a target detection model and output the target area positioning result through the target detection model.
[0017] Furthermore, training the target detection model and outputting the target area positioning result through the target detection model includes the following steps:
[0018] S131. Build a target detection model based on YOLOv5;
[0019] S132, labeling the data set, and dividing the data set into a training set and a test set, and training the target detection model;
[0020] S133. Use the trained target detection model to predict the data set samples and output the target area positioning results.
[0021] Further, screening the denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm, and adjusting the parameters of the screened denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm by using the optimization algorithm include the following steps:
[0022] S31, obtaining the best denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm;
[0023] S32. Use a particle swarm optimization algorithm to adjust the parameters of the best denoising algorithm, contrast adjustment algorithm, and detail enhancement algorithm.
[0024] Furthermore, obtaining the best denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm includes the following steps:
[0025] S311. Use peak signal-to-noise ratio and structural similarity as two indicators to quantitatively analyze different denoising methods and select the denoising algorithm with the best optimization effect;
[0026] S312, adjusting and analyzing the contrast of the denoised image, and selecting a contrast adjustment algorithm with the best optimization effect;
[0027] S313, detail enhancement and analysis of the image after contrast adjustment, and selection of a detail enhancement algorithm with the best optimization effect.
[0028] Furthermore, the denoising algorithms include mean filtering, median filtering, Gaussian filtering, wavelet transform and non-local mean denoising.
[0029] Furthermore, the contrast adjustment algorithm includes contrast stretching, histogram equalization and adaptive histogram equalization.
[0030] Furthermore, detail enhancement algorithms include filter sharpening, Laplacian operator and unsharp masking.
[0031] Furthermore, using the particle swarm optimization algorithm to adjust the parameters of the best denoising algorithm, contrast adjustment algorithm, and detail enhancement algorithm includes the following steps:
[0032] S321, adjusting the lower bound and upper bound of the filter strength in the denoising algorithm;
[0033] S322, adjusting the contrast limit lower bound and upper bound in the contrast adjustment algorithm, and the lower bound and upper bound of the grid size;
[0034] S323, adjusting the convolution kernel elements in the detail enhancement algorithm;
[0035] S324, using the peak signal-to-noise ratio as the optimization result for evaluation.
[0036] Furthermore, after importing the picture and automatically realizing the target area positioning, image reconstruction, image denoising, contrast adjustment, detail enhancement and image saving operations in sequence, the optimized image is verified by importing it into the image optimization system.
[0037] The present invention includes the following beneficial effects:
[0038] (1) The present invention provides a pressure pipeline girth weld X-ray image optimization method that combines deep learning technology and image processing. By introducing deep learning technology, it is possible to more efficiently locate the weld area and reconstruct the image, remove useless information in the image during weld detection, and significantly improve the accuracy and efficiency of weld area extraction. At the same time, through the image processing algorithm for the reconstructed image, it is possible to effectively reduce noise and enhance image details, significantly improve the image noise and contrast problems, make the weld details clearer, and thus achieve high-quality batch optimization of pressure pipeline girth weld X-ray images.
[0039] (2) The present invention designs a pipeline circumferential weld X-ray image weld area recognition and image reconstruction algorithm based on the YOLOv5 deep learning model, which achieves accurate positioning and extraction of the weld area. It performs well in positioning the weld and reference area, with an average accuracy of 95.62% and an average recall rate of 98.82%.
[0040] (3) In image processing, the present invention compares various denoising, contrast adjustment and detail enhancement methods, and selects non-local mean denoising, adaptive histogram equalization and convolution kernel sharpening to improve image quality, which significantly improves image clarity and preserves edge details.
[0041] (4) The present invention realizes dynamic optimization of processing parameters through the particle swarm optimization algorithm, which can maximize the image processing effect and ensure that the quality of the processed image can reach the best state in different application scenarios.
[0042] (5) The present invention comprehensively applies deep learning and image processing methods to realize the automatic processing of pipeline circumferential seam X-ray images, providing a basis for the automatic identification of weld defects and demonstrating its application potential in industrial inspection. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only 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.
[0044] Figure 1is a flow chart of a method for optimizing an X-ray image of a girth weld of a pressure pipeline under complex noise interference according to an embodiment of the present invention;
[0045] Figure 2 is a flowchart of a specific technology according to an embodiment of the present invention;
[0046] Figure 3 is a diagram of an image optimization system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0048] To further illustrate each embodiment, the present invention provides drawings, which are part of the disclosure of the present invention and are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, ordinary technicians in the field should be able to understand other possible implementations and advantages of the present invention. The components in the figures are not drawn to scale, and similar component symbols are generally used to represent similar components.
[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0050] According to an embodiment of the present invention, a method for optimizing X-ray images of girth welds of pressure pipelines under complex noise interference is provided, which relates to a method for optimizing X-ray images of girth welds of pressure pipelines by combining deep learning and image processing technology, which is applied in the field of industrial pipeline welding quality inspection.
[0051] The present invention is further described with reference to the accompanying drawings and specific embodiments. Figure 1 As shown, according to an embodiment of the present invention, a pressure pipeline girth weld X-ray image optimization method under complex noise interference includes the following steps:
[0052] S1. Use the X-ray imaging system and target detection model to locate the target area in the image of the pressure pipeline girth weld area.
[0053] In one embodiment, using an X-ray imaging system and a target detection model to locate a target area in an image of a girth weld area of a pressure pipeline includes the following steps:
[0054] S11. The image of the girth weld area of the pressure pipeline is obtained by the digital imaging technology of the X-ray imaging system, and part of the images of the girth weld area of the pressure pipeline are selected as a data set, and the remaining images are used for image optimization system verification.
[0055] S12. Labelimg software is used to mark the weld area and reference area in the data set. Labelimg software is an image annotation tool.
[0056] S13: Train a target detection model and output the target area positioning result through the target detection model.
[0057] In one embodiment, training a target detection model and outputting a target area positioning result through the target detection model includes the following steps:
[0058] S131. Build a target detection model based on YOLOv5 (You Only Look Once version 5); wherein YOLOv5 is a single-stage target detection algorithm.
[0059] S132. Label the data set and randomly divide the data set into a training set and a test set in a ratio of 7:3 to train the target detection model.
[0060] S133. Use the trained YOLOv5 target detection model to predict the data set samples and output the target area positioning results.
[0061] S2. Based on the located target area, an image reconstruction algorithm is used to extract a reconstructed target area from the pressure pipeline girth weld area image to obtain a reconstructed image, and the relative position of the object in the pressure pipeline girth weld area image is maintained.
[0062] S3, screening denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm, and adjusting the parameters of the screened denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm through the optimization algorithm.
[0063] In one embodiment, screening a denoising algorithm, a contrast adjustment algorithm, and a detail enhancement algorithm, and adjusting the parameters of the screened denoising algorithm, the contrast adjustment algorithm, and the detail enhancement algorithm by using an optimization algorithm comprises the following steps:
[0064] S31, obtaining the best denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm.
[0065] S32. Use the particle swarm optimization algorithm to adjust the parameters of the best denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm to ensure that the image optimization under different image qualities can reach the best state.
[0066] In one embodiment, obtaining the best denoising algorithm, contrast adjustment algorithm, and detail enhancement algorithm includes the following steps:
[0067] S311. Use the peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) to quantitatively analyze different denoising methods and select the denoising algorithm with the best optimization effect.
[0068] S312, adjusting and analyzing the contrast of the denoised image, and selecting a contrast adjustment algorithm with the best optimization effect.
[0069] S313, detail enhancement and analysis of the image after contrast adjustment, and selection of a detail enhancement algorithm with the best optimization effect.
[0070] In one embodiment, the denoising algorithm includes mean filtering, median filtering, Gaussian filtering, wavelet transform and non-local mean denoising to remove image noise.
[0071] In one embodiment, the contrast adjustment algorithm includes contrast stretching, histogram equalization, and adaptive histogram equalization.
[0072] In one embodiment, the detail enhancement algorithm includes filter sharpening, Laplacian operator and unsharp masking.
[0073] In one embodiment, using the particle swarm optimization algorithm to adjust the parameters of the optimal denoising algorithm, contrast adjustment algorithm, and detail enhancement algorithm includes the following steps:
[0074] S321, adjusting the lower and upper bounds of the filter strength in the denoising algorithm.
[0075] S322: Adjust the lower and upper limits of the contrast limit in the contrast adjustment algorithm, as well as the lower and upper limits of the grid size.
[0076] S323. Adjust the convolution kernel elements in the detail enhancement algorithm.
[0077] S324, using the peak signal-to-noise ratio as the optimization result for evaluation.
[0078] S4. Design an image optimization system, import images, and automatically implement target area positioning, image reconstruction, image denoising, contrast adjustment, detail enhancement and image saving operations in sequence.
[0079] In one embodiment, after importing a picture and automatically performing operations such as target area positioning, image reconstruction, image denoising, contrast adjustment, detail enhancement, and image saving, the optimized image is verified by importing it into an image optimization system, and the effect of the image optimization system is analyzed.
[0080] In order to facilitate understanding of the above technical solutions of the present invention, the working principle or operation mode of the present invention in the actual process is described in detail below.
[0081] Specific technical implementations include Figure 2 As shown, it mainly includes: target area positioning and image reconstruction; image enhancement processing of reconstructed images; image optimization system design and verification.
[0082] Target area positioning and image reconstruction.
[0083] 1. Dataset construction and annotation.
[0084] The original experimental data comes from X-ray images of pressure pipeline girth welds provided by a branch of a special inspection institute, totaling 1,476 images, of which 577 images were selected as the data set, and the remaining 899 images were used for subsequent experimental verification. In actual weld defect detection, it is necessary to use the reference area on the pipeline to locate the defects, so the Labelimg software is used to mark the weld area and the reference area at the same time. The entire data set is divided into a training set and a validation set with a ratio of 70:30, which are 403 and 174 images respectively.
[0085] 2. Target positioning.
[0086] Import the dataset and train YOLOv5 for 300 cycles. Load the model and calculate the precision and recall of the test set.
[0087] Accuracy refers to the proportion of correctly classified samples to the total number of samples in the prediction, reflecting the overall prediction performance of the model. The larger the value, the more accurate the overall prediction of the model. The calculation formula is as follows:
[0088]
[0089] Recall rate refers to the proportion of samples predicted as positive among all samples that are actually positive, reflecting the model's ability to identify positive samples. The larger the value, the stronger the model's ability to identify positive samples. The calculation formula is as follows:
[0090]
[0091] Among them, TP (True Positive) indicates the number of objects predicted as positive when the object is positive. TN (True Negative) indicates the number of objects predicted as negative when the object is negative. FP (False Positive) indicates the number of objects predicted as positive when the object is negative. FN (False Negative) indicates the number of objects predicted as negative when the object is positive.
[0092] 3. Image reconstruction.
[0093] After loading the trained detection model to perform target detection on the data set samples, automatic reconstruction can be achieved through the image reconstruction algorithm designed by the present invention. The algorithm formula is as follows:
[0094] (1) Get the coordinates of the upper left and upper right corners of the bounding box in the positioning result, expressed as:
[0095] (x1,y1),(x2,y2) (3)
[0096] (2) Traverse all detected objects and find the minimum and maximum coordinates of the bounding boxes of all objects, expressed as:
[0097] (x left ,y top , x right ,y bottom ) (4)
[0098] According to the minimum and maximum coordinates, the width and height of the new canvas are calculated to create a new minimum canvas as the background of the reconstructed image. The calculation formula is:
[0099] canvas_width=x right -x left (5)
[0100] canvas_height=y bottom -y top (6)
[0101] (4) In order to maintain the relative position of the objects in the original image, its coordinates need to be converted to the new canvas. For each detected object, the new upper left corner coordinate calculation formula is:
[0102] new_x1=x1-x left (7)
[0103] new_y1=y1-y top (8)
[0104] The new lower right corner coordinate calculation formula is:
[0105] new_x2 = new_x1 +(x2-x1) (9)
[0106] new_y2 = new_y1 +(y2-y1) (10)
[0107] Through the image reconstruction algorithm, the target area can be effectively extracted and the relative position of the original image object can be maintained.
[0108] Image enhancement processing of reconstructed images.
[0109] 1. Noise cancellation.
[0110] In order to improve the noise removal effect, the present invention uses five algorithms, namely mean filtering, median filtering, Gaussian filtering, wavelet transform and non-local mean denoising, to remove noise from the reconstructed image and compare the effects.
[0111] 1) Mean filtering: By replacing the value of each pixel in the image with the average value of all pixels in its neighborhood, the image is smoothed and noise is reduced. The algorithm formula can be expressed as:
[0112]
[0113] In the formula, represents the processed pixel value at position (x, y) in image I; W represents a window or a set of regions, the region formed around position (x, y) in image I; |W| represents the number of pixels in window W, that is, the size of the window; I(x+i, y+j) represents the pixel at position (x+i, y+j) in image I; i and j are offsets within window W, used to traverse all pixels in the window.
[0114] When performing mean filtering on an image, the initial parameter size of the filter kernel is set to 5, that is, W is a 5×5 matrix window, and the value of each element in the matrix is Used to perform mean filtering on the input image.
[0115] 2) Median filtering: The value of each pixel in the image is replaced by the median value of the pixel values in its neighborhood. This can effectively remove salt and pepper noise while maintaining the edge details of the image. The algorithm formula can be expressed as:
[0116]
[0117] Where median represents the median operation. When performing median filtering on an image, the initial parameter size of the filter kernel is set to 5.
[0118] 3) Gaussian filtering: Gaussian function is used to weight the pixel values in the neighborhood, reducing noise while processing the image more smoothly. It is suitable for reducing Gaussian noise. The algorithm formula can be expressed as:
[0119]
[0120] The Gaussian kernel formula is:
[0121]
[0122] The Gaussian kernel G is weighted according to the square of the distance and the standard deviation σ. When performing Gaussian filtering on an image, the initial parameter size of the filter kernel is set to 5 and the initial standard deviation is set to 0. The standard deviation of 0 means that a suitable standard deviation value is automatically calculated based on the kernel size.
[0123] 4) Wavelet transform: By decomposing the image into components of different frequencies and then processing them separately, the noise can be effectively removed while maintaining the multi-scale details of the image. The algorithm formula can be expressed as:
[0124]
[0125] Where W ψ (a,b) represents the result of weighting the function f(t) by the parameters a and b under the influence of the window function ψ(t); ψ(t) represents the wavelet function, which is a waveform-based function used to analyze the local characteristics of a signal or image; t represents the independent variable in the continuous time domain, which is used to describe the change of the signal f(t). When performing wavelet transform on the image, the wavelet basis function is set to Haar, the initial threshold is 3, and the soft threshold processing method is used.
[0126] 5) Non-local mean denoising: By calculating the weighted average of each pixel in the image and all pixels in its neighborhood, similar blocks are used for denoising, which can better preserve the details and texture information of the image and calculate the template window size of pixel similarity. The algorithm formula can be expressed as:
[0127]
[0128] In the formula, represents the pixel value of the denoised image at position x; C(x) represents the normalization coefficient to ensure that the sum of the weights is 1; I(y) represents the pixel value of image I at position Y; I(N x ) and I(N y ) is the neighborhood around pixel x and y; represents the square of the Euclidean distance between pixel values; h represents the filter parameter. When performing non-local mean denoising on an image, the initial value of h is set to 3, and the template window I(N x ) has an initial size of 7, and the search window I(N y ) has an initial size of 21.
[0129] In order to achieve image denoising while retaining the details of the weld as much as possible, the peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) were used to quantitatively analyze different denoising methods.
[0130] Peak Signal-to-Noise Ratio (PSNR) measures the peak signal-to-noise ratio between the denoised image and the original image. The higher the value, the better the denoising effect.
[0131] Structural Similarity (SSIM) measures the structural similarity between the denoised image and the original image. The closer the value is to 1, the higher the similarity between the two.
[0132] 2. Contrast adjustment.
[0133] In order to balance the image contrast, the present invention uses three algorithms, namely contrast stretching, histogram equalization, and adaptive histogram equalization, to adjust the contrast of the image after noise elimination and compare the effects.
[0134] 1) Contrast stretching: By linearly transforming the image, the range of pixel values is expanded, making the darkest pixel darker and the brightest pixel brighter, thereby enhancing the overall contrast of the image. The algorithm formula can be expressed as:
[0135]
[0136] Here, I(x,y) represents the image pixel value at position (x,y); I min and I max are the minimum and maximum pixel values of the original image respectively; O min and O max are the minimum and maximum pixel values of the target output.
[0137] 2) Histogram equalization: By redistributing the grayscale values of pixels in the image, the grayscale distribution of the image is made more uniform, the contrast is improved, and the details and edge features of the image are enhanced. The algorithm formula can be expressed as:
[0138]
[0139] Here, CDF(I(x,y)) is the cumulative distribution function of the pixel value I(x,y); CDF min is the minimum non-zero cumulative distribution value; L is the grayscale level, and MN is the total number of pixels in the image.
[0140] Adaptive Histogram Equalization (CLAHE): Divide the image into small blocks and perform histogram equalization on them separately, then stitch these small blocks together to significantly improve the local contrast while maintaining image details and avoiding overexposure and underexposure. The algorithm formula can be expressed as:
[0141] Each subimage is histogram equalized and contrast limited:
[0142]
[0143] Among them, CDF clip (k) represents the cumulative distribution function after contrast limiting is applied; Represents the histogram of the subgraph Isub;
[0144] Represents the cropping threshold, which limits the maximum value of the histogram; m and n represent the width and height of the sub-image respectively.
[0145] Use the adjusted CDF to equalize the sub-image pixels:
[0146] I s ' ub (i,j)=round(CDF clip (I sub (i,j))·(L-1))(20)
[0147] Among them, I′ sub (i,j) represents subgraph I sub The pixel value after equalization at position (i, j); I sub (i,j) represents subgraph I sub The pixel value at position (i, j) in ; round indicates rounding operation; L indicates the total number of gray levels.
[0148] Perform bilinear interpolation on the processed sub-image:
[0149] I new (x,y)=(1-α)(1-β)I′ sub1 +α(1-β)I′ sub2 +(1-α)βI′ sub3 +αβI′ sub4 (twenty one)
[0150] Where I(x,y) represents the image pixel value at position (x,y); α and β are interpolation coefficients calculated based on the pixel position; I′ sub1 , I′ sub2 , I′ sub3 , I′ sub4 Indicates the equalization results of four adjacent sub-images. When performing CLAHE (contrast limited adaptive histogram equalization) operation on the image, the initial value of the contrast limit is set to 2, and the initial size of the small block grid is (8, 8).
[0151] 3.Detail enhancement.
[0152] In order to make the defects in the weld more prominent, the present invention uses three algorithms, namely filter sharpening, Laplace operator and unsharp masking, to perform detail enhancement and effect comparison on the contrast-adjusted image.
[0153] 1) Filter sharpening: By applying a convolution kernel to enhance the edges and details in the image, the image looks clearer and sharper. The sharpening kernel used in the present invention is as follows:
[0154]
[0155] 2) Laplace operator: Use the Laplace operator to perform second-order differential operations to highlight the edge features in the image, enhance the details, and make the edges of the image more obvious. The algorithm formula can be expressed as:
[0156]
[0157] in represents the Laplace operator of image I at position (x, y), which is the sum of the second-order derivatives of the image and is used to measure the curvature change in the image; I(x, y) represents the image pixel value at position (x, y); and Represent the second partial derivatives of image I at position (x, y) with respect to the x and y directions respectively.
[0158] 3) Unsharp masking: By adding the difference between the original image and its blurred version back to the original image, the edges and details are enhanced while reducing the impact of noise, making the image sharper and clearer. The algorithm formula can be expressed as:
[0159] I sharpened (x,y)=I(x,y)+κ·(I(x,y)-I blurred (x,y))(24)
[0160] Among them, I sharpened (x, y) represents the sharpened image pixel value at position (x, y); I(x, y) represents the original image pixel value at position (x, y); I blurred (x, y) represents the pixel value of the image after blurring at the position (x, y); κ represents the enhancement coefficient, which is used to control the degree of sharpening. The present invention uses Gaussian blur to obtain a blurred version of the original image, with a weight of -0.5 and a weight of 1.5 for the original image.
[0161] Algorithm parameter adjustment:
[0162] Since the image quality of different images in practical applications varies, it is necessary to dynamically adjust the parameters of each image optimization algorithm for different images. Particle Swarm Optimization is an optimization algorithm based on swarm intelligence, which can be used to automatically adjust the parameters of the image processing algorithm so that the optimized image can achieve the required effect. The algorithm formula can be expressed as:
[0163] Speed update formula:
[0164] v a (n+1)=ωv a (n)+c1r1[p a (n)-f a (n)]+c2r2[g(n)-f a (n)](25)
[0165] Position update formula:
[0166] f a (n+1)=f a (n)+v a (n+1)(26)
[0167] Among them, v a (n) is the particle velocity, which represents the velocity vector of the ath particle at time n, v a (n+1) is the particle velocity, which represents the velocity vector of the ath particle at time n+1; f a (n) is the particle position, which represents the position vector of the ath particle at time n, f a (n+1) is the particle position, which represents the position vector of the ath particle at time n+1; ω is the inertia weight, which represents the influence of the previous speed on the current speed; c1 and c2 are the individual learning factor and the group learning factor, respectively, which control the speed at which the particle moves to the optimal position of itself and the group; r1 and r2 represent random numbers generated in the interval [0, 1]; p a (n) represents the best position found by the a-th particle at time n; g(n) represents the best position found by the entire group at time n; n and n+1 represent the current time step and the next time step, respectively.
[0168] The present invention selects the best algorithm by comparing various noise elimination, contrast adjustment, and detail enhancement algorithms. They are non-local mean denoising, adaptive histogram equalization, and convolution kernel sharpening algorithms, and uses the particle swarm optimization algorithm to automatically adjust their internal parameters. The specific parameter settings are as follows:
[0169] 1) In the non-local mean denoising algorithm, the lower bound of the filter strength h is set to 1, the upper bound is set to 10, and the template window I (N x ) has a lower bound of 3 and an upper bound of 21, and the search window I(N y )The lower bound of the size is 10 and the upper bound is 31.
[0170] 2) In adaptive histogram equalization, the lower bound of the contrast limit is set to 1 and the upper bound is set to 10. The lower bound of the grid size is (2, 2) and the upper bound is (16, 16).
[0171] 3) In the convolution kernel sharpening algorithm, 9 elements of the 3×3 convolution kernel are optimized, and the range of each element of the convolution kernel is set to [-10, 10].
[0172] 4) All the above algorithms use the peak signal-to-noise ratio (PSNR) as the optimization result evaluation, and save the parameter combination with the peak signal-to-noise ratio closest to the target value of 47. The initial population size is 30, the maximum number of iterations is 100, and the minimum step size is 10 -8 .
[0173] Image optimization system design and verification.
[0174] like Figure 3 As shown, the present invention uses Visual Studio Code (a code editor) to write an image optimization system. After the user inputs the image to be optimized, the image is automatically subjected to YOLOv5 model positioning, image reconstruction, non-local mean denoising, adaptive histogram equalization, convolution kernel sharpening algorithm and image saving operations in sequence, thereby realizing batch processing of pipeline annular seam X-ray images. The remaining 899 verification images are input to the image optimization system for batch processing.
[0175] In summary, the present invention provides a pressure pipeline girth weld X-ray image optimization method combining deep learning technology and image processing. By introducing deep learning technology, the weld area can be located more efficiently and the image can be reconstructed, useless information in the image during weld detection can be removed, and the accuracy and efficiency of weld area extraction can be significantly improved. At the same time, through the image processing algorithm for the reconstructed image, the noise can be effectively reduced and the image details can be enhanced, the noise and contrast problems of the image can be significantly improved, and the weld details can be made clearer, thereby realizing high-quality batch optimization of the pressure pipeline girth weld X-ray image. The present invention designs a pipeline girth weld X-ray image weld area recognition and image reconstruction algorithm based on the YOLOv5 deep learning model, which realizes the accurate positioning and extraction of the weld area. It performs well in the positioning of welds and reference areas, with an average accuracy of 95.62% and an average recall rate of 98.82%. In image processing, the present invention selects non-local mean denoising, adaptive histogram equalization and convolution kernel sharpening to improve image quality by comparing various denoising, contrast adjustment and detail enhancement methods, which significantly improves image clarity and preserves edge details. The present invention uses a particle swarm optimization algorithm to dynamically optimize processing parameters, which can maximize the image processing effect and ensure that the quality of processed images in different application scenarios can reach the best state. The present invention uses deep learning and image processing methods to achieve automatic processing of pipeline annular seam X-ray images, providing a basis for the automatic identification of weld defects and demonstrating its application potential in industrial inspection.
[0176] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional charging modules / units in the systems and devices may be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0177] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0178] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A pressure pipeline girth weld X-ray image optimization method under complex noise interference, characterized in that: The pressure pipeline girth weld X-ray image optimization method under complex noise interference includes the following steps: S1. Use an X-ray imaging system and a target detection model to locate a target area in an image of a girth weld area of a pressure pipeline; S2. Based on the located target area, an image reconstruction algorithm is used to extract a reconstructed target area from the pressure pipeline girth weld area image to obtain a reconstructed image, and the relative position of the object in the pressure pipeline girth weld area image is maintained; S3, screening denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm, and adjusting the parameters of the screened denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm through an optimization algorithm; S4. Import the image and automatically perform target area positioning, image reconstruction, image denoising, contrast adjustment, detail enhancement and image saving operations in sequence.
2. The pressure pipeline girth weld X-ray image optimization method under complex noise interference according to claim 1 is characterized in that: The method of using an X-ray imaging system and a target detection model to locate a target area in an image of a girth weld area of a pressure pipeline comprises the following steps: S11. Obtain images of the girth weld area of the pressure pipeline by using the digital imaging technology of the X-ray imaging system, and select part of the images of the girth weld area of the pressure pipeline as a data set, and the remaining images are used for image optimization system verification; S12, marking the weld area and the reference area in the data set; S13: Train a target detection model and output the target area positioning result through the target detection model.
3. The pressure pipeline girth weld X-ray image optimization method under complex noise interference according to claim 2 is characterized in that: The training of the target detection model and outputting the target area positioning result through the target detection model comprises the following steps: S131. Build a target detection model based on YOLOv5; S132, labeling the data set, and dividing the data set into a training set and a test set, and training the target detection model; S133. Use the trained target detection model to predict the data set samples and output the target area positioning results.
4. The pressure pipeline girth weld X-ray image optimization method under complex noise interference according to claim 3 is characterized in that: The screening of the denoising algorithm, the contrast adjustment algorithm and the detail enhancement algorithm, and adjusting the parameters of the screened denoising algorithm, the contrast adjustment algorithm and the detail enhancement algorithm by the optimization algorithm comprises the following steps: S31, obtaining the best denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm; S32. Use a particle swarm optimization algorithm to adjust the parameters of the best denoising algorithm, contrast adjustment algorithm, and detail enhancement algorithm.
5. The pressure pipeline girth weld X-ray image optimization method under complex noise interference according to claim 4 is characterized in that: The method of obtaining the best denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm comprises the following steps: S311. Use peak signal-to-noise ratio and structural similarity as two indicators to quantitatively analyze different denoising methods and select the denoising algorithm with the best optimization effect; S312, adjusting and analyzing the contrast of the denoised image, and selecting a contrast adjustment algorithm with the best optimization effect; S313, detail enhancement and analysis of the image after contrast adjustment, and selection of a detail enhancement algorithm with the best optimization effect.
6. The pressure pipeline girth weld X-ray image optimization method under complex noise interference according to claim 5 is characterized in that: The denoising algorithms include mean filtering, median filtering, Gaussian filtering, wavelet transform and non-local mean denoising.
7. The pressure pipeline girth weld X-ray image optimization method under complex noise interference according to claim 6 is characterized in that: The contrast adjustment algorithm includes contrast stretching, histogram equalization and adaptive histogram equalization.
8. The pressure pipeline girth weld X-ray image optimization method under complex noise interference according to claim 7 is characterized in that: The detail enhancement algorithm includes filter sharpening, Laplacian operator and unsharp masking.
9. The pressure pipeline girth weld X-ray image optimization method under complex noise interference according to claim 8, characterized in that: The method of using the particle swarm optimization algorithm to adjust the parameters of the optimal denoising algorithm, contrast adjustment algorithm and detail enhancement algorithm comprises the following steps: S321, adjusting the lower bound and upper bound of the filter strength in the denoising algorithm; S322, adjusting the contrast limit lower bound and upper bound in the contrast adjustment algorithm, and the lower bound and upper bound of the grid size; S323, adjusting the convolution kernel elements in the detail enhancement algorithm; S324, using the peak signal-to-noise ratio as the optimization result for evaluation.
10. The pressure pipeline girth weld X-ray image optimization method under complex noise interference according to claim 9, characterized in that: After the picture is imported and the target area positioning, image reconstruction, image denoising, contrast adjustment, detail enhancement and image saving operations are automatically performed in sequence, the optimized image is verified by importing it into the image optimization system.
Citation Information
Patent Citations
Bivariate nonlocal average filtering de-noising method for X-ray image
CN102609904A
Weld defect identification and positioning method and system based on deep learning network
CN113034478A
Photovoltaic module defect detection method and system
CN114187260A
Welding seam tracking method for precise welding of ultrathin metal
CN114406425A
Modularized weld joint identification device and identification method
CN115063361A
Cited By
Modular welding equipment and welding quality evaluation method
CN120920847A
