COMPARATIVE ANALYSIS OF TRANSFORMER-BASED AND CONVENTIONAL CONVOLUTIONAL NEURAL NETWORK (CNN) MODELS FOR DEFECT DETECTION IN CAST PRODUCTS
DOI:
https://doi.org/10.33003/fjs-2026-1001-4373Keywords:
Defect Detection, Cast, Transformer-Based Model, Convolutional Neural Network (CNN), Computer VisionAbstract
Casting is a widely used manufacturing process which is frequently affected by surface and internal defects that compromise product quality and structural integrity. Conventional inspection methods, such as manual visual inspection, rely heavily on human expertise and are often slow, subjective, and prone to oversight. To address these limitations, this study develops a computer vision system for the detection of defects in cast products using Transformer-based and conventional convolutional neural network (CNN) models. The performance of both models was evaluated in terms of accuracy, precision, recall, specificity, sensitivity, and F1-score. The models were trained on a dataset of 7,348 grayscale images using the Google Colab platform. Experimental results show that the Transformer-based model outperformed the traditional CNN, achieving an accuracy of 98.4%, precision of 96.7%, recall of 94.9%, F1-score of 96.2%, specificity of 95.9%, and sensitivity of 97.8%. The proposed system enhances quality assurance, reduces manufacturing waste, and supports continuous process optimization, offering significant benefits for medium-sized foundries seeking improved efficiency and product reliability.
References
Adi, K., Pujiyanto, S., Dwi Nurhayati, O., & Pamungkas, A. (2017). Beef quality identification using thresholding method and decision tree classification based on Android smartphone. Journal of Food Quality, 2017, 1–10. https://doi.org/10.1155/2017/1674718
Adi, K., Pujiyanto, S., Nurhayati, O. D., & Pamungkas, A. (2017). Beef marbling identification using color analysis and decision tree classification. Advanced Science Letters, 23(7), 6618–6622. https://doi.org/10.1166/asl.2017.9697
Akanmu, A. A., Anumba, C. J., & Ogunseiju, O. O. (2021). Towards next generation cyber-physical systems and digital twins for construction. Journal of Information Technology in Construction, 26, 505–525. https://doi.org/10.36680/j.itcon.2021.027
Alaa, K. A., Kotb, Y., & Kotb, A. (2024). Automated detection of defects on metal surfaces using vision transformers. arXiv. https://doi.org/10.48550/arXiv.2410.04440
Alaiz-Rodríguez, R., & Parnell, A. C. (2020). A machine learning approach for lamb meat quality assessment using FTIR spectra. IEEE Access, 8, 52385–52394. https://doi.org/10.1109/access.2020.2974623
Avian, C., Leu, J. S., Prakosa, S. W., & Faisal, M. (2022). An improved classification of pork adulteration in beef based on electronic nose using modified deep extreme learning with principal component analysis as feature learning. Food Analytical Methods, 15(11), 3020–3031. https://doi.org/10.1007/s12161-022-02361-9
Baduge, S. K., Thilakarathna, S., Perera, J. S., Arashpour, M., Sharafi, P., Teodosio, B., Shringi, A., & Mendis, P. (2022). Artificial intelligence and smart vision for building and construction 4.0: Machine and deep learning methods and applications. Automation in Construction, 141, Article 104440. https://doi.org/10.1016/j.autcon.2022.104440
Bellamy, R. K. E., Dey, K., Hind, M., Hoffman, S. C., Houde, S., Kannan, K., Lohia, P., Martino, J., Mehta, S., Mojsilovic, A., Nagar, S., Ramamurthy, K. N., Richards, J., Saha, D., Sattigeri, P., Singh, M., Varshney, K. R., & Zhang, Y. (2019). AI fairness 360: An extensible toolkit for detecting and mitigating algorithmic bias. IBM Journal of Research and Development, 63(4/5), 4:1-4:15. https://doi.org/10.1147/jrd.2019.2942287
Bila, S., Fitrianto, A., & Sartono, B. (2021). Image classification of beef and pork using convolutional neural network in Keras framework. International Journal of Science, Engineering and Information Technology, 5(02), 245–248. https://doi.org/10.21107/ijseit.v5i02.9864
Butt, S. I., Asgher, U., Mushtaq, U., Ahmed, R., Zhang, F., Ayaz, Y., Jamil, M., & Amjad, M. K. (2017). Intelligent machine vision based modeling and positioning system in sand casting process. Advances in Materials Science and Engineering, 2017, 1–11. https://doi.org/10.1155/2017/3192672
Cáceres, C., & Selling, B. (1996). Casting defects and the tensile properties of an AlSiMg alloy. Materials Science and Engineering: A, 220(1-2), 109–116. https://doi.org/10.1016/s0921-5093(96)10433-0
Chen, C., Lu, J., Zhou, M., Yi, J., Liao, M., & Gao, Z. (2022). A YOLOv3-based computer vision system for identification of tea buds and the picking point. Computers and Electronics in Agriculture, 198, Article 107116. https://doi.org/10.1016/j.compag.2022.107116
Chen, H., Li, C., Wang, G., Li, X., Rahaman, M. M., Sun, H., Hu, W., Li, Y., Liu, W., Sun, C., Ai, S., & Grzegorzek, M. (2022). GasHis-Transformer: A multi-scale visual transformer approach for gastric histopathological image detection. Pattern Recognition, 130, Article 108827. https://doi.org/10.1016/j.patcog.2022.108827
Chen, Z., Zhang, J. M., Sarro, F., & Harman, M. (2023). A comprehensive empirical study of bias mitigation methods for machine learning classifiers. ACM Transactions on Software Engineering and Methodology, 32(4), 1–30. https://doi.org/10.1145/3583561
Chouldechova, A. (2017). Fair prediction with disparate impact: A study of bias in recidivism prediction instruments. Big Data, 5(2), 153–163. https://doi.org/10.1089/big.2016.0047
CraftMach Engineered Solutions Inc. (2023, June 20). Why metal casting parts are preferred for high performance applications across all major industries. https://craftmach.com/why-metal-casting-parts-are-preferred-for-high-performance-applications-across-all-major-industries/
Delgado, J. M. D., Oyedele, L., Demian, P., & Beach, T. (2020). A research agenda for augmented and virtual reality in architecture, engineering and construction. Advanced Engineering Informatics, 45, Article 101122. https://doi.org/10.1016/j.aei.2020.101122
Di Leo, G., Liguori, C., Pietrosanto, A., & Sommella, P. (2017). A vision system for the online quality monitoring of industrial manufacturing. Optics and Lasers in Engineering, 89, 162–168. https://doi.org/10.1016/j.optlaseng.2016.05.007
Ferguson, M., Ak, R., Lee, Y.-T., & Law, K. H. (2017). Automatic localization of casting defects with convolutional neural networks. In 2017 IEEE international conference on big data (big data) (pp. 1726-1735). IEEE. https://doi.org/10.1109/bigdata.2017.8258115
Friedler, S. A., Scheidegger, C., & Venkatasubramanian, S. (2021). The (im)possibility of fairness. Communications of the ACM, 64(4), 136–143. https://doi.org/10.1145/3433949
Fu, R., Huang, Y., & Singh, P. V. (2020). AI and algorithmic bias: Source, detection, mitigation and implications. SSRN Electronic Journal. https://doi.org/10.2139/ssrn.3681517
GC, S., Saidul Md, B., Zhang, Y., Reed, D., Ahsan, M., Berg, E., & Sun, X. (2021). Using deep learning neural network in artificial intelligence technology to classify beef cuts. Frontiers in Sensors, 2, Article 654357. https://doi.org/10.3389/fsens.2021.654357
Göksu, M., Göksu, A., & Alkan, A. (2022). Emergency detection with deep learning based image processing. Computer Science. https://doi.org/10.53070/bbd.1173385
Goodfellow, I., Bengio, Y., & Courville, A. (2016). Deep learning. MIT Press. https://www.deeplearningbook.org
Gu, J., Wang, Z., Kuen, J., Ma, L., Shahroudy, A., Shuai, B., Liu, T., Wang, X., Wang, G., Cai, J., & Chen, T. (2018). Recent advances in convolutional neural networks. Pattern Recognition, 77, 354–377. https://doi.org/10.1016/j.patcog.2017.10.013
Gupta, R., Anand, V., Gupta, S., & Koundal, D. (2023). Deep learning model for defect analysis in industry using casting images. Expert Systems With Applications, 232, Article 120758. https://doi.org/10.1016/j.eswa.2023.120758
Ibrahim, H., & Tapamo, J.-R. O. (2024). A survey of vision-based methods for surface defects' detection and classification in steel products. Informatics, 11(2), Article 25. https://doi.org/10.3390/informatics11020025
Ito, T. (2016). Supervised learning methods of bilinear neural network systems using discrete data. International Journal of Machine Learning and Computing, 6(5), 235–240. https://doi.org/10.18178/ijmlc.2016.6.5.604
Jia, W., Liang, G., Wang, Y., & Wang, J. (2018). Electronic noses as a powerful tool for assessing meat quality: A mini review. Food Analytical Methods, 11(10), 2916–2924. https://doi.org/10.1007/s12161-018-1283-1
Kim, J. Y. (2022). Coffee beans quality prediction using machine learning. SSRN Electronic Journal. https://doi.org/10.2139/ssrn.4024785
Kleinberg, J. (2018). Inherent trade-offs in algorithmic fairness. ACM SIGMETRICS Performance Evaluation Review, 46(1), 40. https://doi.org/10.1145/3292040.3219634
Krizhevsky, A., Sutskever, I., & Hinton, G. E. (2017). ImageNet classification with deep convolutional neural networks. Communications of the ACM, 60(6), 84–90. https://doi.org/10.1145/3065386
Lan, R., Awolusi, I., & Cai, J. (2024). Computer vision for safety management in the steel industry. AI, 5(3), 1192–1215. https://doi.org/10.3390/ai5030058
LeCun, Y., Bengio, Y., & Hinton, G. (2015). Deep learning. Nature, 521(7553), 436–444. https://doi.org/10.1038/nature14539
Li, H., Tian, Y., Mueller, K., & Chen, X. (2019). Beyond saliency: Understanding convolutional neural networks from saliency prediction on layer-wise relevance propagation. Image and Vision Computing, 83-84, 70–86. https://doi.org/10.1016/j.imavis.2019.02.005
Li, X., Zhang, B., Li, P., Liu, Z., Li, K., Zhang, Z., & Guo, W. (2024). A survey on applications of reinforcement learning in spatial resource allocation. Computational Urban Science, 4, Article 11. https://doi.org/10.1007/s43762-024-00127-z
Li, Z., Dong, M., Wen, S., Hu, X., Zhou, P., & Zeng, Z. (2019). CLU-CNNs: Object detection for medical images. Neurocomputing, 350, 53–59. https://doi.org/10.1016/j.neucom.2019.04.002
Li, Z., Liu, F., Yang, W., Peng, S., & Zhou, J. (2021). A survey of convolutional neural networks: Analysis, applications, and prospects. IEEE Transactions on Neural Networks and Learning Systems, 33(12), 6999–7019. https://doi.org/10.1109/TNNLS.2021.3087087
Malikhah, M., Sarno, R., & Sabilla, S. (2021). Ensemble learning for optimizing classification of pork adulteration in beef based on electronic nose dataset. International Journal of Intelligent Engineering and Systems, 14(4), 44–55. https://doi.org/10.22266/ijies2021.0831.05
Mandhala, V. N., Bhattacharyya, D., Midhunchakkaravarthy, D., & Kim, H. J. (2022). Detecting and mitigating bias in data using machine learning with pre-training metrics. Ingénierie des Systèmes d'Information, 27(1), 119–125. https://doi.org/10.18280/isi.270114
Marasigan, R. I., Jr. (2020). Copra meat classification using convolutional neural network. International Journal of Emerging Trends in Engineering Research, 8(2), 435–439. https://doi.org/10.30534/ijeter/2020/30822020
Medeiros, E. C., Almeida, L. M., & Filho, J. G. D. a. T. (2021). Computer vision and machine learning for tuna and salmon meat classification. Informatics, 8(4), Article 70. https://doi.org/10.3390/informatics8040070
Megalingam, R. K., Saboo, N., Patyal, V., Sreekanth, S., & Babu, R. (2019). A smart traffic control system using convolutional neural network for Indian lanes. In 2019 international conference on intelligent computing and control systems (ICICCS) (pp. 1–5). IEEE. https://doi.org/10.1109/ICCS45141.2019.9065755
Mileusnic, I., Sakota-Rosic, J., Muncan, J., Dogramadzi, S., & Matija, L. (2017). Computer assisted rapid nondestructive method for evaluation of meat freshness. FME Transactions, 45(4), 597–602. https://doi.org/10.5937/fmet1704597m
Milovanovic, B., Djekic, I., Djordjevic, V., Tomovic, V., Barba, F., Tomasevic, I., & Lorenzo, J. M. (2019). Pros and cons of using a computer vision system for color evaluation of meat and meat products. IOP Conference Series: Earth and Environmental Science, 333, Article 012008. https://doi.org/10.1088/1755-1315/333/1/012008
Nibareke, T., & Laassiri, J. (2020). Using big data-machine learning models for diabetes prediction and flight delays analytics. Journal of Big Data, 7, Article 78. https://doi.org/10.1186/s40537-020-00355-0
Noble, J. A. (1995). From inspection to process understanding and monitoring: A view on computer vision in manufacturing. Image and Vision Computing, 13(3), 197–214. https://doi.org/10.1016/0262-8856(95)90840-5
Noor-A-Rahim, M., Firyaguna, F., John, J., Khyam, M. O., Pesch, D., Armstrong, E., Claussen, H., & Poor, H. V. (2022). Toward industry 5.0: Intelligent reflecting surface in smart manufacturing. IEEE Communications Magazine, 60(10), 72–78. https://doi.org/10.1109/mcom.001.2200016
Patterson, J., & Gibson, A. (2017). Deep learning: A practitioner's approach. O'Reilly Media.
Pierdicca, R., Paolanti, M., Felicetti, A., Piccinini, F., & Zingaretti, P. (2020). Automatic faults detection of photovoltaic farms: solAIr, a deep learning-based system for thermal images. Energies, 13(24), Article 6496. https://doi.org/10.3390/en13246496
Polkinghorne, R., & Thompson, J. (2010). Meat standards and grading. Meat Science, 86(1), 227–235. https://doi.org/10.1016/j.meatsci.2010.05.010
Powell, A. (2017). Integrating a gender perspective into transparency and accountability initiatives: Three case studies. Gender & Development, 25(3), 489–507. https://doi.org/10.1080/13552074.2017.1379774
Rasheed, A., San, O., & Kvamsdal, T. (2020). Digital twin: Values, challenges and enablers from a modeling perspective. IEEE Access, 8, 21980–22012. https://doi.org/10.1109/access.2020.2970143
Sarno, R., Sabilla, S. I., Wijaya, D. R., Sunaryono, D., & Fatichah, C. (2020). Electronic nose dataset for pork adulteration in beef. Data in Brief, 32, Article 106139. https://doi.org/10.1016/j.dib.2020.106139
Sathya, R., & Abraham, A. (2013). Comparison of supervised and unsupervised learning algorithms for pattern classification. International Journal of Advanced Research in Artificial Intelligence, 2(2), 34–38. https://doi.org/10.14569/ijarai.2013.020206
Silva, R. L., Rudek, M., Szejka, A. L., & Canciglieri Junior, O. (2018). Machine vision systems for industrial quality control inspections. In IFIP advances in information and communication technology (Vol. 540, pp. 631–641). Springer. https://doi.org/10.1007/978-3-030-01614-2_58
Taheri-Garavand, A., Fatahi, S., Omid, M., & Makino, Y. (2019). Meat quality evaluation based on computer vision technique: A review. Meat Science, 156, 183–195. https://doi.org/10.1016/j.meatsci.2019.06.002
Taheri-Garavand, A., Fatahi, S., Shahbazi, F., & de la Guardia, M. (2019). A nondestructive intelligent approach to real-time evaluation of chicken meat freshness based on computer vision technique. Journal of Food Process Engineering, 42(4), Article e13039. https://doi.org/10.1111/jfpe.13039
Tang, Z., Tian, E., Wang, Y., Wang, L., & Yang, T. (2021). Nondestructive defect detection in castings by using spatial attention bilinear convolutional neural network. IEEE Transactions on Industrial Informatics, 17(1), 82–89. https://doi.org/10.1109/tii.2020.2985159
Unceta, I., Nin, J., & Pujol, O. (2020). Risk mitigation in algorithmic accountability: The role of machine learning copies. PLOS ONE, 15(11), Article e0241286. https://doi.org/10.1371/journal.pone.0241286
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., & Polosukhin, I. (2017). Attention is all you need. In Advances in neural information processing systems (pp. 5998–6008).
Wang, L., & Sun, Y. (2022). Image classification using convolutional neural network with wavelet domain inputs. IET Image Processing, 16(8), 2037–2048. https://doi.org/10.1049/ipr2.12466
What is face detection and how does it work? (2023, April 1). TechTarget. https://www.techtarget.com/searchenterpriseai/definition/face-detection
Wojnowski, W., Majchrzak, T., Dymerski, T., Gębicki, J., & Namieśnik, J. (2017). Electronic noses: Powerful tools in meat quality assessment. Meat Science, 131, 119–131. https://doi.org/10.1016/j.meatsci.2017.04.240
Yamashita, R., Nishio, M., Do, R. K. G., & Togashi, K. (2018). Convolutional neural networks: An overview and application in radiology. Insights into Imaging, 9(4), 611–629. https://doi.org/10.1007/s13244-018-0639-9
Yaluru, G., & Kakirala, S. T. (2021). Automation and integration of industries through computer vision systems. Journal of Cardiovascular Disease Research, 12(6), 326–330. https://bibliomed.org/?mno=137490
Zhou, L., Zhang, L., & Konz, N. (2023). Computer vision techniques in manufacturing. IEEE Transactions on Systems, Man, and Cybernetics: Systems, 53(1), 105–117. https://doi.org/10.1109/tsmc.2022.3166397
Žliobaitė, I. (2017). Measuring discrimination in algorithmic decision making. Data Mining and Knowledge Discovery, 31(4), 1060–1089. https://doi.org/10.1007/s10618-017-0506-1
Zou, J., & Schiebinger, L. (2018). AI can be sexist and racist — it’s time to make it fair. Nature, 559(7714), 324–326. https://doi.org/10.1038/d41586-018-05707-8
Downloads
Published
Issue
Section
Categories
License
Copyright (c) 2026 Lazarus Uduma Igwe, Oluwafemi Ayodeji Olugboji

This work is licensed under a Creative Commons Attribution 4.0 International License.