Back to guides
6
8 min

AI for Quality Control & NDT

SPC Pattern Recognition, NDT Indication Classification, and Process Capability Monitoring

Mechanical Testing SPC with AI Pattern Recognition

Statistical Process Control (SPC) is standard practice in any quality-managed metallurgical operation — X-bar/R charts on tensile strength, hardness, Charpy impact, elongation. The Nelson rules (or Western Electric rules) detect non-random patterns: trends, shifts, stratification, mixture. But manual chart monitoring misses subtle patterns, especially when multiple variables drift simultaneously.

Open data/mechanical-test-results.csv in the code panel. Each row is a mechanical test result: steel grade, heat number, sample location, test type (tensile, hardness, Charpy), measured value, specification limits, and test date.

Beyond Nelson Rules

Traditional SPC detects 8 patterns (Nelson rules). AI-based pattern recognition extends this to:

PatternNelson RuleAI DetectionCorrective Action
Mean shiftRule 1 (point beyond 3σ)Detects shifts of 0.5σ with CUSUMRaw material change, furnace drift
TrendRule 3 (6 points increasing)Detects trends earlier (4 points + slope)Electrode wear, furnace refractory erosion
CyclicRule 8 (8 points alternating)FFT-based cycle detection at any frequencyShift-to-shift variation, day/night temperature
StratificationRule 5 (15 points within 1σ)Detects mixture distributions (bimodal)Two populations in data (two furnaces, two operators)
Multi-variable driftNot coveredPCA on correlated propertiesSystematic process change affecting multiple properties

Multivariate SPC

Mechanical properties are correlated — YS and UTS move together, Charpy and elongation are inversely related to hardness. Monitoring each property independently misses situations where all properties shift together by a small amount (still within individual spec limits) but the shift indicates a process change.

Hotelling's T² chart on the principal components of [YS, UTS, elongation, Charpy, hardness] detects multivariate shifts that individual X-bar charts miss:

Input: [YS, UTS, elongation, reduction_of_area, Charpy, hardness] per heat
PCA: 6 variables → 3 principal components (capturing 95% variance)
T² = Σ (PC_i / λ_i)² — Mahalanobis distance from process centroid
Alarm: T² exceeds UCL (F-distribution threshold)

At a Pune auto component manufacturer, multivariate SPC detected a slow drift in 42CrMo4 properties (YS dropping by 15 MPa, Charpy increasing by 8 J — each within spec) that traced to a systematic decrease in carbon content from the steel supplier. Individual charts showed nothing abnormal. The T² chart flagged it 3 weeks before any property would have breached spec limits.

Anomaly Detection on Test Data

Beyond SPC, anomaly detection flags individual test results that are physically inconsistent:

  • UTS < YS (impossible — the test or data entry is wrong)
  • Charpy at -40°C > Charpy at room temperature by > 20% (unusual — check specimen identification)
  • Hardness 28 HRC but YS 900 MPa (inconsistent — likely wrong hardness or wrong sample)
  • A simple rule engine catches the obvious cases. An isolation forest trained on the multivariate distribution catches subtle anomalies — results that are individually plausible but collectively improbable.

    NDT Indication Classification

    Non-Destructive Testing generates enormous amounts of data that is currently interpreted by human inspectors — ASNT Level II or III certified technicians who visually assess indications and classify them per acceptance criteria. AI assists (not replaces) these inspectors.

    Open data/ndt-inspection-results.json — each record contains: inspection method (UT, RT, MPI, DPT), component details, indication characteristics, inspector classification, and accept/reject decision.

    Ultrasonic Testing (UT)

    UT produces A-scan waveforms (amplitude vs time) or phased array S-scan images (sector view). Indication classification requires determining:

  • Nature — volumetric (porosity, slag) vs planar (crack, lack of fusion)
  • Size — equivalent reflector size (ERS) via DAC or DGS method
  • Location — depth, position relative to weld fusion line
  • AI classification from UT data:

    Input: A-scan waveform (or S-scan image for phased array)
           probe_frequency, probe_angle, material_velocity, scan_position
    Model: 1D-CNN on A-scan waveforms OR 2D-CNN on S-scan images
    Classes: crack, lack_of_fusion, porosity, slag_inclusion, geometric_reflector
    Accuracy: 91% (vs 84% inter-inspector agreement on indication classification)

    The highest-value application: distinguishing cracks from slag inclusions in weld inspection. Both produce reflections at similar depths, but cracks are planar (high amplitude, sharp echo, orientation-dependent) while slag is volumetric (lower amplitude, broader echo, orientation-independent). Misclassifying a crack as slag has severe safety implications.

    Radiographic Testing (RT)

    Digital radiography (DR) produces 16-bit greyscale images where indications appear as density variations. Manual interpretation involves comparing indication characteristics to reference radiographs (ASTM E446 for steel castings, E186 for thick-wall castings).

    Input: DR image (2048 × 2048, 16-bit)
    Preprocessing: flat-field correction, contrast enhancement (CLAHE)
    Model: Faster R-CNN for indication detection + ResNet classifier for type/severity
    Classes: shrinkage_cavity, gas_porosity, slag_inclusion, crack, hot_tear,
             shrinkage_porosity (micro/macro), sand_inclusion
    Severity: ASTM E446 Level 1-5
    Output: annotated image with indication boxes, type labels, severity levels

    At a Rajkot diesel engine foundry, AI-assisted RT interpretation reduced radiographic review time from 12 minutes to 3 minutes per image while improving consistency — the system achieved 96% agreement with a Level III radiographer, vs 88% agreement between two Level II inspectors.

    Magnetic Particle Inspection (MPI) and Dye Penetrant Testing (DPT)

    MPI and DPT produce visual indications (fluorescent or visible particles/dye in surface-breaking discontinuities). AI-assisted classification uses camera images of the inspected surface:

    Input: high-resolution photograph of MPI/DPT indication
    Model: Object detection (YOLO v8) for indication localization +
           classifier for type (crack, seam, lap, grinding crack, non-relevant)
    Key challenge: distinguishing relevant indications from non-relevant
      (magnetic writing, part geometry, grain flow lines in MPI)

    The practical challenge in Indian workshops: lighting consistency. MPI under UV light requires controlled ambient darkness, and camera settings must be standardized. DPT requires consistent developer thickness. AI models trained on well-controlled images may fail on shop-floor images with variable lighting and developer application.

    Process Capability with AI-Assisted Monitoring

    Cp and Cpk Calculation

    Process capability indices quantify how well a process meets specifications:

    Cp = (USL - LSL) / (6σ)     — process spread vs specification width
    Cpk = min[(USL - μ) / (3σ), (μ - LSL) / (3σ)]  — includes centering

    Open data/spc-charts-data.csv — it contains time-series data for key quality parameters with specification limits.

    For metallurgical processes, Cpk targets are:

    ParameterTypical Indian CpkCustomer RequirementAI Target
    Hardness (HRC)1.2-1.4≥ 1.33≥ 1.67
    Yield Strength (MPa)1.0-1.3≥ 1.33≥ 1.67
    Charpy Impact (J)0.8-1.1≥ 1.0 (min spec only)≥ 1.33
    Grain Size (ASTM)1.1-1.5≥ 1.33≥ 1.67
    Nodularity (% for SG iron)0.9-1.2≥ 1.33≥ 1.67

    AI-Assisted Cpk Improvement

    AI contributes to Cpk improvement by:

  • Identifying controllable sources of variation — a regression model predicting hardness from heat treatment parameters quantifies how much each parameter contributes to hardness scatter. If furnace zone temperature variation accounts for 40% of hardness variation, that is where to invest in control improvement.
  • Real-time Cpk tracking with predictive alerts — instead of calculating Cpk at end of batch (when it is too late), AI tracks the running Cpk and predicts where it will end up. If the current trajectory will produce Cpk < 1.33, it alerts the operator while there is still time to adjust.
  • Optimal setpoint recommendation — given the process variation (which cannot be eliminated overnight), what setpoint maximizes Cpk? For a hardness spec of 28-34 HRC with σ = 1.2 HRC, the optimal aim is 31.0 HRC (centroid). But if the distribution is skewed (common in tempering), the optimal aim shifts.
  • BIS Acceptance Criteria and NABL Compliance

    Indian quality control operates within the BIS (Bureau of Indian Standards) framework. IS 2062, IS 1570, IS 2004 — each has specific acceptance criteria for mechanical properties, and these are not always aligned with international standards.

    AI-assisted compliance checking ensures:

  • Correct standard applied — auto-selects acceptance criteria from heat analysis + product form + grade designation
  • Retest logic automated — when initial tests fail, BIS standards allow retesting per specific rules (IS 2062 Clause 11.3). The AI system manages retest eligibility, additional sample selection, and reclassification.
  • NABL lab accreditation requirements — measurement uncertainty reporting (mandatory for NABL-accredited labs) is automated. The AI calculates expanded uncertainty from calibration data, repeatability studies, and reproducibility records.
  • Customer Audit Readiness

    Indian auto component suppliers face 3-5 customer audits per year (OEM quality engineers, tier-1 auditors, third-party certification bodies). Each audit examines SPC charts, Cpk reports, MSA (Measurement System Analysis) results, and PPAP documentation.

    AI-generated audit packages:

  • Real-time Cpk dashboards with drill-down to individual heats
  • MSA (Gage R&R) analysis updated automatically with each calibration cycle
  • Control plan vs actual monitoring comparison (are you actually monitoring what the control plan says?)
  • Non-conformance trending with Pareto analysis and corrective action tracking
  • This transforms audit preparation from a 2-week scramble into a button click.

    Key Takeaways

  • Multivariate SPC detects process changes that individual charts miss — correlated properties (YS, UTS, Charpy, hardness) shift together. Hotelling's T² on PCA components is the appropriate method.
  • NDT indication classification assists but does not replace certified inspectors — AI provides consistency and speed, but the ASNT Level III makes the accept/reject decision. The value is in reducing inter-inspector variability.
  • Cpk is the metric customers care about — not individual test results. AI-assisted real-time Cpk tracking with predictive alerts prevents out-of-spec batches before they happen.
  • Audit readiness is a real pain point for Indian suppliers — automated SPC reporting, MSA documentation, and compliance checking eliminate the 2-week pre-audit scramble and reduce dependence on individual quality engineers.
  • This is chapter 6 of AI for Metallurgy & Materials.

    Get the full hands-on course — free during early access. Build the complete system. Your projects become your portfolio.

    View course details