X-Ray Weld Image Detection Method of Water Injection Network Based on Sparse Representation
Highlights
- A sparse representation-based framework is proposed to detect micro-defects (e.g., cracks and pinholes) in X-ray weld images of water injection networks. By combining Otsu thresholding with Sobel edge detection, segmented ROI extraction is achieved, which adapts to inclined or curved welds and effectively reduces background interference.
- Using dictionary learning (K-SVD, OMP) and a unified 15 × 15 template for defect SDR normalization, the method achieves 99.81% overall recognition accuracy for circular defects, linear defects, and noise samples, demonstrating strong capability in identifying low-contrast, small-sized defects.
- The proposed method provides an accurate and robust automatic solution for detecting micro-defects in X-ray weld images of water injection networks, advancing intelligent nondestructive testing for pipeline welds.
- For larger defects such as lack of fusion, incomplete penetration, and cracks, the sparse description approach still exhibits missed detections. Therefore, integrating it with a YOLO-based deep learning model is recommended to achieve comprehensive detection of all weld defect types.
Abstract
1. Introduction
2. Method for X-Ray Weld Image Preprocessing and Evaluation Region Extraction
3. Sparse Description-Based Method for Small Defect Recognition
3.1. Basic Idea of Sparse Description
3.2. Basic Model of Sparse Description
- (1)
- Taking the extracted weld ROI as input, preliminarily locate candidate anomaly regions in the image.
- (2)
- Extract features such as position, area, grayscale, and morphology of the candidate regions, and construct feature vectors.
- (3)
- Set the neighborhood radius Eps and the minimum number of samples MinPts for the density-based clustering algorithm.
- (4)
- Perform cluster analysis on the candidate regions in the feature space, grouping densely distributed samples into the same cluster.
- (5)
- Identify isolated and scattered regions that do not form valid clusters as noise and remove them.
- (6)
- Retain the valid candidate regions obtained after clustering as the SDR extraction result.
3.3. Dictionary Matrix Problem Description
3.4. Algorithm for Constructing Dictionary Learning Model
3.5. Sparse Solving and Classification Decision
- (1)
- Initialization
- (2)
- Select the Most Relevant Atom
- (3)
- Update the support set
- (4)
- Least squares solution for coefficients
- (5)
- Update the residual
- (6)
- Termination Condition
3.6. Dual-Thread Detection Mechanism for Comprehensive Defect Recognition
4. Experimental Results and Analysis
4.1. Experiment on Sample Training of the Dictionary Matrix
4.2. Defect Detection Rate and Applicability Analysis
4.3. Experiment on Detection of Larger Defects Based on Sparse Description
4.4. Comparison of Computational Efficiency
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Lan, Q.; Sun, R.; Tang, W.; Zhang, C.; Liu, Y.; Wang, Y.; Lei, A.; Huang, C.; Li, S.; Cai, Z.; et al. Application of Electromagnetic Ultrasonic Testing Technology in Pipeline Defects. Coatings 2026, 16, 133. [Google Scholar] [CrossRef] [Scilit]
- Wei, M.; Zhang, Z. Research on defect identification method of oil and gas pipeline based on ultrasonic echo signal. Nondestruct. Test. Eval. 2026, 41, 460–486. [Google Scholar]
- Trigka, M.; Dritsas, E. A Comprehensive Survey of Deep Learning Approaches in Image Processing. Sensors 2025, 25, 531. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Zhang, M.; Hu, Y.; Xu, B.; Luo, L.; Wang, S. DSF-YOLO for weld defect detection in X-ray images with dynamic staged fusion. Sci. Rep. 2025, 15, 23305. [Google Scholar] [PubMed]
- Su, G.; Su, X.; Wang, Q.; Luo, W.; Lu, W. Research on X-Ray Weld Defect Detection of Steel Pipes by Integrating ECA and EMA Dual Attention Mechanisms. Appl. Sci. 2025, 15, 4519. [Google Scholar] [CrossRef] [Scilit]
- Liang, Y.; Yu, B.; Ding, M.; Hu, W.; Jin, Y.; Yuan, Y. WELD-DETR: A Real-Time Welding Defect Detection Framework with Multi-Scale Feature Fusion and Multi-Kernel Perception Optimization. Sensors 2025, 25, 7024. [Google Scholar] [PubMed]
- Ramírez, P.D.; Veitía, R.D.B.; Ariosa, F.P.; Espinel-Hernández, A.; Sánchez-Roca, Á.; Carvajal-Fals, H.; Núñez-Álvarez, J.R.; Hernández-Herrera, H. Deep convolutional neural network for weld defect classification in radiographic images. Heliyon 2024, 10, e30590. [Google Scholar] [CrossRef] [Scilit]
- López, G.; Ramírez, D.P.; Vega, E.; Pizarro, F.; Toro, J.; Parra, C. WeldVGG: A VGG-Inspired Deep Learning Model for Weld Defect Classification from Radiographic Images with Visual Interpretability. Sensors 2025, 25, 6183. [Google Scholar] [PubMed]
- Aharon, M.; Elad, M.; Bruckstein, A. K-SVD: An Algorithm for Designing Overcomplete Dictionaries for Sparse Representation. IEEE Trans. Signal Process. 2006, 54, 4311–4322. [Google Scholar]
- Mairal, J.; Bach, F.; Ponce, J.; Sapiro, G. Online Dictionary Learning for Sparse Coding. Int. J. Comput. Vis. 2010, 86, 224–240. [Google Scholar]
- Li, X.; Shen, H. Image Denoising with Dual-Tree Complex Wavelet and Sparse Representation. IEEE Access 2018, 6, 11234–11245. [Google Scholar]
- Gan, M.; Wang, C. Feature extraction and sparse representation classification for acoustic emission signals of bearing. Meas. Sci. Technol. 2015, 26, 095001. [Google Scholar]
- Zhang, Q.; Li, B. Discriminative K-SVD for dictionary learning in face recognition. In 2010 IEEE Computer Society Conference on Computer Vision and Pattern Recognition; IEEE: Piscataway, NJ, USA, 2010. [Google Scholar]
- Elhendawy, A.G.; Taybany, E.Y. Machine Vision-Assisted Welding Defect Detection System with Convolutional Neural Networks. Int. J. Precis. Eng. Manuf. 2025, 26, 3185–3194. [Google Scholar] [CrossRef] [Scilit]
- Zhang, X.; Chen, H.; Liu, Z.; Anli, S. Lightweight DETR algorithm for X-ray weld defect detection. Sci. Rep. 2025, 15, 41873. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Lyu, D.; Xiao, X.; Hu, H.; Liu, Z.; Wang, X.; Xu, N. Orientation characterisation of branched crack-like defects in curved components using ultrasonic array vector total focusing method. Nondestruct. Test. Eval. 2026, 41, 185–202. [Google Scholar]
- Gao, L.; Liu, H.; Gao, W.; He, J. YOLO11-Based Weld Defect Detection Method for X-Ray Images Integrating SIoU Bounding Box Regression and P2 Shallow Feature Enhancement. Sensors 2026, 26, 4144. [Google Scholar] [CrossRef] [Scilit]
- GB/T 44046-2024; Non-Destructive Testing—Metal Magnetic Memory—Inspection of Welded Joints. State Administration for Market Regulation and Standardization Administration of the People’s Republic of China: Beijing, China, 2024.
- NB/T 47013-2015; Nondestructive Testing of Pressure Equipments. National Energy Administration: Beijing, China, 2015.
- GB/T 3323.1-2019; Non-Destructive Testing of Welds—Radiographic Testing—Part 1: X- and Gamma-Ray Techniques with Film. State Administration for Market Regulation and Standardization Administration of the People’s Republic of China: Beijing, China, 2019.
- Qi, H.; Cheng, X.; Li, H.; Chen, X.; Xu, X. Weld Defect Detection Algorithm Based on Improved YOLOv7. Electron. Sci. Tech. 2025, 38, 79–84. [Google Scholar]
- Wu, L.; Chu, Y.K.; Yang, H.G. Aluminum Alloy Weld DR Image Defect Detection Technology Based on YOLOv7TS. Chin. J. Lasers 2024, 51, 2002102. [Google Scholar]
- Mu, C.; Li, C.; Ma, X.; Liu, Y.; Yang, K.; Liu, B. Improved YOLOV7-tiny Lightweight Large Casting Weld Defect Detection. Modul. Mach. Tool Autom. Manuf. Tech. 2024, 7, 156–160. [Google Scholar]
- Wang, H.; Yu, X. Research on image recognition algorithm of weld defect based on deep learning. Adv. Comput. Signals Syst. 2022, 6, 83–89. [Google Scholar]
- Chen, Y.; Tang, H.; Zhou, C.; Xiong, G.; Tang, H. Weld seam defect detection based on deformable convolutional neural networks. IEICE Electron. Express 2024, 21, 20240468. [Google Scholar] [CrossRef] [Scilit]
- Yang, L.; Wang, H.; Huo, B.; Li, F.; Liu, Y. An automatic welding defect location algorithm based on deep learning. NDT E Int. 2021, 120, 102435. [Google Scholar] [CrossRef] [Scilit]














| Method Category | Classical Methods | Small-Sample Adaptability | Micro-Defect Recognition Capability | Interpretability | Computational Complexity |
|---|---|---|---|---|---|
| Conventional Methods | Edge Detection, GLCM | Weak | Weak | Strong | Weak |
| Statistical Learning | SVM, Random Forest | Moderate | Moderate | Moderate | Moderate |
| Deep Learning | CNN, ResNet, YOLO | Weak | Strong | Weak | Strong |
| Sparse Representation | K-SVD, OMP | Strong | Strong | Strong | Moderate |
| Algorithm | Dictionary Update Method | Advantages | Disadvantages | Applicable Characteristics |
|---|---|---|---|---|
| MOD | Global update of the dictionary matrix | Simple in form and fast update speed | Insufficiently fine atom adjustment | Suitable for fast learning with large-scale samples |
| K-SVD | Atom-by-atom update of dictionary and coefficients | Strong representativeness and good expressive capability of the dictionary | High computational complexity | Suitable for modeling complex local features |
| Experiment No. | Circular Defect Samples | Linear Defect Samples |
|---|---|---|
| 1 (5 circular + 10 linear) | ![]() | ![]() |
| 2 (10 circular + 13 linear) | ![]() | ![]() |
| 3 (15 circular + 16 linear) | ![]() | ![]() |
| 4 (20 circular + 19 linear) | ![]() | ![]() |
| 5 (25 circular + 22 linear) | ![]() | ![]() |
| 6 (30 circular + 25 linear) | ![]() | ![]() |
| 7 (35 circular + 27 linear) | ![]() | ![]() |
| 8 (40 circular + 30 linear) | ![]() | ![]() |
| Experiment No. | Circular Defect (TP) | Circular Defect (FN) | Linear Defect (TP) | Linear Defect (FN) | Pseudo-Defect (TP) | Pseudo-Defect (FN) | Circular & Linear Defect |
|---|---|---|---|---|---|---|---|
| 1 | 536 | 64 | 271 | 79 | 2865 | 235 | 5 + 10 |
| 2 | 568 | 32 | 289 | 61 | 2958 | 142 | 10 + 13 |
| 3 | 579 | 21 | 301 | 49 | 3006 | 94 | 15 + 16 |
| 4 | 586 | 14 | 314 | 26 | 3042 | 58 | 20 + 19 |
| 5 | 591 | 9 | 325 | 25 | 3068 | 32 | 25 + 22 |
| 6 | 594 | 6 | 333 | 17 | 3082 | 18 | 30 + 25 |
| 7 | 596 | 4 | 339 | 11 | 3090 | 10 | 35 + 27 |
| 8 | 597 | 3 | 343 | 7 | 3094 | 6 | 40 + 30 |
| Experiment No. | ACC (%) | PPV (%) | TPR (%) | TNR (%) |
|---|---|---|---|---|
| 1 | 90.85 | 77.43 | 84.95 | 92.42 |
| 2 | 95.03 | 85.78 | 90.21 | 95.42 |
| 3 | 96.90 | 90.34 | 92.63 | 96.97 |
| 4 | 98.05 | 93.95 | 94.74 | 98.13 |
| 5 | 98.88 | 96.63 | 96.42 | 98.97 |
| 6 | 99.38 | 98.10 | 97.58 | 99.42 |
| 7 | 99.68 | 98.94 | 98.42 | 99.68 |
| 8 | 99.81 | 99.37 | 98.95 | 99.81 |
| Technical Approach | PPV | Dataset |
|---|---|---|
| Improved YOLO, global attention mechanism, CNeB module [21] | mAP improvement of 94.2% | Not provided |
| YOLOv7TS, TSCODE decoupled head, CARAFE upsampling operator [22] | +4.6% | Not provided |
| Improved YOLO-tiny with ELAN-PCS network structure [23] | mAP improvement of 6.8% | Casting weld defect data |
| Improved Faster R-CNN [24] | 98.8% | Slice images |
| Convolutional neural network segmentation technique [25] | 98.8% | Not provided |
| U-Net-based automatic localization algorithm [26] | 88.4% | Not provided |
| Image ID | Image Type | Resolution | Bit Depth | Data Volume |
|---|---|---|---|---|
| 001-200 | Small-diameter pipe weld image | 2388 × 667 | 8 | 200 |
| 201-400 | Long-distance pipeline weld image | 3128 × 1944 | 24 | 200 |
| Experiment No. | Number of Defect Samples | Number of Manually Annotated Images | Number of Test Images | Defect Detection Rate | Noise Recognition Rate |
|---|---|---|---|---|---|
| 1 | 5 | 2 | 198 | 97.4% | 100% |
| 2 | 8 | 5 | 195 | 97.6% | 100% |
| 3 | 13 | 7 | 193 | 97.9% | 100% |
| 4 | 17 | 9 | 191 | 98.1% | 100% |
| 5 | 21 | 11 | 189 | 98.3% | 100% |
| 6 | 26 | 14 | 186 | 98.6% | 100% |
| 7 | 30 | 16 | 184 | 98.8% | 100% |
| 8 | 34 | 18 | 182 | 99.0% | 100% |
| 9 | 39 | 21 | 179 | 99.2% | 100% |
| 10 | 45 | 24 | 176 | 99.4% | 100% |
| Experiment No. | Number of Defect Samples | Number of Manually Annotated Images | Number of Test Images | Defect Detection Rate | Noise Recognition Rate |
|---|---|---|---|---|---|
| 11 | 6 | 3 | 197 | 98.3% | 100% |
| 12 | 10 | 6 | 194 | 98.5% | 100% |
| 13 | 15 | 9 | 191 | 98.6% | 100% |
| 14 | 19 | 12 | 188 | 98.8% | 100% |
| 15 | 24 | 15 | 186 | 98.9% | 100% |
| 16 | 28 | 17 | 183 | 99.1% | 100% |
| 17 | 33 | 20 | 180 | 99.2% | 100% |
| 18 | 37 | 22 | 178 | 99.4% | 100% |
| 19 | 42 | 25 | 175 | 99.5% | 100% |
| 20 | 47 | 27 | 173 | 99.7% | 100% |
| Model | Parameters (Millions) | Time (ms/image) | Hardware Dependency |
|---|---|---|---|
| Proposed Method | 0.05 | 12.4 | CPU (Low Power) |
| YOLOv8 | 3.0 | 45.2 | GPU Recommended |
| ResNet50 | 25.6 | 68.5 | GPU Required |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Liu, H.; Gao, W.; Gao, L.; He, J. X-Ray Weld Image Detection Method of Water Injection Network Based on Sparse Representation. Sensors 2026, 26, 4160. https://doi.org/10.3390/s26134160
Liu H, Gao W, Gao L, He J. X-Ray Weld Image Detection Method of Water Injection Network Based on Sparse Representation. Sensors. 2026; 26(13):4160. https://doi.org/10.3390/s26134160
Chicago/Turabian StyleLiu, Hailong, Weixin Gao, Li Gao, and Junjie He. 2026. "X-Ray Weld Image Detection Method of Water Injection Network Based on Sparse Representation" Sensors 26, no. 13: 4160. https://doi.org/10.3390/s26134160
APA StyleLiu, H., Gao, W., Gao, L., & He, J. (2026). X-Ray Weld Image Detection Method of Water Injection Network Based on Sparse Representation. Sensors, 26(13), 4160. https://doi.org/10.3390/s26134160

















