Pipe Defect Detection

Detection Completed Nov 2025 – Jan 2026 Project Lead

Highlights

Results

Defect Detection Precision
100.0%
No false-positive defect alarms on test data
Defect Detection Recall
94.0%
Miss rate dominated by extremely low-contrast defects
Segmentation Pixel Precision
95.34%
Evaluated on defect-positive images only
Segmentation Pixel Recall
97.27%
High coverage of defect regions

Details

Problem

Internal inspection of rocket engine pipes requires reliable detection of surface defects under challenging conditions, including cylindrical geometry, specular reflections, uneven illumination, and subtle texture variations. The goal is to detect defect regions with high precision while minimizing false positives in defect-free pipes.

Approach

Data

High-resolution grayscale images were captured from the inner surface of cylindrical rocket pipes using a rotating inspection setup.
Annotations were provided at the defect-region level, with many samples containing extremely small defect areas relative to the full image.

To address class imbalance:

  • Defect and non-defect samples were balanced at the image level
  • Pixel-level evaluation was restricted to defect-containing images

Model

We adopt Segment Anything Model (SAM) as the base segmentation backbone and fine-tune it using Low-Rank Adaptation (LoRA).

  • The SAM image encoder is kept frozen
  • LoRA layers are injected into attention projections to adapt the model to pipe-surface textures
  • Only LoRA parameters and the mask decoder are trained, significantly reducing trainable parameters

This design preserves SAM’s strong generalization while enabling domain-specific adaptation to subtle defect patterns.

Training

  • Input images are provided along with bounding-box prompts derived from defect annotations
  • Loss: binary cross-entropy combined with Dice loss
  • LoRA fine-tuning ensures stable training even with limited defect samples
  • Data augmentation includes intensity jitter, spatial flips, and mild geometric perturbations

Evaluation

Evaluation is performed at two levels:

  1. Image-level defect detection (defect present vs. absent)
  2. Pixel-level segmentation quality on defect-containing images only

Connected components from predicted masks are used to derive final defect regions and bounding boxes.

Results

Image-Level Detection

  • GT images: 100
  • True Positives: 47
  • False Positives: 0
  • False Negatives: 3
  • True Negatives: 50
MetricValue
Precision1.000
Recall0.940

Pixel-Level Metrics (Defect Images Only)

MetricValue
Pixel Precision (mean)0.9534
Pixel Recall (mean)0.9727

Notes

  • LoRA fine-tuning allows SAM to adapt to highly reflective, repetitive pipe textures without overfitting.
  • Zero false positives at the image level is critical for industrial inspection workflows.
  • Most missed detections correspond to extremely small or low-contrast defects near specular boundaries.
  • A lightweight GUI was developed to visualize predictions, inspect defect regions, and validate results interactively.

Stack

Pytorch SAM Finetuning