← All projects

Computer Vision / Industrial AI

Industrial Defect Detection & Segmentation

Pixel-Level Manufacturing Defect Inspection with YOLOv8

A deep learning pipeline for detecting manufacturing defects and localizing affected regions through instance segmentation.

YOLOv8PyTorchOpenCVCUDAInstance Segmentation
Defect boundaries, made visible
SHORT SHOTSINK MARK

Illustrative segmentation visualization

Synthetic component · not actual model output.

01

Project Overview

Manufacturing defects can be subtle, irregular, and difficult to localize consistently. Image classification indicates whether a defect exists, but does not identify its spatial boundaries.

YOLOv8 instance segmentation identifies individual defects and generates pixel-level masks. This project investigates Short Shot and Sink Mark through refined polygon annotations, targeted augmentation, GPU training, and class-specific evaluation.

Short Shot

Incomplete material filling that produces missing or partially formed component regions.

Sink Mark

Surface depressions caused by uneven material shrinkage or cooling.

02

System Architecture

Supervised vision / System architecture

From defect boundaries to instance masks.

YOLOv8n-seg
Short Shot · Sink Mark

Annotated examples shape the model offline. A trained model localizes and segments defects at inspection time. Validation tests the engineering choices separately.

Offline / Dataset preparation

Inspection image
Refined polygon labels

Images + instance annotations

Class labels and defect boundaries
Short Shot · Sink Mark

Train
Learn weights
Validation
Compare runs
Test
Separate split

Offline / Experimental configurations

Reference configuration

Baseline training

vs
Experimental configuration

Targeted augmentation

Training split only

Supervised model development

YOLOv8n-seg training

NVIDIA A100 · CUDA
Compare the resulting models on validation.

Output / Trained weights for each run

Inspection-time input

New image

No annotation required.
No weight updates.

Standard Ultralytics architectureTrained weights / per run
01 / Backbone

Feature extraction

Conv · C2f · SPPF

02 / Feature fusion

Multi-scale features

Upsample · concatenate
Downsample · fuse

03 / Segment head

Boxes + classes

Object localization

Prototypes + coefficients

Instance mask reconstruction

Functional model schematic · no custom layers or project-specific dimensions are implied.

One instance. Two spatial descriptions.

Enclose the defect with a box; describe its boundary with a mask.

Detection / Localization

Bounding box

Dashed enclosing rectangle

Segmentation / Boundary

Instance mask

Hatched pixel region

Short Shot. An incomplete edge region: its irregular mask occupies only part of the localization box.

All sample images, annotations, feature maps, and predictions are original synthetic schematics. No measured confidence or actual model output is shown.

Offline / Validation for each experimental run

Validation predictions + ground truth

Compare instances & boundaries

Run validation images through the trained model and compare predictions with their annotations.

Mask validation

Precision · recall · mAP50

Overall performance and class-level analysis

Experimental comparison

Baseline ↔ augmented

Short Shot and Sink Mark assessed separately

Engineering review

Investigate class-level failure modes, revisit annotation quality, and reassess augmentation. These are review decisions, not an automatic retraining loop.

Verified experiment context

Augmented-model validation · mask metrics

Overall precision
81.5%
Overall mAP50
77.7%
Sink Mark mAP50
96.6%

Targeted augmentation reduced Short Shot recall and mAP in the documented comparison. These validation mask results are not box-detection metrics, test-set results, or production guarantees.

Inference / feature dataTraining / learned weightsOffline validation
Text architecture & implementation scope

Offline development. Inspection images and refined polygon instance annotations are partitioned into training, validation, and test data. Targeted augmentation applies only to the training split. Baseline and augmented training configurations produce trained YOLOv8n-seg weights for comparison.

Inspection inference. A new image enters a trained model. The standard YOLOv8-seg backbone extracts visual features, multi-scale processing fuses them, and the Segment head predicts boxes, classes, mask coefficients, and prototypes used for instance masks. This is a functional architecture, not a proprietary model graph.

Separate validation. Validation images use the trained model’s prediction path in an offline evaluation run. Predictions are compared against validation ground truth; the dashed connections express that relationship, not background evaluation of every new inspection image. Mask metrics and class-level failures inform review of annotation and augmentation choices.

Evidence boundary. All supplied numerical results are validation mask metrics. The augmented-model comparison includes a decline in Short Shot recall and mAP. Dataset counts, transformation recipes, confidence values, private configurations, custom layers, and deployment claims are deliberately unspecified. Every visual example is synthetic.

FIG. 01 / Industrial defect detection & segmentationInteractive architecture · synthetic visuals · no model execution
03

Interactive Visual Inspection

Explore defect localization

Interactive layers
SHORT SHOT

Illustrative visualization — not actual model output.Synthetic component · authored SVG overlays

Short Shot · masks on · boxes on

Visualization
Defect class

Short Shot

An irregular edge mask outlines incomplete filling within the bounding box.

45%
04

Data Quality Before Model Complexity

Accurate polygon annotations teach the model where defects end. The two categories presented different modelling difficulties; targeted augmentation investigated whether additional short-shot training variation could improve segmentation.

  1. Polygon Annotation Review

  2. Annotation Refinement

  3. Class Distribution Analysis

  4. Training-Only Augmentation

  5. Model Retraining

Scroll to explore the pipeline

Original

Augmented

Transformed Polygon

Synthetic augmentation illustration. An illustrative geometric transform moves the component and polygon together; it does not reproduce a proprietary training sample or a model prediction.

Training-only augmentation. Validation and test observations were excluded from augmentation.

05

Measured Validation Performance

Augmented-model validation · YOLOv8n-seg · NVIDIA A100 training

Overall Mask Precision
81.5%
Overall Mask mAP50
77.7%
Sink-Mark Mask mAP50
96.6%

Mask metrics · validation comparison

YOLOv8n-seg · 0–100%
  • Before targeted augmentation
  • After targeted augmentation

Overall validation mask metrics

Precision+5.5 pp

Overall Precision, Before targeted augmentation: 76.0%

Overall Precision, After targeted augmentation: 81.5%

Recall−4.3 pp

Overall Recall, Before targeted augmentation: 75.3%

Overall Recall, After targeted augmentation: 71.0%

mAP50−0.9 pp

Overall mAP50, Before targeted augmentation: 78.6%

Overall mAP50, After targeted augmentation: 77.7%

mAP50–95+0.6 pp

Overall mAP50–95, Before targeted augmentation: 40.0%

Overall mAP50–95, After targeted augmentation: 40.6%

Targeted augmentation improved precision but reduced short-shot recall and mAP. Values describe model validation; they do not establish test-set or deployment performance. Changes are percentage points (pp).
06

What the Experiments Revealed

Annotation Quality Matters

Accurate polygon boundaries are essential for reliable instance segmentation.

Augmentation Is Not Automatically Better

Targeted augmentation improved precision, but introduced recall and mAP trade-offs.

Class-Level Evaluation Is Essential

Aggregate metrics can conceal weaker performance on challenging defect classes.

07

Technology Stack

Computer Vision

  • YOLOv8
  • OpenCV

Deep Learning

  • PyTorch
  • CUDA

Data Processing

  • Python
  • NumPy

Training Infrastructure

  • NVIDIA A100
  • Thunder Compute

Engineering

  • Docker
  • Git
  • Ultralytics