Research methodology

Scientific framework for defect detection and classification in tubular NDT inspection, operating under the constraint that only JPEG visual outputs are available from vendor hardware.

1. Problem statement

Nucliex operates integrated NDT inspection systems (MFL, UT, ECT) for tubular inventory across multiple yards. The vendor hardware+software produces only JPEG visual outputs — no raw signal data, no structured export (CSV/XML), no API or SDK access. The manufacturer has confirmed no intermediate data is available.

This is a recognized limitation in industrial inspection digitalization. Available input parameters per scan are limited to: pipe outer diameter (OD), wall thickness, trolley speed, excitation frequency (Hz), and inspection method.

Key constraint

All analytical methods must operate on JPEG images as the sole data source. This eliminates direct signal-level analysis (waveform decomposition, FFT on raw A-scans) and requires image-domain approaches for both detection and quantification.

2. Mathematical framework

2.1 Defect detection as object localization

Given an input image I ∈ ℝ^(H×W×3) (JPEG, RGB), the detection task is to find a set of bounding boxes B = { b₁, b₂, …, bₙ } where each bᵢ = (x, y, w, h, c, p) represents center coordinates, dimensions, class label c ∈ C, and confidence p ∈ [0, 1].

L_total = λ_box · L_box + λ_obj · L_obj + λ_cls · L_cls

Where L_box is the CIoU (Complete Intersection over Union) loss for bounding box regression, L_obj is objectness loss (binary cross-entropy), and L_cls is classification loss over the defect taxonomy.

2.2 Defect class taxonomy C

ClassNDT signaturePhysical mechanismSeverity range
External corrosionMFL amplitude drop, broad signalElectrochemical oxidation of outer wall5–80% WT
Internal corrosionMFL/UT wall loss indication from IDFlow-induced erosion-corrosion5–60% WT
Wall lossUT thickness below nominalGeneral or localized material loss10–70% WT
LaminationUT mid-wall reflection, split signalRolling defect — gas pocket or inclusionMinor–Moderate
Transverse crackECT impedance spike, narrowStress corrosion cracking (SCC), fatigueModerate–Critical
Longitudinal crackMFL axial channel anomalySeam weld defect, hydrogen crackingModerate–Critical
PittingSharp localized MFL/UT indicationMicrobiologically influenced corrosion (MIC)10–50% WT
InclusionUT scatter, non-metallic reflectionSlag/oxide entrapped during steel makingMinor
DentCaliper channel geometry changeMechanical damage (impact, pressure)Minor–Moderate
OvalityCaliper diameter variation >1%External force, ground movementMinor–Moderate

2.3 Segmentation for wall loss quantification

For precise defect sizing, pixel-level segmentation via U-Net produces a mask M ∈ { 0, 1 }^(H×W). Wall loss depth d is estimated by correlating the mask area with calibrated signal intensity:

d̂ = f(A_mask, I̅_region, OD, WT) = α · (A_mask / A_pipe) + β · (I̅_region / I̅_ref) + γ

Where A_mask is defect area in pixels, I̅_region is mean intensity in the defect region, and α, β, γ are regression coefficients fitted to calibration standards (typically API 5L reference blocks).

2.4 Signal reconstruction from JPEG plots

When JPEG outputs contain graphical signal traces (B-scan strips, amplitude vs. position), approximate numerical reconstruction is possible via image digitization:

  1. Axis calibration — identify pixel coordinates for known physical values on x/y axes
  2. Curve tracing — edge detection (Canny) + contour following to extract (pixel_x, pixel_y) series
  3. Coordinate transform — map pixels → physical units using affine calibration matrix
  4. Signal conditioning — low-pass filter to suppress JPEG compression artifacts
s(t) = T⁻¹ · [x_pixel(t), y_pixel(t)]ᵀ where T = [[sx, 0, tx], [0, sy, ty]]

Expected accuracy: ±3–5% of full scale, limited by JPEG compression (typical Q=75–85) and pixel resolution. Sufficient for trend analysis and anomaly flagging, not for regulatory-grade measurements.

3. Machine learning pipeline

3.1 Architecture overview

Ingest

JPEG capture

Upload from vendor NDT software. Extract EXIF metadata, file hash for dedup.

Pre-proc

Normalization

Resize to 640×640. CLAHE contrast enhancement. Denoise (bilateral filter σ=75).

Detect

Object detection

YOLOv8 inference. Output: bounding boxes + class + confidence for each defect.

Segment

Pixel masking

U-Net on cropped ROIs. Binary mask per defect. Area + centroid computation.

Classify

Defect typing

10 classes × 3 severity. EfficientNet classifier on masked regions. Ensemble voting.

Quantify

Sizing

Wall loss depth estimation from intensity-area regression. Circumferential extent.

Report

Output

Annotated JPEG + structured JSON + DB record. API returns defect annotations.

3.2 Model comparison — expected performance

ModelArchitecturemAP@50InferenceTraining dataUse case
YOLOv8-mSingle-stage anchor-free0.87–0.92~8 ms500+ imagesReal-time defect detection
Faster R-CNNTwo-stage with FPN0.89–0.94~45 ms500+ imagesHigh accuracy detection
U-NetEncoder-decoder FCNIoU 0.82–0.90~15 ms300+ masksPixel-level segmentation
ResNet-50 AEAutoencoder anomalyAUC 0.88–0.95~5 msClean onlyUnsupervised anomaly detection
EfficientNet-B4Compound scaling CNN0.90–0.93~12 ms500+ imagesClassification baseline
Vision LLMGemini / LLaVA / GPT-4oQualitative~2 sZero-shotExploratory analysis, reporting

Performance estimates based on comparable industrial inspection literature (pipe weld defects, steel surface defects). Actual performance will depend on dataset quality and the specificity of Nucliex NDT JPEG outputs.

3.3 Training strategy

Phase A — Transfer learning

  • • Pre-trained backbone (ImageNet / COCO)
  • • Freeze early layers, fine-tune detection head
  • • 300–500 labeled images sufficient for baseline
  • • Expected mAP@50: 0.75–0.85

Phase B — Full fine-tuning + augmentation

  • • Unfreeze all layers, reduced learning rate (1e-5)
  • • Geometric augmentation: rotation, flip, crop
  • • Photometric: brightness, contrast, JPEG re-compression
  • • Synthetic mixing: CycleGAN defect injection
  • • Target: 1000+ effective training samples
  • • Expected mAP@50: 0.85–0.95

4. Synthetic data generation

Given the absence of historical structured datasets, synthetic data generation is critical for reaching training set sizes required by deep learning models.

Physics simulation

Finite-element modeling (COMSOL, ANSYS) of MFL/UT wave propagation through pipe walls with parametric defect geometries (depth, width, orientation). Output: synthetic inspection images matching vendor output format.

COMSOL Multiphysics / MATLAB

GAN augmentation

Train CycleGAN on paired clean/defective images to learn the defect→image mapping. Generate novel defect variations with controlled parameters. Diffusion models (Stable Diffusion + ControlNet) for finer control.

PyTorch / Diffusers

Domain randomization

Render synthetic NDT screens with randomized backgrounds, noise levels, axis scales, and overlay defect signatures at known locations. Cheap to produce at scale, useful for pre-training before real-data fine-tuning.

OpenCV / Pillow / Albumentations

Data pipeline

Real JPEG (N=300–500) → Label with CVAT → Augment (×3–5) → Mix with synthetic (×2–3) → Effective dataset: 2000–5000 training images. This is sufficient for robust detection across the 10-class defect taxonomy.

5. Signal reconstruction from JPEG

When JPEG outputs contain graphical representations of inspection signals (common for MFL longitudinal profiles, UT B-scans), it is possible to recover approximate numerical data through image digitization.

Reconstruction workflow

  1. ROI extraction — crop the plot region from the full JPEG screenshot
  2. Axis detection — Hough line transform to find axis lines, OCR for tick labels
  3. Calibration — build affine transform matrix from known axis points
  4. Curve tracing — color segmentation + morphological ops to isolate signal trace
  5. Sampling — extract (x_phys, y_phys) at regular intervals along the trace
  6. De-noising — Savitzky-Golay filter (window=11, order=3) to smooth JPEG artifacts
  7. Feature extraction — peak detection, baseline deviation, energy spectral density

Extracted features for ML

peak_amplitudeMaximum signal deviation from baseline(max|s(t) - s̄|)
peak_widthFWHM of the largest anomaly peak(Δt at 0.5 × peak)
energyTotal signal energy in the anomaly region(∫ s²(t) dt)
baseline_stdStandard deviation of defect-free regions(σ(s_clean))
snrSignal-to-noise ratio at defect location(20·log₁₀(peak/σ_noise))
zero_crossingsRate of sign changes in derivative(count(ds/dt = 0) / Δt)
spectral_centroidCenter of mass of frequency spectrum(∑(f·|S(f)|) / ∑|S(f)|)

6. Implementation roadmap

0

Data intake & cataloging

Weeks 1–4

  • Build JPEG ingestion pipeline (watched folder + manual upload)
  • Extract metadata from filenames, EXIF, and operator input
  • Store in PostgreSQL with full-text search on tags and notes
  • Establish file naming convention: {pipe_id}_{date}_{method}_{seq}.jpg
FastAPIPostgreSQLS3/MinIOPython-Pillow
1

Customer portal (Stage 1a)

Weeks 3–8

  • Inventory dashboard with filters (grade, size, yard, cert, status)
  • Inspection history per pipe with image gallery
  • Certificate storage and retrieval
  • Role-based access: operator, engineer, external customer
Next.js 15TanStack QueryTailwind CSSAuth.js
2

Defect detection (Stage 1b)

Weeks 6–16

  • Label 300–500 images using CVAT (bounding box + class + severity)
  • Train YOLOv8 baseline with transfer learning from COCO
  • Implement inference API: POST /api/v1/ai/detect → defect annotations
  • Integrate results into portal: overlay boxes on snapshots
  • A/B test: human inspector agreement vs model predictions
PyTorchUltralyticsCVATOpenCVONNX Runtime
3

Signal reconstruction & synthetic data

Weeks 12–20

  • Implement plot digitizer pipeline for B-scan JPEG → time-series CSV
  • Build synthetic NDT image generator (parametric defect rendering)
  • Train CycleGAN for defect augmentation on real image pairs
  • Validate reconstructed signals against calibration blocks
WebPlotDigitizerCOMSOLCycleGANDiffusersSciPy
4

Predictive analytics (Stage 2)

Weeks 20–30+

  • Combine inspection history + environmental data for corrosion rate modeling
  • Time-series analysis of repeated inspections → degradation curves
  • Risk-based ranking: probability of failure × consequence
  • Recommended re-inspection interval calculation
  • Asset life prediction dashboard
scikit-learnXGBoostProphetPlotlyD3.js

7. Key references

Deep Learning Based Steel Pipe Weld Defect Detection

Zhang et al.NDT & E International, 2024

Demonstrates YOLOv5 achieving 91.3% mAP on pipe weld X-ray images — directly comparable to our JPEG-based detection task.

Critical Analysis and Best Practices for Visual Industrial Anomaly Detection

Baiocchi et al.arXiv:2503.23451, 2025

Comprehensive survey of anomaly detection methods that work with visual data only. Validates the feasibility of unsupervised approaches when labeled defect data is scarce.

Introducing a Tool for Synthetic Defect Image Data Generation

Schmedemann et al.SPIE, 2025

Framework for generating synthetic defect images to augment small real datasets — directly applicable to our data scarcity problem.

Automated Defect Detection in Industrial Pipes Using Image Processing

Kumar & SinghJournal of NDE, 2024

Proposes a complete pipeline from image preprocessing to defect localization in pipe inspection images without requiring raw signal access.

A Survey of Deep Learning for Industrial Visual Anomaly Detection

Liu et al.Springer CVIU, 2025

Reviews 50+ methods for visual defect detection. Key finding: transfer learning + moderate augmentation achieves 85–95% accuracy with <1000 training images.

Gas Pipeline Defect Detection Based on Improved Deep Learning

Wang et al.Sensors (MDPI), 2024

Improved YOLOv8 architecture for pipeline defect detection with small object handling — relevant for detecting small corrosion pits in our NDT images.

Image Reconstruction from Compressed Measurements for NDT

Hauffen et al.NDT.net, 2023

Addresses signal reconstruction from limited/compressed data — analogous to our JPEG-to-signal reconstruction challenge.

Synthetic X-ray Image Generation for Non-Destructive Testing using GANs

Chen et al.IEEE Access, 2024

GAN-based synthetic generation for NDT specifically. Shows FID scores indicating generated images are realistic enough for model training.