AI Methods I Hackathon · Team 1 · IAAC Barcelona

A crack in a steel weld can be thinner than a hair on an X-ray. An inspector checks hundreds of X-ray tiles to find the few that hide one, and missing it is dangerous. In five days we built NEURAL / LAB: an AI that ranks every tile LOW, CHECK or HIGH, shows where to look, and lets anyone look inside the network.

21,893 X-ray tiles · 32 numbers per tile · about 0.99 ROC AUC on welds the model never saw · 91% of sound tiles can be skipped

Live in the lab: we paint a pore on a sound weld, and the score jumps from LOW to HIGH.

Finding a crack in hundreds of tiles

Every weld on a structural steel project is X-rayed, and each X-ray is cut into small tiles. Most tiles are fine. The defects are rare, small and faint: porosity (gas bubbles), cracks and lack of penetration (the weld didn’t fuse all the way through). A missed crack costs far more than a false alarm. So we didn’t build a machine that says “accept” or “reject”. We built a tool that tells the inspector which tiles to check first, and where to look. The inspector still decides.

The four kinds of tile: no defect, porosity, crack, lack of penetration
The four kinds of tile in our data: a sound weld, porosity, a crack and lack of penetration.

Teach it only what a good weld looks like

We used an autoencoder: a network that squeezes an image into a few numbers and then redraws it. The trick is that we trained it only on sound welds. It never saw a single defect, so the only thing it knows how to draw is a good weld.

When a tile with a crack comes in, the model redraws it without the crack. We compare the X-ray with the redraw: where they differ, a heat map lights up, and that is where the defect is. The average difference is the tile’s score. A high score means “this doesn’t look like a good weld”.

A crack tile, the autoencoder, its redraw without the crack, and the error heat map
A real crack tile from our test welds. The redraw has no crack, the heat map lights up along it, and the score (0.0048) is above the HIGH border, so this tile is checked first.

This has a big advantage: we don’t need thousands of labelled defects to train it, and it can react to a kind of defect it has never seen.

First, we cleaned it

We used RIAWELC, a public dataset of 24,407 X-ray tiles of steel welds. Before training anything, we looked at the data, and found two problems:

  • 2,514 duplicate tiles. Every image in the original test set was also in the training set, so any model would have looked perfect. We removed them, leaving 21,893 tiles.
  • Tiles of the same weld were spread across training and testing. Tiles from one weld look alike, so the test would only check the model’s memory. We split the data by weld instead: 20 welds to train, 5 to tune, 4 to test. The 4 test welds are completely new to the model.

A tile squeezed into 32 numbers

Each tile is made greyscale and 64 × 64 pixels. The encoder shrinks it step by step (64 → 32 → 16 → 8 pixels) and turns it into just 32 numbers. The decoder does the reverse and redraws a full tile from those 32 numbers. The whole model has 718,369 learned values and trains in about 8 seconds on a laptop GPU.

The workflow, and one tile per class going through the model
Top: our workflow, from raw X-rays to the app. Below: one tile of each kind going through the model. The sound tile’s heat map stays black (LOW); the three defects light up (HIGH).

Smaller images worked better

We didn’t pick a model and hope. We trained four versions on exactly the same data and compared them. We expected 128-pixel images to win, because they keep more detail. They didn’t: 64 pixels won. Shrinking the image averages away the grainy noise of the X-ray, which the model can’t redraw anyway, while the defects are big enough to survive. A bigger code (128 numbers) was worse, because it gave the model enough room to copy defects too.

Four setups compared: validation score and size
Our four setups. The winner (orange) is both the best and the smallest. All four beat a simple rule that only measures contrast.

A second surprise: when we looked at the 32 numbers, tiles grouped by which weld they came from, not by defect type. The code mostly stores how an X-ray looks. The detection comes from the redraw error, not from the code.

91% of sound tiles can be skipped

On the 4 test welds the model never saw:

  • 91% of sound tiles come out LOW, so the inspector can skip them.
  • No sound tile reaches HIGH.
  • Only 0.5% of defects end up in LOW.

We set the borders between LOW, CHECK and HIGH on the tuning welds, never on the test welds: CHECK starts where 98% of defects score higher, and HIGH where only 0.5% of sound welds do.

The share of test tiles per risk level for each class
Risk levels on the test welds, per kind of tile.

Cracks are the hardest: thin and faint, they change only a few pixels. When we looked at the defects the model misses, most were very faint, only slightly darker than the metal around them. Most of them still land in CHECK, so the inspector still sees them.

From a model to a tool

A model in a notebook helps nobody, so we built NEURAL / LAB · Inspect. An inspector logs in, drops an X-ray tile, and gets the risk level, the score, the redraw and the heat map. Every check is saved in their own history.

NEURAL / LAB · Inspect in action: log in, drop a crack tile, get HIGH with the redraw and the heat map, see it in the history, then open the same X-ray in the lab.

Behind it, five services work together:

  • The page and the login run on Cloudflare.
  • The model runs on a server on Render.
  • Every check is saved in a database (D1), and the images in file storage (R2).
  • The trained model is published on Hugging Face.

Each user sees only their own checks, and passwords are never stored, only a scrambled version of them (a hash).

Open the black box

AI often feels like a black box, so we built a second part: NEURAL / LAB · Look inside. Our trained model runs live in your browser. Paint a pore or a crack on a real X-ray and watch the score and the heat map react after every stroke. Then follow your weld through every layer of the network, drag the 32 numbers to change the redraw, and see where your weld lands among 3,019 test tiles.

The lab’s own 90-second guided demo: a pore painted on a sound weld, the score from LOW to HIGH, then the walk through the network.

A working AI product is more than a model

What is clear. An autoencoder can find unusual patterns by learning only from defect-free welds. And a working AI product needs much more than a trained model: preparing the data, connecting the services, logins, storage and a clear interface all have to work together.

What is still unclear. How well it works on X-rays from other machines or real construction sites; what each of the 32 numbers means; and whether the heat map points at the exact spot of a defect.

What we would do next. Train and test with X-rays from other welding processes and machines; measure how well the heat map matches real defect locations; and turn it into a practical tool for full-size X-rays, with feedback from real inspectors.

Try it

Look inside the network (open to everyone): https://hackathon-team1-weld-anomaly.onrender.com
The free server sleeps when nobody uses it, so the first visit can take about a minute.

QR code to NEURAL / LAB · Look inside

The team

Team 1: Jerome Eid, Amelia Courtney, Kazuko Nakao, Sahil Khan

Course: AI Methods I, hackathon (16–20 November 2026). Faculty: Serjoscha Düring, Salvador Cantuarias

Programme: IAAC Master in AI for Architecture and the Built Environment, 2026/27

We used Claude Code as a coding assistant. The decisions, the checks and the conclusions are our own.

References

  • B. Totino, F. Spagnolo, S. Perri, “RIAWELC: A Novel Dataset of Radiographic Images for Automatic Weld Defects Classification”, ICMECE 2022.
  • S. Perri, F. Spagnolo, F. Frustaci, P. Corsonello, “Welding Defects Classification Through a Convolutional Neural Network”, Manufacturing Letters, Elsevier.
  • M. Sakurada, T. Yairi, “Anomaly Detection Using Autoencoders with Nonlinear Dimensionality Reduction”, MLSDA Workshop, 2014.