Machine Learning-Based Welding Defect Recognition Using GLCM Features and k-Fold Cross-Validation: KNN and SVM Techniques
Abstract
Although radiographic inspection is one of the oldest techniques for non-destructive testing, it is still considered vital in many industrial fields to ensure the quality of welds and meet the demands of work conditions and design, as well as safety and reliability requirements. This paper presents an algorithm that identifies and categorizes welding defects in radiographic images using machine learning techniques. For this aim, two supervised classifiers are proposed and conducted: 1) K-nearest neighbor (KNN), which is a nonparametric classifier, and 2) a multiclass classifier based on a support vector machine (SVM) as a highly generalized learning-based classifier. SVM is commonly used in binary classification, but it can be adapted for multi-classification using various common methods, such as one-versus-one and one-against-all. The texture features are adopted in this paper as inputs to the classifiers, where two groups of them are used: the local binary pattern (LBP) features and the gray-level co-occurrence matrix (GLCM) extraction, to obtain the feature vector. To avoid the risk of overfitting, a 4-fold cross-validation is applied. The experimental results are reported for the two different classifiers, achieving an accuracy of 91.66 % when combining GLCM and SVM.
Keywords:
welding defect, radiographic images, classification, machine learning, k-fold cross-validationReferences
- Kumar D.D., Fang C., Zheng Y., Gao Y., Semi-supervised transfer learning-based automatic weld defect detection and visual inspection, Engineering Structures, 292: 116580, 2023, https://doi.org/10.1016/j.engstruct.2023.116580
- Kadhim S.J., Al-Sabur R.K., Ali A.B.K., Application of different median filter algorithms for welding defects clarification in radiographic images, University of Thi-Qar Journal for Engineering Sciences, 11(1): 56–61, 2020, https://doi.org/10.31663/tqujes.11.1.378(2020)
- Wang D., Yi Q., Liu Y., Lu R., Tian G., Advanced detection and reconstruction of welding defects in irregular geometries using eddy current pulsed thermography, NDT & E International, 154: 103398, 2025, https://doi.org/10.1016/j.ndteint.2025.103398
- Alvarado J.W.V., Garcia L.F.C., Neira M.T., Flores J.W.V., Probability of defects detection in welded joints using the magnetic particle method, Archives of Metallurgy and Materials, 69(2): 607–612, 2024, https://doi.org/10.24425/amm.2024.149789
- Sumardani N.I., Setiawan N.I., Nuryadin B.W., Sumardani D., Defect analysis of carbonsteel pipe welding connections using non-destructive testing with the penetrant test method, Risenologi, 5(1): 38–47, 2020, https://doi.org/10.47028/j.risenologi.2020.51.72
- Aboali A., El-Shaib M., Sharara A., Shehadeh M., Screening for welding defects using acoustic emission technique, Advanced Materials Research, 1025–1026: 7–12, 2014, https://doi.org/10.4028/www.scientific.net/amr.1025-1026.7
- Alasdi S.N., Al-Sabur R., In-depth thermal analysis of different PIN configurations in friction stir spot welding of similar and dissimilar alloys, Journal of Manufacturing and Materials Processing, 9(6): 184, 2025, https://doi.org/10.3390/jmmp9060184
- Salgado-Lopez J.M., Ojeda-Elizarraras J.L., Silva-Hernandez A., Tello-Rico J.M., Failure of an autotank repaired by welding, Journal of Scientific and Technical Applications, 6(17): 1–9, http://doi.org/10.35429/jsta.2020.17.6.1.9
- Hamade R.F., Baydoun A.M.R., Nondestructive detection of defects in friction stir welded lap joints using computed tomography, Materials & Design, 162: 10–23, 2019, https://doi.org/10.1016/j.matdes.2018.11.034
- Abdelkader R., Ramou N., Khorchef M., Chetih N., Boutiche Y., Segmentation of x-ray image for welding defects detection using an improved Chan-Vese model, Materials Today Proceedings, 42(5): 2963–2967, 2021, https://doi.org/10.1016/j.matpr.2020.12.806
- Liao T.W., Classification of weld flaws with imbalanced class data, Expert Systems with Applications, 35(3): 1041–52, 2008, https://doi.org/10.1016/j.eswa.2007.08.044
- Chen Y., He Y., Wu L., Detection of welding defects using the YOLOV8-ELA algorithm, Applied Sciences, 15(9): 5204, 2025, https://doi.org/10.3390/app15095204
- Orlando M., De Maddis M., Razza V., Lunetto V., Non-destructive detection and analysis of weld defects in dissimilar pulsed GMAW and FSW joints of aluminium castings and plates through 3D X-ray computed tomography, The International Journal of Advanced Manufacturing Technology, 132(5–6): 2957–70, 2024, https://doi.org/10.1007/s00170-024-13576-x
- Liao T.W., Ni J., An automated radiographic NDT system for weld inspection: Part I – Weld extraction, NDT & E International, 29(3): 157–62, 1996, https://doi.org/10.1016/0963-8695(96)00009-6
- Da Silva R.R., Caloba L.P., Siqueira M.H.S., Rebello J.M.A., Pattern recognition of weld defects detected by radiographic test, NDT & E International, 37(6): 461–70, 2004, https://doi.org/10.1016/j.ndteint.2003.12.004
- Tou J.Y., Tay Y.H., Lau P.Y., Gabor filters and grey-level co-occurrence matrices in texture classification, [in:] MMU International Symposium on Information and Communications Technologies, pp. 197–202, 2007.
- Valentin P., Kounalakis T., Nalpantidis L., Weld classification using gray level cooccurrence matrix and local binary patterns, [in:] 2018 IEEE International Conference on Imaging Systems and Techniques, pp. 1–6, 2018, https://doi.org/10.1109/ist.2018.8577092
- Abidin Z., Anompa M.A., Muhtadan, Development of welding defects identifier application on radiographic film using gray level co-occurrence matrix and backpropagation, [in:] AIP Conference Proceedings, 1555: 70–74, 2013, https://doi.org/10.1063/1.4820996
- Ramana E.V., Penekalapati S.V., Namala K.K., Identification of weld sub-surface defects by radiographic images using texture features, E3S Web of Conferences, 552: 01017, 2024, https://doi.org/10.1051/e3sconf/202455201017
- Mery D., Berti M.A., Automatic detection of welding defects using texture features, Insight – Non-Destructive Testing and Condition Monitoring, 45(10): 676–81, 2003, https://doi.org/10.1784/insi.45.10.676.52952
- Wang X., Wong B.S., Tan C.S., Recognition of welding defects in radiographic images by using support vector machine classifier, Research Journal of Applied Sciences, Engineering and Technology, 2(3): 295-301, 2010.
- Hassan J., Awan A.M., Jalil A., Welding defect detection and classification using geometric features, [in:] 2012 10th International Conference on Frontiers of Information Technology, pp. 139–44, 2012, https://doi.org/10.1109/fit.2012.33
- Valavanis I., Kosmopoulos D., Multiclass defect detection and classification in weld radiographic images using geometric and texture features, Expert Systems With Applications, 7(12): 7606–14, 2010, https://doi.org/10.1016/j.eswa.2010.04.082
- Palma-Ramirez D., Ross-Veitia B.D., Font-Ariosa P., Espinel-Hernandez A., Sanchez-Roca A., Carvajal-Fals H., Nunez-Alvarez J.R., Hernandez-Herrera H., Deep convolutional neural network for weld defect classification in radiographic images, Heliyon, 10(9): e30590, 2024, https://doi.org/10.1016/j.heliyon.2024.e30590
- Zhang W., Liu W., Yu X., Kang D., Xiong Z., Lv X., Huang S., Li Y., Deep learning-based automated detection of welding defects in pressure pipeline radiograph, Coatings, 15(7): 808, 2025, https://doi.org/10.3390/coatings15070808
- Lone A.H., Siddiqui A.N., Noise models in digital image processing, Global Sci-Tech, 10(2): 63, 2018, https://doi.org/10.5958/2455-7110.2018.00010.1
- Singh H., Kaur S., Sharma P., Utilizing various filtering methodologies in digital image processing, [in:] 2024 International Conference on Electrical Electronics and Computing Technologies (ICEECT), pp. 1–6, 2024, https://doi.org/10.1109/iceect61758.2024.10738905
- Al-Taie R., A review paper: digital image filtering processing, Technium, 3(9): 1–11, 2021, https://doi.org/10.47577/technium.v3i9
- Rivera-Aguilar B.A., Cuevas E., Luque-Chang A., Lopez J., Perez-Cisneros M., Pixel Interaction model for contrast enhancement: bridging social science and image processing, Applied Sciences, 14(23): 10887, 2024, https://doi.org/10.3390/app142310887
- Patel P., Bhandari A., A review on image contrast enhancement techniques, Smart Moves Journal Ijoscience, 5(7): 18–22, 2019, https://scispace.com/pdf/a-review-on-image-contrast-enhancement-techniques-mn53j9lvgm.pdf
- Lasnel R., Froute L., Kovscek A.R., Jolivet I.C., Creux P., Image processing and segmentation open source codes applied to FIB-SEM images of ultra-tight gas shales samples: enhanced pore space representativeness and mineral identification, Gas Science and Engineering, 138: 205610, 2025, https://doi.org/10.1016/j.jgsce.2025.205610
- Mageswari S.U., Sridevi M., Mala C., An experimental study and analysis of different image segmentation techniques, Procedia Engineering, 64: 36–45, 2013, https://doi.org/10.1016/j.proeng.2013.09.074
- Atta M.A., Imtiaz M., Hassan A., Saqib S., Image segmentation by using threshold techniques, Lahore Garrison University Research Journal of Computer Science and Information Technology, 2(2): 1–6, 2018, https://lgurjcsit.lgu.edu.pk/index.php/lgurjcsit/issue/view/29/18
- Chen X., Liu C., Xie D., Miao D., Image thresholding segmentation method based on adaptive granulation and reciprocal rough entropy, Information Sciences, 695: 121737, 2025, https://doi.org/10.1016/j.ins.2024.121737
- Haralick R.M., Shanmugam K., Dinstein I., Textural features for image classification, IEEE Transactions on Systems Man and Cybernetics, SMC-3(6): 610–621, 1973, https://doi.org/10.1109/tsmc.1973.4309314
- Utaminingrum F., Alqadri A.M., Somawirata I.K., Karim C., Septiarini A., Lin C.Y., Shih T.K., Feature selection of gray-level cooccurrence matrix using genetic algorithm with extreme learning machine classification for early detection of pole roads, Results in Engineering, 20: 101437, 2023, https://doi.org/10.1016/j.rineng.2023.101437">https://doi.org/10.1016/j.rineng.2023.101437.
- Iqbal N., Mumtaz R., Shafi U., Zaidi S.M.H., Gray level co-occurrence matrix (GLCM) texture based crop classification using low altitude remote sensing platforms, PeerJ Computer Science, 7: 1–26, 2021, https://doi.org/10.7717/peerj-cs.536
- Jobanputra R., Clausi D.A., Preserving boundaries for image texture segmentation using grey level co-occurring probabilities, Pattern Recognition, 39(2): 234–245, 2006, https://doi.org/10.1016/j.patcog.2005.07.010
- Kwak J.T., Xu S., Wood B.J., Efficient data mining for local binary pattern in texture image analysis, Expert Systems With Applications, 42(9): 4529–4539, 2015, https://doi.org/10.1016/j.eswa.2015.01.055
- Lan S., Liao X., Fan H., Hu S., Pan Z., A multi-channel framework based Local Binary Pattern with two novel local feature descriptors for texture classification, Digital Signal Processing, 140: 104124, 2023, https://doi.org/10.1016/j.dsp.2023.104124
- Kaur N., Nazir N., Manik, A review of local binary pattern based texture feature extraction, 2021 9th International Conference on Reliability, Infocom Technologies and Optimization (Trends and Future Directions) (ICRITO), 2021, https://doi.org/10.1109/ICRITO51393.2021.9596485
- Ojala T., Pietikainen M., Harwood D., A comparative study of texture measures with classification based on featured distributions, Pattern Recognition, 29(1): 51–59, 1996, https://doi.org/10.1016/0031-3203(95)00067-4
- Ojala T., Pietikainen M., Maenpaa T., Gray scale and rotation invariant texture classification with local binary patterns, [in:] Computer Vision – ECCV 2000, 1842: 404–420, 2000, https://doi.org/10.1007/3-540-45054-8 27.
- Ikram K., Djilali K., Abdennasser D., Al-Sabur R., Ahmed B., Sharkawy A.N., Comparative analysis of fouling resistance prediction in shell and tube heat exchangers using advanced machine learning techniques, Research on Engineering Structures and Materials, 10(1): 253–270, 2024, https://doi.org/10.17515/resm2023.858en0816
- Shi B., Liu J., Nonlinear metric learning for kNN and SVMs through geometric transformations, Neurocomputing, 318: 18–29, 2018, https://doi.org/10.1016/j.neucom.2018.07.074
- Fan Z., Xie J.K., Wang Z.Y., Liu P.C., Qu S.J., Huo L., Image classification method based on improved KNN algorithm, Journal of Physics Conference Series, 1930(1): 012009, 2021, https://doi.org/10.1088/1742-6596/1930/1/012009
- Allwein E.L., Schapire R.E., Singer Y., Reducing multiclass to binary: a unifying approach for margin classifiers, Journal of Machine Learning Research, 1: 113–141, 2000, https://www.jmlr.org/papers/volume1/allwein00a/allwein00a.pdf
- Liu Y., Bi J.W., Fan Z.P., A method for multi-class sentiment classification based on an improved one-vs-one (OVO) strategy and the support vector machine (SVM) algorithm, Information Sciences, 394–395: 38–52, 2017, https://doi.org/10.1016/j.ins.2017.02.016
- Bahedh A.S., Mishra A., Al-Sabur R., Jassim A.K., Machine learning algorithms for prediction of penetration depth and geometrical analysis of weld in friction stir spot welding process, Metallurgical Research & Technology, 119(3): 305, 2022, https://doi.org/10.1051/metal/2022032
- Al-Sabur R., Mishra A., Khalaf H.I., Mastering friction stir welding (FSW) with machine learning (ML): a comprehensive guide to algorithms and applications, [in:] Using Computational Intelligence for Sustainable Manufacturing of Advanced Materials, pp. 387–416, 2025, https://doi.org/10.4018/979-8-3693-7974-5.ch017
- Encord, Confusion Matrix, Encord Computer Vision Glossary, https://encord.com/glossary/confusion-matrix/ (access: 2.09.2025).
- Sokolova M., Lapalme G., A systematic analysis of performance measures for classification tasks, Information Processing & Management, 45(4): 427–37, 2009, https://doi.org/10.1016/j.ipm.2009.03.002
- Mahmoud K.H., Abdel-Jaber G.T., Sharkawy A.N., Neural network-based classifier for collision classification and identification for a 3-DOF industrial robot, Automation, 5(1): 13–34, 2024, https://doi.org/10.3390/automation5010002

