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:
- Decode and encode RLE masks.
- Compute the competition score and see why an empty prediction earns 0.30.
- Train a ResNet-34 U-Net with BCE plus Dice loss.
- Tune a threshold, a component filter, and an area filter for each class.
Key results
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.
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
- The problem and the datasetFour defect types, 800 × 128 images, and RLE masks. Includes an RLE playground.
- Exploring the dataClass balance, label combinations, mask sizes, and the stratified split.
- The competition metricDice, empty-mask handling, and why predicting nothing scores 0.30. Includes a Dice painter.
- Model architectureU-Net encoder, decoder, and skip connections. ResNet-34 and EfficientNet-B3.
- Training the modelLoss, augmentation, the one-cycle schedule, and the real training curves.
- Post-processing and thresholdsTune three rules per class on real probability maps and lift the score to 0.6486.
- Inference, ensembling, and submissionFlip TTA, averaging models, and writing RLE rows.
- 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.