Section 1 · Deep learning project

Industrial surface defect detection

A long, thin photo of a manufactured surface goes in. Four masks come out, one for each defect type. You will rebuild the whole pipeline, from run-length-encoded labels to a tuned U-Net, and learn why the scoring rule matters more than the network.

What you will build

This section teaches a finished student project from the DLGenAI course. The project trains a U-Net on 11,393 images of 128 × 800 pixels and predicts defects at pixel level. By the end, you can explain every step of the pipeline and re-run the numbers yourself:

Key results

0.6486
holdout score, 2-fold CV, after post-processing
0.6420
raw score at tau 0.3 (ResNet-34, TTA)
0.3000
score for predicting nothing
84.2%
of image-class pairs are empty

Source: runs/r34_baseline/eval.json and milestone1/answers.json. The holdout has 2,279 images.

Watch first

This clip sweeps the decision threshold on three real holdout images. You will understand every part of it by lesson 6.

Ground truth against the ResNet-34 prediction as the threshold changes.

Slide deck. Prefer slides? Open the 17-slide summary of the project, with speaker notes. Press S in the deck to open the speaker view.

Lessons

  1. The problem and the datasetFour defect types, 800 × 128 images, and RLE masks. Includes an RLE playground.
  2. Exploring the dataClass balance, label combinations, mask sizes, and the stratified split.
  3. The competition metricDice, empty-mask handling, and why predicting nothing scores 0.30. Includes a Dice painter.
  4. Model architectureU-Net encoder, decoder, and skip connections. ResNet-34 and EfficientNet-B3.
  5. Training the modelLoss, augmentation, the one-cycle schedule, and the real training curves.
  6. Post-processing and thresholdsTune three rules per class on real probability maps and lift the score to 0.6486.
  7. Inference, ensembling, and submissionFlip TTA, averaging models, and writing RLE rows.
  8. Lessons learned and recapWhat moved the score, what the files can't show, and a recap quiz.

Before you start

You need basic Python and some machine learning: what a training loop is, what a loss function does, and what a convolution is. You don't need to run the project code. Every interactive demo runs in your browser, and the numbers come from the project's saved results.

What this section does not claim. The project has a measured score for one model (ResNet-34 with TTA and tuned post-processing). It has code for ensembling, but no measured ensemble result and no leaderboard score. Lesson 8 lists every gap.

Back to the course home