Machine Learning / Case study
Laser Weld Defect Inspection
Interpretable machine learning for detecting laser-weld defects from thermal camera images, using physics-motivated features and validation grouped by weld.
- Python
- Image Analysis
- scikit-learn
- SHAP
Key result
Author-reported frame-level ROC AUC: 0.974 ± 0.007 (mean ± standard deviation across five outer weld-grouped folds). ROC AUC measures ranking discrimination across thresholds, not 97.4% accuracy or weld-level detection success.
Limitations at a glance
Labels progress from Beginning to Sound to Unsound in 93 of 97 welds. Hot-band position, a leading SHAP feature, may partly reflect temporal drift rather than a defect-specific mechanism. Label timing and errors around the sound/unsound boundary therefore matter.
Read all limitations
Problem
Can thermal imagery reveal when a laser butt weld becomes unsound—and explain what drove the prediction? The study investigates a discontinuity developing as the metal sheets move apart, connecting scientific imaging with interpretable classification.
Data or modelled system
The repository describes 16,362 labelled 32 × 32 long-wave infrared frames at 30 Hz from 97 welds, drawn from 100 recordings at two welding speeds. Frames are labelled Beginning, Sound or Unsound. The model uses thermal-image features, not the inductive probes also recorded in the source dataset.
The externally hosted data is attributed to Walther et al. (2025). The repository documents its download rather than bundling the raw dataset.
Implementation
Python scripts handle data inspection, feature extraction and Random Forest training with scikit-learn. SHAP provides feature-level explanations. A locally launched Streamlit dashboard displays predictions over time, frames, the first alarm and the first unsound label.
Approach / workflow
Extract seven physics-motivated, label-free features from each frame, normalized against the first 15 labelled frames of its weld. This baseline requires an acquisition window; startup-frame features can include later frames within that window, so immediate causal online inference is not established. Keep complete welds together during nested cross-validation and select decision thresholds using training welds only.
Grouping matters: neighbouring frames from the same weld are correlated. Random frame splits could put almost identical experimental conditions into both training and testing and overstate generalisation.
Evaluation
The repository compares the thermal-feature model with a weld-position-only baseline. That baseline reports similarly high discrimination but needs knowledge of the weld position/end; the author explicitly identifies it as a “cheating” baseline, not a deployable predictor.
Nested cross-validation measures ROC AUC, balanced accuracy and unsound-class F1 on held-out welds. These are repository-reported evaluations; they have not been independently reproduced for this portfolio.
Results
Author-reported frame-level ROC AUC: 0.974 ± 0.007 (mean ± standard deviation across five outer weld-grouped folds). ROC AUC measures ranking discrimination across thresholds, not 97.4% accuracy or weld-level detection success.
The author also reports balanced accuracy of 0.927 ± 0.012 (mean recall of the two classes) and unsound-class F1 of 0.900 ± 0.016 (harmonic mean of precision and recall), with the same fold-SD convention. SHAP explanations and the local dashboard make individual predictions inspectable; no production deployment is claimed.
Limitations
Labels progress from Beginning to Sound to Unsound in 93 of 97 welds. Hot-band position, a leading SHAP feature, may partly reflect temporal drift rather than a defect-specific mechanism. Label timing and errors around the sound/unsound boundary therefore matter.
Evaluation covers one dataset and welding setup. Transfer to other materials, speeds or cameras remains untested. The first-15-frame baseline requires a warm-up window; startup evaluation does not establish strictly causal real-time prediction. The dashboard is a local inspection tool, not a verified hosted service.
Repository and reproducibility
The public repository contains scripts, tests, report figures and commands for downloading data, extracting features, training and launching Streamlit. Follow its documented environment and pytest instructions. This portfolio summarises implemented work; it does not claim an independent rerun.