Back to case study
Inference overlay replay

YOLOv12 Steel Surface Defect Detection

An Ultralytics YOLOv12 detector trained on NEU-DET: 6 defect classes, ~5000 images, full train → val → predict pipeline for automated steel quality inspection. A reproducible recipe + an illustrative inference demo.

Pick a steel-surface image and replay the trained best.pt: YOLOv12 loads, runs one forward pass, and defect boxes (class + confidence) land on the surface, ending in a per-class AP@0.5 table.

YOLOv12UltralyticsObject DetectionNEU-DETIndustrial CV
YOLOv12 Steel Surface Defect Detection

Why this local version exists

The training data (NEU-DET, ~5000 images) and code (3-yolo-steel.py / dataset.yaml) are real from the course, but best.pt weights are not shipped and no model runs in the browser. The boxes, scores, and per-class AP are representative of a typical NEU-DET YOLO run — labeled illustrative, not measured from shipped weights.

Interactive Preview

Run YOLOv12 steel-defect detection

Pick a steel-surface image and replay best.pt inference: defect boxes + per-class confidence appear, ending in an mAP / per-class AP table.

Input image

best.pt → YOLO("best.pt")

Ultralytics loads the YOLOv12 weights trained on NEU-DET (6 classes, imgsz 640).

model.predict(img, conf=0.25)

A single forward pass over the held-out steel image returns boxes + class + confidence.

results[0].boxes → overlay

Detections are drawn over the surface, then summarized into a per-class mAP table.

Training recipe

NEU-DET ~5000 imgs → train / val / predict. ~100 epochs, imgsz 640, mosaic + mixup + copy-paste augments, trained on an AutoDL GPU.

Activity log

Run inference to watch defect boxes land on the steel surface.

Detection overlay

imgsz 640
Steel surface (run inference to detect defects)

* Boxes + scores are illustrative; best.pt weights are not shipped and no model runs in the browser.

What to try

Switch between the three sample steel images and re-run inference.

Watch the load → predict → overlay stages light up, then boxes appear with per-class labels.

Read the per-class AP@0.5 table — note crazing is the known low-recall hard class.

What this demo proves

You can run end-to-end industrial CV: dataset.yaml → training → val → inference, not just a classification API.

You know the object-detection levers: imgsz, conf threshold, and mosaic/mixup/copy-paste for imbalanced defect classes.

You picked YOLO deliberately — single-stage real-time detection fits a moving production line.

Model

Ultralytics YOLOv12 · transfer from yolov12n.pt · imgsz 640

Dataset

NEU-DET · ~5000 imgs · 6 classes (crazing / inclusion / pitted / scratches / patches / scale)

Pipeline

train → val (mAP) → predict(best.pt) on an AutoDL GPU