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.
Illustrative segmentation visualization
Synthetic component · not actual model output.
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.
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
Images + instance annotations
Class labels and defect boundaries
Short Shot · Sink Mark
- Train
- Learn weights
- Validation
- Compare runs
- Test
- Separate split
Offline / Experimental configurations
Baseline training
Targeted augmentation
Training split only
YOLOv8n-seg training
NVIDIA A100 · CUDA
Compare the resulting models on validation.
Output / Trained weights for each run
New image
No annotation required.
No weight updates.
Feature extraction
Conv · C2f · SPPF
Multi-scale features
Upsample · concatenate
Downsample · fuse
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.
Bounding box
Dashed enclosing rectangle
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
Compare instances & boundaries
Run validation images through the trained model and compare predictions with their annotations.
Precision · recall · mAP50
Overall performance and class-level analysis
Baseline ↔ augmented
Short Shot and Sink Mark assessed separately
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.
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.
Interactive Visual Inspection
Explore defect localization
Interactive layersIllustrative visualization — not actual model output.Synthetic component · authored SVG overlays
Short Shot · masks on · boxes on
Short Shot
An irregular edge mask outlines incomplete filling within the bounding box.
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.
Polygon Annotation Review
Annotation Refinement
Class Distribution Analysis
Training-Only Augmentation
Model Retraining
Scroll to explore the pipeline
Original
Augmented
Transformed Polygon
Training-only augmentation. Validation and test observations were excluded from augmentation.
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%
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.
Technology Stack
Computer Vision
- YOLOv8
- OpenCV
Deep Learning
- PyTorch
- CUDA
Data Processing
- Python
- NumPy
Training Infrastructure
- NVIDIA A100
- Thunder Compute
Engineering
- Docker
- Git
- Ultralytics