Weld ROI Finder: finding the weld region on radiographs
Software that finds the weld region on digitized radiographic films, before the defect detection step.
Problem solved
Isolate the weld region when the film also carries lettering and marker symbols.
What I built
Candidate masks from Meta SAM 2.1, masks over text removed with RapidOCR, the weld region chosen by scoring curved-edge density (Canny), luminance and size, then cropped as a rotated box along the weld axis. A FastAPI service and a web UI.
Result
63 of the 68 radiographs in the GDXray Welds dataset were segmented correctly.
The problem
In radiographic weld inspection, where a defect sits relative to the weld seam decides how it is classified. Most published work on defect detection assumes the weld region has already been cropped by hand.
How it works
- The radiograph is contrast stretched and denoised.
- Meta SAM 2.1 generates candidate masks.
- Each mask is scored by curved-edge density, luminance against its surroundings, size and continuity. Masks that overlap text found by RapidOCR are removed.
- The best mask is cropped as a minimum-area rotated rectangle, aligned to the weld axis.
Test
On the GDXray Welds dataset of 68 radiographs, 63 were segmented correctly. Of the 5 failures, 3 took a circular pipe boundary for the weld, 1 film was too faint to show the weld, and on 1 film SAM did not segment a weld that was clearly visible.