Gradient surgery: A necessity for robust test-time adaptation for detecting casting defects

Casting defects pose a significant challenge in the manufacturing industry, leading to material waste, production inefficiencies, and compromised product quality. While deep learning models have shown promise in automating defect detection, their effectiveness is often constrained by domain shifts and variability in real-world data distributions. In this work, we propose Bayesian Test-Time Adaptation (BTTA), a novel framework designed to enhance the robustness and adaptability of machine learning models in such dynamic environments. Unlike traditional Test-Time Adaptation (TTA) methods, our approach employs gradient-guided diversification with Stein Variational Gradient Descent (SVGD) to explore diverse optimization paths. Experimental results on benchmark datasets, including CIFAR-10-C , Casting Defects , and GDXray , demonstrate significant performance improvements across key metrics. Notably, the framework achieves an average accuracy improvement of 2-3% under severe corruption levels and excels in cross-domain generalization, highlighting its ability to handle diverse and unseen defect categories. This dynamic adaptability not only addresses the limitations of static models but also offers a practical and cost-effective solution for real-time defect detection in industrial settings. Our study underscores the potential of BTTA to transform quality assurance processes, ensuring reliable performance across varying operational conditions without the need for extensive retraining or large annotated datasets. The codebase for BTTA is available on: https://github.com/afsharshamsi/GradSurgery .

Authors

Institutions

Publication Details

Journal
Engineering Applications of Artificial Intelligence
Published
2025-08-29
DOI
https://doi.org/10.1016/j.engappai.2025.112039
Primary Topic
Non-Destructive Testing Techniques
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Gradient surgery: A necessity for robust test-time adaptation for detecting casting defects

Afshar Shamsi, Hamid Alinejad‐Rokny, Ahmadreza Argha, Arash Mohammadi et al.
Engineering Applications of Artificial Intelligence
Non-Destructive Testing Techniques
article

Gradient surgery: A necessity for robust test-time adaptation for detecting casting defects

Afshar Shamsi, Hamid Alinejad‐Rokny, Ahmadreza Argha, Arash Mohammadi, Rejisa Becirovic
article en

Abstract

Casting defects pose a significant challenge in the manufacturing industry, leading to material waste, production inefficiencies, and compromised product quality. While deep learning models have shown promise in automating defect detection, their effectiveness is often constrained by domain shifts and variability in real-world data distributions. In this work, we propose Bayesian Test-Time Adaptation (BTTA), a novel framework designed to enhance the robustness and adaptability of machine learning models in such dynamic environments. Unlike traditional Test-Time Adaptation (TTA) methods, our approach employs gradient-guided diversification with Stein Variational Gradient Descent (SVGD) to explore diverse optimization paths. Experimental results on benchmark datasets, including CIFAR-10-C , Casting Defects , and GDXray , demonstrate significant performance improvements across key metrics. Notably, the framework achieves an average accuracy improvement of 2-3% under severe corruption levels and excels in cross-domain generalization, highlighting its ability to handle diverse and unseen defect categories. This dynamic adaptability not only addresses the limitations of static models but also offers a practical and cost-effective solution for real-time defect detection in industrial settings. Our study underscores the potential of BTTA to transform quality assurance processes, ensuring reliable performance across varying operational conditions without the need for extensive retraining or large annotated datasets. The codebase for BTTA is available on: https://github.com/afsharshamsi/GradSurgery .

Engineering Applications of Artificial IntelligenceVol. 161
The University of Sydney (AU), UNSW Sydney (AU), Concordia University (CA)
Natural Sciences and Engineering Research Council of Canada
Climate action
Openalex Percentile: Top 77%
Non-Destructive Testing Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.