Sandbox — LSD is in active testing. All systems operational·payments are test-mode (no real charges).
Overview Use Cases News Docs Tool Store Support Community Get LSD
Use cases/ Computer Vision/ Detecting surface defects on an aluminium line
Defect masks overlaid on aluminium line-scan strips in the viewer replace with clip · 1600 × 900

Detecting surface defects on an aluminium line

LSD turns a folder dump of line-scan frames and one defects.csv into a live segmentation pipeline — tile, augment, batch, run an ONNX model, and QA every mask as an overlay. The @deliver step then writes a defect report per coil with class counts, defect area, and the worst frames.

▶ Video walkthrough Intermediate ⏱ 25 min defect-detectionsegmentationonnxmanufacturingquality-control

The mess this replaces#

A line-scan rig over an aluminium coater produces tens of thousands of strips per shift, and the labels live in a CSV someone exports from the annotation tool. The usual glue is a pile of scripts — one to tile, one to augment, one to run the model, a notebook to eyeball results. When QA asks why coil 1187 got flagged, you re-run all four and hope the intermediate folders weren't stale.

On the canvas, that whole chain is one pipeline. The frames, the join, the tiler, and the model that scores every tile are live nodes; change the tile overlap and only the steps downstream recompute, because everything upstream is a cached intermediate. The answer to "what did the model actually see?" is always one click on a preview.

Before you start#

You need three things — the capture folders straight off the rig, the defect label CSV, and a segmentation model exported to ONNX. Any encoder-decoder trained on 1024 px crops works; the walkthrough uses a six-class U-Net covering pits, scratches, dents, roll marks, inclusions, and edge cracks. No GPU required — batches just score slower.

Where to take it next#

Once the pipeline runs clean, point the @load node at the live capture share and re-run per shift; the report step keeps writing one CSV per coil. Teams usually add a threshold node next, so only coils whose defect area crosses spec ever reach a human.

Step by step

How it's built

  1. #023 · Load 01

    Load the line-scan captures

    Drop the per-coil capture folders onto the canvas. An @load node indexes every frame into one browsable image set — forty-thousand-odd strips, thumbnails and all — without copying a single file. Filenames like coil-1187_cam2_00412.png stay attached as metadata you can filter on later.

    Canvas with the @load node and the indexed frame grid replace with screenshot · 1200 × 750
  2. 02

    Join the defect label CSV

    Drop defects.csv next to it and connect both into a join step keyed on filename. Every frame now previews with its coil id and defect class — and the handful of frames with no label row light up immediately as unmatched.

    Join step preview matching frames to label rows replace with screenshot · 1200 × 750
  3. #024 · Shape 03

    Tile the strips into model-sized crops

    Line-scan frames are 8192 × 2048 — far too big for the model. Add a tile step set to 1024 × 1024 with 128 px overlap; the preview draws the cut grid over a sample frame. The tiled set becomes a cached intermediate, so downstream tweaks never re-cut it.

    Tile step preview showing the 1024 px cut grid replace with screenshot · 1200 × 750
  4. 04

    Preview the augmentations

    Stack a horizontal flip and mild brightness jitter to mimic lighting drift between shifts. Each augmentation is a live node — click through samples and see exactly the pixels the model will receive, then set the batch step to 16 tiles.

    Augmentation preview with flip and jitter applied replace with screenshot · 1200 × 750
  5. #025 · Deliver 05

    Run the ONNX segmentation model

    Drop your trained model file onto the canvas and LSD wraps it in a @deliver node. Wire in the batched tiles and hit run — masks stream back batch by batch, and the viewer overlays each one on its source tile so you can QA predictions while the set is still scoring.

    Viewer with defect masks overlaid on line-scan tiles replace with screenshot · 1200 × 750
  6. 06

    Deliver the per-coil defect report

    Add a report step that stitches tile masks back to frame coordinates and groups them by coil id. Export one CSV per coil — defect class, count, and area in mm² — plus overlay PNGs of the worst frames for the QA binder.

    Defect report export with per-coil class and area columns replace with screenshot · 1200 × 750
The pipeline

Every step used, at a glance

Load

Frames + labels

Index per-coil folders of line-scan frames and join the defect label CSV by filename.

CSV
Shape

Tile, augment & batch

Cut 1024 px overlapping tiles, add flip and jitter, and batch — every change previews.

Deliver

Segment & report

Run the ONNX segmentation model, QA masks as overlays, and export a per-coil defect report.

ONNXCSV
6 classes
of surface defect, segmented per tile
3,200 tiles
scored per coil in batches of 16
1 CSV
defect report per coil, plus QA overlays

More use cases