Weld radiograph enhancement and YOLO backbones, animated
CLAHE, unsharp mask and Wiener filtering clean the image. YOLO then detects defects with a stock CNN, Swin or ConvNeXt backbone. Use Pause to freeze a moment.
sharpened = original + amount × (original − blurred)
The red lines mark the row plotted under the images. The input is a synthetic weld radiograph made for this demonstration: a bead, three pores, a crack and a lack-of-fusion line, then blurred and noised.
Three rows: the true signal, what the camera gives you, and what the filter recovers.
Ŵ(f) = H*(f) / ( |H(f)|² + K )
H is the blur, K is noise power ÷ signal power. Where the blur has wiped out a frequency, the filter stops boosting it instead of amplifying noise.
Slide K far left and noise explodes (plain inverse filtering). Slide far right and the result stays blurry.
Follow the formula, frequency by frequency
The image is cut into 4×4 tiles. Each tile gets its own histogram. Tall bars are clipped at a limit so noise isn’t blown up, and the cut-off counts are shared back across all bins. The running total of that histogram becomes the tile’s new brightness curve, and neighbouring tiles are blended so no seams show.
A Swin backbone gives every stage attention over windows, so a crack or lack-of-fusion line can be judged against the wider seam. It costs more compute and needs input sizes that fit the patch and window sizes.
Inside one Swin block
Full attention over every patch is expensive. Swin limits it to small windows, then shifts the windows in the next block so information still travels across the whole image. Weights and colours here are illustrative, not from a trained model.
A ConvNeXt backbone keeps convolution’s speed and locality but uses 7×7 depthwise kernels and transformer-style blocks, so each layer sees more context than a 3×3 stack while staying a pure CNN.
Inside one ConvNeXt block
ConvNeXt is a plain convolution network modernised with transformer habits. One block does spatial mixing with a depthwise convolution, then channel mixing with two 1×1 layers, and adds the input back. The kernel is 3×3 here for clarity; ConvNeXt uses 7×7. All numbers are a worked example.
Order: CLAHE, then unsharp mask, then Wiener. Unsharp raises the noise and Wiener removes much of it. Contrast is the standard deviation of brightness; noise is the typical local variation, both measured on this image. The Wiener step here is the local-statistics form used for images; the frequency form is in the Wiener tab.
A stock YOLO backbone (here CSPDarknet, as in YOLOv8) stacks 3×3 convolutions. It is fast and good at small local defects like pores, but a cell needs many layers to see the whole weld. In all three YOLO tabs the boxes mark the synthetic defects to show the output format. No trained model was run, and the shaded square is an illustrative view size, not a measurement.